cf 0.0.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Uploads a binary file to Cloudforce One's binary database for malware analysis and threat intelligence correlation.`,builder:e=>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`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one binary-storage create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/binary`,pathParams:{},bodyKind:`multipart`,body:{body:t.body,file:t.file},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.file!==void 0||t.body!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);u(await p(`Creating binary storage`,async()=>n.post(`/accounts/${i}/cloudforce-one/binary`,{body:e})),{successLabel:`Created binary storage`});return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating binary storage`,async()=>n.post(`/accounts/${i}/cloudforce-one/binary`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created binary storage`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},h={command:`get <hash>`,describe:`Retrieves a binary file from the Cloudforce One binary storage for analysis.`,builder:e=>e.positional(`hash`,{type:`string`,description:`hash of the binary`,demandOption:!0}),handler:async e=>{s(e.hash,`hash`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading binary storage`,async()=>t.cloudforceOne.binaryStorage.get(n,e.hash)),{successLabel:`Loaded binary storage`})}},g={command:`binary-storage`,describe:`Upload and retrieve malware samples and suspicious binaries for analysis`,builder:e=>e.command(m).command(h).demandCommand(1),handler:()=>{}},_={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:e=>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)`,default:!1}).option(`limit`,{type:`number`,description:`Maximum number of results to return`}),handler:async e=>{let t={};e.aggregateBy!==void 0&&(t.aggregateBy=e.aggregateBy),e.datasetId!==void 0&&(t.datasetId=e.datasetId),e.startDate!==void 0&&(t.startDate=e.startDate),e.endDate!==void 0&&(t.endDate=e.endDate),e.groupByDate!==void 0&&(t.groupByDate=e.groupByDate),e.limit!==void 0&&(t.limit=e.limit);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading aggregate`,async()=>n.cloudforceOne.events.aggregate.get(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded aggregate`})}},ee={command:`aggregate`,describe:`Events operations`,builder:e=>e.command(_).demandCommand(1),handler:()=>{}},te={command:`get`,describe:`Lists categories`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading catalog`,async()=>t.cloudforceOne.events.categories.catalog.get(n)),{successLabel:`Loaded catalog`})}},v={command:`catalog`,describe:`Events operations`,builder:e=>e.command(te).demandCommand(1),handler:()=>{}},y={command:`create <categoryId>`,describe:`Updates a category`,builder:e=>e.positional(`categoryId`,{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)`}),handler:async t=>{if(s(t.categoryId,`categoryId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/categories/${t.categoryId??`<categoryId>`}`,pathParams:{categoryId:String(t.categoryId??``)},bodyKind:`json`,body:{killChain:t.killChain,mitreAttack:t.mitreAttack,mitreCapec:t.mitreCapec,name:t.name,shortname:t.shortname,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating category`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/categories/${t.categoryId}`,{body:e})),{successLabel:`Created category`});return}let m={};t.killChain!==void 0&&c(m,[`killChain`],t.killChain),t.mitreAttack!==void 0&&c(m,[`mitreAttack`],t.mitreAttack),t.mitreCapec!==void 0&&c(m,[`mitreCapec`],t.mitreCapec),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.shortname!==void 0&&c(m,[`shortname`],o(t.shortname,`shortname`,`text`)),u(await p(`Creating category`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/categories/${t.categoryId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created category`})}},b={command:`categories`,describe:`Events operations`,builder:e=>e.command(y).command(v).demandCommand(1),handler:()=>{}},x={command:`create <eventId>`,describe:`Updates an event`,builder:e=>e.positional(`eventId`,{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)`}),handler:async n=>{if(s(n.eventId,`eventId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/${n.eventId??`<eventId>`}`,pathParams:{eventId:String(n.eventId??``)},bodyKind:`json`,body:{attacker:n.attacker,attackerCountry:n.attackerCountry,category:n.category,createdAt:n.createdAt,datasetId:n.datasetId,date:n.date,event:n.event,indicator:n.indicator,indicatorType:n.indicatorType,insight:n.insight,rawSource:n.rawSource,rawTlp:n.rawTlp,targetCountry:n.targetCountry,targetIndustry:n.targetIndustry,tlp:n.tlp,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating event`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/${n.eventId}`,{body:e})),{successLabel:`Created event`});return}n.datasetId===void 0&&(n.datasetId=await t(`dataset-id`,`Dataset ID containing the event to update.`));let h={};n.attacker!==void 0&&c(h,[`attacker`],o(n.attacker,`attacker`,`text`)),n.attackerCountry!==void 0&&c(h,[`attackerCountry`],o(n.attackerCountry,`attackerCountry`,`text`)),n.category!==void 0&&c(h,[`category`],o(n.category,`category`,`text`)),n.createdAt!==void 0&&c(h,[`createdAt`],o(n.createdAt,`createdAt`,`text`)),n.datasetId!==void 0&&c(h,[`datasetId`],o(n.datasetId,`datasetId`,`text`)),n.date!==void 0&&c(h,[`date`],o(n.date,`date`,`text`)),n.event!==void 0&&c(h,[`event`],o(n.event,`event`,`text`)),n.indicator!==void 0&&c(h,[`indicator`],o(n.indicator,`indicator`,`text`)),n.indicatorType!==void 0&&c(h,[`indicatorType`],o(n.indicatorType,`indicatorType`,`text`)),n.insight!==void 0&&c(h,[`insight`],o(n.insight,`insight`,`text`)),n.rawSource!==void 0&&c(h,[`raw`,`source`],o(n.rawSource,`rawSource`,`text`)),n.rawTlp!==void 0&&c(h,[`raw`,`tlp`],o(n.rawTlp,`rawTlp`,`text`)),n.targetCountry!==void 0&&c(h,[`targetCountry`],o(n.targetCountry,`targetCountry`,`text`)),n.targetIndustry!==void 0&&c(h,[`targetIndustry`],o(n.targetIndustry,`targetIndustry`,`text`)),n.tlp!==void 0&&c(h,[`tlp`],o(n.tlp,`tlp`,`text`)),u(await p(`Creating event`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/${n.eventId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created event`})}},S={command:`create <datasetId>`,describe:`Copies specified events from one dataset to another dataset`,builder:e=>e.positional(`datasetId`,{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).`,default:!1}).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)`}),handler:async n=>{s(n.datasetId,`datasetId`);let i={};if(n.keepRawData!==void 0&&(i.keepRawData=n.keepRawData),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${n.datasetId??`<datasetId>`}/copy`,pathParams:{datasetId:String(n.datasetId??``)},bodyKind:`json`,body:{...i,destDatasetId:n.destDatasetId,eventIds:n.eventIds,body:n.body},validation:`passed`});return}let m=await a(n),h=n.local?f:await r(m);if(n.accountId=h,n.body){let e=l(n.body),t=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating copy`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/dataset/${n.datasetId}/copy${t?`?`+t:``}`,{body:e})),{successLabel:`Created copy`});return}if(n.destDatasetId===void 0&&(n.destDatasetId=await t(`dest-dataset-id`,``)),n.eventIds===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let g={};n.destDatasetId!==void 0&&c(g,[`destDatasetId`],o(n.destDatasetId,`destDatasetId`,`text`)),n.eventIds!==void 0&&c(g,[`eventIds`],n.eventIds);let _=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating copy`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/dataset/${n.datasetId}/copy${_?`?`+_:``}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created copy`})}},C={command:`copy`,describe:`Events operations`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`create <datasetId>`,describe:`Updates an existing dataset`,builder:e=>e.positional(`datasetId`,{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)`}),handler:async n=>{if(s(n.datasetId,`datasetId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${n.datasetId??`<datasetId>`}`,pathParams:{datasetId:String(n.datasetId??``)},bodyKind:`json`,body:{isPublic:n.isPublic,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating dataset`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}`,{body:e})),{successLabel:`Created dataset`});return}if(n.isPublic===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`Used to describe the dataset within the account context.`));let h={};n.isPublic!==void 0&&c(h,[`isPublic`],n.isPublic),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Creating dataset`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created dataset`})}},T={command:`delete <datasetId>`,describe:`Deletes a dataset given a datasetId.`,builder:e=>e.positional(`datasetId`,{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}),handler:async t=>{if(s(t.datasetId,`datasetId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/${t.datasetId??`<datasetId>`}`,pathParams:{datasetId:String(t.datasetId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`dataset`,String(t.datasetId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting dataset`,async()=>n.cloudforceOne.events.dataset.delete(o,t.datasetId)),{successLabel:`Deleted dataset`})}},E={command:`get <eventId>`,describe:`Retrieves a specific event by its UUID.`,builder:e=>e.positional(`eventId`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}),handler:async e=>{s(e.eventId,`eventId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading event`,async()=>t.cloudforceOne.events.dataset.events.get(n,e.datasetId,e.eventId)),{successLabel:`Loaded event`})}},D={command:`events`,describe:`Events operations`,builder:e=>e.command(E).demandCommand(1),handler:()=>{}},O={command:`create`,describe:`Create a group`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`json`,body:{description:n.description,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating group`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/-/groups`,{body:e})),{successLabel:`Created group`});return}n.description===void 0&&(n.description=await t(`description`,``)),n.name===void 0&&(n.name=await t(`name`,``));let h={};n.description!==void 0&&c(h,[`description`],o(n.description,`description`,`text`)),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Creating group`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/-/groups`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created group`})}},k={command:`delete <groupId>`,describe:`Delete a group for an account`,builder:e=>e.positional(`groupId`,{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}),handler:async t=>{if(s(t.groupId,`groupId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${t.groupId??`<groupId>`}`,pathParams:{groupId:String(t.groupId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`group`,String(t.groupId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting group`,async()=>n.cloudforceOne.events.dataset.groups.delete(o,t.groupId)),{successLabel:`Deleted group`})}},A={command:`group`,describe:`List groups for an account`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading get`,async()=>t.cloudforceOne.events.dataset.groups.get.group(n)),{successLabel:`Loaded get`})}},j={command:`v2 <groupId>`,describe:`Read a group for an account`,builder:e=>e.positional(`groupId`,{type:`string`,description:`Group ID`,demandOption:!0}),handler:async e=>{s(e.groupId,`groupId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading get`,async()=>t.cloudforceOne.events.dataset.groups.get.v2(n,e.groupId)),{successLabel:`Loaded get`})}},M={command:`get`,describe:`Events operations`,builder:e=>e.command(A).command(j).demandCommand(1),handler:()=>{}},N={command:`create <groupId>`,describe:`Create a group member`,builder:e=>e.positional(`groupId`,{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)`}),handler:async t=>{if(s(t.groupId,`groupId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${t.groupId??`<groupId>`}/members`,pathParams:{groupId:String(t.groupId??``)},bodyKind:`json`,body:{accountTag:t.accountTag,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating member`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/dataset/-/groups/${t.groupId}/members`,{body:e})),{successLabel:`Created member`});return}let m={};t.accountTag!==void 0&&c(m,[`accountTag`],o(t.accountTag,`accountTag`,`text`)),u(await p(`Creating member`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/dataset/-/groups/${t.groupId}/members`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created member`})}},P={command:`delete <memberId>`,describe:`Delete a group member`,builder:e=>e.positional(`memberId`,{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}),handler:async t=>{if(s(t.memberId,`memberId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${t.groupId??`<groupId>`}/members/${t.memberId??`<memberId>`}`,pathParams:{groupId:String(t.groupId??``),memberId:String(t.memberId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`member`,String(t.memberId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}u(await p(`Deleting member`,async()=>n.cloudforceOne.events.dataset.groups.members.delete(o,t.groupId,t.memberId)),{successLabel:`Deleted member`})}},F={command:`get <groupId>`,describe:`List group members`,builder:e=>e.positional(`groupId`,{type:`string`,description:`Group ID`,demandOption:!0}),handler:async e=>{s(e.groupId,`groupId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading member`,async()=>t.cloudforceOne.events.dataset.groups.members.get(n,e.groupId)),{successLabel:`Loaded member`})}},I={command:`members`,describe:`Events operations`,builder:e=>e.command(N).command(P).command(F).demandCommand(1),handler:()=>{}},L={command:`update <groupId>`,describe:`Update a group`,builder:e=>e.positional(`groupId`,{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)`}),handler:async n=>{if(s(n.groupId,`groupId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${n.groupId??`<groupId>`}`,pathParams:{groupId:String(n.groupId??``)},bodyKind:`json`,body:{description:n.description,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating group`,async()=>i.put(`/accounts/${m}/cloudforce-one/events/dataset/-/groups/${n.groupId}`,{body:e})),{successLabel:`Updated group`});return}n.description===void 0&&(n.description=await t(`description`,``)),n.name===void 0&&(n.name=await t(`name`,``));let h={};n.description!==void 0&&c(h,[`description`],o(n.description,`description`,`text`)),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Updating group`,async()=>i.put(`/accounts/${m}/cloudforce-one/events/dataset/-/groups/${n.groupId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated group`})}},R={command:`groups`,describe:`Events operations`,builder:e=>e.command(O).command(k).command(L).command(M).command(I).demandCommand(1),handler:()=>{}},z={command:`create <datasetId>`,describe:`Creates a new indicator type and initializes its dedicated Durable Object`,builder:e=>e.positional(`datasetId`,{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)`}),handler:async n=>{if(s(n.datasetId,`datasetId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset indicator types create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${n.datasetId??`<datasetId>`}/indicatorTypes/create`,pathParams:{datasetId:String(n.datasetId??``)},bodyKind:`json`,body:{description:n.description,indicatorType:n.indicatorType,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating create`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}/indicatorTypes/create`,{body:e})),{successLabel:`Created create`});return}n.indicatorType===void 0&&(n.indicatorType=await t(`indicator-type`,`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`));let h={};n.description!==void 0&&c(h,[`description`],o(n.description,`description`,`text`)),n.indicatorType!==void 0&&c(h,[`indicatorType`],o(n.indicatorType,`indicatorType`,`text`)),u(await p(`Creating create`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}/indicatorTypes/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created create`})}},B={command:`create`,describe:`Events operations`,builder:e=>e.command(z).demandCommand(1),handler:()=>{}},V={command:`types`,describe:`Operations for events.dataset.indicator.types`,builder:e=>e.command(B).demandCommand(1),handler:()=>{}},H={command:`indicator`,describe:`Operations for events.dataset.indicator`,builder:e=>e.command(V).demandCommand(1),handler:()=>{}},U={command:`create <datasetId>`,describe:`Creates multiple indicators at once with their respective types and related datasets.`,builder:e=>e.positional(`datasetId`,{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)`}),handler:async t=>{if(s(t.datasetId,`datasetId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset indicators bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/${t.datasetId??`<datasetId>`}/indicators/bulk`,pathParams:{datasetId:String(t.datasetId??``)},bodyKind:`json`,body:{autoCreateType:t.autoCreateType,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating bulk`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/dataset/${t.datasetId}/indicators/bulk`,{body:e})),{successLabel:`Created bulk`});return}let o={};t.autoCreateType!==void 0&&c(o,[`autoCreateType`],t.autoCreateType),u(await p(`Creating bulk`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/dataset/${t.datasetId}/indicators/bulk`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created bulk`})}},W={command:`bulk`,describe:`Events operations`,builder:e=>e.command(U).demandCommand(1),handler:()=>{}},G={command:`create <datasetId>`,describe:`Creates a new indicator with the specified type and related datasets.`,builder:e=>e.positional(`datasetId`,{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)`}),handler:async n=>{if(s(n.datasetId,`datasetId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset indicators create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${n.datasetId??`<datasetId>`}/indicators/create`,pathParams:{datasetId:String(n.datasetId??``)},bodyKind:`json`,body:{autoCreateType:n.autoCreateType,indicatorType:n.indicatorType,value:n.value,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating create`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}/indicators/create`,{body:e})),{successLabel:`Created create`});return}n.indicatorType===void 0&&(n.indicatorType=await t(`indicator-type`,``)),n.value===void 0&&(n.value=await t(`value`,``));let h={};n.autoCreateType!==void 0&&c(h,[`autoCreateType`],n.autoCreateType),n.indicatorType!==void 0&&c(h,[`indicatorType`],o(n.indicatorType,`indicatorType`,`text`)),n.value!==void 0&&c(h,[`value`],o(n.value,`value`,`text`)),u(await p(`Creating create`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}/indicators/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created create`})}},K={command:`create`,describe:`Events operations`,builder:e=>e.command(G).demandCommand(1),handler:()=>{}},q={command:`delete <indicatorId>`,describe:`Deletes a specific indicator by its UUID.`,builder:e=>e.positional(`indicatorId`,{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}),handler:async t=>{if(s(t.indicatorId,`indicatorId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset indicators delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/${t.datasetId??`<datasetId>`}/indicators/${t.indicatorId??`<indicatorId>`}`,pathParams:{datasetId:String(t.datasetId??``),indicatorId:String(t.indicatorId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`indicator`,String(t.indicatorId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting indicator`,async()=>n.cloudforceOne.events.dataset.indicators.delete(o,t.datasetId,t.indicatorId)),{successLabel:`Deleted indicator`})}},J={command:`indicator <indicatorId>`,describe:`Retrieves a specific indicator by its UUID.`,builder:e=>e.positional(`indicatorId`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}),handler:async e=>{s(e.indicatorId,`indicatorId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading get`,async()=>t.cloudforceOne.events.dataset.indicators.get.indicator(n,e.datasetId,e.indicatorId)),{successLabel:`Loaded get`})}},Y={command:`get`,describe:`Events operations`,builder:e=>e.command(J).demandCommand(1),handler:()=>{}},X={command:`patch <indicatorId>`,describe:`Updates an existing indicator's properties.`,builder:e=>e.positional(`indicatorId`,{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)`}),handler:async t=>{if(s(t.indicatorId,`indicatorId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset indicators patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/${t.datasetId??`<datasetId>`}/indicators/${t.indicatorId??`<indicatorId>`}`,pathParams:{datasetId:String(t.datasetId??``),indicatorId:String(t.indicatorId??``)},bodyKind:`json`,body:{indicatorType:t.indicatorType,value:t.value,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating indicator`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/dataset/${t.datasetId}/indicators/${t.indicatorId}`,{body:e})),{successLabel:`Updated indicator`});return}let m={};t.indicatorType!==void 0&&c(m,[`indicatorType`],o(t.indicatorType,`indicatorType`,`text`)),t.value!==void 0&&c(m,[`value`],o(t.value,`value`,`text`)),u(await p(`Updating indicator`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/dataset/${t.datasetId}/indicators/${t.indicatorId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated indicator`})}},Z={command:`get <datasetId>`,describe:`Returns all mirrored tags from the indicator dataset (DO mirror table). No pagination.`,builder:e=>e.positional(`datasetId`,{type:`string`,description:`Dataset ID.`,demandOption:!0}),handler:async e=>{s(e.datasetId,`datasetId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading tag`,async()=>t.cloudforceOne.events.dataset.indicators.tags.get(n,e.datasetId)),{successLabel:`Loaded tag`})}},Q={command:`tags`,describe:`Events operations`,builder:e=>e.command(Z).demandCommand(1),handler:()=>{}},ne={command:`indicators`,describe:`Events operations`,builder:e=>e.command(q).command(X).command(W).command(K).command(Y).command(Q).demandCommand(1),handler:()=>{}},re={command:`create <datasetId>`,describe:`Moves specified events from one dataset to another dataset`,builder:e=>e.positional(`datasetId`,{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.`,default:!1}).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)`}),handler:async n=>{s(n.datasetId,`datasetId`);let i={};if(n.keepRawData!==void 0&&(i.keepRawData=n.keepRawData),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${n.datasetId??`<datasetId>`}/move`,pathParams:{datasetId:String(n.datasetId??``)},bodyKind:`json`,body:{...i,destDatasetId:n.destDatasetId,eventIds:n.eventIds,body:n.body},validation:`passed`});return}let m=await a(n),h=n.local?f:await r(m);if(n.accountId=h,n.body){let e=l(n.body),t=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating move`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/dataset/${n.datasetId}/move${t?`?`+t:``}`,{body:e})),{successLabel:`Created move`});return}if(n.destDatasetId===void 0&&(n.destDatasetId=await t(`dest-dataset-id`,``)),n.eventIds===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let g={};n.destDatasetId!==void 0&&c(g,[`destDatasetId`],o(n.destDatasetId,`destDatasetId`,`text`)),n.eventIds!==void 0&&c(g,[`eventIds`],n.eventIds);let _=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating move`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/dataset/${n.datasetId}/move${_?`?`+_:``}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created move`})}},ie={command:`move`,describe:`Events operations`,builder:e=>e.command(re).demandCommand(1),handler:()=>{}},ae={command:`create <datasetId>`,describe:`Create a permission`,builder:e=>e.positional(`datasetId`,{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)`}),handler:async i=>{if(s(i.datasetId,`datasetId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events dataset permissions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${i.datasetId??`<datasetId>`}/permissions`,pathParams:{datasetId:String(i.datasetId??``)},bodyKind:`json`,body:{role:i.role,subjectId:i.subjectId,subjectType:i.subjectType,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating permission`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/dataset/${i.datasetId}/permissions`,{body:e})),{successLabel:`Created permission`});return}i.role===void 0&&(i.role=await n(`role`,``,[`read`,`write`])),i.subjectId===void 0&&(i.subjectId=await t(`subject-id`,``)),i.subjectType===void 0&&(i.subjectType=await n(`subject-type`,``,[`account`,`group`]));let g={};i.role!==void 0&&c(g,[`role`],o(i.role,`role`,`text`)),i.subjectId!==void 0&&c(g,[`subjectId`],o(i.subjectId,`subjectId`,`text`)),i.subjectType!==void 0&&c(g,[`subjectType`],o(i.subjectType,`subjectType`,`text`)),u(await p(`Creating permission`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/dataset/${i.datasetId}/permissions`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created permission`})}},oe={command:`delete <grantId>`,describe:`Delete a permission`,builder:e=>e.positional(`grantId`,{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}),handler:async t=>{if(s(t.grantId,`grantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset permissions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/${t.datasetId??`<datasetId>`}/permissions/${t.grantId??`<grantId>`}`,pathParams:{datasetId:String(t.datasetId??``),grantId:String(t.grantId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`permission`,String(t.grantId??``),{force:!!t.force})){process.stderr.write(`Aborted.
7
- `);return}u(await p(`Deleting permission`,async()=>n.cloudforceOne.events.dataset.permissions.delete(o,t.datasetId,t.grantId)),{successLabel:`Deleted permission`})}},se={command:`get <datasetId>`,describe:`List permissions`,builder:e=>e.positional(`datasetId`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}),handler:async e=>{s(e.datasetId,`datasetId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading permission`,async()=>t.cloudforceOne.events.dataset.permissions.get(n,e.datasetId)),{successLabel:`Loaded permission`})}},ce={command:`update <grantId>`,describe:`Update a permission`,builder:e=>e.positional(`grantId`,{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)`}),handler:async t=>{if(s(t.grantId,`grantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events dataset permissions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/dataset/${t.datasetId??`<datasetId>`}/permissions/${t.grantId??`<grantId>`}`,pathParams:{datasetId:String(t.datasetId??``),grantId:String(t.grantId??``)},bodyKind:`json`,body:{role:t.role,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Updating permission`,async()=>i.put(`/accounts/${m}/cloudforce-one/events/dataset/${t.datasetId}/permissions/${t.grantId}`,{body:e})),{successLabel:`Updated permission`});return}t.role===void 0&&(t.role=await n(`role`,``,[`read`,`write`]));let h={};t.role!==void 0&&c(h,[`role`],o(t.role,`role`,`text`)),u(await p(`Updating permission`,async()=>i.put(`/accounts/${m}/cloudforce-one/events/dataset/${t.datasetId}/permissions/${t.grantId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated permission`})}},le={command:`permissions`,describe:`Events operations`,builder:e=>e.command(ae).command(oe).command(se).command(ce).demandCommand(1),handler:()=>{}},ue={command:`get <tagUuid>`,describe:`Returns indicators associated with the provided tag UUID across all indicator datasets, with pagination.`,builder:e=>e.positional(`tagUuid`,{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.`}),handler:async e=>{s(e.tagUuid,`tagUuid`);let t={};e.page!==void 0&&(t.page=e.page),e.pageSize!==void 0&&(t.pageSize=e.pageSize),e.indicatorType!==void 0&&(t.indicatorType=e.indicatorType),e.relatedEvent!==void 0&&(t.relatedEvent=e.relatedEvent);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading indicator`,async()=>n.cloudforceOne.events.dataset.tags.indicators.get(i,e.tagUuid,e.datasetId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded indicator`})}},de={command:`indicators`,describe:`Events operations`,builder:e=>e.command(ue).demandCommand(1),handler:()=>{}},fe={command:`tags`,describe:`Operations for events.dataset.tags`,builder:e=>e.command(de).demandCommand(1),handler:()=>{}},pe={command:`get <datasetId>`,describe:`Lists all target industries for a specific dataset`,builder:e=>e.positional(`datasetId`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}),handler:async e=>{s(e.datasetId,`datasetId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading industry`,async()=>t.cloudforceOne.events.dataset.target.industries.get(n,e.datasetId)),{successLabel:`Loaded industry`})}},me={command:`industries`,describe:`Events operations`,builder:e=>e.command(pe).demandCommand(1),handler:()=>{}},he={command:`target`,describe:`Operations for events.dataset.target`,builder:e=>e.command(me).demandCommand(1),handler:()=>{}},ge={command:`dataset`,describe:`Events operations`,builder:e=>e.command(w).command(T).command(C).command(D).command(R).command(H).command(ne).command(ie).command(le).command(fe).command(he).demandCommand(1),handler:()=>{}},_e={command:`create`,describe:`Populate dataset-specific lookup tables from existing Events data with batch processing`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events datasets populate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/datasets/populate`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating populate`,async()=>n.cloudforceOne.events.datasets.populate.create(i)),{successLabel:`Created populate`})}},ve={command:`populate`,describe:`Events operations`,builder:e=>e.command(_e).demandCommand(1),handler:()=>{}},ye={command:`datasets`,describe:`Operations for events.datasets`,builder:e=>e.command(ve).demandCommand(1),handler:()=>{}},be={command:`delete <datasetId>`,describe:`Deletes one or more events`,builder:e=>e.positional(`datasetId`,{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}),handler:async t=>{s(t.datasetId,`datasetId`);let n={};if(t.eventIds!==void 0&&(n.eventIds=t.eventIds),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf cloudforce-one events delete delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/cloudforce-one/events/${t.datasetId??`<datasetId>`}/delete`,pathParams:{datasetId:String(t.datasetId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`delete`,String(t.datasetId??``),{force:!!t.force})){process.stderr.write(`Aborted.
8
- `);return}u(await p(`Deleting delete`,async()=>o.cloudforceOne.events.delete.delete(c,t.datasetId,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted delete`})}},xe={command:`delete`,describe:`Events operations`,builder:e=>e.command(be).demandCommand(1),handler:()=>{}},Se={command:`ql`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events graphql create graph ql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/graphql`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating graph`,async()=>n.cloudforceOne.events.graphql.create.graph.ql(i)),{successLabel:`Created graph`})}},Ce={command:`qlv2`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events graphql create graph qlv2`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/v2/events/graphql`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating graph`,async()=>n.cloudforceOne.events.graphql.create.graph.qlv2(i)),{successLabel:`Created graph`})}},we={command:`graph`,describe:`Events operations`,builder:e=>e.command(Se).command(Ce).demandCommand(1),handler:()=>{}},Te={command:`create`,describe:`Operations for events.graphql.create`,builder:e=>e.command(we).demandCommand(1),handler:()=>{}},Ee={command:`graphql`,describe:`Operations for events.graphql`,builder:e=>e.command(Te).demandCommand(1),handler:()=>{}},De={command:`get`,describe:`Lists indicator types across multiple datasets`,builder:e=>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.`}),handler:async e=>{let t={};e.datasetIds!==void 0&&(t.datasetIds=e.datasetIds);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading type`,async()=>n.cloudforceOne.events.indicator.types.get(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded type`})}},Oe={command:`types`,describe:`Events operations`,builder:e=>e.command(De).demandCommand(1),handler:()=>{}},ke={command:`indicator`,describe:`Operations for events.indicator`,builder:e=>e.command(Oe).demandCommand(1),handler:()=>{}},Ae={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:e=>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.`,default:!1}).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.`,default:!1}).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`]}),handler:async e=>{let t={};e.datasetIds!==void 0&&(t.datasetIds=e.datasetIds),e.page!==void 0&&(t.page=e.page),e.pageSize!==void 0&&(t.pageSize=e.pageSize),e.search!==void 0&&(t.search=e.search),e.name!==void 0&&(t.name=e.name),e.indicatorType!==void 0&&(t.indicatorType=e.indicatorType),e.relatedEvents!==void 0&&(t.relatedEvents=e.relatedEvents),e.tags!==void 0&&(t.tags=e.tags),e.createdAfter!==void 0&&(t.createdAfter=e.createdAfter),e.createdBefore!==void 0&&(t.createdBefore=e.createdBefore),e.relatedEventsLimit!==void 0&&(t.relatedEventsLimit=e.relatedEventsLimit),e.includeTags!==void 0&&(t.includeTags=e.includeTags),e.includeTotalCount!==void 0&&(t.includeTotalCount=e.includeTotalCount),e.format!==void 0&&(t.format=e.format);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading indicator`,async()=>n.cloudforceOne.events.indicators.get(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded indicator`})}},je={command:`indicators`,describe:`Events operations`,builder:e=>e.command(Ae).demandCommand(1),handler:()=>{}},Me={command:`create-create`,describe:`Create a new saved event query for the account`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events queries create-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/queries/create`,pathParams:{},bodyKind:`json`,body:{alertEnabled:n.alertEnabled,alertRollupEnabled:n.alertRollupEnabled,name:n.name,queryJson:n.queryJson,ruleEnabled:n.ruleEnabled,ruleScope:n.ruleScope,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating query`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/queries/create`,{body:e})),{successLabel:`Created query`});return}if(n.alertEnabled===void 0)throw Error(`--alert-enabled is required (or pass --body with this field set).`);if(n.alertRollupEnabled===void 0)throw Error(`--alert-rollup-enabled is required (or pass --body with this field set).`);if(n.name===void 0&&(n.name=await t(`name`,`Unique name for the saved query`)),n.queryJson===void 0&&(n.queryJson=await t(`query-json`,`JSON string containing the query parameters`)),n.ruleEnabled===void 0)throw Error(`--rule-enabled is required (or pass --body with this field set).`);let h={};n.alertEnabled!==void 0&&c(h,[`alert_enabled`],n.alertEnabled),n.alertRollupEnabled!==void 0&&c(h,[`alert_rollup_enabled`],n.alertRollupEnabled),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.queryJson!==void 0&&c(h,[`query_json`],o(n.queryJson,`queryJson`,`text`)),n.ruleEnabled!==void 0&&c(h,[`rule_enabled`],n.ruleEnabled),n.ruleScope!==void 0&&c(h,[`rule_scope`],o(n.ruleScope,`ruleScope`,`text`)),u(await p(`Creating query`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/queries/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created query`})}},Ne={command:`create <queryId>`,describe:`Update an existing saved event query by its ID`,builder:e=>e.positional(`queryId`,{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)`}),handler:async t=>{if(s(t.queryId,`queryId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events queries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/queries/${t.queryId??`<queryId>`}`,pathParams:{queryId:String(t.queryId??``)},bodyKind:`json`,body:{alertEnabled:t.alertEnabled,alertRollupEnabled:t.alertRollupEnabled,name:t.name,queryJson:t.queryJson,ruleEnabled:t.ruleEnabled,ruleScope:t.ruleScope,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating query`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/queries/${t.queryId}`,{body:e})),{successLabel:`Created query`});return}let m={};t.alertEnabled!==void 0&&c(m,[`alert_enabled`],t.alertEnabled),t.alertRollupEnabled!==void 0&&c(m,[`alert_rollup_enabled`],t.alertRollupEnabled),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.queryJson!==void 0&&c(m,[`query_json`],o(t.queryJson,`queryJson`,`text`)),t.ruleEnabled!==void 0&&c(m,[`rule_enabled`],t.ruleEnabled),t.ruleScope!==void 0&&c(m,[`rule_scope`],o(t.ruleScope,`ruleScope`,`text`)),u(await p(`Creating query`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/queries/${t.queryId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created query`})}},Pe={command:`delete <queryId>`,describe:`Delete a saved event query by its ID`,builder:e=>e.positional(`queryId`,{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}),handler:async t=>{if(s(t.queryId,`queryId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events queries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/queries/${t.queryId??`<queryId>`}`,pathParams:{queryId:String(t.queryId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`query`,String(t.queryId??``),{force:!!t.force})){process.stderr.write(`Aborted.
9
- `);return}u(await p(`Deleting query`,async()=>n.cloudforceOne.events.queries.delete(o,t.queryId)),{successLabel:`Deleted query`})}},Fe={command:`event`,describe:`Retrieve all saved event queries for the account`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading get`,async()=>t.cloudforceOne.events.queries.get.event(n)),{successLabel:`Loaded get`})}},Ie={command:`v2 <queryId>`,describe:`Retrieve a saved event query by its ID`,builder:e=>e.positional(`queryId`,{type:`string`,description:`Event query ID`,demandOption:!0}),handler:async e=>{s(e.queryId,`queryId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading get`,async()=>t.cloudforceOne.events.queries.get.v2(n,e.queryId)),{successLabel:`Loaded get`})}},Le={command:`get`,describe:`Events operations`,builder:e=>e.command(Fe).command(Ie).demandCommand(1),handler:()=>{}},Re={command:`patch <queryId>`,describe:`Update an existing saved event query by its ID`,builder:e=>e.positional(`queryId`,{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)`}),handler:async t=>{if(s(t.queryId,`queryId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events queries patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/queries/${t.queryId??`<queryId>`}`,pathParams:{queryId:String(t.queryId??``)},bodyKind:`json`,body:{alertEnabled:t.alertEnabled,alertRollupEnabled:t.alertRollupEnabled,name:t.name,queryJson:t.queryJson,ruleEnabled:t.ruleEnabled,ruleScope:t.ruleScope,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating query`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/queries/${t.queryId}`,{body:e})),{successLabel:`Updated query`});return}let m={};t.alertEnabled!==void 0&&c(m,[`alert_enabled`],t.alertEnabled),t.alertRollupEnabled!==void 0&&c(m,[`alert_rollup_enabled`],t.alertRollupEnabled),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.queryJson!==void 0&&c(m,[`query_json`],o(t.queryJson,`queryJson`,`text`)),t.ruleEnabled!==void 0&&c(m,[`rule_enabled`],t.ruleEnabled),t.ruleScope!==void 0&&c(m,[`rule_scope`],o(t.ruleScope,`ruleScope`,`text`)),u(await p(`Updating query`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/queries/${t.queryId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated query`})}},ze={command:`queries`,describe:`Events operations`,builder:e=>e.command(Ne).command(Me).command(Pe).command(Re).command(Le).demandCommand(1),handler:()=>{}},Be={command:`create <rawId>`,describe:`Updates a raw event`,builder:e=>e.positional(`rawId`,{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)`}),handler:async t=>{if(s(t.rawId,`rawId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events raw create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/${t.eventId??`<eventId>`}/raw/${t.rawId??`<rawId>`}`,pathParams:{eventId:String(t.eventId??``),rawId:String(t.rawId??``)},bodyKind:`json`,body:{source:t.source,tlp:t.tlp,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating raw`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/${t.eventId}/raw/${t.rawId}`,{body:e})),{successLabel:`Created raw`});return}let m={};t.source!==void 0&&c(m,[`source`],o(t.source,`source`,`text`)),t.tlp!==void 0&&c(m,[`tlp`],o(t.tlp,`tlp`,`text`)),u(await p(`Creating raw`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/${t.eventId}/raw/${t.rawId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created raw`})}},Ve={command:`raw`,describe:`Events operations`,builder:e=>e.command(Be).demandCommand(1),handler:()=>{}},He={command:`create <eventId>`,describe:`Creates event references for a event`,builder:e=>e.positional(`eventId`,{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)`}),handler:async t=>{if(s(t.eventId,`eventId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events relate create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/relate/${t.eventId??`<eventId>`}/create`,pathParams:{eventId:String(t.eventId??``)},bodyKind:`json`,body:{events:t.events,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating create`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/relate/${t.eventId}/create`,{body:e})),{successLabel:`Created create`});return}if(t.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let o={};t.events!==void 0&&c(o,[`events`],t.events),u(await p(`Creating create`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/relate/${t.eventId}/create`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created create`})}},Ue={command:`create`,describe:`Events operations`,builder:e=>e.command(He).demandCommand(1),handler:()=>{}},We={command:`relate`,describe:`Operations for events.relate`,builder:e=>e.command(Ue).demandCommand(1),handler:()=>{}},Ge={command:`create`,describe:`Creates a directed relationship between two events. The relationship is from parent to child with a specified type.`,builder:e=>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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events relationships create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/relationships/create`,pathParams:{},bodyKind:`json`,body:{childIds:i.childIds,datasetId:i.datasetId,parentId:i.parentId,relationshipType:i.relationshipType,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating create`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/relationships/create`,{body:e})),{successLabel:`Created create`});return}if(i.childIds===void 0)throw Error(`--child-ids is required (or pass --body with this field set).`);i.datasetId===void 0&&(i.datasetId=await t(`dataset-id`,`Dataset identifier where the events are stored`)),i.parentId===void 0&&(i.parentId=await t(`parent-id`,`UUID of the parent event that will be the source of the relationship`)),i.relationshipType===void 0&&(i.relationshipType=await n(`relationship-type`,`Type of relationship to create between parent and child events`,[`related_to`,`caused_by`,`attributed_to`]));let g={};i.childIds!==void 0&&c(g,[`childIds`],i.childIds),i.datasetId!==void 0&&c(g,[`datasetId`],o(i.datasetId,`datasetId`,`text`)),i.parentId!==void 0&&c(g,[`parentId`],o(i.parentId,`parentId`,`text`)),i.relationshipType!==void 0&&c(g,[`relationshipType`],o(i.relationshipType,`relationshipType`,`text`)),u(await p(`Creating create`,async()=>m.post(`/accounts/${h}/cloudforce-one/events/relationships/create`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created create`})}},Ke={command:`create`,describe:`Events operations`,builder:e=>e.command(Ge).demandCommand(1),handler:()=>{}},qe={command:`get <eventId>`,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:e=>e.positional(`eventId`,{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.`,default:!1}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}),handler:async e=>{s(e.eventId,`eventId`);let t={};e.direction!==void 0&&(t.direction=e.direction),e.maxDepth!==void 0&&(t.maxDepth=e.maxDepth),e.relationshipTypes!==void 0&&(t.relationshipTypes=e.relationshipTypes),e.indicatorTypeIds!==void 0&&(t.indicatorTypeIds=e.indicatorTypeIds),e.datasetId!==void 0&&(t.datasetId=e.datasetId),e.includeParent!==void 0&&(t.includeParent=e.includeParent),e.page!==void 0&&(t.page=e.page),e.pageSize!==void 0&&(t.pageSize=e.pageSize);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading relationship`,async()=>n.cloudforceOne.events.relationships.get(i,e.eventId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded relationship`})}},Je={command:`relationships`,describe:`Events operations`,builder:e=>e.command(qe).command(Ke).demandCommand(1),handler:()=>{}},Ye={command:`create`,describe:`Creates a new Source-of-Truth tag category for an account.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events tags categories create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/tags/categories/create`,pathParams:{},bodyKind:`json`,body:{description:n.description,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating create`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/tags/categories/create`,{body:e})),{successLabel:`Created create`});return}n.name===void 0&&(n.name=await t(`name`,``));let h={};n.description!==void 0&&c(h,[`description`],o(n.description,`description`,`text`)),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Creating create`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/tags/categories/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created create`})}},Xe={command:`create`,describe:`Events operations`,builder:e=>e.command(Ye).demandCommand(1),handler:()=>{}},Ze={command:`delete <categoryUuid>`,describe:`Deletes a Source-of-Truth tag category by UUID.`,builder:e=>e.positional(`categoryUuid`,{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}),handler:async t=>{if(s(t.categoryUuid,`categoryUuid`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events tags categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/tags/categories/${t.categoryUuid??`<categoryUuid>`}`,pathParams:{categoryUuid:String(t.categoryUuid??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`category`,String(t.categoryUuid??``),{force:!!t.force})){process.stderr.write(`Aborted.
10
- `);return}u(await p(`Deleting category`,async()=>n.cloudforceOne.events.tags.categories.delete(o,t.categoryUuid)),{successLabel:`Deleted category`})}},Qe={command:`get`,describe:`Returns all Source-of-Truth tag categories for an account.`,builder:e=>e.option(`search`,{type:`string`,description:`Search`}),handler:async e=>{let t={};e.search!==void 0&&(t.search=e.search);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading category`,async()=>n.cloudforceOne.events.tags.categories.get(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded category`})}},$e={command:`patch <categoryUuid>`,describe:`Updates a Source-of-Truth tag category by UUID.`,builder:e=>e.positional(`categoryUuid`,{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)`}),handler:async t=>{if(s(t.categoryUuid,`categoryUuid`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events tags categories patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/tags/categories/${t.categoryUuid??`<categoryUuid>`}`,pathParams:{categoryUuid:String(t.categoryUuid??``)},bodyKind:`json`,body:{description:t.description,name:t.name,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating category`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/tags/categories/${t.categoryUuid}`,{body:e})),{successLabel:`Updated category`});return}let m={};t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),u(await p(`Updating category`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/tags/categories/${t.categoryUuid}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated category`})}},et={command:`categories`,describe:`Events operations`,builder:e=>e.command(Ze).command(Qe).command($e).command(Xe).demandCommand(1),handler:()=>{}},tt={command:`delete <tagUuid>`,describe:`Deletes a Source-of-Truth tag by UUID.`,builder:e=>e.positional(`tagUuid`,{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}),handler:async t=>{if(s(t.tagUuid,`tagUuid`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/tags/${t.tagUuid??`<tagUuid>`}`,pathParams:{tagUuid:String(t.tagUuid??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`tag`,String(t.tagUuid??``),{force:!!t.force})){process.stderr.write(`Aborted.
11
- `);return}u(await p(`Deleting tag`,async()=>n.cloudforceOne.events.tags.delete(o,t.tagUuid)),{successLabel:`Deleted tag`})}},nt={command:`get`,describe:`Returns all Source-of-Truth tags for an account.`,builder:e=>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`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.pageSize!==void 0&&(t.pageSize=e.pageSize),e.search!==void 0&&(t.search=e.search),e.categoryUuid!==void 0&&(t.categoryUuid=e.categoryUuid);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading tag`,async()=>n.cloudforceOne.events.tags.get(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded tag`})}},rt={command:`patch <tagUuid>`,describe:`Updates a Source-of-Truth tag by UUID.`,builder:e=>e.positional(`tagUuid`,{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)`}),handler:async t=>{if(s(t.tagUuid,`tagUuid`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one events tags patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/tags/${t.tagUuid??`<tagUuid>`}`,pathParams:{tagUuid:String(t.tagUuid??``)},bodyKind:`json`,body:{activeDuration:t.activeDuration,actorCategory:t.actorCategory,aliasGroupNames:t.aliasGroupNames,aliasGroupNamesInternal:t.aliasGroupNamesInternal,analyticPriority:t.analyticPriority,attributionConfidence:t.attributionConfidence,attributionOrganization:t.attributionOrganization,categoryUuid:t.categoryUuid,externalReferenceLinks:t.externalReferenceLinks,internalDescription:t.internalDescription,motive:t.motive,opsecLevel:t.opsecLevel,originCountryIso:t.originCountryIso,priority:t.priority,sophisticationLevel:t.sophisticationLevel,value:t.value,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating tag`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/tags/${t.tagUuid}`,{body:e})),{successLabel:`Updated tag`});return}let m={};t.activeDuration!==void 0&&c(m,[`activeDuration`],o(t.activeDuration,`activeDuration`,`text`)),t.actorCategory!==void 0&&c(m,[`actorCategory`],o(t.actorCategory,`actorCategory`,`text`)),t.aliasGroupNames!==void 0&&c(m,[`aliasGroupNames`],t.aliasGroupNames),t.aliasGroupNamesInternal!==void 0&&c(m,[`aliasGroupNamesInternal`],t.aliasGroupNamesInternal),t.analyticPriority!==void 0&&c(m,[`analyticPriority`],t.analyticPriority),t.attributionConfidence!==void 0&&c(m,[`attributionConfidence`],o(t.attributionConfidence,`attributionConfidence`,`text`)),t.attributionOrganization!==void 0&&c(m,[`attributionOrganization`],o(t.attributionOrganization,`attributionOrganization`,`text`)),t.categoryUuid!==void 0&&c(m,[`categoryUuid`],o(t.categoryUuid,`categoryUuid`,`text`)),t.externalReferenceLinks!==void 0&&c(m,[`externalReferenceLinks`],t.externalReferenceLinks),t.internalDescription!==void 0&&c(m,[`internalDescription`],o(t.internalDescription,`internalDescription`,`text`)),t.motive!==void 0&&c(m,[`motive`],o(t.motive,`motive`,`text`)),t.opsecLevel!==void 0&&c(m,[`opsecLevel`],o(t.opsecLevel,`opsecLevel`,`text`)),t.originCountryIso!==void 0&&c(m,[`originCountryISO`],o(t.originCountryIso,`originCountryIso`,`text`)),t.priority!==void 0&&c(m,[`priority`],t.priority),t.sophisticationLevel!==void 0&&c(m,[`sophisticationLevel`],o(t.sophisticationLevel,`sophisticationLevel`,`text`)),t.value!==void 0&&c(m,[`value`],o(t.value,`value`,`text`)),u(await p(`Updating tag`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/tags/${t.tagUuid}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated tag`})}},it={command:`tags`,describe:`Events operations`,builder:e=>e.command(tt).command(nt).command(rt).command(et).demandCommand(1),handler:()=>{}},at={command:`get`,describe:`Lists all target industries from industry map catalog`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading catalog`,async()=>t.cloudforceOne.events.target.industries.catalog.get(n)),{successLabel:`Loaded catalog`})}},ot={command:`catalog`,describe:`Events operations`,builder:e=>e.command(at).demandCommand(1),handler:()=>{}},st={command:`industries`,describe:`Operations for events.target.industries`,builder:e=>e.command(ot).demandCommand(1),handler:()=>{}},ct={command:`target`,describe:`Operations for events.target`,builder:e=>e.command(st).demandCommand(1),handler:()=>{}},lt={command:`patch`,describe:`Updates multiple events with the same field values. Maximum 100 events per request.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one events update bulk patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/update/bulk`,pathParams:{},bodyKind:`json`,body:{datasetId:n.datasetId,eventIds:n.eventIds,updatesAttacker:n.updatesAttacker,updatesAttackerCountry:n.updatesAttackerCountry,updatesCategory:n.updatesCategory,updatesCreatedAt:n.updatesCreatedAt,updatesEvent:n.updatesEvent,updatesIndicator:n.updatesIndicator,updatesIndicatorType:n.updatesIndicatorType,updatesInsight:n.updatesInsight,updatesRawSource:n.updatesRawSource,updatesRawTlp:n.updatesRawTlp,updatesTargetCountry:n.updatesTargetCountry,updatesTargetIndustry:n.updatesTargetIndustry,updatesTlp:n.updatesTlp,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating bulk`,async()=>i.patch(`/accounts/${m}/cloudforce-one/events/update/bulk`,{body:e})),{successLabel:`Updated bulk`});return}if(n.datasetId===void 0&&(n.datasetId=await t(`dataset-id`,`Dataset ID containing the events to update. Required to prevent cross-account modifications.`)),n.eventIds===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h={};n.datasetId!==void 0&&c(h,[`datasetId`],o(n.datasetId,`datasetId`,`text`)),n.eventIds!==void 0&&c(h,[`eventIds`],n.eventIds),n.updatesAttacker!==void 0&&c(h,[`updates`,`attacker`],o(n.updatesAttacker,`updatesAttacker`,`text`)),n.updatesAttackerCountry!==void 0&&c(h,[`updates`,`attackerCountry`],o(n.updatesAttackerCountry,`updatesAttackerCountry`,`text`)),n.updatesCategory!==void 0&&c(h,[`updates`,`category`],o(n.updatesCategory,`updatesCategory`,`text`)),n.updatesCreatedAt!==void 0&&c(h,[`updates`,`createdAt`],o(n.updatesCreatedAt,`updatesCreatedAt`,`text`)),n.updatesEvent!==void 0&&c(h,[`updates`,`event`],o(n.updatesEvent,`updatesEvent`,`text`)),n.updatesIndicator!==void 0&&c(h,[`updates`,`indicator`],o(n.updatesIndicator,`updatesIndicator`,`text`)),n.updatesIndicatorType!==void 0&&c(h,[`updates`,`indicatorType`],o(n.updatesIndicatorType,`updatesIndicatorType`,`text`)),n.updatesInsight!==void 0&&c(h,[`updates`,`insight`],o(n.updatesInsight,`updatesInsight`,`text`)),n.updatesRawSource!==void 0&&c(h,[`updates`,`raw`,`source`],o(n.updatesRawSource,`updatesRawSource`,`text`)),n.updatesRawTlp!==void 0&&c(h,[`updates`,`raw`,`tlp`],o(n.updatesRawTlp,`updatesRawTlp`,`text`)),n.updatesTargetCountry!==void 0&&c(h,[`updates`,`targetCountry`],o(n.updatesTargetCountry,`updatesTargetCountry`,`text`)),n.updatesTargetIndustry!==void 0&&c(h,[`updates`,`targetIndustry`],o(n.updatesTargetIndustry,`updatesTargetIndustry`,`text`)),n.updatesTlp!==void 0&&c(h,[`updates`,`tlp`],o(n.updatesTlp,`updatesTlp`,`text`)),u(await p(`Updating bulk`,async()=>i.patch(`/accounts/${m}/cloudforce-one/events/update/bulk`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated bulk`})}},ut={command:`bulk`,describe:`Events operations`,builder:e=>e.command(lt).demandCommand(1),handler:()=>{}},dt={command:`update`,describe:`Operations for events.update`,builder:e=>e.command(ut).demandCommand(1),handler:()=>{}},ft={command:`events`,describe:`Events operations`,builder:e=>e.command(x).command(ee).command(b).command(ge).command(ye).command(xe).command(Ee).command(ke).command(je).command(ze).command(Ve).command(We).command(Je).command(it).command(ct).command(dt).demandCommand(1),handler:()=>{}},pt={command:`create <requestId>`,describe:`Uploads a new asset to a Cloudforce One intelligence request.`,builder:e=>e.positional(`requestId`,{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.`}),handler:async t=>{if(s(t.requestId,`requestId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests asset-new create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/asset/new`,pathParams:{requestId:String(t.requestId??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,source:t.source},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.file!==void 0||t.body!==void 0||t.source!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);t.source!==void 0&&e.append(`source`,String(o(t.source,`source`,`text`)??``)),u(await p(`Creating asset new`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/asset/new`,{body:e})),{successLabel:`Created asset new`});return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating asset new`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/asset/new`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created asset new`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},mt={command:`asset-new`,describe:`Additional request operations — priority listing and asset creation`,builder:e=>e.command(pt).demandCommand(1),handler:()=>{}},ht={command:`create <requestId>`,describe:`Lists assets attached to a Cloudforce One intelligence request.`,builder:e=>e.positional(`requestId`,{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)`}),handler:async t=>{if(s(t.requestId,`requestId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests assets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/asset`,pathParams:{requestId:String(t.requestId??``)},bodyKind:`json`,body:{page:t.page,perPage:t.perPage,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating asset`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/asset`,{body:e})),{successLabel:`Created asset`});return}if(t.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(t.perPage===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let o={};t.page!==void 0&&c(o,[`page`],t.page),t.perPage!==void 0&&c(o,[`per_page`],t.perPage),u(await p(`Creating asset`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/asset`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created asset`})}},gt={command:`delete <assetId>`,describe:`Removes an asset from a Cloudforce One intelligence request.`,builder:e=>e.positional(`assetId`,{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}),handler:async t=>{if(s(t.assetId,`assetId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests assets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/asset/${t.assetId??`<assetId>`}`,pathParams:{requestId:String(t.requestId??``),assetId:String(t.assetId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`asset`,String(t.assetId??``),{force:!!t.force})){process.stderr.write(`Aborted.
12
- `);return}u(await p(`Deleting asset`,async()=>n.cloudforceOne.requests.assets.delete(o,t.requestId,t.assetId)),{successLabel:`Deleted asset`})}},_t={command:`get <assetId>`,describe:`Retrieves an asset attached to a Cloudforce One intelligence request.`,builder:e=>e.positional(`assetId`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}),handler:async e=>{s(e.assetId,`assetId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading asset`,async()=>t.cloudforceOne.requests.assets.get(n,e.requestId,e.assetId)),{successLabel:`Loaded asset`})}},vt={command:`update <assetId>`,describe:`Updates an asset in a Cloudforce One intelligence request.`,builder:e=>e.positional(`assetId`,{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)`}),handler:async t=>{if(s(t.assetId,`assetId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests assets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/asset/${t.assetId??`<assetId>`}`,pathParams:{requestId:String(t.requestId??``),assetId:String(t.assetId??``)},bodyKind:`json`,body:{source:t.source,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating asset`,async()=>n.put(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/asset/${t.assetId}`,{body:e})),{successLabel:`Updated asset`});return}let m={};t.source!==void 0&&c(m,[`source`],o(t.source,`source`,`text`)),u(await p(`Updating asset`,async()=>n.put(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/asset/${t.assetId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated asset`})}},yt={command:`assets`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(ht).command(gt).command(_t).command(vt).demandCommand(1),handler:()=>{}},bt={command:`constants`,describe:`Retrieves constant values used in Cloudforce One requests, including valid statuses and types.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading request`,async()=>t.cloudforceOne.requests.constants(n)),{successLabel:`Loaded request`})}},xt={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:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/new`,pathParams:{},bodyKind:`json`,body:{content:t.content,priority:t.priority,requestType:t.requestType,summary:t.summary,tlp:t.tlp,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating request`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/new`,{body:e})),{successLabel:`Created request`});return}let m={};t.content!==void 0&&c(m,[`content`],o(t.content,`content`,`text`)),t.priority!==void 0&&c(m,[`priority`],o(t.priority,`priority`,`text`)),t.requestType!==void 0&&c(m,[`request_type`],o(t.requestType,`requestType`,`text`)),t.summary!==void 0&&c(m,[`summary`],o(t.summary,`summary`,`text`)),t.tlp!==void 0&&c(m,[`tlp`],o(t.tlp,`tlp`,`text`)),u(await p(`Creating request`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/new`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created request`})}},St={command:`delete <requestId>`,describe:`Deletes a Cloudforce One intelligence request and all associated data.`,builder:e=>e.positional(`requestId`,{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}),handler:async t=>{if(s(t.requestId,`requestId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}`,pathParams:{requestId:String(t.requestId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`request`,String(t.requestId??``),{force:!!t.force})){process.stderr.write(`Aborted.
13
- `);return}u(await p(`Deleting request`,async()=>n.cloudforceOne.requests.delete(o,t.requestId)),{successLabel:`Deleted request`})}},Ct={command:`get <requestId>`,describe:`Retrieves details for a specific Cloudforce One intelligence request.`,builder:e=>e.positional(`requestId`,{type:`string`,description:`UUID.`,demandOption:!0}),handler:async e=>{s(e.requestId,`requestId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading request`,async()=>t.cloudforceOne.requests.get(n,e.requestId)),{successLabel:`Loaded request`})}},wt={command:`list`,describe:`Lists Cloudforce One intelligence requests with filtering and pagination.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests`,pathParams:{},bodyKind:`json`,body:{page:t.page,perPage:t.perPage,requestType:t.requestType,sortBy:t.sortBy,sortOrder:t.sortOrder,status:t.status,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating requests`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests`,{body:e})),{successLabel:`Created requests`});return}if(t.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(t.perPage===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let m={};t.page!==void 0&&c(m,[`page`],t.page),t.perPage!==void 0&&c(m,[`per_page`],t.perPage),t.requestType!==void 0&&c(m,[`request_type`],o(t.requestType,`requestType`,`text`)),t.sortBy!==void 0&&c(m,[`sort_by`],o(t.sortBy,`sortBy`,`text`)),t.sortOrder!==void 0&&c(m,[`sort_order`],o(t.sortOrder,`sortOrder`,`text`)),t.status!==void 0&&c(m,[`status`],o(t.status,`status`,`text`)),u(await p(`Creating requests`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created requests`})}},Tt={command:`create <requestId>`,describe:`Adds a message to a Cloudforce One intelligence request conversation.`,builder:e=>e.positional(`requestId`,{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)`}),handler:async t=>{if(s(t.requestId,`requestId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests message create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/message/new`,pathParams:{requestId:String(t.requestId??``)},bodyKind:`json`,body:{content:t.content,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/message/new`,{body:e})),{successLabel:`Created message`});return}let m={};t.content!==void 0&&c(m,[`content`],o(t.content,`content`,`text`)),u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/message/new`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created message`})}},Et={command:`delete <messageId>`,describe:`Removes a message from a Cloudforce One intelligence request thread.`,builder:e=>e.positional(`messageId`,{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}),handler:async t=>{if(s(t.messageId,`messageId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests message delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/message/${t.messageId??`<messageId>`}`,pathParams:{requestId:String(t.requestId??``),messageId:String(t.messageId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`message`,String(t.messageId??``),{force:!!t.force})){process.stderr.write(`Aborted.
14
- `);return}u(await p(`Deleting message`,async()=>n.cloudforceOne.requests.message.delete(o,t.requestId,t.messageId)),{successLabel:`Deleted message`})}},Dt={command:`get <requestId>`,describe:`Lists messages in a Cloudforce One intelligence request conversation.`,builder:e=>e.positional(`requestId`,{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)`}),handler:async t=>{if(s(t.requestId,`requestId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests message get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/message`,pathParams:{requestId:String(t.requestId??``)},bodyKind:`json`,body:{page:t.page,perPage:t.perPage,sortBy:t.sortBy,sortOrder:t.sortOrder,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/message`,{body:e})),{successLabel:`Created message`});return}if(t.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(t.perPage===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let m={};t.page!==void 0&&c(m,[`page`],t.page),t.perPage!==void 0&&c(m,[`per_page`],t.perPage),t.sortBy!==void 0&&c(m,[`sort_by`],o(t.sortBy,`sortBy`,`text`)),t.sortOrder!==void 0&&c(m,[`sort_order`],o(t.sortOrder,`sortOrder`,`text`)),u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/message`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created message`})}},Ot={command:`update <messageId>`,describe:`Updates a message in a Cloudforce One intelligence request thread.`,builder:e=>e.positional(`messageId`,{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)`}),handler:async t=>{if(s(t.messageId,`messageId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests message update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}/message/${t.messageId??`<messageId>`}`,pathParams:{requestId:String(t.requestId??``),messageId:String(t.messageId??``)},bodyKind:`json`,body:{content:t.content,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating message`,async()=>n.put(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/message/${t.messageId}`,{body:e})),{successLabel:`Updated message`});return}let m={};t.content!==void 0&&c(m,[`content`],o(t.content,`content`,`text`)),u(await p(`Updating message`,async()=>n.put(`/accounts/${i}/cloudforce-one/requests/${t.requestId}/message/${t.messageId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated message`})}},kt={command:`message`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(Tt).command(Et).command(Dt).command(Ot).demandCommand(1),handler:()=>{}},At={command:`create`,describe:`Creates a new priority intelligence request in Cloudforce One.`,builder:e=>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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one requests priority create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/requests/priority/new`,pathParams:{},bodyKind:`json`,body:{labels:i.labels,priority:i.priority,requirement:i.requirement,tlp:i.tlp,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating priority`,async()=>m.post(`/accounts/${h}/cloudforce-one/requests/priority/new`,{body:e})),{successLabel:`Created priority`});return}if(i.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(i.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);i.requirement===void 0&&(i.requirement=await t(`requirement`,`Requirement.`)),i.tlp===void 0&&(i.tlp=await n(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let g={};i.labels!==void 0&&c(g,[`labels`],i.labels),i.priority!==void 0&&c(g,[`priority`],i.priority),i.requirement!==void 0&&c(g,[`requirement`],o(i.requirement,`requirement`,`text`)),i.tlp!==void 0&&c(g,[`tlp`],o(i.tlp,`tlp`,`text`)),u(await p(`Creating priority`,async()=>m.post(`/accounts/${h}/cloudforce-one/requests/priority/new`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created priority`})}},jt={command:`delete <priorityId>`,describe:`Deletes a priority intelligence request from Cloudforce One.`,builder:e=>e.positional(`priorityId`,{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}),handler:async t=>{if(s(t.priorityId,`priorityId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests priority delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/priority/${t.priorityId??`<priorityId>`}`,pathParams:{priorityId:String(t.priorityId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`priority`,String(t.priorityId??``),{force:!!t.force})){process.stderr.write(`Aborted.
15
- `);return}u(await p(`Deleting priority`,async()=>n.cloudforceOne.requests.priority.delete(o,t.priorityId)),{successLabel:`Deleted priority`})}},Mt={command:`get <priorityId>`,describe:`Retrieves a specific priority intelligence request from Cloudforce One.`,builder:e=>e.positional(`priorityId`,{type:`string`,description:`UUID.`,demandOption:!0}),handler:async e=>{s(e.priorityId,`priorityId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading priority`,async()=>t.cloudforceOne.requests.priority.get(n,e.priorityId)),{successLabel:`Loaded priority`})}},Nt={command:`list`,describe:`Lists priority intelligence requests in Cloudforce One.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests priority list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/priority`,pathParams:{},bodyKind:`json`,body:{page:t.page,perPage:t.perPage,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating priority`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/priority`,{body:e})),{successLabel:`Created priority`});return}if(t.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(t.perPage===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let o={};t.page!==void 0&&c(o,[`page`],t.page),t.perPage!==void 0&&c(o,[`per_page`],t.perPage),u(await p(`Creating priority`,async()=>n.post(`/accounts/${i}/cloudforce-one/requests/priority`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created priority`})}},Pt={command:`quota`,describe:`Retrieves quota usage for Cloudforce One priority requests.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading priority`,async()=>t.cloudforceOne.requests.priority.quota(n)),{successLabel:`Loaded priority`})}},Ft={command:`update <priorityId>`,describe:`Updates a priority intelligence request in Cloudforce One.`,builder:e=>e.positional(`priorityId`,{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)`}),handler:async i=>{if(s(i.priorityId,`priorityId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one requests priority update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/requests/priority/${i.priorityId??`<priorityId>`}`,pathParams:{priorityId:String(i.priorityId??``)},bodyKind:`json`,body:{labels:i.labels,priority:i.priority,requirement:i.requirement,tlp:i.tlp,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating priority`,async()=>m.put(`/accounts/${h}/cloudforce-one/requests/priority/${i.priorityId}`,{body:e})),{successLabel:`Updated priority`});return}if(i.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(i.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);i.requirement===void 0&&(i.requirement=await t(`requirement`,`Requirement.`)),i.tlp===void 0&&(i.tlp=await n(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let g={};i.labels!==void 0&&c(g,[`labels`],i.labels),i.priority!==void 0&&c(g,[`priority`],i.priority),i.requirement!==void 0&&c(g,[`requirement`],o(i.requirement,`requirement`,`text`)),i.tlp!==void 0&&c(g,[`tlp`],o(i.tlp,`tlp`,`text`)),u(await p(`Updating priority`,async()=>m.put(`/accounts/${h}/cloudforce-one/requests/priority/${i.priorityId}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated priority`})}},It={command:`priority`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(At).command(jt).command(Mt).command(Nt).command(Pt).command(Ft).demandCommand(1),handler:()=>{}},Lt={command:`quota`,describe:`Retrieves quota usage for Cloudforce One standard requests.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading request`,async()=>t.cloudforceOne.requests.quota(n)),{successLabel:`Loaded request`})}},Rt={command:`types`,describe:`Lists available request types for Cloudforce One intelligence requests.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading request`,async()=>t.cloudforceOne.requests.types(n)),{successLabel:`Loaded request`})}},zt={command:`update <requestId>`,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:e=>e.positional(`requestId`,{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)`}),handler:async t=>{if(s(t.requestId,`requestId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one requests update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/requests/${t.requestId??`<requestId>`}`,pathParams:{requestId:String(t.requestId??``)},bodyKind:`json`,body:{content:t.content,priority:t.priority,requestType:t.requestType,summary:t.summary,tlp:t.tlp,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating request`,async()=>n.put(`/accounts/${i}/cloudforce-one/requests/${t.requestId}`,{body:e})),{successLabel:`Updated request`});return}let m={};t.content!==void 0&&c(m,[`content`],o(t.content,`content`,`text`)),t.priority!==void 0&&c(m,[`priority`],o(t.priority,`priority`,`text`)),t.requestType!==void 0&&c(m,[`request_type`],o(t.requestType,`requestType`,`text`)),t.summary!==void 0&&c(m,[`summary`],o(t.summary,`summary`,`text`)),t.tlp!==void 0&&c(m,[`tlp`],o(t.tlp,`tlp`,`text`)),u(await p(`Updating request`,async()=>n.put(`/accounts/${i}/cloudforce-one/requests/${t.requestId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated request`})}},Bt={command:`requests`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(bt).command(xt).command(St).command(Ct).command(wt).command(Lt).command(Rt).command(zt).command(mt).command(yt).command(kt).command(It).demandCommand(1),handler:()=>{}},Vt={command:`create`,describe:`Create a new detection rule.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`json`,body:{content:n.content,description:n.description,enabled:n.enabled,isPublic:n.isPublic,name:n.name,namespaces:n.namespaces,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating rule`,async()=>i.post(`/accounts/${m}/cloudforce-one/rules`,{body:e})),{successLabel:`Created rule`});return}if(n.content===void 0&&(n.content=await t(`content`,``)),n.name===void 0&&(n.name=await t(`name`,``)),n.namespaces===void 0)throw Error(`--namespaces is required (or pass --body with this field set).`);let h={};n.content!==void 0&&c(h,[`content`],o(n.content,`content`,`text`)),n.description!==void 0&&c(h,[`description`],o(n.description,`description`,`text`)),n.enabled!==void 0&&c(h,[`enabled`],n.enabled),n.isPublic!==void 0&&c(h,[`is_public`],n.isPublic),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.namespaces!==void 0&&c(h,[`namespaces`],n.namespaces),u(await p(`Creating rule`,async()=>i.post(`/accounts/${m}/cloudforce-one/rules`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created rule`})}},Ht={command:`rules`,describe:`Delete all rules in an account.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one rules delete all rules`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`all`,``,{force:!!t.force})){process.stderr.write(`Aborted.
16
- `);return}u(await p(`Deleting all`,async()=>n.cloudforceOne.rules.delete.all.rules(o)),{successLabel:`Deleted all`})}},Ut={command:`all`,describe:`Rules operations`,builder:e=>e.command(Ht).demandCommand(1),handler:()=>{}},Wt={command:`rule <id>`,describe:`Delete an existing rule.`,builder:e=>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}),handler:async t=>{if(s(t.id,`id`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one rules delete one rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/rules/${t.id??`<id>`}`,pathParams:{id:String(t.id??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`one`,String(t.id??``),{force:!!t.force})){process.stderr.write(`Aborted.
17
- `);return}u(await p(`Deleting one`,async()=>n.cloudforceOne.rules.delete.one.rule(o,t.id)),{successLabel:`Deleted one`})}},Gt={command:`one`,describe:`Rules operations`,builder:e=>e.command(Wt).demandCommand(1),handler:()=>{}},Kt={command:`delete`,describe:`Operations for rules.delete`,builder:e=>e.command(Ut).command(Gt).demandCommand(1),handler:()=>{}},qt={command:`get <id>`,describe:`Get a single rule by ID.`,builder:e=>e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}),handler:async e=>{s(e.id,`id`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading rule`,async()=>t.cloudforceOne.rules.get(n,e.id)),{successLabel:`Loaded rule`})}},Jt={command:`list`,describe:`List all rules for an account with optional filtering.`,builder:e=>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`}),handler:async e=>{let t={};e.namespace!==void 0&&(t.namespace=e.namespace),e.recursive!==void 0&&(t.recursive=e.recursive),e.search!==void 0&&(t.search=e.search),e.isPublic!==void 0&&(t.is_public=e.isPublic),e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading rules`,async()=>n.cloudforceOne.rules.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded rules`})}},Yt={command:`get`,describe:`Get statistics about rules for the dashboard.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading stat`,async()=>t.cloudforceOne.rules.stats.get(n)),{successLabel:`Loaded stat`})}},Xt={command:`stats`,describe:`Rules operations`,builder:e=>e.command(Yt).demandCommand(1),handler:()=>{}},Zt={command:`get`,describe:`Get the folder tree structure for rules navigation.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading tree`,async()=>t.cloudforceOne.rules.tree.get(n)),{successLabel:`Loaded tree`})}},Qt={command:`tree`,describe:`Rules operations`,builder:e=>e.command(Zt).demandCommand(1),handler:()=>{}},$t={command:`update <id>`,describe:`Update an existing rule.`,builder:e=>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)`}),handler:async t=>{if(s(t.id,`id`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/rules/${t.id??`<id>`}`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:{content:t.content,description:t.description,enabled:t.enabled,isPublic:t.isPublic,name:t.name,namespaces:t.namespaces,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating rule`,async()=>n.put(`/accounts/${i}/cloudforce-one/rules/${t.id}`,{body:e})),{successLabel:`Updated rule`});return}let m={};t.content!==void 0&&c(m,[`content`],o(t.content,`content`,`text`)),t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.enabled!==void 0&&c(m,[`enabled`],t.enabled),t.isPublic!==void 0&&c(m,[`is_public`],t.isPublic),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.namespaces!==void 0&&c(m,[`namespaces`],t.namespaces),u(await p(`Updating rule`,async()=>n.put(`/accounts/${i}/cloudforce-one/rules/${t.id}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated rule`})}},en={command:`create`,describe:`Validate rule syntax, name uniqueness, namespace, and meta checks.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one rules validate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/rules/validate`,pathParams:{},bodyKind:`json`,body:{content:n.content,excludeRuleId:n.excludeRuleId,name:n.name,namespaces:n.namespaces,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating rule`,async()=>i.post(`/accounts/${m}/cloudforce-one/rules/validate`,{body:e})),{successLabel:`Created rule`});return}if(n.content===void 0&&(n.content=await t(`content`,``)),n.name===void 0&&(n.name=await t(`name`,``)),n.namespaces===void 0)throw Error(`--namespaces is required (or pass --body with this field set).`);let h={};n.content!==void 0&&c(h,[`content`],o(n.content,`content`,`text`)),n.excludeRuleId!==void 0&&c(h,[`excludeRuleId`],o(n.excludeRuleId,`excludeRuleId`,`text`)),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.namespaces!==void 0&&c(h,[`namespaces`],n.namespaces),u(await p(`Creating rule`,async()=>i.post(`/accounts/${m}/cloudforce-one/rules/validate`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created rule`})}},tn={command:`validate`,describe:`Rules operations`,builder:e=>e.command(en).demandCommand(1),handler:()=>{}},nn={command:`rules`,describe:`Rules operations`,builder:e=>e.command(Vt).command(qt).command(Jt).command($t).command(Kt).command(Xt).command(Qt).command(tn).demandCommand(1),handler:()=>{}},rn={command:`create`,describe:`Create a scan configuration`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one scans config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`json`,body:{frequency:t.frequency,ips:t.ips,ports:t.ports,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating config`,async()=>n.post(`/accounts/${i}/cloudforce-one/scans/config`,{body:e})),{successLabel:`Created config`});return}if(t.ips===void 0)throw Error(`--ips is required (or pass --body with this field set).`);let o={};t.frequency!==void 0&&c(o,[`frequency`],t.frequency),t.ips!==void 0&&c(o,[`ips`],t.ips),t.ports!==void 0&&c(o,[`ports`],t.ports),u(await p(`Creating config`,async()=>n.post(`/accounts/${i}/cloudforce-one/scans/config`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created config`})}},an={command:`delete <configId>`,describe:`Delete scan configurations`,builder:e=>e.positional(`configId`,{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}),handler:async t=>{if(s(t.configId,`configId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one scans config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/scans/config/${t.configId??`<configId>`}`,pathParams:{configId:String(t.configId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`config`,String(t.configId??``),{force:!!t.force})){process.stderr.write(`Aborted.
18
- `);return}u(await p(`Deleting config`,async()=>n.cloudforceOne.scans.config.delete(o,t.configId)),{successLabel:`Deleted config`})}},on={command:`edit <configId>`,describe:`Update a scan configuration`,builder:e=>e.positional(`configId`,{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)`}),handler:async t=>{if(s(t.configId,`configId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one scans config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/scans/config/${t.configId??`<configId>`}`,pathParams:{configId:String(t.configId??``)},bodyKind:`json`,body:{frequency:t.frequency,ips:t.ips,ports:t.ports,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating config`,async()=>n.patch(`/accounts/${i}/cloudforce-one/scans/config/${t.configId}`,{body:e})),{successLabel:`Updated config`});return}let o={};t.frequency!==void 0&&c(o,[`frequency`],t.frequency),t.ips!==void 0&&c(o,[`ips`],t.ips),t.ports!==void 0&&c(o,[`ports`],t.ports),u(await p(`Updating config`,async()=>n.patch(`/accounts/${i}/cloudforce-one/scans/config/${t.configId}`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated config`})}},sn={command:`list`,describe:`List scan configurations`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading config`,async()=>t.cloudforceOne.scans.config.list(n)),{successLabel:`Loaded config`})}},cn={command:`config`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(rn).command(an).command(on).command(sn).demandCommand(1),handler:()=>{}},ln={command:`get <configId>`,describe:`Get open ports scan results`,builder:e=>e.positional(`configId`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}),handler:async e=>{s(e.configId,`configId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading result`,async()=>t.cloudforceOne.scans.results.get(n,e.configId)),{successLabel:`Loaded result`})}},un={command:`results`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(ln).demandCommand(1),handler:()=>{}},dn={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(cn).command(un).demandCommand(1),handler:()=>{}},fn={command:`list`,describe:`Lists known threat attackers tracked in Cloudforce One threat intelligence.`,builder:e=>e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query attackers from. If not provided, uses the default dataset.`}),handler:async e=>{let t={};e.datasetIds!==void 0&&(t.datasetIds=e.datasetIds);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading attackers`,async()=>n.cloudforceOne.threatEvents.attackers.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded attackers`})}},pn={command:`attackers`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(fn).demandCommand(1),handler:()=>{}},mn={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:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/create/bulk`,pathParams:{},bodyKind:`json`,body:{datasetId:n.datasetId,includeCreatedEvents:n.includeCreatedEvents,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating threat events`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/create/bulk`,{body:e})),{successLabel:`Created threat events`});return}n.datasetId===void 0&&(n.datasetId=await t(`dataset-id`,``));let h={};n.datasetId!==void 0&&c(h,[`datasetId`],o(n.datasetId,`datasetId`,`text`)),n.includeCreatedEvents!==void 0&&c(h,[`includeCreatedEvents`],n.includeCreatedEvents),u(await p(`Creating threat events`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/create/bulk`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created threat events`})}},hn={command:`create`,describe:`Creates a new threat event category in Cloudforce One for organizing and classifying threat events.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/categories/create`,pathParams:{},bodyKind:`json`,body:{killChain:n.killChain,mitreAttack:n.mitreAttack,mitreCapec:n.mitreCapec,name:n.name,shortname:n.shortname,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating category`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/categories/create`,{body:e})),{successLabel:`Created category`});return}if(n.killChain===void 0)throw Error(`--kill-chain is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,``));let h={};n.killChain!==void 0&&c(h,[`killChain`],n.killChain),n.mitreAttack!==void 0&&c(h,[`mitreAttack`],n.mitreAttack),n.mitreCapec!==void 0&&c(h,[`mitreCapec`],n.mitreCapec),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.shortname!==void 0&&c(h,[`shortname`],o(n.shortname,`shortname`,`text`)),u(await p(`Creating category`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/categories/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created category`})}},gn={command:`delete <categoryId>`,describe:`Removes a threat event category from Cloudforce One.`,builder:e=>e.positional(`categoryId`,{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}),handler:async t=>{if(s(t.categoryId,`categoryId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one threat-events categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/categories/${t.categoryId??`<categoryId>`}`,pathParams:{categoryId:String(t.categoryId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`category`,String(t.categoryId??``),{force:!!t.force})){process.stderr.write(`Aborted.
19
- `);return}u(await p(`Deleting category`,async()=>n.cloudforceOne.threatEvents.categories.delete(o,t.categoryId)),{successLabel:`Deleted category`})}},_n={command:`edit <categoryId>`,describe:`Partially updates a threat event category in Cloudforce One, modifying specific fields without replacing the entire category.`,builder:e=>e.positional(`categoryId`,{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)`}),handler:async t=>{if(s(t.categoryId,`categoryId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one threat-events categories edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/categories/${t.categoryId??`<categoryId>`}`,pathParams:{categoryId:String(t.categoryId??``)},bodyKind:`json`,body:{killChain:t.killChain,mitreAttack:t.mitreAttack,mitreCapec:t.mitreCapec,name:t.name,shortname:t.shortname,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating category`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/categories/${t.categoryId}`,{body:e})),{successLabel:`Updated category`});return}let m={};t.killChain!==void 0&&c(m,[`killChain`],t.killChain),t.mitreAttack!==void 0&&c(m,[`mitreAttack`],t.mitreAttack),t.mitreCapec!==void 0&&c(m,[`mitreCapec`],t.mitreCapec),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.shortname!==void 0&&c(m,[`shortname`],o(t.shortname,`shortname`,`text`)),u(await p(`Updating category`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/categories/${t.categoryId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated category`})}},vn={command:`get <categoryId>`,describe:`Retrieves details for a specific threat event category.`,builder:e=>e.positional(`categoryId`,{type:`string`,description:`Category UUID.`,demandOption:!0}),handler:async e=>{s(e.categoryId,`categoryId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading category`,async()=>t.cloudforceOne.threatEvents.categories.get(n,e.categoryId)),{successLabel:`Loaded category`})}},yn={command:`list`,describe:`Lists all threat event categories configured for classifying and organizing threat events.`,builder:e=>e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query categories from. If not provided, uses the default dataset.`}),handler:async e=>{let t={};e.datasetIds!==void 0&&(t.datasetIds=e.datasetIds);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading categories`,async()=>n.cloudforceOne.threatEvents.categories.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded categories`})}},bn={command:`categories`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(hn).command(gn).command(_n).command(vn).command(yn).demandCommand(1),handler:()=>{}},xn={command:`list`,describe:`Lists countries referenced in Cloudforce One threat intelligence data.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading countries`,async()=>t.cloudforceOne.threatEvents.countries.list(n)),{successLabel:`Loaded countries`})}},Sn={command:`countries`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(xn).demandCommand(1),handler:()=>{}},Cn={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:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/create`,pathParams:{},bodyKind:`json`,body:{attacker:n.attacker,attackerCountry:n.attackerCountry,category:n.category,datasetId:n.datasetId,date:n.date,event:n.event,indicator:n.indicator,indicatorType:n.indicatorType,insight:n.insight,rawSource:n.rawSource,rawTlp:n.rawTlp,tags:n.tags,targetCountry:n.targetCountry,targetIndustry:n.targetIndustry,tlp:n.tlp,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating threat event`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/create`,{body:e})),{successLabel:`Created threat event`});return}n.category===void 0&&(n.category=await t(`category`,``)),n.date===void 0&&(n.date=await t(`date`,``)),n.event===void 0&&(n.event=await t(`event`,``)),n.tlp===void 0&&(n.tlp=await t(`tlp`,``));let h={};n.attacker!==void 0&&c(h,[`attacker`],o(n.attacker,`attacker`,`text`)),n.attackerCountry!==void 0&&c(h,[`attackerCountry`],o(n.attackerCountry,`attackerCountry`,`text`)),n.category!==void 0&&c(h,[`category`],o(n.category,`category`,`text`)),n.datasetId!==void 0&&c(h,[`datasetId`],o(n.datasetId,`datasetId`,`text`)),n.date!==void 0&&c(h,[`date`],o(n.date,`date`,`text`)),n.event!==void 0&&c(h,[`event`],o(n.event,`event`,`text`)),n.indicator!==void 0&&c(h,[`indicator`],o(n.indicator,`indicator`,`text`)),n.indicatorType!==void 0&&c(h,[`indicatorType`],o(n.indicatorType,`indicatorType`,`text`)),n.insight!==void 0&&c(h,[`insight`],o(n.insight,`insight`,`text`)),n.rawSource!==void 0&&c(h,[`raw`,`source`],o(n.rawSource,`rawSource`,`text`)),n.rawTlp!==void 0&&c(h,[`raw`,`tlp`],o(n.rawTlp,`rawTlp`,`text`)),n.tags!==void 0&&c(h,[`tags`],n.tags),n.targetCountry!==void 0&&c(h,[`targetCountry`],o(n.targetCountry,`targetCountry`,`text`)),n.targetIndustry!==void 0&&c(h,[`targetIndustry`],o(n.targetIndustry,`targetIndustry`,`text`)),n.tlp!==void 0&&c(h,[`tlp`],o(n.tlp,`tlp`,`text`)),u(await p(`Creating threat event`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created threat event`})}},wn={command:`create`,describe:`Creates a new threat event dataset in Cloudforce One for organizing related threat events.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/create`,pathParams:{},bodyKind:`json`,body:{isPublic:n.isPublic,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating dataset`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/create`,{body:e})),{successLabel:`Created dataset`});return}if(n.isPublic===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`Used to describe the dataset within the account context.`));let h={};n.isPublic!==void 0&&c(h,[`isPublic`],n.isPublic),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Creating dataset`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/dataset/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created dataset`})}},Tn={command:`edit <datasetId>`,describe:`Partially updates a threat event dataset in Cloudforce One, modifying specific fields without replacing the entire dataset configuration.`,builder:e=>e.positional(`datasetId`,{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)`}),handler:async n=>{if(s(n.datasetId,`datasetId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events datasets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/dataset/${n.datasetId??`<datasetId>`}`,pathParams:{datasetId:String(n.datasetId??``)},bodyKind:`json`,body:{isPublic:n.isPublic,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating dataset`,async()=>i.patch(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}`,{body:e})),{successLabel:`Updated dataset`});return}if(n.isPublic===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`Used to describe the dataset within the account context.`));let h={};n.isPublic!==void 0&&c(h,[`isPublic`],n.isPublic),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Updating dataset`,async()=>i.patch(`/accounts/${m}/cloudforce-one/events/dataset/${n.datasetId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated dataset`})}},En={command:`get <datasetId>`,describe:`Retrieves details for a specific threat event dataset.`,builder:e=>e.positional(`datasetId`,{type:`string`,description:`Dataset ID.`,demandOption:!0}),handler:async e=>{s(e.datasetId,`datasetId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading dataset`,async()=>t.cloudforceOne.threatEvents.datasets.get(n,e.datasetId)),{successLabel:`Loaded dataset`})}},Dn={command:`list`,describe:`Lists all threat event datasets configured in Cloudforce One.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading datasets`,async()=>t.cloudforceOne.threatEvents.datasets.list(n)),{successLabel:`Loaded datasets`})}},On={command:`raw <eventId>`,describe:`Retrieves the raw data associated with an event. Searches across all shards in the dataset.`,builder:e=>e.positional(`eventId`,{type:`string`,description:`Event ID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}),handler:async e=>{s(e.eventId,`eventId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading dataset`,async()=>t.cloudforceOne.threatEvents.datasets.raw(n,e.eventId,e.datasetId)),{successLabel:`Loaded dataset`})}},kn={command:`datasets`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(wn).command(Tn).command(En).command(Dn).command(On).demandCommand(1),handler:()=>{}},An={command:`edit <eventId>`,describe:`Partially updates a threat event in Cloudforce One, modifying specific fields without replacing the entire event.`,builder:e=>e.positional(`eventId`,{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)`}),handler:async n=>{if(s(n.eventId,`eventId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/${n.eventId??`<eventId>`}`,pathParams:{eventId:String(n.eventId??``)},bodyKind:`json`,body:{attacker:n.attacker,attackerCountry:n.attackerCountry,category:n.category,createdAt:n.createdAt,datasetId:n.datasetId,date:n.date,event:n.event,indicator:n.indicator,indicatorType:n.indicatorType,insight:n.insight,rawSource:n.rawSource,rawTlp:n.rawTlp,targetCountry:n.targetCountry,targetIndustry:n.targetIndustry,tlp:n.tlp,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating threat event`,async()=>i.patch(`/accounts/${m}/cloudforce-one/events/${n.eventId}`,{body:e})),{successLabel:`Updated threat event`});return}n.datasetId===void 0&&(n.datasetId=await t(`dataset-id`,`Dataset ID containing the event to update.`));let h={};n.attacker!==void 0&&c(h,[`attacker`],o(n.attacker,`attacker`,`text`)),n.attackerCountry!==void 0&&c(h,[`attackerCountry`],o(n.attackerCountry,`attackerCountry`,`text`)),n.category!==void 0&&c(h,[`category`],o(n.category,`category`,`text`)),n.createdAt!==void 0&&c(h,[`createdAt`],o(n.createdAt,`createdAt`,`text`)),n.datasetId!==void 0&&c(h,[`datasetId`],o(n.datasetId,`datasetId`,`text`)),n.date!==void 0&&c(h,[`date`],o(n.date,`date`,`text`)),n.event!==void 0&&c(h,[`event`],o(n.event,`event`,`text`)),n.indicator!==void 0&&c(h,[`indicator`],o(n.indicator,`indicator`,`text`)),n.indicatorType!==void 0&&c(h,[`indicatorType`],o(n.indicatorType,`indicatorType`,`text`)),n.insight!==void 0&&c(h,[`insight`],o(n.insight,`insight`,`text`)),n.rawSource!==void 0&&c(h,[`raw`,`source`],o(n.rawSource,`rawSource`,`text`)),n.rawTlp!==void 0&&c(h,[`raw`,`tlp`],o(n.rawTlp,`rawTlp`,`text`)),n.targetCountry!==void 0&&c(h,[`targetCountry`],o(n.targetCountry,`targetCountry`,`text`)),n.targetIndustry!==void 0&&c(h,[`targetIndustry`],o(n.targetIndustry,`targetIndustry`,`text`)),n.tlp!==void 0&&c(h,[`tlp`],o(n.tlp,`tlp`,`text`)),u(await p(`Updating threat event`,async()=>i.patch(`/accounts/${m}/cloudforce-one/events/${n.eventId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated threat event`})}},jn={command:`create <eventId>`,describe:`Adds a tag to a threat event in Cloudforce One for classification and filtering.`,builder:e=>e.positional(`eventId`,{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)`}),handler:async t=>{if(s(t.eventId,`eventId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one threat-events event-tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/event_tag/${t.eventId??`<eventId>`}/create`,pathParams:{eventId:String(t.eventId??``)},bodyKind:`json`,body:{tags:t.tags,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating event tag`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/event_tag/${t.eventId}/create`,{body:e})),{successLabel:`Created event tag`});return}if(t.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let o={};t.tags!==void 0&&c(o,[`tags`],t.tags),u(await p(`Creating event tag`,async()=>n.post(`/accounts/${i}/cloudforce-one/events/event_tag/${t.eventId}/create`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created event tag`})}},Mn={command:`delete <eventId>`,describe:`Removes a tag from a threat event in Cloudforce One.`,builder:e=>e.positional(`eventId`,{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)`}),handler:async t=>{if(s(t.eventId,`eventId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one threat-events event-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/event_tag/${t.eventId??`<eventId>`}`,pathParams:{eventId:String(t.eventId??``)},bodyKind:`json`,body:{tags:t.tags,body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`event tag`,String(t.eventId??``),{force:!!t.force})){process.stderr.write(`Aborted.
20
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting event tag`,async()=>n.delete(`/accounts/${o}/cloudforce-one/events/event_tag/${t.eventId}`,{body:e})),{successLabel:`Deleted event tag`});return}if(t.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let m={};t.tags!==void 0&&c(m,[`tags`],t.tags),u(await p(`Deleting event tag`,async()=>n.delete(`/accounts/${o}/cloudforce-one/events/event_tag/${t.eventId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted event tag`})}},Nn={command:`event-tags`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(jn).command(Mn).demandCommand(1),handler:()=>{}},$={command:`get <eventId>`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/events/:event_id instead.`,builder:e=>e.positional(`eventId`,{type:`string`,description:`Event UUID.`,demandOption:!0}),handler:async e=>{s(e.eventId,`eventId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading threat event`,async()=>t.cloudforceOne.threatEvents.get(n,e.eventId)),{successLabel:`Loaded threat event`})}},Pn={command:`list`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes instead.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading indicator types`,async()=>t.cloudforceOne.threatEvents.indicatorTypes.list(n)),{successLabel:`Loaded indicator types`})}},Fn={command:`indicator-types`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Pn).demandCommand(1),handler:()=>{}},In={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:e=>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`,default:!1}).option(`format`,{type:`string`,description:`Format`,choices:[`json`,`stix2`]}),handler:async e=>{let t={};e.cursor!==void 0&&(t.cursor=e.cursor),e.search!==void 0&&(t.search=e.search),e.page!==void 0&&(t.page=e.page),e.pageSize!==void 0&&(t.pageSize=e.pageSize),e.orderBy!==void 0&&(t.orderBy=e.orderBy),e.order!==void 0&&(t.order=e.order),e.datasetId!==void 0&&(t.datasetId=e.datasetId),e.forceRefresh!==void 0&&(t.forceRefresh=e.forceRefresh),e.format!==void 0&&(t.format=e.format);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading threat events`,async()=>n.cloudforceOne.threatEvents.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded threat events`})}},Ln={command:`edit <rawId>`,describe:`Partially updates raw threat event data in Cloudforce One, modifying specific fields of the event.`,builder:e=>e.positional(`rawId`,{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)`}),handler:async t=>{if(s(t.rawId,`rawId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one threat-events raw edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/${t.eventId??`<eventId>`}/raw/${t.rawId??`<rawId>`}`,pathParams:{eventId:String(t.eventId??``),rawId:String(t.rawId??``)},bodyKind:`json`,body:{source:t.source,tlp:t.tlp,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating raw`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/${t.eventId}/raw/${t.rawId}`,{body:e})),{successLabel:`Updated raw`});return}let m={};t.source!==void 0&&c(m,[`source`],o(t.source,`source`,`text`)),t.tlp!==void 0&&c(m,[`tlp`],o(t.tlp,`tlp`,`text`)),u(await p(`Updating raw`,async()=>n.patch(`/accounts/${i}/cloudforce-one/events/${t.eventId}/raw/${t.rawId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated raw`})}},Rn={command:`get <rawId>`,describe:`Retrieves raw threat event data for a specific event in Cloudforce One.`,builder:e=>e.positional(`rawId`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}),handler:async e=>{s(e.rawId,`rawId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading raw`,async()=>t.cloudforceOne.threatEvents.raw.get(n,e.eventId,e.rawId)),{successLabel:`Loaded raw`})}},zn={command:`raw`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Ln).command(Rn).demandCommand(1),handler:()=>{}},Bn={command:`delete <eventId>`,describe:`Removes a reference link between related threat events in Cloudforce One.`,builder:e=>e.positional(`eventId`,{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)`}),handler:async t=>{if(s(t.eventId,`eventId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf cloudforce-one threat-events relate delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/events/relate/${t.eventId??`<eventId>`}`,pathParams:{eventId:String(t.eventId??``)},bodyKind:`json`,body:{events:t.events,body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`relate`,String(t.eventId??``),{force:!!t.force})){process.stderr.write(`Aborted.
21
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting relate`,async()=>n.delete(`/accounts/${o}/cloudforce-one/events/relate/${t.eventId}`,{body:e})),{successLabel:`Deleted relate`});return}if(t.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let m={};t.events!==void 0&&c(m,[`events`],t.events),u(await p(`Deleting relate`,async()=>n.delete(`/accounts/${o}/cloudforce-one/events/relate/${t.eventId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted relate`})}},Vn={command:`relate`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Bn).demandCommand(1),handler:()=>{}},Hn={command:`create`,describe:`Creates a new tag to be used accross threat events.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf cloudforce-one threat-events tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/events/tags/create`,pathParams:{},bodyKind:`json`,body:{activeDuration:n.activeDuration,actorCategory:n.actorCategory,aliasGroupNames:n.aliasGroupNames,aliasGroupNamesInternal:n.aliasGroupNamesInternal,analyticPriority:n.analyticPriority,attributionConfidence:n.attributionConfidence,attributionOrganization:n.attributionOrganization,categoryUuid:n.categoryUuid,externalReferenceLinks:n.externalReferenceLinks,internalDescription:n.internalDescription,motive:n.motive,opsecLevel:n.opsecLevel,originCountryIso:n.originCountryIso,priority:n.priority,sophisticationLevel:n.sophisticationLevel,value:n.value,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating tag`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/tags/create`,{body:e})),{successLabel:`Created tag`});return}n.value===void 0&&(n.value=await t(`value`,``));let h={};n.activeDuration!==void 0&&c(h,[`activeDuration`],o(n.activeDuration,`activeDuration`,`text`)),n.actorCategory!==void 0&&c(h,[`actorCategory`],o(n.actorCategory,`actorCategory`,`text`)),n.aliasGroupNames!==void 0&&c(h,[`aliasGroupNames`],n.aliasGroupNames),n.aliasGroupNamesInternal!==void 0&&c(h,[`aliasGroupNamesInternal`],n.aliasGroupNamesInternal),n.analyticPriority!==void 0&&c(h,[`analyticPriority`],n.analyticPriority),n.attributionConfidence!==void 0&&c(h,[`attributionConfidence`],o(n.attributionConfidence,`attributionConfidence`,`text`)),n.attributionOrganization!==void 0&&c(h,[`attributionOrganization`],o(n.attributionOrganization,`attributionOrganization`,`text`)),n.categoryUuid!==void 0&&c(h,[`categoryUuid`],o(n.categoryUuid,`categoryUuid`,`text`)),n.externalReferenceLinks!==void 0&&c(h,[`externalReferenceLinks`],n.externalReferenceLinks),n.internalDescription!==void 0&&c(h,[`internalDescription`],o(n.internalDescription,`internalDescription`,`text`)),n.motive!==void 0&&c(h,[`motive`],o(n.motive,`motive`,`text`)),n.opsecLevel!==void 0&&c(h,[`opsecLevel`],o(n.opsecLevel,`opsecLevel`,`text`)),n.originCountryIso!==void 0&&c(h,[`originCountryISO`],o(n.originCountryIso,`originCountryIso`,`text`)),n.priority!==void 0&&c(h,[`priority`],n.priority),n.sophisticationLevel!==void 0&&c(h,[`sophisticationLevel`],o(n.sophisticationLevel,`sophisticationLevel`,`text`)),n.value!==void 0&&c(h,[`value`],o(n.value,`value`,`text`)),u(await p(`Creating tag`,async()=>i.post(`/accounts/${m}/cloudforce-one/events/tags/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created tag`})}},Un={command:`tags`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Hn).demandCommand(1),handler:()=>{}},Wn={command:`list`,describe:`Retrieves the catalog of industry classifications used in Cloudforce One threat intelligence.`,builder:e=>e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query target industries from. If not provided, uses the default dataset.`}),handler:async e=>{let t={};e.datasetIds!==void 0&&(t.datasetIds=e.datasetIds);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading target industries`,async()=>n.cloudforceOne.threatEvents.targetIndustries.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded target industries`})}},Gn={command:`target-industries`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Wn).demandCommand(1),handler:()=>{}},Kn={command:`threat-events`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(mn).command(Cn).command(An).command($).command(In).command(pn).command(bn).command(Sn).command(kn).command(Nn).command(Fn).command(zn).command(Vn).command(Un).command(Gn).demandCommand(1),handler:()=>{}},qn={command:`cloudforce-one`,describe:`Threat intelligence platform — request investigations, scan indicators, and track threat events`,builder:e=>e.command(g).command(ft).command(Bt).command(nn).command(dn).command(Kn).demandCommand(1),handler:()=>{}};export{qn as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e}from"./rolldown-runtime-CR7SCCRW.mjs";import{existsSync as t,mkdirSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{homedir as a}from"node:os";import{join as o}from"node:path";var s=e({getConfigFile:()=>u,loadConfig:()=>f,saveConfig:()=>p,updateConfig:()=>m});const c=o(a(),`.config`,`cf`),l=o(c,`config.json`);function u(){return l}function d(){t(c)||n(c,{recursive:!0,mode:448})}function f(){try{if(!t(l))return{};let e=r(l,`utf-8`);return JSON.parse(e)}catch{return{}}}function p(e){d(),i(l,JSON.stringify(e,null,2),{mode:384})}function m(e){let t=f(),n={...t,...e};e.completions&&t.completions&&(n.completions={...t.completions,...e.completions}),e.defaults&&t.defaults&&(n.defaults={...t.defaults,...e.defaults}),p(n)}export{p as i,u as n,f as r,s as t};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Creates a new connectivity service entry in the directory.`,builder:e=>e.option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin. - `"verify_full"` — verify certificate chain and hostname (default) - `"verify_ca"` — verify certificate chain only, skip hostname check - `"disabled"` — do not verify the server certificate at all',choices:[`verify_full`,`verify_ca`,`disabled`]}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port 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)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf connectivity directory services create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/connectivity/directory/services`,pathParams:{},bodyKind:`json`,body:{hostIpv4:i.hostIpv4,hostNetworkTunnelId:i.hostNetworkTunnelId,hostIpv6:i.hostIpv6,hostHostname:i.hostHostname,hostResolverNetworkResolverIps:i.hostResolverNetworkResolverIps,hostResolverNetworkTunnelId:i.hostResolverNetworkTunnelId,name:i.name,tlsSettingsCertVerificationMode:i.tlsSettingsCertVerificationMode,type:i.type,httpPort:i.httpPort,httpsPort:i.httpsPort,appProtocol:i.appProtocol,tcpPort:i.tcpPort,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating service`,async()=>m.post(`/accounts/${h}/connectivity/directory/services`,{body:e})),{successLabel:`Created service`});return}i.name===void 0&&(i.name=await t(`name`,``)),i.type===void 0&&(i.type=await n(`type`,``,[`tcp`,`http`]));let g={};i.hostIpv4!==void 0&&c(g,[`host`,`ipv4`],o(i.hostIpv4,`hostIpv4`,`text`)),i.hostNetworkTunnelId!==void 0&&c(g,[`host`,`network`,`tunnel_id`],o(i.hostNetworkTunnelId,`hostNetworkTunnelId`,`text`)),i.hostIpv6!==void 0&&c(g,[`host`,`ipv6`],o(i.hostIpv6,`hostIpv6`,`text`)),i.hostHostname!==void 0&&c(g,[`host`,`hostname`],o(i.hostHostname,`hostHostname`,`text`)),i.hostResolverNetworkResolverIps!==void 0&&c(g,[`host`,`resolver_network`,`resolver_ips`],i.hostResolverNetworkResolverIps),i.hostResolverNetworkTunnelId!==void 0&&c(g,[`host`,`resolver_network`,`tunnel_id`],o(i.hostResolverNetworkTunnelId,`hostResolverNetworkTunnelId`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.tlsSettingsCertVerificationMode!==void 0&&c(g,[`tls_settings`,`cert_verification_mode`],o(i.tlsSettingsCertVerificationMode,`tlsSettingsCertVerificationMode`,`text`)),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),i.httpPort!==void 0&&c(g,[`http_port`],i.httpPort),i.httpsPort!==void 0&&c(g,[`https_port`],i.httpsPort),i.appProtocol!==void 0&&c(g,[`app_protocol`],o(i.appProtocol,`appProtocol`,`text`)),i.tcpPort!==void 0&&c(g,[`tcp_port`],i.tcpPort),u(await p(`Creating service`,async()=>m.post(`/accounts/${h}/connectivity/directory/services`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created service`})}},h={command:`delete <serviceId>`,describe:`Removes a connectivity service entry from the directory.`,builder:e=>e.positional(`serviceId`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.serviceId,`serviceId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf connectivity directory services delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/connectivity/directory/services/${t.serviceId??`<serviceId>`}`,pathParams:{serviceId:String(t.serviceId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`service`,String(t.serviceId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting service`,async()=>n.connectivity.directory.services.delete(o,t.serviceId)),{successLabel:`Deleted service`})}},g={command:`get <serviceId>`,describe:`Retrieves details for a specific connectivity service entry.`,builder:e=>e.positional(`serviceId`,{type:`string`,description:`Service ID`,demandOption:!0}),handler:async e=>{s(e.serviceId,`serviceId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading service`,async()=>t.connectivity.directory.services.get(n,e.serviceId)),{successLabel:`Loaded service`})}},_={command:`list`,describe:`Lists all connectivity service entries in the directory.`,builder:e=>e.option(`type`,{type:`string`,description:`Type`}).option(`page`,{type:`number`,description:`Current page in the response`}).option(`per-page`,{type:`number`,description:`Max amount of entries returned per page`}),handler:async e=>{let t={};e.type!==void 0&&(t.type=e.type),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading services`,async()=>n.connectivity.directory.services.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded services`})}},v={command:`update <serviceId>`,describe:`Updates an existing connectivity service entry in the directory.`,builder:e=>e.positional(`serviceId`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin. - `"verify_full"` — verify certificate chain and hostname (default) - `"verify_ca"` — verify certificate chain only, skip hostname check - `"disabled"` — do not verify the server certificate at all',choices:[`verify_full`,`verify_ca`,`disabled`]}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port 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)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0}),handler:async t=>{if(s(t.serviceId,`serviceId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf connectivity directory services update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/connectivity/directory/services/${t.serviceId??`<serviceId>`}`,pathParams:{serviceId:String(t.serviceId??``)},bodyKind:`json`,body:{hostIpv4:t.hostIpv4,hostNetworkTunnelId:t.hostNetworkTunnelId,hostIpv6:t.hostIpv6,hostHostname:t.hostHostname,hostResolverNetworkResolverIps:t.hostResolverNetworkResolverIps,hostResolverNetworkTunnelId:t.hostResolverNetworkTunnelId,name:t.name,tlsSettingsCertVerificationMode:t.tlsSettingsCertVerificationMode,type:t.type,httpPort:t.httpPort,httpsPort:t.httpsPort,appProtocol:t.appProtocol,tcpPort:t.tcpPort,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating service`,async()=>n.put(`/accounts/${i}/connectivity/directory/services/${t.serviceId}`,{body:e})),{successLabel:`Updated service`});return}let m={};t.hostIpv4!==void 0&&c(m,[`host`,`ipv4`],o(t.hostIpv4,`hostIpv4`,`text`)),t.hostNetworkTunnelId!==void 0&&c(m,[`host`,`network`,`tunnel_id`],o(t.hostNetworkTunnelId,`hostNetworkTunnelId`,`text`)),t.hostIpv6!==void 0&&c(m,[`host`,`ipv6`],o(t.hostIpv6,`hostIpv6`,`text`)),t.hostHostname!==void 0&&c(m,[`host`,`hostname`],o(t.hostHostname,`hostHostname`,`text`)),t.hostResolverNetworkResolverIps!==void 0&&c(m,[`host`,`resolver_network`,`resolver_ips`],t.hostResolverNetworkResolverIps),t.hostResolverNetworkTunnelId!==void 0&&c(m,[`host`,`resolver_network`,`tunnel_id`],o(t.hostResolverNetworkTunnelId,`hostResolverNetworkTunnelId`,`text`)),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.tlsSettingsCertVerificationMode!==void 0&&c(m,[`tls_settings`,`cert_verification_mode`],o(t.tlsSettingsCertVerificationMode,`tlsSettingsCertVerificationMode`,`text`)),t.type!==void 0&&c(m,[`type`],o(t.type,`type`,`text`)),t.httpPort!==void 0&&c(m,[`http_port`],t.httpPort),t.httpsPort!==void 0&&c(m,[`https_port`],t.httpsPort),t.appProtocol!==void 0&&c(m,[`app_protocol`],o(t.appProtocol,`appProtocol`,`text`)),t.tcpPort!==void 0&&c(m,[`tcp_port`],t.tcpPort),u(await p(`Updating service`,async()=>n.put(`/accounts/${i}/connectivity/directory/services/${t.serviceId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated service`})}},y={command:`services`,describe:`Connectivity service entries that define available network endpoints and their properties`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).demandCommand(1),handler:()=>{}},b={command:`directory`,describe:`Operations for directory`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`connectivity`,describe:`Service directory for network connectivity endpoints and their configurations`,builder:e=>e.command(b).demandCommand(1),handler:()=>{}};export{x as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{m as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Update the Content Scanning status.`,builder:e=>e.option(`value`,{type:`string`,description:`The status value for Content Scanning.`,choices:[`enabled`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Content Scanning settings to update.`}),handler:async t=>{if(t.dryRun){l({command:`cf content-scanning create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/content-upload-scan/settings`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{value:t.value,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating content scanning`,async()=>a.put(`/zones/${t.zoneId}/content-upload-scan/settings`,{body:e})),{successLabel:`Updated content scanning`});return}t.value===void 0&&(t.value=await e(`value`,`The status value for Content Scanning.`,[`enabled`,`disabled`]));let d={};t.value!==void 0&&o(d,[`value`],i(t.value,`value`,`text`)),c(await u(`Updating content scanning`,async()=>a.put(`/zones/${t.zoneId}/content-upload-scan/settings`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated content scanning`})}},f={command:`disable`,describe:`Disable Content Scanning.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(e.dryRun){l({command:`cf content-scanning disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/content-upload-scan/disable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t(`content scanning`,String(a??``),{force:!!e.force,message:`This operation turns off WAF content scanning for a zone.`})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting content scanning`,async()=>i.contentScanning.disable(a)),{successLabel:`Deleted content scanning`})}},p={command:`enable`,describe:`Enable Content Scanning.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async e=>{if(e.dryRun){l({command:`cf content-scanning enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/content-upload-scan/enable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Creating content scanning`,async()=>t.contentScanning.enable(i)),{successLabel:`Created content scanning`})}},m={command:`get`,describe:`Retrieve the current status of Content Scanning.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading content scanning`,async()=>t.contentScanning.get(i)),{successLabel:`Loaded content scanning`})}},h={command:`create`,describe:`Add custom scan expressions for Content Scanning.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Array of custom scan expressions to add.`}),handler:async e=>{if(e.dryRun){l({command:`cf content-scanning payloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/content-upload-scan/payloads`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Creating payload`,async()=>t.post(`/zones/${e.zoneId}/content-upload-scan/payloads`,{body:n})),{successLabel:`Created payload`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`delete <expressionId>`,describe:`Delete a Content Scan Custom Expression.`,builder:e=>e.positional(`expressionId`,{type:`string`,description:`defines the unique ID for this custom scan expression.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(a(e.expressionId,`expressionId`),e.dryRun){l({command:`cf content-scanning payloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/content-upload-scan/payloads/${e.expressionId??`<expressionId>`}`,pathParams:{zoneId:String(e.zoneId??``),expressionId:String(e.expressionId??``)},bodyKind:`none`,validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`payload`,String(e.expressionId??``),{force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting payload`,async()=>i.contentScanning.payloads.delete(o,e.expressionId)),{successLabel:`Deleted payload`})}},_={command:`list`,describe:`Get a list of existing custom scan expressions for Content Scanning.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading payloads`,async()=>t.contentScanning.payloads.list(i)),{successLabel:`Loaded payloads`})}},v={command:`payloads`,describe:`Scanned payload logs showing detection results for uploaded content`,builder:e=>e.command(h).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`get`,describe:`Retrieve the current status of Content Scanning.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading setting`,async()=>t.contentScanning.settings.get(i)),{successLabel:`Loaded setting`})}},b={command:`settings`,describe:`Content scanning expressions that define which request body fields to inspect`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`update`,describe:`Update the Content Scanning status.`,builder:e=>e.option(`value`,{type:`string`,description:`The status value for Content Scanning.`,choices:[`enabled`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Content Scanning settings to update.`}),handler:async t=>{if(t.dryRun){l({command:`cf content-scanning update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/content-upload-scan/settings`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{value:t.value,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating content scanning`,async()=>a.put(`/zones/${t.zoneId}/content-upload-scan/settings`,{body:e})),{successLabel:`Updated content scanning`});return}t.value===void 0&&(t.value=await e(`value`,`The status value for Content Scanning.`,[`enabled`,`disabled`]));let d={};t.value!==void 0&&o(d,[`value`],i(t.value,`value`,`text`)),c(await u(`Updating content scanning`,async()=>a.put(`/zones/${t.zoneId}/content-upload-scan/settings`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated content scanning`})}},S={command:`content-scanning`,describe:`Scan uploaded content in HTTP requests for malware and malicious payloads`,builder:e=>e.command(d).command(f).command(p).command(m).command(x).command(v).command(b).demandCommand(1),handler:()=>{}};export{S as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{D as e,a as t,c as n,f as r,i,n as a,s as o}from"./auth-BHD_B2p9.mjs";import{a as s}from"./theme-BKCxTQTe.mjs";import{n as c,r as l}from"./ui-Dj3No2vN.mjs";import{n as u,r as d}from"./config-BmTd_qeU.mjs";import{t as f}from"./output-CqGQp2r6.mjs";const p={command:`clear [key]`,describe:`Clear a default context value`,builder:e=>e.positional(`key`,{type:`string`,description:`Context key to clear (account-id or zone)`,choices:[`account-id`,`zone`]}).option(`all`,{type:`boolean`,description:`Clear all context defaults`,default:!1}).option(`project`,{type:`boolean`,alias:`p`,description:`Clear from project .cfrc instead of user config`,default:!1}).check(e=>{if(!e.key&&!e.all)throw Error(`Please specify a key to clear, or use --all to clear everything`);return!0}),handler:async e=>{let r=e.project?`project`:`user`,a={"account-id":`accountId`,zone:`zone`};if(e.all){i(`all`,r);let e=r===`project`?n():u();if(r===`project`){let e=t();console.log(e?l(`Deleted ${s.muted(e.path)}`):c(`No project config found to delete`))}else console.log(l(`Cleared all defaults from ${s.muted(e)}`));return}let o=e.key?a[e.key]:void 0;o||(console.error(s.error(`Unknown key "${e.key}". Use "account-id" or "zone".`)),process.exit(1)),i(o,r);let d=r===`project`?n():u();console.log(l(`Cleared ${e.key} from ${s.muted(d)}`))}},m={command:`set <key> <value>`,describe:`Set a default context value`,builder:e=>e.positional(`key`,{type:`string`,description:`Context key to set (account-id or zone)`,choices:[`account-id`,`zone`],demandOption:!0}).positional(`value`,{type:`string`,description:`Value to set (account ID/name, or zone ID/domain)`,demandOption:!0}).option(`project`,{type:`boolean`,alias:`p`,description:`Save to project .cfrc instead of user config`,default:!1}),handler:async t=>{let i;try{i=await a()}catch{console.error(s.error(`Please authenticate first with `)+s.code(`cf auth login`)),process.exit(1)}let o=new e({apiToken:i}),c=t.project?`project`:`user`,d={"account-id":`accountId`,zone:`zone`}[t.key];d||(console.error(s.error(`Unknown key "${t.key}". Use "account-id" or "zone".`)),process.exit(1));let f=await r(d,t.value,c,o),p=c===`project`?n():u();console.log(l(`Saved ${t.key} "${s.bold(f.displayName)}" to ${s.muted(p)}`))}};async function h(e,t){try{return(await t.accounts.list()).find(t=>t.id===e)?.name}catch{return}}async function g(e,t){try{return(await t.zones.list()).find(t=>t.id===e||t.name===e)?.name}catch{return}}const _={command:`show`,describe:`Show current context (default account and zone)`,builder:e=>e,handler:async n=>{let r=await o(),i=d(),s=t(),c;try{c=new e({apiToken:await a()})}catch{}if(c){if(r.accountId){let e=await h(r.accountId.value,c);e&&(r.accountId.name=e)}if(r.zone){let e=await g(r.zone.value,c);e&&(r.zone.name=e)}}f({accountId:r.accountId||null,zone:r.zone||null,env:{CLOUDFLARE_ACCOUNT_ID:process.env.CLOUDFLARE_ACCOUNT_ID||null,CLOUDFLARE_ZONE_ID:process.env.CLOUDFLARE_ZONE_ID||null},files:{userConfig:u(),userConfigExists:!!i,projectConfig:s?.path||null}})}},v={command:`context`,describe:`Manage default account and zone context`,builder:e=>e.command(_).command(m).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Upload a new SSL certificate for a zone.`,builder:e=>e.option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or certificate and the intermediate(s).`}).option(`custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`deploy`,{type:`string`,description:`The environment to deploy the certificate to, defaults to production`,choices:[`staging`,`production`],default:`production`}).option(`geo-restrictions-label`,{type:`string`,description:`The geo_restrictions.label field`,choices:[`us`,`eu`,`highest_security`]}).option(`policy`,{type:`string`,description:`Specify the policy that determines the region where your private key will be held locally. HTTPS connections to any excluded data center will still be fully encrypted, but will incur some latency while Keyless SSL is used to complete the handshake with the nearest allowed data center. Any combination of countries, specified by their two letter country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) can be chosen, such as 'country: IN', as well as 'region: EU' which refers to the EU region. If there are too few data centers satisfying the policy, it will be rejected. Note: The API accepts this field as either "policy" or "policy_restrictions" in requests. Responses return this field as "policy_restrictions".`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).option(`type`,{type:`string`,description:`The type 'legacy_custom' enables support for legacy clients which do not include SNI in the TLS handshake.`,choices:[`legacy_custom`,`sni_custom`],default:`legacy_custom`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf custom-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/custom_certificates`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{bundleMethod:t.bundleMethod,certificate:t.certificate,customCsrId:t.customCsrId,deploy:t.deploy,geoRestrictionsLabel:t.geoRestrictionsLabel,policy:t.policy,privateKey:t.privateKey,type:t.type,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating custom certificate`,async()=>a.post(`/zones/${t.zoneId}/custom_certificates`,{body:e})),{successLabel:`Created custom certificate`});return}t.certificate===void 0&&(t.certificate=await e(`certificate`,`The zone's SSL certificate or certificate and the intermediate(s).`)),t.privateKey===void 0&&(t.privateKey=await e(`private-key`,`The zone's private key.`,{kind:`secret`}));let d={};t.bundleMethod!==void 0&&o(d,[`bundle_method`],i(t.bundleMethod,`bundleMethod`,`text`)),t.certificate!==void 0&&o(d,[`certificate`],i(t.certificate,`certificate`,`text`)),t.customCsrId!==void 0&&o(d,[`custom_csr_id`],i(t.customCsrId,`customCsrId`,`text`)),t.deploy!==void 0&&o(d,[`deploy`],i(t.deploy,`deploy`,`text`)),t.geoRestrictionsLabel!==void 0&&o(d,[`geo_restrictions`,`label`],i(t.geoRestrictionsLabel,`geoRestrictionsLabel`,`text`)),t.policy!==void 0&&o(d,[`policy`],i(t.policy,`policy`,`text`)),t.privateKey!==void 0&&o(d,[`private_key`],i(t.privateKey,`privateKey`,`text`)),t.type!==void 0&&o(d,[`type`],i(t.type,`type`,`text`)),c(await u(`Creating custom certificate`,async()=>a.post(`/zones/${t.zoneId}/custom_certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created custom certificate`})}},f={command:`delete <customCertificateId>`,describe:`Remove a SSL certificate from a zone.`,builder:e=>e.positional(`customCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.customCertificateId,`customCertificateId`),e.dryRun){l({command:`cf custom-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates/${e.customCertificateId??`<customCertificateId>`}`,pathParams:{customCertificateId:String(e.customCertificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`custom certificate`,String(e.customCertificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}if(e.body){let t=s(e.body);c(await u(`Deleting custom certificate`,async()=>i.delete(`/zones/${e.zoneId}/custom_certificates/${e.customCertificateId}`,{body:t})),{successLabel:`Deleted custom certificate`});return}c(await u(`Deleting custom certificate`,async()=>i.customCertificates.delete(e.customCertificateId,o)),{successLabel:`Deleted custom certificate`})}},p={command:`edit <customCertificateId>`,describe:`Upload a new private key and/or PEM/CRT for the SSL certificate. Note: PATCHing a configuration for sni_custom certificates will result in a new resource id being returned, and the previous one being deleted.`,builder:e=>e.positional(`customCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or certificate and the intermediate(s).`}).option(`custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`deploy`,{type:`string`,description:`The environment to deploy the certificate to, defaults to production`,choices:[`staging`,`production`],default:`production`}).option(`geo-restrictions-label`,{type:`string`,description:`The geo_restrictions.label field`,choices:[`us`,`eu`,`highest_security`]}).option(`policy`,{type:`string`,description:`Specify the policy that determines the region where your private key will be held locally. HTTPS connections to any excluded data center will still be fully encrypted, but will incur some latency while Keyless SSL is used to complete the handshake with the nearest allowed data center. Any combination of countries, specified by their two letter country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) can be chosen, such as 'country: IN', as well as 'region: EU' which refers to the EU region. If there are too few data centers satisfying the policy, it will be rejected. Note: The API accepts this field as either "policy" or "policy_restrictions" in requests. Responses return this field as "policy_restrictions".`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.customCertificateId,`customCertificateId`),e.dryRun){l({command:`cf custom-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates/${e.customCertificateId??`<customCertificateId>`}`,pathParams:{customCertificateId:String(e.customCertificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{bundleMethod:e.bundleMethod,certificate:e.certificate,customCsrId:e.customCsrId,deploy:e.deploy,geoRestrictionsLabel:e.geoRestrictionsLabel,policy:e.policy,privateKey:e.privateKey,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating custom certificate`,async()=>t.patch(`/zones/${e.zoneId}/custom_certificates/${e.customCertificateId}`,{body:n})),{successLabel:`Updated custom certificate`});return}let d={};e.bundleMethod!==void 0&&o(d,[`bundle_method`],i(e.bundleMethod,`bundleMethod`,`text`)),e.certificate!==void 0&&o(d,[`certificate`],i(e.certificate,`certificate`,`text`)),e.customCsrId!==void 0&&o(d,[`custom_csr_id`],i(e.customCsrId,`customCsrId`,`text`)),e.deploy!==void 0&&o(d,[`deploy`],i(e.deploy,`deploy`,`text`)),e.geoRestrictionsLabel!==void 0&&o(d,[`geo_restrictions`,`label`],i(e.geoRestrictionsLabel,`geoRestrictionsLabel`,`text`)),e.policy!==void 0&&o(d,[`policy`],i(e.policy,`policy`,`text`)),e.privateKey!==void 0&&o(d,[`private_key`],i(e.privateKey,`privateKey`,`text`)),c(await u(`Updating custom certificate`,async()=>t.patch(`/zones/${e.zoneId}/custom_certificates/${e.customCertificateId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated custom certificate`})}},m={command:`get <customCertificateId>`,describe:`Retrieves details for a specific custom SSL certificate, including certificate metadata, bundle method, geographic restrictions, and associated keyless server configuration.`,builder:e=>e.positional(`customCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.customCertificateId,`customCertificateId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading custom certificate`,async()=>t.customCertificates.get(e.customCertificateId,i)),{successLabel:`Loaded custom certificate`})}},h={command:`list`,describe:`List, search, and filter all of your custom SSL certificates. The higher priority will break ties across overlapping 'legacy_custom' certificates, but 'legacy_custom' certificates will always supercede 'sni_custom' certificates.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of zones per page.`}).option(`match`,{type:`string`,description:`Whether to match all search requirements or at least one (any).`,choices:[`any`,`all`]}).option(`status`,{type:`string`,description:`Status of the zone's custom SSL.`,choices:[`active`,`expired`,`deleted`,`pending`,`initializing`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.match!==void 0&&(t.match=e.match),e.status!==void 0&&(t.status=e.status);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading custom certificates`,async()=>i.customCertificates.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded custom certificates`})}},g={command:`update`,describe:`If a zone has multiple SSL certificates, you can set the order in which they should be used during a request. The higher priority will break ties across overlapping 'legacy_custom' certificates.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf custom-certificates prioritize update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates/prioritize`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=s(e.body);c(await u(`Updating prioritize`,async()=>t.put(`/zones/${e.zoneId}/custom_certificates/prioritize`,{body:n})),{successLabel:`Updated prioritize`});return}c(await u(`Updating prioritize`,async()=>t.customCertificates.prioritize.update(i)),{successLabel:`Updated prioritize`})}},_={command:`prioritize`,describe:`Reorder the priority of custom SSL certificates to control which one is served first`,builder:e=>e.command(g).demandCommand(1),handler:()=>{}},v={command:`custom-certificates`,describe:`Upload and manage your own SSL/TLS certificates for a zone, with priority ordering`,builder:e=>e.command(d).command(f).command(p).command(m).command(h).command(_).demandCommand(1),handler:()=>{}};export{v as default};