cf 0.10.0 → 0.12.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 (352) hide show
  1. package/README.md +15 -5
  2. package/dist/_meta/agent-context.json +13 -5
  3. package/dist/_meta/commands.json +2393 -262
  4. package/dist/_meta/hand-written-commands.json +960 -0
  5. package/dist/_meta/schemas.json +1882 -155
  6. package/dist/{abuse-reports-CGF4zcKf.mjs → abuse-reports-D40QFl-y.mjs} +2 -2
  7. package/dist/{access-lhLJo1v2.mjs → access-Dl2IU1ID.mjs} +1 -1
  8. package/dist/account-CPbieCZ4.mjs +2 -0
  9. package/dist/{account-tags-B88TotoH.mjs → account-tags-skfP7H8k.mjs} +4 -4
  10. package/dist/{accounts-BSIAT_iP.mjs → accounts-CSgR6909.mjs} +12 -12
  11. package/dist/{acm-VULm1djv.mjs → acm-CVvCTaNk.mjs} +1 -1
  12. package/dist/{addressing-BHPBIkRY.mjs → addressing-Uq5hEDDP.mjs} +11 -11
  13. package/dist/{agent-context-KBy48G1b.mjs → agent-context-BvuDdaJb.mjs} +1 -1
  14. package/dist/agent-memory-BrHMIU0E.mjs +6 -0
  15. package/dist/ai-audit-BoZuL84i.mjs +2 -0
  16. package/dist/ai-gateway-DE50Jem1.mjs +13 -0
  17. package/dist/ai-search-Fx7NHCHB.mjs +7 -0
  18. package/dist/ai-security-DyLbY9kv.mjs +4 -0
  19. package/dist/ai-v2fP1r0s.mjs +5 -0
  20. package/dist/{alerting-Bl8OqViR.mjs → alerting-5mFZjTcD.mjs} +1 -1
  21. package/dist/analytics-BygTfozw.mjs +3 -0
  22. package/dist/analytics_engine-4L-q362P.mjs +2 -0
  23. package/dist/{api-security-4FVrD4n8.mjs → api-security-DjFsRYWx.mjs} +20 -20
  24. package/dist/argo-TzXPN7tz.mjs +2 -0
  25. package/dist/args-CDgWUP4J.mjs +2 -0
  26. package/dist/{artifacts-CVDGnr2V.mjs → artifacts-dEw2UUBV.mjs} +1 -1
  27. package/dist/audit-logs-CqY7zzwv.mjs +2 -0
  28. package/dist/auth-CPLdkOC7.mjs +5 -0
  29. package/dist/{auth-MQEamPN9.mjs → auth-DY_Y2bXC.mjs} +3 -3
  30. package/dist/billing-DHQuRT8S.mjs +3 -0
  31. package/dist/body-parser-BGVbwPeM.mjs +2 -0
  32. package/dist/bot-management-CfqG79hF.mjs +5 -0
  33. package/dist/botnet-feed-BOeNnDoH.mjs +3 -0
  34. package/dist/brand-protection-DYttrKIM.mjs +3 -0
  35. package/dist/{browser-extension-BtpCbh-2.mjs → browser-extension-CTUCdgfn.mjs} +1 -1
  36. package/dist/browser-run-373D4e1i.mjs +4 -0
  37. package/dist/build-D0ir_S70.mjs +2 -0
  38. package/dist/{cache-VyWK1SjY.mjs → cache-DJXBmc3w.mjs} +1 -1
  39. package/dist/{calls-BxoRYxs4.mjs → calls-COO0Eoz1.mjs} +1 -1
  40. package/dist/certificate-authorities-DbHLmKbd.mjs +2 -0
  41. package/dist/cf-yPz_IqW6.mjs +18 -0
  42. package/dist/chunk-LQW53VED-9MACsvSG.mjs +119 -0
  43. package/dist/chunk-QBZBEHZB-yeyhVUeD.mjs +2 -0
  44. package/dist/{client-certificates-DDUv8K0a.mjs → client-certificates-RBRqYP3f.mjs} +1 -1
  45. package/dist/{client-side-security-D4ysjwWT.mjs → client-side-security-HOmA37et.mjs} +1 -1
  46. package/dist/cloud-connector-C7hw1c1f.mjs +2 -0
  47. package/dist/cloudforce-one-DLOj76q4.mjs +36 -0
  48. package/dist/command-BV87D4tR.mjs +2 -0
  49. package/dist/{completions-BHE4pRjB.mjs → completions-BnD46cXe.mjs} +3 -3
  50. package/dist/config.d.mts +1451 -1366
  51. package/dist/config.mjs +1 -1
  52. package/dist/connector-interrupts-DY-z_LrH.mjs +2 -0
  53. package/dist/connector-telemetry-events-DCXmcAc9.mjs +2 -0
  54. package/dist/connector-telemetry-snapshots-D8GNuzx3.mjs +2 -0
  55. package/dist/{connectors-BqxYMMtQ.mjs → connectors-fEOn-J_i.mjs} +1 -1
  56. package/dist/containers-BDBsEs7-.mjs +58 -0
  57. package/dist/{content-scan-Dgd7A8KF.mjs → content-scan-Cmj9--XY.mjs} +1 -1
  58. package/dist/{csamScanner-DYL37wLc.mjs → csamScanner-BRXyMCyH.mjs} +1 -1
  59. package/dist/{ct-alerting-CkhSbfAs.mjs → ct-alerting-9AvYys-f.mjs} +1 -1
  60. package/dist/custom-certificates-C5qrlyhb.mjs +5 -0
  61. package/dist/custom-csrs-BgOnTbBW.mjs +3 -0
  62. package/dist/{custom-hostnames-q_nsnlye.mjs → custom-hostnames-CbQD9aYo.mjs} +1 -1
  63. package/dist/custom-nameservers-2ZajBkRC.mjs +3 -0
  64. package/dist/custom-pages-Buki_Cb8.mjs +3 -0
  65. package/dist/d1-n2in0cSF.mjs +20 -0
  66. package/dist/data-security-DzOQMkv3.mjs +7 -0
  67. package/dist/dcv-delegation-BTP9LCOm.mjs +2 -0
  68. package/dist/delegate.mjs +1 -1
  69. package/dist/deploy-BUSz35vq.mjs +2 -0
  70. package/dist/deploy-input-BvD9aRP1.mjs +2 -0
  71. package/dist/dev-DY_DquQx.mjs +4 -0
  72. package/dist/{diagnostics-BTH-8nJH.mjs → diagnostics-BvHV8kQb.mjs} +1 -1
  73. package/dist/{directory-BlH6N6Qy.mjs → directory-BeiSyg8A.mjs} +1 -1
  74. package/dist/{dispatch-namespaces-BCjH1JzB.mjs → dispatch-namespaces-Dp8Jjpwy.mjs} +1 -1
  75. package/dist/dist-BBx1io2f.mjs +2 -0
  76. package/dist/dist-Cb9TJ2VV.mjs +9 -0
  77. package/dist/dist-DV7LR38l.mjs +387 -0
  78. package/dist/dist-DvizctjW.mjs +48 -0
  79. package/dist/{dls-BF5iN78p.mjs → dls-BwoU29mS.mjs} +1 -1
  80. package/dist/{dns-CeCTNqRk.mjs → dns-DISAfuzj.mjs} +13 -13
  81. package/dist/{dns-firewall-B54MaLGm.mjs → dns-firewall-wBcCx_ua.mjs} +1 -1
  82. package/dist/{dot-prop-6SRZBKHT-wIVDg_fl.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
  83. package/dist/dry-run-ILZRVpnp.mjs +2 -0
  84. package/dist/durable-objects-DhDL3San.mjs +2 -0
  85. package/dist/email-auth-BROqK6-C.mjs +2 -0
  86. package/dist/email-routing-BZXHDAOO.mjs +6 -0
  87. package/dist/email-security-DVumybrk.mjs +18 -0
  88. package/dist/email-sending-CDQ3_wyz.mjs +7 -0
  89. package/dist/fieldExtractors-Cy1rxHEF.mjs +3 -0
  90. package/dist/{firewall-CBPGJ43p.mjs → firewall-C0g5X7Zd.mjs} +9 -9
  91. package/dist/flagship-fFBiZUz-.mjs +4 -0
  92. package/dist/{fraud-BIhS8pLf.mjs → fraud-CjIETOaM.mjs} +1 -1
  93. package/dist/google-tag-gateway-hPa5IHUx.mjs +2 -0
  94. package/dist/{healthchecks-FiXIk-KP.mjs → healthchecks-CoycpTf9.mjs} +1 -1
  95. package/dist/{hostnames-Bx0mykMR.mjs → hostnames-x_Yezxpr.mjs} +1 -1
  96. package/dist/{hyperdrive-C8qCabBF.mjs → hyperdrive-BlfrTwSq.mjs} +1 -1
  97. package/dist/iam-Bk7K_PPO.mjs +6 -0
  98. package/dist/images-BAEFb9q1.mjs +8 -0
  99. package/dist/index.mjs +1 -1
  100. package/dist/{intel-B-9Z_sJs.mjs → intel-DDkyJVaP.mjs} +1 -1
  101. package/dist/interactive-CRnq-B5I.mjs +11 -0
  102. package/dist/{interactive-DtsCYfrK.mjs → interactive-cytQzL94.mjs} +1 -1
  103. package/dist/ips-DU0ti0i0.mjs +2 -0
  104. package/dist/{keyless-certificates-THHvoXX3.mjs → keyless-certificates-E1P9jBTb.mjs} +1 -1
  105. package/dist/keys-DqldTZqH.mjs +2 -0
  106. package/dist/{kv-BFDUCnft.mjs → kv-CcfCfnwq.mjs} +1 -1
  107. package/dist/{leaked-credential-checks-DUlUCOoJ.mjs → leaked-credential-checks-CqmKaEbd.mjs} +1 -1
  108. package/dist/load-balancers-Dg4pDad1.mjs +6 -0
  109. package/dist/{local-D-aVNu6A.mjs → local-DGiIS1uM.mjs} +1 -1
  110. package/dist/local-runtime--IQr44qq.mjs +2 -0
  111. package/dist/logexplorer-Bu2mG5rh.mjs +17 -0
  112. package/dist/logo-matches-CWUzxY7G.mjs +2 -0
  113. package/dist/logos-BTfdkDPi.mjs +3 -0
  114. package/dist/{logpush-BK34mMQs.mjs → logpush-BZyay3h2.mjs} +1 -1
  115. package/dist/{logs-CLAqX9h2.mjs → logs-BqF7jjQO.mjs} +1 -1
  116. package/dist/{magic-cloud-networking-h_ozrC5S.mjs → magic-cloud-networking-Dhd8pTyM.mjs} +4 -4
  117. package/dist/magic-network-monitoring-D0FnkjuN.mjs +4 -0
  118. package/dist/magic-transit-B5skt0G7.mjs +111 -0
  119. package/dist/managed-transforms-B6X_crcJ.mjs +3 -0
  120. package/dist/matches-DeYaB4I0.mjs +2 -0
  121. package/dist/mcp-ChjBiMx2.mjs +4 -0
  122. package/dist/mesh-DRVAFLBX.mjs +4 -0
  123. package/dist/{moq-qmuVPAO0.mjs → moq-DE7VDEFS.mjs} +1 -1
  124. package/dist/mtls-certificates-Cbc3uAkN.mjs +3 -0
  125. package/dist/{network-D74cSy3t.mjs → network-CDPZNFbn.mjs} +1 -1
  126. package/dist/{network-interconnects-BJ0Nc48J.mjs → network-interconnects-CMRs_chR.mjs} +1 -1
  127. package/dist/oauth-DAa7SwkM.mjs +14 -0
  128. package/dist/{oauth-clients-Br-smLxQ.mjs → oauth-clients-DAI_gcuL.mjs} +1 -1
  129. package/dist/oauth-scopes-BE6xF4_h.mjs +2 -0
  130. package/dist/observability-DnyI8rPJ.mjs +4 -0
  131. package/dist/{open-PBXRGS4R-R-qesf18.mjs → open-PBXRGS4R-DIiYQyU9.mjs} +3 -3
  132. package/dist/{organization-NX7yCZrq.mjs → organization-yh0mSUdI.mjs} +6 -6
  133. package/dist/organizations-B3aU-RCG.mjs +2 -0
  134. package/dist/origin-ca-certificates-BaNWfVqf.mjs +3 -0
  135. package/dist/origin-post-quantum-encryption-CIUtQgyv.mjs +2 -0
  136. package/dist/origin-tls-client-auth-CvEpbX2Q.mjs +4 -0
  137. package/dist/{output-DrpYYfnB.mjs → output-BqDR9h74.mjs} +1 -1
  138. package/dist/page-rules-CzbyXbt6.mjs +27 -0
  139. package/dist/pages-CX8yefTI.mjs +14 -0
  140. package/dist/pay-per-crawl-v4vBOMWD.mjs +4 -0
  141. package/dist/pipelines-BZ1KGupx.mjs +6 -0
  142. package/dist/precursor-D42A9ay5.mjs +4 -0
  143. package/dist/progress-jYW64HY7.mjs +2 -0
  144. package/dist/project-settings-BN7tL0c7.mjs +3 -0
  145. package/dist/prompt-CyATfGUu.mjs +3 -0
  146. package/dist/{public-BwQqexwo-CNW_dPly.mjs → public-BMg6-Hxh-DgIH5obr.mjs} +1 -1
  147. package/dist/queries-xvETUjUE.mjs +3 -0
  148. package/dist/queues-CpqHDtxF.mjs +6 -0
  149. package/dist/{r2-data-catalog-Du7hN9jA.mjs → r2-data-catalog-DgKmlTKR.mjs} +1 -1
  150. package/dist/r2-jhmLvD1z.mjs +24 -0
  151. package/dist/radar-C2J16wpX.mjs +2 -0
  152. package/dist/{rate-limits-yBF3qoYD.mjs → rate-limits-CoH9Xma0.mjs} +1 -1
  153. package/dist/raw-fetch-CNKIypJ7.mjs +2 -0
  154. package/dist/{realtimekit-CIP7lP-a.mjs → realtimekit-CDs0Z5WW.mjs} +1 -1
  155. package/dist/registrar-BI5ewTAk.mjs +23 -0
  156. package/dist/{registrar-sandbox-DiXg8p_1.mjs → registrar-sandbox-al1znWMc.mjs} +4 -4
  157. package/dist/{registry-Bck_zFkz.mjs → registry-5-I2XLwF.mjs} +1 -1
  158. package/dist/reporting-CxsdHAH3.mjs +2 -0
  159. package/dist/request-tracers-DJJCncft.mjs +2 -0
  160. package/dist/{resource-sharing-D1pSDvtf.mjs → resource-sharing-qQGn8AEn.mjs} +1 -1
  161. package/dist/resource-tagging-aTtpX5e5.mjs +2 -0
  162. package/dist/rules-PpsDU89Q.mjs +4 -0
  163. package/dist/rulesets-DP12Aqik.mjs +5 -0
  164. package/dist/rum-DxvpzJYc.mjs +4 -0
  165. package/dist/{schema-B34Q9tLF.mjs → schema-DlLbiOJj.mjs} +1 -1
  166. package/dist/schema-flags-CTfQVGCs.mjs +5 -0
  167. package/dist/schemas-BFCBlp_W.mjs +65 -0
  168. package/dist/{scim-CcSyfKCH.mjs → scim-DJ4AVU20.mjs} +1 -1
  169. package/dist/{secrets-store-DFmvtphu.mjs → secrets-store-D6KDNo_s.mjs} +1 -1
  170. package/dist/security-center-008FMs_z.mjs +2 -0
  171. package/dist/{security-txt-DqnFpjMI.mjs → security-txt-CqcfrhlN.mjs} +1 -1
  172. package/dist/{share-BuwYUzOL.mjs → share-D5fzsVAJ.mjs} +4 -4
  173. package/dist/{deploy-input-CrvuoDGJ.mjs → shared-DlKGNPiT.mjs} +97 -99
  174. package/dist/smart-shield-DpFscIk8.mjs +4 -0
  175. package/dist/snippets-CCKgI2ZX.mjs +4 -0
  176. package/dist/spawn-C3_tJ3RB.mjs +526 -0
  177. package/dist/{spectrum-b7N1ZRAm.mjs → spectrum-LmdqY3ki.mjs} +1 -1
  178. package/dist/{speed-cw31yFva.mjs → speed-CEK36h3A.mjs} +1 -1
  179. package/dist/src-CEb2fgtT.mjs +108 -0
  180. package/dist/{ssl-CsEhRVTO.mjs → ssl-ChHUyaQm.mjs} +1 -1
  181. package/dist/startup-profile-Dpxg-MjV.mjs +17 -0
  182. package/dist/{state-Bb5Cbc_L.mjs → state-DeX23Kmg.mjs} +1 -1
  183. package/dist/{stream-DFOao6Gu.mjs → stream-DfUSELMX.mjs} +13 -13
  184. package/dist/submit-DF2G5CIz.mjs +2 -0
  185. package/dist/tags-nFJJHlLJ.mjs +2 -0
  186. package/dist/tenant-CRLw1oRU.mjs +2 -0
  187. package/dist/tenant-custom-nameservers-BvBQRDcs.mjs +3 -0
  188. package/dist/{tools-BHfBOZOU.mjs → tools-j8UGEtP1.mjs} +1 -1
  189. package/dist/{tunnel-DkMiNtVY.mjs → tunnel-CMQeBgmb.mjs} +1 -1
  190. package/dist/tunnels-iVA3MrdS.mjs +2 -0
  191. package/dist/turnstile-DQHP6-_b.mjs +23 -0
  192. package/dist/{ui-DE8CNn6c.mjs → ui-DJFcf61J.mjs} +1 -1
  193. package/dist/url-info-BVgdb_pf.mjs +2 -0
  194. package/dist/{url-normalization-ClfFiruK.mjs → url-normalization-BTcxLxIQ.mjs} +1 -1
  195. package/dist/url-scanner-DwuDZLPk.mjs +2 -0
  196. package/dist/user-I_MbB_KX.mjs +12 -0
  197. package/dist/values-S-Q7-5o8.mjs +2 -0
  198. package/dist/{vectorize-CVKu7lEt.mjs → vectorize-CNZdF_0A.mjs} +1 -1
  199. package/dist/waiting-rooms-Bo-OSsxu.mjs +11 -0
  200. package/dist/{web-assets-C2s9kzWf.mjs → web-assets-tlFzKdNL.mjs} +1 -1
  201. package/dist/web3-CdbfoZ2x.mjs +4 -0
  202. package/dist/workers-DQ9Q7czn.mjs +28 -0
  203. package/dist/{workers-builds-B55-oXOa.mjs → workers-builds-CGRhYx-x.mjs} +1 -1
  204. package/dist/{workflows-B-kGHxFu.mjs → workflows-BhEy-crm.mjs} +1 -1
  205. package/dist/zaraz-DbKvA_8C.mjs +2 -0
  206. package/dist/{zero-trust-DV3sIOvu.mjs → zero-trust-DrHCPVOc.mjs} +67 -66
  207. package/dist/zone-D2zrbJI2.mjs +2 -0
  208. package/dist/zones-DrpxQ_-A.mjs +21 -0
  209. package/package.json +12 -8
  210. package/dist/account-CYRm3yoN.mjs +0 -2
  211. package/dist/agent-memory-DDv_Gxr7.mjs +0 -6
  212. package/dist/ai-audit-BWZGvbca.mjs +0 -2
  213. package/dist/ai-gateway-jeB-sAgP.mjs +0 -13
  214. package/dist/ai-search-BmdskMjR.mjs +0 -7
  215. package/dist/ai-security-CsmfcaUx.mjs +0 -4
  216. package/dist/ai-viHB1tgI.mjs +0 -5
  217. package/dist/analytics-vOxw8Hy0.mjs +0 -3
  218. package/dist/analytics_engine-DO4-C0wD.mjs +0 -2
  219. package/dist/argo-CQfCgazW.mjs +0 -2
  220. package/dist/args-DlUhyGU0.mjs +0 -2
  221. package/dist/audit-logs-CzpwvQ6A.mjs +0 -2
  222. package/dist/auth-D0xZxAEa.mjs +0 -5
  223. package/dist/billing-aJgapeRm.mjs +0 -3
  224. package/dist/body-parser-C-c9gfH1.mjs +0 -2
  225. package/dist/bot-management-Y2q5d-pi.mjs +0 -5
  226. package/dist/botnet-feed-DANJqfmE.mjs +0 -3
  227. package/dist/brand-protection-CjpZWBjp.mjs +0 -3
  228. package/dist/browser-run-BFn9h2Tz.mjs +0 -4
  229. package/dist/build-DcflwvqN.mjs +0 -2
  230. package/dist/certificate-authorities-D7OAFxF_.mjs +0 -2
  231. package/dist/cf-C7DU4819.mjs +0 -18
  232. package/dist/chunk-LQW53VED-DLrXV-hE.mjs +0 -499
  233. package/dist/cloud-connector-Bhec6z2P.mjs +0 -2
  234. package/dist/cloudforce-one-J_hn9ss9.mjs +0 -36
  235. package/dist/connector-interrupts-Dycx8zFx.mjs +0 -2
  236. package/dist/connector-telemetry-events-BmxOSNtN.mjs +0 -2
  237. package/dist/connector-telemetry-snapshots-CdcqfKnH.mjs +0 -2
  238. package/dist/containers-CKW081JA.mjs +0 -54
  239. package/dist/custom-certificates-BzAOnEoT.mjs +0 -5
  240. package/dist/custom-csrs-CgzG3pd3.mjs +0 -3
  241. package/dist/custom-nameservers-BUBmfhUe.mjs +0 -3
  242. package/dist/custom-pages-M7jA2Hit.mjs +0 -3
  243. package/dist/d1-BFvMd6-S.mjs +0 -20
  244. package/dist/data-security-Bji4Or_j.mjs +0 -7
  245. package/dist/dcv-delegation-BuoRQ1Yh.mjs +0 -2
  246. package/dist/deploy-CZ7bgNDu.mjs +0 -2
  247. package/dist/dev-V10MG-Bg.mjs +0 -4
  248. package/dist/dist-CgrMkXFx.mjs +0 -72
  249. package/dist/durable-objects-D8FQORrL.mjs +0 -2
  250. package/dist/email-auth-DJK0Eb30.mjs +0 -2
  251. package/dist/email-routing-NpmiKIrl.mjs +0 -6
  252. package/dist/email-security-BLZ7WZ9Z.mjs +0 -18
  253. package/dist/email-sending-dn-353Nx.mjs +0 -7
  254. package/dist/fieldExtractors-ahysj57J.mjs +0 -3
  255. package/dist/flagship-BusjRNIb.mjs +0 -4
  256. package/dist/google-tag-gateway-TZZ3F1tV.mjs +0 -2
  257. package/dist/iam-Cj63Kjc6.mjs +0 -6
  258. package/dist/images-CBWXCDhy.mjs +0 -8
  259. package/dist/ips-qs9eGJnI.mjs +0 -2
  260. package/dist/keys-D7N0j4-x.mjs +0 -2
  261. package/dist/load-balancers-D2zbQ8fT.mjs +0 -6
  262. package/dist/local-runtime-Dh3keC5v.mjs +0 -2
  263. package/dist/logexplorer-CUsfZ_bS.mjs +0 -13
  264. package/dist/logo-matches-CJcthPHf.mjs +0 -2
  265. package/dist/logos-BS65zN8q.mjs +0 -3
  266. package/dist/magic-network-monitoring-C7tAPNKP.mjs +0 -4
  267. package/dist/magic-transit-BtsFePMx.mjs +0 -111
  268. package/dist/managed-transforms-Cm_KVCMB.mjs +0 -3
  269. package/dist/matches-InA1hwII.mjs +0 -2
  270. package/dist/mcp-mJ7bekNJ.mjs +0 -4
  271. package/dist/mesh-BK4S1Ezy.mjs +0 -4
  272. package/dist/mtls-certificates-CU4OAAXY.mjs +0 -3
  273. package/dist/oauth-B0ETkNcX.mjs +0 -15
  274. package/dist/oauth-scopes-D5bF11ju.mjs +0 -2
  275. package/dist/observability-BWE0Gg3V.mjs +0 -4
  276. package/dist/organizations-DLhiRt8g.mjs +0 -2
  277. package/dist/origin-ca-certificates-Ff4McZRQ.mjs +0 -3
  278. package/dist/origin-post-quantum-encryption-UuTr4_SW.mjs +0 -2
  279. package/dist/origin-tls-client-auth-DOJ1zlH3.mjs +0 -4
  280. package/dist/page-rules-BSz1gO-_.mjs +0 -18
  281. package/dist/pages-DVDogxPs.mjs +0 -14
  282. package/dist/pay-per-crawl-BrLXK7gT.mjs +0 -4
  283. package/dist/pipelines-BszRk4sM.mjs +0 -6
  284. package/dist/precursor-BPNjQr76.mjs +0 -4
  285. package/dist/progress-CsHIt3Tp.mjs +0 -2
  286. package/dist/prompt-DdegNPpg.mjs +0 -3
  287. package/dist/queries-JL1H1Biz.mjs +0 -3
  288. package/dist/queues-DpkYdRUE.mjs +0 -6
  289. package/dist/r2-CKozthw_.mjs +0 -24
  290. package/dist/radar-C-92vggG.mjs +0 -2
  291. package/dist/raw-fetch-CteyTOM2.mjs +0 -2
  292. package/dist/registrar-DKKN0M29.mjs +0 -21
  293. package/dist/reporting-fg_GKXe1.mjs +0 -2
  294. package/dist/request-tracers-CkMya96z.mjs +0 -2
  295. package/dist/resource-tagging-z48JGHCq.mjs +0 -2
  296. package/dist/rules-BTmNjDN-.mjs +0 -4
  297. package/dist/rulesets-CsoSM-17.mjs +0 -5
  298. package/dist/rum-DB4iO2q5.mjs +0 -4
  299. package/dist/schema-flags-iGoOriJt.mjs +0 -5
  300. package/dist/security-center-DFKeHq5c.mjs +0 -2
  301. package/dist/session-D6KHthHf.mjs +0 -2
  302. package/dist/shared-VppSAQf4.mjs +0 -2
  303. package/dist/smart-shield-D6X8L7p8.mjs +0 -4
  304. package/dist/snippets-DIpc9pb_.mjs +0 -4
  305. package/dist/spawn-O1RS01vr.mjs +0 -523
  306. package/dist/src-D_HETJNy.mjs +0 -108
  307. package/dist/submit--xTzyNPy.mjs +0 -2
  308. package/dist/tags-efICDkah.mjs +0 -2
  309. package/dist/tenant-CerHuToJ.mjs +0 -2
  310. package/dist/tenant-custom-nameservers-C4otMBm2.mjs +0 -3
  311. package/dist/triggers-BEsiiKAf.mjs +0 -2
  312. package/dist/tunnels-D0J8lJoI.mjs +0 -2
  313. package/dist/turnstile-CFmtY5bn.mjs +0 -23
  314. package/dist/url-info-DBCeRWwb.mjs +0 -2
  315. package/dist/url-scanner-CNyvg65L.mjs +0 -2
  316. package/dist/user-bifVEQq5.mjs +0 -12
  317. package/dist/values-OxkdP1tV.mjs +0 -2
  318. package/dist/versions-BVL-Ludh.mjs +0 -2
  319. package/dist/waiting-rooms-CmRAl51T.mjs +0 -11
  320. package/dist/web3-y_cY91V_.mjs +0 -4
  321. package/dist/workers-jDcq14GH.mjs +0 -24
  322. package/dist/zaraz-27zwjLvv.mjs +0 -2
  323. package/dist/zone-BJix2KQ9.mjs +0 -2
  324. package/dist/zones-Bkj5i92c.mjs +0 -21
  325. /package/dist/{alerts-CRmjqOZi.mjs → alerts-9PR5sQ_z.mjs} +0 -0
  326. /package/dist/{autorag-BD7cu5NU.mjs → autorag-Bevo1kIH.mjs} +0 -0
  327. /package/dist/{brands-BhALBkX2.mjs → brands-C4M04Man.mjs} +0 -0
  328. /package/dist/{chunk-6EUZQHAF-B7bSMYLe.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
  329. /package/dist/{clear-BgF8No7D.mjs → clear-DS0eRXOc.mjs} +0 -0
  330. /package/dist/{cli-types-BsTty22w.mjs → cli-types-C3nVfpSG.mjs} +0 -0
  331. /package/dist/{connector-telemetry-events-latest-BY2556uL.mjs → connector-telemetry-events-latest-CKKG6_pD.mjs} +0 -0
  332. /package/dist/{connector-telemetry-snapshots-latest-BHYdxUEF.mjs → connector-telemetry-snapshots-latest-Bv5OddJr.mjs} +0 -0
  333. /package/dist/{domain-info-C50W5GhA.mjs → domain-info-BUiaGCEq.mjs} +0 -0
  334. /package/dist/{health-BFNZqiAm.mjs → health-vX6Ml2Na.mjs} +0 -0
  335. /package/dist/{input-validation-Bav2M9F-.mjs → input-validation-1esLElok.mjs} +0 -0
  336. /package/dist/{internal-BTeSewwB.mjs → internal-ROz7anul.mjs} +0 -0
  337. /package/dist/{live-Dkiyu30_.mjs → live-CSxvigCS.mjs} +0 -0
  338. /package/dist/{metadata-8AkOftcB.mjs → metadata-DEqBUaSv.mjs} +0 -0
  339. /package/dist/{rate-limit-analytics-Dz-Wv1T0.mjs → rate-limit-analytics-CgHgKjmV.mjs} +0 -0
  340. /package/dist/{ready-TKOkKeRg.mjs → ready-6G9zVGPJ.mjs} +0 -0
  341. /package/dist/{recent-submissions-3Asm6eIi.mjs → recent-submissions-B3Smh-QM.mjs} +0 -0
  342. /package/dist/{refute-BVz9nMyd.mjs → refute-DjkmLSNe.mjs} +0 -0
  343. /package/dist/{resolve-CeBbH6Pq.mjs → resolve-DEvdeprv.mjs} +0 -0
  344. /package/dist/{scan-logo-ZteA-PUV.mjs → scan-logo-545qLcGs.mjs} +0 -0
  345. /package/dist/{scan-page-DWDSyzQ7.mjs → scan-page-DRQiVufl.mjs} +0 -0
  346. /package/dist/{search-DGNc37HK.mjs → search-CXbqFoqe.mjs} +0 -0
  347. /package/dist/{signed-url-B5Qpn2mn.mjs → signed-url-rU_nvgFA.mjs} +0 -0
  348. /package/dist/{submission-info-FjUolE6A.mjs → submission-info-D6PgXNQP.mjs} +0 -0
  349. /package/dist/{theme-CeVf-5qG.mjs → theme-CrIBazAF.mjs} +0 -0
  350. /package/dist/{total-queries-NHJj1HGq.mjs → total-queries-XkFyu8H5.mjs} +0 -0
  351. /package/dist/{tracked-domains-CniKVHIp.mjs → tracked-domains-CmcRXHj_.mjs} +0 -0
  352. /package/dist/{verify-DS1PWAJe.mjs → verify-CM1NakP0.mjs} +0 -0
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{a as r,r as i}from"./auth-MQEamPN9.mjs";import{t as a}from"./output-DrpYYfnB.mjs";import{n as o,t as s}from"./progress-CsHIt3Tp.mjs";import{n as c,r as l,t as u}from"./body-parser-C-c9gfH1.mjs";import{n as d,t as f}from"./input-validation-Bav2M9F-.mjs";import{a as p,i as m,n as h}from"./prompt-DdegNPpg.mjs";import{t as g}from"./cli-types-BsTty22w.mjs";import{n as _,t as v}from"./raw-fetch-CteyTOM2.mjs";function ee(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Binary file to be uploaded to the database.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const te={command:`create`,describe:`Uploads a binary file to Cloudforce One's binary database for malware analysis and threat intelligence correlation.`,builder:ee,handler:async c=>{if(c.dryRun){o({command:`cf cloudforce-one binary-storage create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/binary`,pathParams:{},bodyKind:`multipart`,body:{body:c.body,file:c.file}});return}let l=await i(c),u=c.local?e:await t();if(c.accountId=u,c.file!==void 0||c.body!==void 0){let e=new FormData;if(c.file){let t=f(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${u}/cloudforce-one/binary`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=d(c.body,`body`,`binary`);a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${u}/cloudforce-one/binary`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function y(e){return e.positional(`hash`,{type:`string`,description:`hash of the binary`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <hash>`,describe:`Retrieves a binary file from the Cloudforce One binary storage for analysis.`,builder:y,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one binary-storage get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/binary/${r.hash==null?`<hash>`:encodeURIComponent(String(r.hash))}`,pathParams:{hash:String(r.hash??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.binaryStorage.get({account_id:l,hash:r.hash})),{successLabel:`Loaded`})}},x={command:`binary-storage`,describe:`Upload and retrieve malware samples and suspicious binaries for analysis`,builder:e=>e.command(te).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`aggregate-by`,{type:`string`,description:`Column(s) to aggregate by - single column or comma-separated list (e.g., 'attacker', 'targetIndustry', 'attacker,targetIndustry')`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUIDs to filter by, or one standalone scope value: 'all'/'*' for all accessible non-analytics event datasets (analytics datasets are silently excluded), 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, uses the default dataset.`}).option(`start-date`,{type:`string`,description:`Start date for filtering (ISO 8601 format, e.g., '2024-01-01')`}).option(`end-date`,{type:`string`,description:`End date for filtering (ISO 8601 format, e.g., '2024-12-31')`}).option(`group-by-date`,{type:`boolean`,description:`Whether to group results by date (daily aggregation)`}).option(`limit`,{type:`number`,description:`Maximum number of results to return`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={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:S,handler:async r=>{let c={aggregateBy:r[`aggregate-by`],datasetId:r[`dataset-id`],startDate:r[`start-date`],endDate:r[`end-date`],groupByDate:r[`group-by-date`],limit:r.limit};if(r.dryRun){o({command:`cf cloudforce-one events aggregate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/aggregate`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.aggregate.get({account_id:u,...c})),{successLabel:`Loaded`})}},w={command:`aggregate`,describe:`Operations for events.aggregate`,builder:e=>e.command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get`,describe:`Lists categories`,builder:T,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events categories catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories/catalog`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.categories.catalog.get({account_id:l})),{successLabel:`Loaded`})}},D={command:`catalog`,describe:`Operations for events.categories.catalog`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`kill-chain`,{type:`number`,description:`The killChain field`}).option(`mitre-attack`,{type:`string`,array:!0,description:`The mitreAttack field`}).option(`mitre-capec`,{type:`string`,array:!0,description:`The mitreCapec field`}).option(`name`,{type:`string`,description:`The name field`}).option(`shortname`,{type:`string`,description:`The shortname field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const k={command:`create <category-id>`,describe:`Updates a category`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories/${r[`category-id`]==null?`<category-id>`:encodeURIComponent(String(r[`category-id`]))}`,pathParams:{"category-id":String(r[`category-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:d(r.name,`name`,`text`),shortname:d(r.shortname,`shortname`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.categories.create({...e,account_id:f,category_id:r[`category-id`]})),{successLabel:`Created`});return}let p=u({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:d(r.name,`name`,`text`),shortname:d(r.shortname,`shortname`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.categories.create({...p,account_id:f,category_id:r[`category-id`]})),{successLabel:`Created`})}},A={command:`categories`,describe:`Operations for events.categories`,builder:e=>e.command(k).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`attacker`,{type:`string`,description:`The attacker field`}).option(`attacker-country`,{type:`string`,description:`The attackerCountry field`}).option(`category`,{type:`string`,description:`The category field`}).option(`created-at`,{type:`string`,description:`The createdAt field`}).option(`dataset-id`,{type:`string`,description:`Dataset ID containing the event to update.`}).option(`date`,{type:`string`,description:`The date field`}).option(`event`,{type:`string`,description:`The event field`}).option(`indicator`,{type:`string`,description:`The indicator field`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`create <event-id>`,describe:`Updates an event`,builder:j,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({attacker:d(r.attacker,`attacker`,`text`),attackerCountry:d(r[`attacker-country`],`attacker-country`,`text`),category:d(r.category,`category`,`text`),createdAt:d(r[`created-at`],`created-at`,`text`),datasetId:d(r[`dataset-id`],`dataset-id`,`text`),date:d(r.date,`date`,`text`),event:d(r.event,`event`,`text`),indicator:d(r.indicator,`indicator`,`text`),indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),insight:d(r.insight,`insight`,`text`),raw:{source:d(r[`raw-source`],`raw-source`,`text`),tlp:d(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:d(r[`target-country`],`target-country`,`text`),targetIndustry:d(r[`target-industry`],`target-industry`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.create({...e,account_id:f,event_id:r[`event-id`]})),{successLabel:`Created`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await p(`dataset-id`,`Dataset ID containing the event to update.`));let m=u({attacker:d(r.attacker,`attacker`,`text`),attackerCountry:d(r[`attacker-country`],`attacker-country`,`text`),category:d(r.category,`category`,`text`),createdAt:d(r[`created-at`],`created-at`,`text`),datasetId:d(r[`dataset-id`],`dataset-id`,`text`),date:d(r.date,`date`,`text`),event:d(r.event,`event`,`text`),indicator:d(r.indicator,`indicator`,`text`),indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),insight:d(r.insight,`insight`,`text`),raw:{source:d(r[`raw-source`],`raw-source`,`text`),tlp:d(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:d(r[`target-country`],`target-country`,`text`),targetIndustry:d(r[`target-industry`],`target-industry`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.create({...m,account_id:f,event_id:r[`event-id`]})),{successLabel:`Created`})}};function N(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`keep-raw-data`,{type:`boolean`,description:`If true, copies raw data to the destination dataset. Default is false (raw data is stripped/not copied).`}).option(`dest-dataset-id`,{type:`string`,description:`The destDatasetId field`}).option(`event-ids`,{type:`string`,array:!0,description:`The eventIds field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`create <dataset-id>`,describe:`Copies specified events from one dataset to another dataset`,builder:N,handler:async r=>{let l={keepRawData:r[`keep-raw-data`]};if(r.dryRun){o({command:`cf cloudforce-one events dataset copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/copy`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},query:l,bodyKind:`json`,body:r.body===void 0?u({destDatasetId:d(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]}):c(r.body)});return}let f=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.cloudforceOne.events.dataset.copy.create({...e,account_id:m,dataset_id:r[`dataset-id`],...l})),{successLabel:`Created`});return}if(r[`dest-dataset-id`]===void 0&&(r[`dest-dataset-id`]=await p(`dest-dataset-id`,`The destDatasetId field`)),r[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h=u({destDatasetId:d(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.cloudforceOne.events.dataset.copy.create({...h,account_id:m,dataset_id:r[`dataset-id`],...l})),{successLabel:`Created`})}},F={command:`copy`,describe:`Operations for events.dataset.copy`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`is-public`,{type:`boolean`,description:`If true, then anyone can search the dataset. If false, then its limited to the account.`}).option(`name`,{type:`string`,description:`Used to describe the dataset within the account context.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`create <dataset-id>`,describe:`Updates an existing dataset`,builder:I,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({isPublic:r[`is-public`],name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.create({...e,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}if(r[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await p(`name`,`Used to describe the dataset within the account context.`));let m=u({isPublic:r[`is-public`],name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.create({...m,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}};function R(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID to delete`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const z={command:`delete <dataset-id>`,describe:`Soft-deletes a dataset given a datasetId.`,builder:R,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.delete({account_id:l,dataset_id:r[`dataset-id`]})),{successLabel:`Deleted`})}};function B(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <event-id>`,describe:`Retrieves a specific event by its UUID.`,builder:B,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"event-id":String(r[`event-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.events.get({account_id:l,dataset_id:r[`dataset-id`],event_id:r[`event-id`]})),{successLabel:`Loaded`})}},H={command:`events`,describe:`Operations for events.dataset.events`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Create a group`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.groups.create({...e,account_id:f})),{successLabel:`Created`});return}r.description===void 0&&(r.description=await p(`description`,`The description field`)),r.name===void 0&&(r.name=await p(`name`,`The name field`));let m=u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.groups.create({...m,account_id:f})),{successLabel:`Created`})}};function G(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <group-id>`,describe:`Delete a group for an account`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.groups.delete({account_id:l,group_id:r[`group-id`]})),{successLabel:`Deleted`})}};function q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`group`,describe:`List groups for an account`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups get group`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.groups.get.group({account_id:l})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`v2 <group-id>`,describe:`Read a group for an account`,builder:Y,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.groups.get.v2({account_id:l,group_id:r[`group-id`]})),{successLabel:`Loaded`})}},Z={command:`get`,describe:`Operations for events.dataset.groups.get`,builder:e=>e.command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`The accountTag field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`create <group-id>`,describe:`Create a group member`,builder:Q,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}/members`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({accountTag:d(r[`account-tag`],`account-tag`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.groups.members.create({...e,account_id:f,group_id:r[`group-id`]})),{successLabel:`Created`});return}let p=u({accountTag:d(r[`account-tag`],`account-tag`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.groups.members.create({...p,account_id:f,group_id:r[`group-id`]})),{successLabel:`Created`})}};function re(e){return e.positional(`member-id`,{type:`string`,description:`Member ID`,demandOption:!0}).option(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ie={command:`delete <member-id>`,describe:`Delete a group member`,builder:re,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}/members/${r[`member-id`]==null?`<member-id>`:encodeURIComponent(String(r[`member-id`]))}`,pathParams:{"group-id":String(r[`group-id`]??``),"member-id":String(r[`member-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
5
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.groups.members.delete({account_id:l,group_id:r[`group-id`],member_id:r[`member-id`]})),{successLabel:`Deleted`})}};function ae(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get <group-id>`,describe:`List group members`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups members get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}/members`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.groups.members.get({account_id:l,group_id:r[`group-id`]})),{successLabel:`Loaded`})}},se={command:`members`,describe:`Operations for events.dataset.groups.members`,builder:e=>e.command(ne).command(ie).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`update <group-id>`,describe:`Update a group`,builder:ce,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.groups.update({...e,account_id:f,group_id:r[`group-id`]})),{successLabel:`Updated`});return}r.description===void 0&&(r.description=await p(`description`,`The description field`)),r.name===void 0&&(r.name=await p(`name`,`The name field`));let m=u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.groups.update({...m,account_id:f,group_id:r[`group-id`]})),{successLabel:`Updated`})}},ue={command:`groups`,describe:`Operations for events.dataset.groups`,builder:e=>e.command(W).command(K).command(le).command(Z).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the indicator type`}).option(`indicator-type`,{type:`string`,description:`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`create <dataset-id>`,describe:`Creates a new indicator type and initializes its dedicated Durable Object`,builder:de,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicator types create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicatorTypes/create`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),indicatorType:d(r[`indicator-type`],`indicator-type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicator.types.create.create({...e,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}r[`indicator-type`]===void 0&&(r[`indicator-type`]=await p(`indicator-type`,`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`));let m=u({description:d(r.description,`description`,`text`),indicatorType:d(r[`indicator-type`],`indicator-type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicator.types.create.create({...m,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}},pe={command:`create`,describe:`Operations for events.dataset.indicator.types.create`,builder:e=>e.command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},me={command:`types`,describe:`Operations for events.dataset.indicator.types`,builder:e=>e.command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},he={command:`indicator`,describe:`Operations for events.dataset.indicator`,builder:e=>e.command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ge(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`auto-create-type`,{type:`boolean`,description:`Global flag to automatically create indicator types if they don't exist. Individual indicators can override this with their own autoCreateType flag.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _e={command:`create <dataset-id>`,describe:`Creates multiple indicators at once with their respective types and related datasets.`,builder:ge,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/bulk`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({autoCreateType:r[`auto-create-type`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicators.bulk.create({...e,account_id:d,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}let f=u({autoCreateType:r[`auto-create-type`]});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicators.bulk.create({...f,account_id:d,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}},ve={command:`bulk`,describe:`Operations for events.dataset.indicators.bulk`,builder:e=>e.command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`auto-create-type`,{type:`boolean`,description:`If true, automatically create the indicator type if it doesn't exist. If false (default), throw an error when the indicator type doesn't exist.`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`tlp`,{type:`string`,description:`Traffic Light Protocol designation. Case-insensitive on input, stored and returned as UPPERCASE. Allowed values: clear, green, amber, amber-strict, red, purple.`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`create <dataset-id>`,describe:`Creates a new indicator with the specified type and related datasets.`,builder:ye,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/create`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({autoCreateType:r[`auto-create-type`],indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicators.create.create({...e,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}r[`indicator-type`]===void 0&&(r[`indicator-type`]=await p(`indicator-type`,`The indicatorType field`)),r.value===void 0&&(r.value=await p(`value`,`The value field`));let m=u({autoCreateType:r[`auto-create-type`],indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicators.create.create({...m,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}},xe={command:`create`,describe:`Operations for events.dataset.indicators.create`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ce={command:`delete <indicator-id>`,describe:`Deletes a specific indicator by its UUID.`,builder:Se,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
6
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.indicators.delete({account_id:l,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Deleted`})}};function we(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`indicator <indicator-id>`,describe:`Retrieves a specific indicator by its UUID.`,builder:we,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators get indicator`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.indicators.get.indicator({account_id:l,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Loaded`})}},Ee={command:`get`,describe:`Operations for events.dataset.indicators.get`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`tlp`,{type:`string`,description:`Traffic Light Protocol designation. Case-insensitive on input, stored and returned as UPPERCASE. Allowed values: clear, green, amber, amber-strict, red, purple.`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`patch <indicator-id>`,describe:`Updates an existing indicator's properties.`,builder:De,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.indicators.patch({...e,account_id:f,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Updated`});return}let p=u({indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.indicators.patch({...p,account_id:f,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Confidence score 0–100.`}).option(`target-id`,{type:`string`,description:`UUID of the target entity.`}).option(`target-type`,{type:`string`,description:`Target type. "indicator" is not allowed (indicator↔indicator relationships are not supported).`,choices:[`event`,`tag`]}).option(`type`,{type:`string`,description:`Relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ae={command:`create <indicator-id>`,describe:`Creates a new relationship with the indicator as the source entity. Indicator↔indicator relationships are not supported.`,builder:ke,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({confidence:r.confidence,targetId:d(r[`target-id`],`target-id`,`text`),targetType:d(r[`target-type`],`target-type`,`text`),type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicators.relationships.create({...e,account_id:f,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Created`});return}r[`target-id`]===void 0&&(r[`target-id`]=await p(`target-id`,`UUID of the target entity.`)),r[`target-type`]===void 0&&(r[`target-type`]=await m(`target-type`,`Target type. "indicator" is not allowed (indicator↔indicator relationships are not supported).`,[`event`,`tag`])),r.type===void 0&&(r.type=await p(`type`,`Relationship type.`));let h=u({confidence:r.confidence,targetId:d(r[`target-id`],`target-id`,`text`),targetType:d(r[`target-type`],`target-type`,`text`),type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.indicators.relationships.create({...h,account_id:f,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Created`})}};function je(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Me={command:`delete <rel-uuid>`,describe:`Deletes a relationship by UUID. Idempotent: returns deleted=false if not found.`,builder:je,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
7
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.indicators.relationships.delete({account_id:l,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],rel_uuid:r[`rel-uuid`]})),{successLabel:`Deleted`})}};function Ne(e){return e.option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`search`,{type:`string`,description:`JSON array of {field, op, value} filters, AND-combined. Fields: entityType (other-end type), type (relationship type), confidence (0–100), metadata.<key>. Example: [{"field":"type","op":"equals","value":"appears_in"},{"field":"confidence","op":"gte","value":50}]`}).option(`expand`,{type:`string`,description:`Comma-separated entity types to hydrate (event, indicator, tag).`}).option(`cursor`,{type:`string`,description:`Keyset cursor from a previous page.`}).option(`page-size`,{type:`number`,description:`Page size (1–100, default 25).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:"Returns sparse relationship edges. Optionally hydrate related entities via `expand`.",builder:g(Ne),handler:async r=>{let c={search:r.search,expand:r.expand,cursor:r.cursor,pageSize:r[`page-size`]};if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.dataset.indicators.relationships.list({account_id:u,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],...c})),{successLabel:`Loaded`})}};function Fe(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Updated confidence. null clears it.`}).option(`type`,{type:`string`,description:`Updated relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ie={command:`update <rel-uuid>`,describe:`Partially updates a relationship by UUID. Only provided fields are changed.`,builder:Fe,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},bodyKind:`json`,body:r.body===void 0?u({confidence:r.confidence,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.indicators.relationships.update({...e,account_id:f,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],rel_uuid:r[`rel-uuid`]})),{successLabel:`Updated`});return}let p=u({confidence:r.confidence,type:d(r.type,`type`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.indicators.relationships.update({...p,account_id:f,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],rel_uuid:r[`rel-uuid`]})),{successLabel:`Updated`})}},Le={command:`relationships`,describe:`Operations for events.dataset.indicators.relationships`,builder:e=>e.command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Re(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <dataset-id>`,describe:`Returns all mirrored tags from the indicator dataset (DO mirror table). No pagination.`,builder:Re,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/tags`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.indicators.tags.get({account_id:l,dataset_id:r[`dataset-id`]})),{successLabel:`Loaded`})}},Be={command:`tags`,describe:`Operations for events.dataset.indicators.tags`,builder:e=>e.command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ve={command:`indicators`,describe:`Operations for events.dataset.indicators`,builder:e=>e.command(Ce).command(Oe).command(ve).command(xe).command(Ee).command(Le).command(Be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function He(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`keep-raw-data`,{type:`boolean`,description:`If true, copies raw data to the destination dataset. Default is false (raw data is stripped/not copied). Raw data is always deleted from the source.`}).option(`dest-dataset-id`,{type:`string`,description:`The destDatasetId field`}).option(`event-ids`,{type:`string`,array:!0,description:`The eventIds field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ue={command:`create <dataset-id>`,describe:`Moves specified events from one dataset to another dataset`,builder:He,handler:async r=>{let l={keepRawData:r[`keep-raw-data`]};if(r.dryRun){o({command:`cf cloudforce-one events dataset move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/move`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},query:l,bodyKind:`json`,body:r.body===void 0?u({destDatasetId:d(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]}):c(r.body)});return}let f=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.cloudforceOne.events.dataset.move.create({...e,account_id:m,dataset_id:r[`dataset-id`],...l})),{successLabel:`Created`});return}if(r[`dest-dataset-id`]===void 0&&(r[`dest-dataset-id`]=await p(`dest-dataset-id`,`The destDatasetId field`)),r[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h=u({destDatasetId:d(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.cloudforceOne.events.dataset.move.create({...h,account_id:m,dataset_id:r[`dataset-id`],...l})),{successLabel:`Created`})}},We={command:`move`,describe:`Operations for events.dataset.move`,builder:e=>e.command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ge(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`role`,{type:`string`,description:`The role field`,choices:[`read`,`write`]}).option(`subject-id`,{type:`string`,description:`The subjectId field`}).option(`subject-type`,{type:`string`,description:`The subjectType field`,choices:[`account`,`group`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`create <dataset-id>`,describe:`Create a permission`,builder:Ge,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset permissions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/permissions`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({role:d(r.role,`role`,`text`),subjectId:d(r[`subject-id`],`subject-id`,`text`),subjectType:d(r[`subject-type`],`subject-type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.permissions.create({...e,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}r.role===void 0&&(r.role=await m(`role`,`The role field`,[`read`,`write`])),r[`subject-id`]===void 0&&(r[`subject-id`]=await p(`subject-id`,`The subjectId field`)),r[`subject-type`]===void 0&&(r[`subject-type`]=await m(`subject-type`,`The subjectType field`,[`account`,`group`]));let h=u({role:d(r.role,`role`,`text`),subjectId:d(r[`subject-id`],`subject-id`,`text`),subjectType:d(r[`subject-type`],`subject-type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.dataset.permissions.create({...h,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}};function qe(e){return e.positional(`grant-id`,{type:`string`,description:`Grant ID`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Je={command:`delete <grant-id>`,describe:`Delete a permission`,builder:qe,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset permissions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/permissions/${r[`grant-id`]==null?`<grant-id>`:encodeURIComponent(String(r[`grant-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"grant-id":String(r[`grant-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
8
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.permissions.delete({account_id:l,dataset_id:r[`dataset-id`],grant_id:r[`grant-id`]})),{successLabel:`Deleted`})}};function Ye(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Xe={command:`get <dataset-id>`,describe:`List permissions`,builder:Ye,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset permissions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/permissions`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.permissions.get({account_id:l,dataset_id:r[`dataset-id`]})),{successLabel:`Loaded`})}};function Ze(e){return e.positional(`grant-id`,{type:`string`,description:`Grant ID`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`role`,{type:`string`,description:`The role field`,choices:[`read`,`write`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Qe={command:`update <grant-id>`,describe:`Update a permission`,builder:Ze,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset permissions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/permissions/${r[`grant-id`]==null?`<grant-id>`:encodeURIComponent(String(r[`grant-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"grant-id":String(r[`grant-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({role:d(r.role,`role`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.permissions.update({...e,account_id:f,dataset_id:r[`dataset-id`],grant_id:r[`grant-id`]})),{successLabel:`Updated`});return}r.role===void 0&&(r.role=await m(`role`,`The role field`,[`read`,`write`]));let p=u({role:d(r.role,`role`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.dataset.permissions.update({...p,account_id:f,dataset_id:r[`dataset-id`],grant_id:r[`grant-id`]})),{successLabel:`Updated`})}},$e={command:`permissions`,describe:`Operations for events.dataset.permissions`,builder:e=>e.command(Ke).command(Je).command(Xe).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to scope to (repeat the param for multiple), or one standalone scope: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. Analytics datasets do not expose tag associations, so 'analytics' returns an empty result. Omit to search all readable datasets.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-event`,{type:`string`,description:`Filter indicators by related event UUID(s). Multiple UUIDs can be provided by repeating the parameter.`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType. Multiple conditions are AND'd together. Max 10 conditions per request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const tt={command:`get <tag-uuid>`,describe:`Returns indicators associated with the provided tag UUID, with pagination. By default fans out across every indicator dataset the account can read; pass datasetIds to scope to UUIDs, analytics datasets, or operational datasets. Analytics datasets do not expose tag associations, so the analytics scope returns an empty result.`,builder:g(et),handler:async r=>{let c={datasetIds:r[`dataset-ids`],page:r.page,pageSize:r[`page-size`],indicatorType:r[`indicator-type`],relatedEvent:r[`related-event`],search:r.search};if(r.dryRun){o({command:`cf cloudforce-one events dataset tags indicators get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/indicators`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.dataset.tags.indicators.get({account_id:u,tag_uuid:r[`tag-uuid`],...c})),{successLabel:`Loaded`})}},nt={command:`indicators`,describe:`Operations for events.dataset.tags.indicators`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},rt={command:`tags`,describe:`Operations for events.dataset.tags`,builder:e=>e.command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function it(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`get <dataset-id>`,describe:`Lists all target industries for a specific dataset`,builder:it,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset target industries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/targetIndustries`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.dataset.target.industries.get({account_id:l,dataset_id:r[`dataset-id`]})),{successLabel:`Loaded`})}},ot={command:`industries`,describe:`Operations for events.dataset.target.industries`,builder:e=>e.command(at).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},st={command:`target`,describe:`Operations for events.dataset.target`,builder:e=>e.command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ct={command:`dataset`,describe:`Operations for events.dataset`,builder:e=>e.command(L).command(z).command(F).command(H).command(ue).command(he).command(Ve).command(We).command($e).command(rt).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function lt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`create`,describe:`Populate dataset-specific lookup tables from existing Events data with batch processing`,builder:lt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events datasets populate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/datasets/populate`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.cloudforceOne.events.datasets.populate.create({account_id:l})),{successLabel:`Created`})}},dt={command:`populate`,describe:`Operations for events.datasets.populate`,builder:e=>e.command(ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ft={command:`datasets`,describe:`Operations for events.datasets`,builder:e=>e.command(dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pt(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`event-ids`,{type:`string`,description:`Array of Event IDs to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const mt={command:`delete <dataset-id>`,describe:`Deletes one or more events`,builder:pt,handler:async r=>{let c={eventIds:r[`event-ids`]};if(r.dryRun){o({command:`cf cloudforce-one events delete delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/delete`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await h({force:!!r.force})){process.stderr.write(`Aborted.
9
- `);return}a(await s(`Deleting`,async()=>l.cloudforceOne.events.delete.delete({account_id:u,dataset_id:r[`dataset-id`],...c})),{successLabel:`Deleted`})}},ht={command:`delete`,describe:`Operations for events.delete`,builder:e=>e.command(mt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`ql`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:gt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events graphql create graph ql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/graphql`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.cloudforceOne.events.graphql.create.graph.ql({account_id:l})),{successLabel:`Created`})}};function vt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const yt={command:`qlv2`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:vt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events graphql create graph qlv2`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/events/graphql`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.cloudforceOne.events.graphql.create.graph.qlv2({account_id:l})),{successLabel:`Created`})}},bt={command:`graph`,describe:`Operations for events.graphql.create.graph`,builder:e=>e.command(_t).command(yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xt={command:`create`,describe:`Operations for events.graphql.create`,builder:e=>e.command(bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},St={command:`graphql`,describe:`Operations for events.graphql`,builder:e=>e.command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ct(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to query, or one standalone scope value: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, queries all accessible datasets.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const wt={command:`get`,describe:`Lists indicator types across multiple datasets`,builder:Ct,handler:async r=>{let c={datasetIds:r[`dataset-ids`]};if(r.dryRun){o({command:`cf cloudforce-one events indicator types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/indicator-types`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.indicator.types.get({account_id:u,...c})),{successLabel:`Loaded`})}},Tt={command:`types`,describe:`Operations for events.indicator.types`,builder:e=>e.command(wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Et={command:`indicator`,describe:`Operations for events.indicator`,builder:e=>e.command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Dt(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to query, or one standalone scope value: 'all'/'*' for legacy all-datasets behavior, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false 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, uuid. 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(`tag-search`,{type:`string`,description:'Structured tag-metadata filter as a JSON array of {field, op, value} objects. Operates against the per-dataset IndicatorTag mirror so you can find indicators by tag attributes (origin country, motive, sophistication, priority, etc.) without a separate Tags lookup. Common dashboard usage: drill from a country into indicators, e.g. tagSearch=[{"field":"originCountryISO","op":"in","value":["IR","CN"]}]. Country values may be passed as alpha-2, alpha-3, name, or alias (e.g. "iran"). Operators: equals, not, gt/gte/lt/lte (numeric only), contains/like/find/startsWith/endsWith (string only), in. AND-joined across entries; combined with `tags`, a matching tag must satisfy both. Max 10 entries per request, max 100 values per \'in\'. Performance notes: `originCountryISO` uses its B-tree index for equals/not/in. `priority` uses its B-tree index for numeric comparisons. Other string columns (`actorCategory`, `motive`, etc.) are case-insensitive and unindexed; current catalog size makes this a non-issue. `endsWith` and `aliasGroupNames` contains/like are leading-wildcard scans and slow on large result sets. `aliasGroupNames` matches on the JSON-encoded text, so substrings can cross alias boundaries ("apt28" also matches "apt280" when both appear in the same tag\'s alias list).'}).option(`created-after`,{type:`string`,description:`Filter indicators created on or after this date. Must use ISO 8601 format (e.g., '2024-01-15T00:00:00Z').`}).option(`created-before`,{type:`string`,description:`Filter indicators created on or before this date. Must use ISO 8601 format (e.g., '2024-12-31T23:59:59Z').`}).option(`related-events-limit`,{type:`number`,description:`Limit the number of related events returned per indicator. Default: 2. Set to 0 for none, -1 for all events.`}).option(`include-tags`,{type:`boolean`,description:`Whether to include full tag details for each indicator. Defaults to true.`}).option(`include-total-count`,{type:`boolean`,description:`Whether to compute total count via COUNT(*). Defaults to false for performance. total_count is null unless this is true and the complete fan-out succeeds.`}).option(`format`,{type:`string`,description:`Output format for indicator data. 'json' returns the default format, 'stix2' returns STIX 2.1 Indicator SDOs, 'taxii' returns a TAXII 2.1 Envelope with Content-Type application/taxii+json;version=2.1.`,choices:[`json`,`stix2`,`taxii`]}).option(`cache`,{type:`string`,description:"Cache strategy. 'from-graph' serves results from the graph-node KV cache when all requested UUIDs are cached; falls back to normal path on partial/zero hit. Cannot be combined with `cursor`.",choices:[`from-graph`]}).option(`cursor`,{type:`string`,description:"Opaque cursor from a previous response's `pagination.cursor`. When provided, all filters, datasetIds, page, `pageSize`, `includeTags` and `relatedEventsLimit` come from the cursor — do not resend them. Sending any filter, `page`, `pageSize`, `includeTags`, `relatedEventsLimit`, `includeTotalCount=true`, or `cache=from-graph` alongside a cursor yields a 400 `CursorFilterConflictError`. A cursor issued for a different entity, an unsupported version, or a dataset that has since been reconfigured as analytics-only yields a 400 `InvalidCursorError`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ot={command:`get`,describe:`Retrieves indicators across specified datasets, ordered by createdAt descending then UUID, dataset ID, and shard ID ascending. Use the standalone datasetIds value 'all'/'*' for legacy all-datasets behavior, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If no datasetIds are provided, uses the default dataset.`,builder:g(Dt),handler:async r=>{let c={datasetIds:r[`dataset-ids`],page:r.page,pageSize:r[`page-size`],search:r.search,name:r.name,indicatorType:r[`indicator-type`],relatedEvents:r[`related-events`],tags:r.tags,tagSearch:r[`tag-search`],createdAfter:r[`created-after`],createdBefore:r[`created-before`],relatedEventsLimit:r[`related-events-limit`],includeTags:r[`include-tags`],includeTotalCount:r[`include-total-count`],format:r.format,cache:r.cache,cursor:r.cursor};if(r.dryRun){o({command:`cf cloudforce-one events indicators get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/indicators`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.indicators.get({account_id:u,...c})),{successLabel:`Loaded`})}},kt={command:`indicators`,describe:`Operations for events.indicators`,builder:e=>e.command(Ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function At(e){return e.option(`alert-enabled`,{type:`boolean`,description:`Enable alerts for this query`}).option(`alert-rollup-enabled`,{type:`boolean`,description:`Enable alert rollup for this query`}).option(`name`,{type:`string`,description:`Unique name for the saved query`}).option(`query-json`,{type:`string`,description:`JSON string containing the query parameters`}).option(`rule-enabled`,{type:`boolean`,description:`Enable rule for this query`}).option(`rule-scope`,{type:`string`,description:`Scope for the rule`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const jt={command:`create-create`,describe:`Create a new saved event query for the account`,builder:At,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events queries create-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/queries/create`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:d(r.name,`name`,`text`),query_json:d(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:d(r[`rule-scope`],`rule-scope`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.queries.createCreate({...e,account_id:f})),{successLabel:`Created`});return}if(r[`alert-enabled`]===void 0)throw Error(`--alert-enabled is required (or pass --body with this field set).`);if(r[`alert-rollup-enabled`]===void 0)throw Error(`--alert-rollup-enabled is required (or pass --body with this field set).`);if(r.name===void 0&&(r.name=await p(`name`,`Unique name for the saved query`)),r[`query-json`]===void 0&&(r[`query-json`]=await p(`query-json`,`JSON string containing the query parameters`)),r[`rule-enabled`]===void 0)throw Error(`--rule-enabled is required (or pass --body with this field set).`);let m=u({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:d(r.name,`name`,`text`),query_json:d(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:d(r[`rule-scope`],`rule-scope`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.queries.createCreate({...m,account_id:f})),{successLabel:`Created`})}};function Mt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`alert-enabled`,{type:`boolean`,description:`Enable alerts for this query`}).option(`alert-rollup-enabled`,{type:`boolean`,description:`Enable alert rollup for this query`}).option(`name`,{type:`string`,description:`Unique name for the saved query`}).option(`query-json`,{type:`string`,description:`JSON string containing the query parameters`}).option(`rule-enabled`,{type:`boolean`,description:`Enable rule for this query`}).option(`rule-scope`,{type:`string`,description:`Scope for the rule`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Nt={command:`create <query-id>`,describe:`Update an existing saved event query by its ID`,builder:Mt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events queries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/queries/${r[`query-id`]==null?`<query-id>`:encodeURIComponent(String(r[`query-id`]))}`,pathParams:{"query-id":String(r[`query-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:d(r.name,`name`,`text`),query_json:d(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:d(r[`rule-scope`],`rule-scope`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.queries.create({...e,account_id:f,query_id:r[`query-id`]})),{successLabel:`Created`});return}let p=u({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:d(r.name,`name`,`text`),query_json:d(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:d(r[`rule-scope`],`rule-scope`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.queries.create({...p,account_id:f,query_id:r[`query-id`]})),{successLabel:`Created`})}};function Pt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ft={command:`delete <query-id>`,describe:`Delete a saved event query by its ID`,builder:Pt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events queries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/queries/${r[`query-id`]==null?`<query-id>`:encodeURIComponent(String(r[`query-id`]))}`,pathParams:{"query-id":String(r[`query-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
10
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.queries.delete({account_id:l,query_id:r[`query-id`]})),{successLabel:`Deleted`})}};function It(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Lt={command:`event`,describe:`Retrieve all saved event queries for the account`,builder:It,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events queries get event`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/queries`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.queries.get.event({account_id:l})),{successLabel:`Loaded`})}};function Rt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zt={command:`v2 <query-id>`,describe:`Retrieve a saved event query by its ID`,builder:Rt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events queries get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/queries/${r[`query-id`]==null?`<query-id>`:encodeURIComponent(String(r[`query-id`]))}`,pathParams:{"query-id":String(r[`query-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.queries.get.v2({account_id:l,query_id:r[`query-id`]})),{successLabel:`Loaded`})}},Bt={command:`get`,describe:`Operations for events.queries.get`,builder:e=>e.command(Lt).command(zt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Vt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`alert-enabled`,{type:`boolean`,description:`Enable alerts for this query`}).option(`alert-rollup-enabled`,{type:`boolean`,description:`Enable alert rollup for this query`}).option(`name`,{type:`string`,description:`Unique name for the saved query`}).option(`query-json`,{type:`string`,description:`JSON string containing the query parameters`}).option(`rule-enabled`,{type:`boolean`,description:`Enable rule for this query`}).option(`rule-scope`,{type:`string`,description:`Scope for the rule`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ht={command:`patch <query-id>`,describe:`Update an existing saved event query by its ID`,builder:Vt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events queries patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/queries/${r[`query-id`]==null?`<query-id>`:encodeURIComponent(String(r[`query-id`]))}`,pathParams:{"query-id":String(r[`query-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:d(r.name,`name`,`text`),query_json:d(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:d(r[`rule-scope`],`rule-scope`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.queries.patch({...e,account_id:f,query_id:r[`query-id`]})),{successLabel:`Updated`});return}let p=u({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:d(r.name,`name`,`text`),query_json:d(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:d(r[`rule-scope`],`rule-scope`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.queries.patch({...p,account_id:f,query_id:r[`query-id`]})),{successLabel:`Updated`})}},Ut={command:`queries`,describe:`Operations for events.queries`,builder:e=>e.command(Nt).command(jt).command(Ft).command(Ht).command(Bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Wt(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`source`,{type:`string`,description:`The source field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Gt={command:`create <raw-id>`,describe:`Updates a raw event`,builder:Wt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events raw create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}/raw/${r[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(r[`raw-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``),"raw-id":String(r[`raw-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({source:d(r.source,`source`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.raw.create({...e,account_id:f,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Created`});return}let p=u({source:d(r.source,`source`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.raw.create({...p,account_id:f,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Created`})}},Kt={command:`raw`,describe:`Operations for events.raw`,builder:e=>e.command(Gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qt(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`events`,{type:`string`,array:!0,description:`The events field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Jt={command:`create <event-id>`,describe:`Creates event references for a event`,builder:qt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events relate create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/relate/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}/create`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({events:r.events}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.relate.create.create({...e,account_id:d,event_id:r[`event-id`]})),{successLabel:`Created`});return}if(r.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let f=u({events:r.events});a(await s(`Creating`,async()=>l.cloudforceOne.events.relate.create.create({...f,account_id:d,event_id:r[`event-id`]})),{successLabel:`Created`})}},Yt={command:`create`,describe:`Operations for events.relate.create`,builder:e=>e.command(Jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Xt={command:`relate`,describe:`Operations for events.relate`,builder:e=>e.command(Yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zt(e){return e.option(`child-ids`,{type:`string`,array:!0,description:`Array of UUIDs for child events. Single child = 1:1 relationship, multiple = 1:many relationships`}).option(`dataset-id`,{type:`string`,description:`Dataset identifier where the events are stored`}).option(`parent-id`,{type:`string`,description:`UUID of the parent event that will be the source of the relationship`}).option(`relationship-type`,{type:`string`,description:`Type of relationship to create between parent and child events`,choices:[`related_to`,`caused_by`,`attributed_to`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Qt={command:`create`,describe:`Creates a directed relationship between two events. The relationship is from parent to child with a specified type.`,builder:Zt,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events relationships create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/relationships/create`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({childIds:r[`child-ids`],datasetId:d(r[`dataset-id`],`dataset-id`,`text`),parentId:d(r[`parent-id`],`parent-id`,`text`),relationshipType:d(r[`relationship-type`],`relationship-type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.relationships.create.create({...e,account_id:f})),{successLabel:`Created`});return}if(r[`child-ids`]===void 0)throw Error(`--child-ids is required (or pass --body with this field set).`);r[`dataset-id`]===void 0&&(r[`dataset-id`]=await p(`dataset-id`,`Dataset identifier where the events are stored`)),r[`parent-id`]===void 0&&(r[`parent-id`]=await p(`parent-id`,`UUID of the parent event that will be the source of the relationship`)),r[`relationship-type`]===void 0&&(r[`relationship-type`]=await m(`relationship-type`,`Type of relationship to create between parent and child events`,[`related_to`,`caused_by`,`attributed_to`]));let h=u({childIds:r[`child-ids`],datasetId:d(r[`dataset-id`],`dataset-id`,`text`),parentId:d(r[`parent-id`],`parent-id`,`text`),relationshipType:d(r[`relationship-type`],`relationship-type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.relationships.create.create({...h,account_id:f})),{successLabel:`Created`})}},$t={command:`create`,describe:`Operations for events.relationships.create`,builder:e=>e.command(Qt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function en(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`direction`,{type:`string`,description:`The direction to traverse the graph. Defaults to 'both' to search all.`,choices:[`ancestors`,`descendants`,`both`]}).option(`max-depth`,{type:`number`,description:`The maximum depth to traverse. Defaults to 5.`}).option(`relationship-types`,{type:`string`,description:`An optional array of relationship types to filter by.`}).option(`indicator-type-ids`,{type:`string`,description:`An optional array of indicator type IDs to filter the results by.`}).option(`dataset-id`,{type:`string`,description:`The dataset ID to search within.`,demandOption:!0}).option(`include-parent`,{type:`boolean`,description:`Whether to include the starting event in the results. Defaults to true.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const tn={command:`get <event-id>`,describe:"The `event_id` must be defined (to list existing events (and their IDs), use the [`Filter and List Events`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/methods/list/) endpoint). Also, must provide query parameters.",builder:g(en),handler:async r=>{let c={direction:r.direction,maxDepth:r[`max-depth`],relationshipTypes:r[`relationship-types`],indicatorTypeIds:r[`indicator-type-ids`],datasetId:r[`dataset-id`],includeParent:r[`include-parent`],page:r.page,pageSize:r[`page-size`]};if(r.dryRun){o({command:`cf cloudforce-one events relationships get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}/relationships`,pathParams:{"event-id":String(r[`event-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.relationships.get({account_id:u,event_id:r[`event-id`],...c})),{successLabel:`Loaded`})}},nn={command:`relationships`,describe:`Operations for events.relationships`,builder:e=>e.command(tn).command($t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rn(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const an={command:`create`,describe:`Creates a new Source-of-Truth tag category for an account.`,builder:rn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags categories create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/categories/create`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.tags.categories.create.create({...e,account_id:f})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await p(`name`,`The name field`));let m=u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.tags.categories.create.create({...m,account_id:f})),{successLabel:`Created`})}},on={command:`create`,describe:`Operations for events.tags.categories.create`,builder:e=>e.command(an).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function sn(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const cn={command:`delete <category-uuid>`,describe:`Deletes a Source-of-Truth tag category by UUID.`,builder:sn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/categories/${r[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(r[`category-uuid`]))}`,pathParams:{"category-uuid":String(r[`category-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
11
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.tags.categories.delete({account_id:l,category_uuid:r[`category-uuid`]})),{successLabel:`Deleted`})}};function ln(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const un={command:`get-by-id <category-uuid>`,describe:`Returns a single Source-of-Truth tag category by UUID, including its full schema.`,builder:ln,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags categories get-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/categories/${r[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(r[`category-uuid`]))}`,pathParams:{"category-uuid":String(r[`category-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.tags.categories.getById({account_id:l,category_uuid:r[`category-uuid`]})),{successLabel:`Loaded`})}};function dn(e){return e.option(`search`,{type:`string`,description:`Search`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fn={command:`get`,describe:`Returns all Source-of-Truth tag categories for an account.`,builder:dn,handler:async r=>{let c={search:r.search};if(r.dryRun){o({command:`cf cloudforce-one events tags categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/categories`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.tags.categories.get({account_id:u,...c})),{successLabel:`Loaded`})}};function pn(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const mn={command:`patch <category-uuid>`,describe:`Updates a Source-of-Truth tag category by UUID.`,builder:pn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags categories patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/categories/${r[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(r[`category-uuid`]))}`,pathParams:{"category-uuid":String(r[`category-uuid`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.tags.categories.patch({...e,account_id:f,category_uuid:r[`category-uuid`]})),{successLabel:`Updated`});return}let p=u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.tags.categories.patch({...p,account_id:f,category_uuid:r[`category-uuid`]})),{successLabel:`Updated`})}},hn={command:`categories`,describe:`Operations for events.tags.categories`,builder:e=>e.command(cn).command(fn).command(un).command(mn).command(on).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _n={command:`delete <tag-uuid>`,describe:`Deletes a Source-of-Truth tag by UUID.`,builder:gn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
12
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.tags.delete({account_id:l,tag_uuid:r[`tag-uuid`]})),{successLabel:`Deleted`})}};function vn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const yn={command:`get-by-id <tag-uuid>`,describe:`Returns a single Source-of-Truth tag by UUID, including custom fields (properties).`,builder:vn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags get-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.tags.getById({account_id:l,tag_uuid:r[`tag-uuid`]})),{successLabel:`Loaded`})}};function bn(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:"Free-text substring match on tag value AND custom-field properties. Searches case-insensitively inside both `Tag.value` and the serialized `Tag.properties` JSON blob (keys, values, and annotation metadata like confidence/tlp are all searchable). Same serialized-text tradeoff as `aliasGroupNames` — substrings can cross JSON boundaries."}).option(`category-uuid`,{type:`string`,description:`CategoryUuid`}).option(`filters`,{type:`string`,description:'Structured filters as a JSON array of {field, op, value} objects. Searchable fields: uuid, value, categoryName, description, dateOfDiscovery, tlp, confidence, actorCategory, motive, attributionOrganization, originCountryISO, aliases, externalReferences, opsecLevel, sophisticationLevel, activeDuration, priority, lastSeen, aliasGroupNames. Operators: equals, not, contains, startsWith, endsWith, gt, lt, gte, lte, like, in, find. Use \'in\' for bulk OR within a single field, e.g. filters=[{"field":"originCountryISO","op":"in","value":["IR","CN"]}]. Multiple entries are AND-joined. Max 10 entries per request, max 100 values per \'in\'. Per-field notes: `uuid` accepts only \'equals\' and \'in\' (other operators throw ValidationError) — matched against the canonical lowercase storage but callers may pass either case (the server lowercases before comparison); index-backed by the column\'s UNIQUE constraint and intended for batched UUID → tag resolution. `originCountryISO` uses its B-tree index for equals/not/in. `priority` uses its B-tree index for numeric comparisons. Other string columns (`actorCategory`, `motive`, etc.) are case-insensitive and unindexed; current catalog size makes this a non-issue. `endsWith` and `aliasGroupNames` contains/like are leading-wildcard scans and slow on large result sets. `aliasGroupNames` matches on the JSON-encoded text, so substrings can cross alias boundaries (a search for "apt28" will also match "apt280" if both appear in the same tag\'s alias list).'}).option(`cache`,{type:`string`,description:`Cache strategy. 'from-graph' serves results from the graph-node KV cache when all requested UUIDs are cached; falls back to normal path on partial/zero hit.`,choices:[`from-graph`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xn={command:`get`,describe:"Returns all Source-of-Truth tags for an account. Supports legacy free-text `search` on tag value and `categoryUuid` exact match, plus a structured `filters` JSON array for filtering by metadata fields (originCountryISO, actorCategory, motive, priority, etc.). Country values may be passed as alpha-2, alpha-3, name, or common alias.",builder:g(bn),handler:async r=>{let c={page:r.page,pageSize:r[`page-size`],search:r.search,categoryUuid:r[`category-uuid`],filters:r.filters,cache:r.cache};if(r.dryRun){o({command:`cf cloudforce-one events tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.tags.get({account_id:u,...c})),{successLabel:`Loaded`})}};function Sn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).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(`category-uuid`,{type:`string`,description:"Tag type (category) UUID. When changed, existing `properties` are re-validated against the new category's schema (400 on mismatch). Set to null to unlink (typeless; properties stop being validated)."}).option(`confidence`,{type:`number`,description:`Overall tag confidence (1-10). Omit to preserve existing.`}).option(`date-of-discovery`,{type:`string`,description:`Date of discovery (ISO YYYY-MM-DD). Omit to preserve existing.`}).option(`description`,{type:`string`,description:`The description field`}).option(`external-reference-links`,{type:`string`,array:!0,description:`The externalReferenceLinks field`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`last-seen`,{type:`string`,description:`The lastSeen field`}).option(`tlp`,{type:`string`,description:`Tag-level TLP marking. Omit to preserve existing. Cannot be cleared to null.`,choices:[`red`,`amber`,`amber-strict`,`green`,`clear`,`purple`,`amber+strict`]}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Cn={command:`patch <tag-uuid>`,describe:`Updates a Source-of-Truth tag by UUID.`,builder:Sn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},bodyKind:`json`,body:r.body===void 0?u({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],categoryUuid:d(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:d(r[`date-of-discovery`],`date-of-discovery`,`text`),description:d(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],internalDescription:d(r[`internal-description`],`internal-description`,`text`),lastSeen:d(r[`last-seen`],`last-seen`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.tags.patch({...e,account_id:f,tag_uuid:r[`tag-uuid`]})),{successLabel:`Updated`});return}let p=u({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],categoryUuid:d(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:d(r[`date-of-discovery`],`date-of-discovery`,`text`),description:d(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],internalDescription:d(r[`internal-description`],`internal-description`,`text`),lastSeen:d(r[`last-seen`],`last-seen`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.events.tags.patch({...p,account_id:f,tag_uuid:r[`tag-uuid`]})),{successLabel:`Updated`})}};function wn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Confidence score 0–100.`}).option(`dataset-id`,{type:`string`,description:`Dataset UUID where the relationship row will be stored (locates the Indicators DO).`}).option(`target-id`,{type:`string`,description:`UUID of the target entity.`}).option(`target-type`,{type:`string`,description:`Target type. "tag" is not allowed (tag↔tag relationships are not supported).`,choices:[`event`,`indicator`]}).option(`type`,{type:`string`,description:`Relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Tn={command:`create <tag-uuid>`,describe:`Creates a new relationship with the tag as the source entity. Requires a datasetId to locate the Indicators DO.`,builder:wn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags relationships create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},bodyKind:`json`,body:r.body===void 0?u({confidence:r.confidence,datasetId:d(r[`dataset-id`],`dataset-id`,`text`),targetId:d(r[`target-id`],`target-id`,`text`),targetType:d(r[`target-type`],`target-type`,`text`),type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.events.tags.relationships.create({...e,account_id:f,tag_uuid:r[`tag-uuid`]})),{successLabel:`Created`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await p(`dataset-id`,`Dataset UUID where the relationship row will be stored (locates the Indicators DO).`)),r[`target-id`]===void 0&&(r[`target-id`]=await p(`target-id`,`UUID of the target entity.`)),r[`target-type`]===void 0&&(r[`target-type`]=await m(`target-type`,`Target type. "tag" is not allowed (tag↔tag relationships are not supported).`,[`event`,`indicator`])),r.type===void 0&&(r.type=await p(`type`,`Relationship type.`));let h=u({confidence:r.confidence,datasetId:d(r[`dataset-id`],`dataset-id`,`text`),targetId:d(r[`target-id`],`target-id`,`text`),targetType:d(r[`target-type`],`target-type`,`text`),type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.events.tags.relationships.create({...h,account_id:f,tag_uuid:r[`tag-uuid`]})),{successLabel:`Created`})}};function En(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID containing the relationship.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Dn={command:`delete <rel-uuid>`,describe:`Deletes a relationship by UUID. Idempotent: returns deleted=false if not found. Requires datasetId query param.`,builder:En,handler:async r=>{let c={datasetId:r[`dataset-id`]};if(r.dryRun){o({command:`cf cloudforce-one events tags relationships delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await h({force:!!r.force})){process.stderr.write(`Aborted.
13
- `);return}a(await s(`Deleting`,async()=>l.cloudforceOne.events.tags.relationships.delete({account_id:u,tag_uuid:r[`tag-uuid`],rel_uuid:r[`rel-uuid`],...c})),{successLabel:`Deleted`})}};function On(e){return e.option(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`datasets`,{type:`string`,description:`Comma-separated dataset UUIDs to scope to, or one standalone scope: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. Analytics datasets do not expose tag associations, so 'analytics' returns an empty result. Omit for all.`}).option(`search`,{type:`string`,description:`JSON array of {field, op, value} filters (same as indicator list search).`}).option(`expand`,{type:`string`,description:`Comma-separated entity types to hydrate (event, indicator, tag).`}).option(`cursor`,{type:`string`,description:`Offset cursor from a previous page.`}).option(`page-size`,{type:`number`,description:`Page size (1–100, default 25).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kn={command:`list`,describe:"Returns sparse relationship edges. Optionally hydrate related entities via `expand`. Fans out across all accessible indicator dataset shards. Analytics datasets do not expose tag associations, so the analytics scope returns an empty result.",builder:g(On),handler:async r=>{let c={datasets:r.datasets,search:r.search,expand:r.expand,cursor:r.cursor,pageSize:r[`page-size`]};if(r.dryRun){o({command:`cf cloudforce-one events tags relationships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.tags.relationships.list({account_id:u,tag_uuid:r[`tag-uuid`],...c})),{successLabel:`Loaded`})}};function An(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID containing the relationship.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Updated confidence. null clears it.`}).option(`type`,{type:`string`,description:`Updated relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const jn={command:`update <rel-uuid>`,describe:`Partially updates a relationship by UUID. Requires datasetId query param.`,builder:An,handler:async r=>{let l={datasetId:r[`dataset-id`]};if(r.dryRun){o({command:`cf cloudforce-one events tags relationships update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},query:l,bodyKind:`json`,body:r.body===void 0?u({confidence:r.confidence,type:d(r.type,`type`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.cloudforceOne.events.tags.relationships.update({...e,account_id:p,tag_uuid:r[`tag-uuid`],rel_uuid:r[`rel-uuid`],...l})),{successLabel:`Updated`});return}let m=u({confidence:r.confidence,type:d(r.type,`type`,`text`)});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.cloudforceOne.events.tags.relationships.update({...m,account_id:p,tag_uuid:r[`tag-uuid`],rel_uuid:r[`rel-uuid`],...l})),{successLabel:`Updated`})}},Mn={command:`relationships`,describe:`Operations for events.tags.relationships`,builder:e=>e.command(Tn).command(Dn).command(kn).command(jn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Nn={command:`tags`,describe:`Operations for events.tags`,builder:e=>e.command(_n).command(xn).command(yn).command(Cn).command(hn).command(Mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fn={command:`get`,describe:`Lists all target industries from industry map catalog`,builder:Pn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events target industries catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/targetIndustries/catalog`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.target.industries.catalog.get({account_id:l})),{successLabel:`Loaded`})}},In={command:`catalog`,describe:`Operations for events.target.industries.catalog`,builder:e=>e.command(Fn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ln={command:`industries`,describe:`Operations for events.target.industries`,builder:e=>e.command(In).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Rn={command:`target`,describe:`Operations for events.target`,builder:e=>e.command(Ln).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function zn(e){return e.option(`dataset-id`,{type:`string`,description:`Dataset ID containing the events to update. Required to prevent cross-account modifications.`}).option(`event-ids`,{type:`string`,array:!0,description:`List of event UUIDs to update (1-100)`}).option(`updates-attacker`,{type:`string`,description:`The updates.attacker field`}).option(`updates-attacker-country`,{type:`string`,description:`The updates.attackerCountry field`}).option(`updates-category`,{type:`string`,description:`The updates.category field`}).option(`updates-created-at`,{type:`string`,description:`The updates.createdAt field`}).option(`updates-event`,{type:`string`,description:`The updates.event field`}).option(`updates-indicator`,{type:`string`,description:`The updates.indicator field`}).option(`updates-indicator-type`,{type:`string`,description:`The updates.indicatorType field`}).option(`updates-insight`,{type:`string`,description:`The updates.insight field`}).option(`updates-raw-source`,{type:`string`,description:`The updates.raw.source field`}).option(`updates-raw-tlp`,{type:`string`,description:`The updates.raw.tlp field`}).option(`updates-target-country`,{type:`string`,description:`The updates.targetCountry field`}).option(`updates-target-industry`,{type:`string`,description:`The updates.targetIndustry field`}).option(`updates-tlp`,{type:`string`,description:`The updates.tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Bn={command:`patch`,describe:`Updates multiple events with the same field values. Maximum 100 events per request.`,builder:zn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events update bulk patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/update/bulk`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({datasetId:d(r[`dataset-id`],`dataset-id`,`text`),eventIds:r[`event-ids`],updates:{attacker:d(r[`updates-attacker`],`updates-attacker`,`text`),attackerCountry:d(r[`updates-attacker-country`],`updates-attacker-country`,`text`),category:d(r[`updates-category`],`updates-category`,`text`),createdAt:d(r[`updates-created-at`],`updates-created-at`,`text`),event:d(r[`updates-event`],`updates-event`,`text`),indicator:d(r[`updates-indicator`],`updates-indicator`,`text`),indicatorType:d(r[`updates-indicator-type`],`updates-indicator-type`,`text`),insight:d(r[`updates-insight`],`updates-insight`,`text`),raw:{source:d(r[`updates-raw-source`],`updates-raw-source`,`text`),tlp:d(r[`updates-raw-tlp`],`updates-raw-tlp`,`text`)},targetCountry:d(r[`updates-target-country`],`updates-target-country`,`text`),targetIndustry:d(r[`updates-target-industry`],`updates-target-industry`,`text`),tlp:d(r[`updates-tlp`],`updates-tlp`,`text`)}}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.events.update.bulk.patch({...e,account_id:f})),{successLabel:`Updated`});return}if(r[`dataset-id`]===void 0&&(r[`dataset-id`]=await p(`dataset-id`,`Dataset ID containing the events to update. Required to prevent cross-account modifications.`)),r[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let m=u({datasetId:d(r[`dataset-id`],`dataset-id`,`text`),eventIds:r[`event-ids`],updates:{attacker:d(r[`updates-attacker`],`updates-attacker`,`text`),attackerCountry:d(r[`updates-attacker-country`],`updates-attacker-country`,`text`),category:d(r[`updates-category`],`updates-category`,`text`),createdAt:d(r[`updates-created-at`],`updates-created-at`,`text`),event:d(r[`updates-event`],`updates-event`,`text`),indicator:d(r[`updates-indicator`],`updates-indicator`,`text`),indicatorType:d(r[`updates-indicator-type`],`updates-indicator-type`,`text`),insight:d(r[`updates-insight`],`updates-insight`,`text`),raw:{source:d(r[`updates-raw-source`],`updates-raw-source`,`text`),tlp:d(r[`updates-raw-tlp`],`updates-raw-tlp`,`text`)},targetCountry:d(r[`updates-target-country`],`updates-target-country`,`text`),targetIndustry:d(r[`updates-target-industry`],`updates-target-industry`,`text`),tlp:d(r[`updates-tlp`],`updates-tlp`,`text`)}});a(await s(`Updating`,async()=>l.cloudforceOne.events.update.bulk.patch({...m,account_id:f})),{successLabel:`Updated`})}},Vn={command:`bulk`,describe:`Operations for events.update.bulk`,builder:e=>e.command(Bn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Hn={command:`update`,describe:`Operations for events.update`,builder:e=>e.command(Vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Un={command:`events`,describe:`Operations for events`,builder:e=>e.command(M).command(w).command(A).command(ct).command(ft).command(ht).command(St).command(Et).command(kt).command(Ut).command(Kt).command(Xt).command(nn).command(Nn).command(Rn).command(Hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Wn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`source`,{type:`string`,description:`Asset file to upload.`})}const Gn={command:`create <request-id>`,describe:`Uploads a new asset to a Cloudforce One intelligence request.`,builder:Wn,handler:async c=>{if(c.dryRun){o({command:`cf cloudforce-one requests asset-new create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${c[`request-id`]==null?`<request-id>`:encodeURIComponent(String(c[`request-id`]))}/asset/new`,pathParams:{"request-id":String(c[`request-id`]??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file,source:c.source}});return}let l=await i(c),u=c.local?e:await t();if(c.accountId=u,c.file!==void 0||c.body!==void 0||c.source!==void 0){let e=new FormData;if(c.file){let t=f(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);c.source!==void 0&&e.append(`source`,String(d(c.source,`source`,`text`)??``)),a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${u}/cloudforce-one/requests/${encodeURIComponent(String(c[`request-id`]))}/asset/new`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=d(c.body,`body`,`binary`);a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${u}/cloudforce-one/requests/${encodeURIComponent(String(c[`request-id`]))}/asset/new`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>l.cloudforceOne.requests.assetNew.create({account_id:u,request_id:c[`request-id`]})),{successLabel:`Created`})}},Kn={command:`asset-new`,describe:`Operations for requests.asset-new`,builder:e=>e.command(Gn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Jn={command:`create <request-id>`,describe:`Lists assets attached to a Cloudforce One intelligence request.`,builder:qn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests assets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/asset`,pathParams:{"request-id":String(r[`request-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({page:r.page,per_page:r[`per-page`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.assets.create({...e,account_id:d,request_id:r[`request-id`]})),{successLabel:`Created`});return}if(r.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(r[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let f=u({page:r.page,per_page:r[`per-page`]});a(await s(`Creating`,async()=>l.cloudforceOne.requests.assets.create({...f,account_id:d,request_id:r[`request-id`]})),{successLabel:`Created`})}};function Yn(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Xn={command:`delete <asset-id>`,describe:`Removes an asset from a Cloudforce One intelligence request.`,builder:Yn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests assets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/asset/${r[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(r[`asset-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``),"asset-id":String(r[`asset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
14
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.assets.delete({account_id:l,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Deleted`})}};function Zn(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qn={command:`get <asset-id>`,describe:`Retrieves an asset attached to a Cloudforce One intelligence request.`,builder:Zn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests assets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/asset/${r[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(r[`asset-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``),"asset-id":String(r[`asset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.assets.get({account_id:l,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Loaded`})}};function $n(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`source`,{type:`string`,description:`Asset file to upload.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const er={command:`update <asset-id>`,describe:`Updates an asset in a Cloudforce One intelligence request.`,builder:$n,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests assets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/asset/${r[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(r[`asset-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``),"asset-id":String(r[`asset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({source:d(r.source,`source`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.requests.assets.update({...e,account_id:f,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Updated`});return}let p=u({source:d(r.source,`source`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.requests.assets.update({...p,account_id:f,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Updated`})}},tr={command:`assets`,describe:`Operations for requests.assets`,builder:e=>e.command(Jn).command(Xn).command(Qn).command(er).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rr={command:`constants`,describe:`Retrieves constant values used in Cloudforce One requests, including valid statuses and types.`,builder:nr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests constants`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/constants`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.constants({account_id:l})),{successLabel:`Loaded`})}};function ir(e){return e.option(`content`,{type:`string`,description:`Request content.`}).option(`priority`,{type:`string`,description:`Priority for analyzing the request.`}).option(`request-type`,{type:`string`,description:`Requested information from request.`}).option(`summary`,{type:`string`,description:`Brief description of the request.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ar={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:ir,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/new`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({content:d(r.content,`content`,`text`),priority:d(r.priority,`priority`,`text`),request_type:d(r[`request-type`],`request-type`,`text`),summary:d(r.summary,`summary`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=u({content:d(r.content,`content`,`text`),priority:d(r.priority,`priority`,`text`),request_type:d(r[`request-type`],`request-type`,`text`),summary:d(r.summary,`summary`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.requests.create({body:p,account_id:f})),{successLabel:`Created`})}};function or(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const sr={command:`delete <request-id>`,describe:`Deletes a Cloudforce One intelligence request and all associated data.`,builder:or,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
15
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.delete({account_id:l,request_id:r[`request-id`]})),{successLabel:`Deleted`})}};function cr(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lr={command:`get <request-id>`,describe:`Retrieves details for a specific Cloudforce One intelligence request.`,builder:cr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.get({account_id:l,request_id:r[`request-id`]})),{successLabel:`Loaded`})}};function ur(e){return e.option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`request-type`,{type:`string`,description:`Requested information from request.`}).option(`sort-by`,{type:`string`,description:`Field to sort results by.`}).option(`sort-order`,{type:`string`,description:`Sort order (asc or desc).`,choices:[`asc`,`desc`]}).option(`status`,{type:`string`,description:`Request Status.`,choices:[`open`,`accepted`,`reported`,`approved`,`completed`,`declined`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const dr={command:`list`,describe:`Lists Cloudforce One intelligence requests with filtering and pagination.`,builder:ur,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({page:r.page,per_page:r[`per-page`],request_type:d(r[`request-type`],`request-type`,`text`),sort_by:d(r[`sort-by`],`sort-by`,`text`),sort_order:d(r[`sort-order`],`sort-order`,`text`),status:d(r.status,`status`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.list({...e,account_id:f})),{successLabel:`Created`});return}if(r.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(r[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let p=u({page:r.page,per_page:r[`per-page`],request_type:d(r[`request-type`],`request-type`,`text`),sort_by:d(r[`sort-by`],`sort-by`,`text`),sort_order:d(r[`sort-order`],`sort-order`,`text`),status:d(r.status,`status`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.requests.list({...p,account_id:f})),{successLabel:`Created`})}};function fr(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`content`,{type:`string`,description:`Content of message.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const pr={command:`create <request-id>`,describe:`Adds a message to a Cloudforce One intelligence request conversation.`,builder:fr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests message create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/message/new`,pathParams:{"request-id":String(r[`request-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({content:d(r.content,`content`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.message.create({body:e,account_id:f,request_id:r[`request-id`]})),{successLabel:`Created`});return}let p=u({content:d(r.content,`content`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.requests.message.create({body:p,account_id:f,request_id:r[`request-id`]})),{successLabel:`Created`})}};function mr(e){return e.positional(`message-id`,{type:`string`,description:`Message ID`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const hr={command:`delete <message-id>`,describe:`Removes a message from a Cloudforce One intelligence request thread.`,builder:mr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests message delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/message/${r[`message-id`]==null?`<message-id>`:encodeURIComponent(String(r[`message-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``),"message-id":String(r[`message-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
16
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.message.delete({account_id:l,request_id:r[`request-id`],message_id:r[`message-id`]})),{successLabel:`Deleted`})}};function gr(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`sort-by`,{type:`string`,description:`Field to sort results by.`}).option(`sort-order`,{type:`string`,description:`Sort order (asc or desc).`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _r={command:`get <request-id>`,describe:`Lists messages in a Cloudforce One intelligence request conversation.`,builder:gr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests message get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/message`,pathParams:{"request-id":String(r[`request-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({page:r.page,per_page:r[`per-page`],sort_by:d(r[`sort-by`],`sort-by`,`text`),sort_order:d(r[`sort-order`],`sort-order`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.message.get({...e,account_id:f,request_id:r[`request-id`]})),{successLabel:`Created`});return}if(r.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(r[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let p=u({page:r.page,per_page:r[`per-page`],sort_by:d(r[`sort-by`],`sort-by`,`text`),sort_order:d(r[`sort-order`],`sort-order`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.requests.message.get({...p,account_id:f,request_id:r[`request-id`]})),{successLabel:`Created`})}};function vr(e){return e.positional(`message-id`,{type:`string`,description:`Message ID`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`content`,{type:`string`,description:`Content of message.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const yr={command:`update <message-id>`,describe:`Updates a message in a Cloudforce One intelligence request thread.`,builder:vr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests message update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}/message/${r[`message-id`]==null?`<message-id>`:encodeURIComponent(String(r[`message-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``),"message-id":String(r[`message-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({content:d(r.content,`content`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.requests.message.update({body:e,account_id:f,request_id:r[`request-id`],message_id:r[`message-id`]})),{successLabel:`Updated`});return}let p=u({content:d(r.content,`content`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.requests.message.update({body:p,account_id:f,request_id:r[`request-id`],message_id:r[`message-id`]})),{successLabel:`Updated`})}},br={command:`message`,describe:`Operations for requests.message`,builder:e=>e.command(pr).command(hr).command(_r).command(yr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xr(e){return e.option(`labels`,{type:`string`,array:!0,description:`List of labels.`}).option(`priority`,{type:`number`,description:`Priority.`}).option(`requirement`,{type:`string`,description:`Requirement.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Sr={command:`create`,describe:`Creates a new priority intelligence request in Cloudforce One.`,builder:xr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests priority create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/priority/new`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({labels:r.labels,priority:r.priority,requirement:d(r.requirement,`requirement`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.priority.create({body:e,account_id:f})),{successLabel:`Created`});return}if(r.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(r.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);r.requirement===void 0&&(r.requirement=await p(`requirement`,`Requirement.`)),r.tlp===void 0&&(r.tlp=await m(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let h=u({labels:r.labels,priority:r.priority,requirement:d(r.requirement,`requirement`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.requests.priority.create({body:h,account_id:f})),{successLabel:`Created`})}};function Cr(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const wr={command:`delete <priority-id>`,describe:`Deletes a priority intelligence request from Cloudforce One.`,builder:Cr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests priority delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/priority/${r[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(r[`priority-id`]))}`,pathParams:{"priority-id":String(r[`priority-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
17
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.priority.delete({account_id:l,priority_id:r[`priority-id`]})),{successLabel:`Deleted`})}};function Tr(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Er={command:`get <priority-id>`,describe:`Retrieves a specific priority intelligence request from Cloudforce One.`,builder:Tr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests priority get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/priority/${r[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(r[`priority-id`]))}`,pathParams:{"priority-id":String(r[`priority-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.priority.get({account_id:l,priority_id:r[`priority-id`]})),{successLabel:`Loaded`})}};function Dr(e){return e.option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Or={command:`list`,describe:`Lists priority intelligence requests in Cloudforce One.`,builder:Dr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests priority list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/priority`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({page:r.page,per_page:r[`per-page`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.requests.priority.list({...e,account_id:d})),{successLabel:`Created`});return}if(r.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(r[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let f=u({page:r.page,per_page:r[`per-page`]});a(await s(`Creating`,async()=>l.cloudforceOne.requests.priority.list({...f,account_id:d})),{successLabel:`Created`})}};function kr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ar={command:`quota`,describe:`Retrieves quota usage for Cloudforce One priority requests.`,builder:kr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests priority quota`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/priority/quota`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.priority.quota({account_id:l})),{successLabel:`Loaded`})}};function jr(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`labels`,{type:`string`,array:!0,description:`List of labels.`}).option(`priority`,{type:`number`,description:`Priority.`}).option(`requirement`,{type:`string`,description:`Requirement.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Mr={command:`update <priority-id>`,describe:`Updates a priority intelligence request in Cloudforce One.`,builder:jr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests priority update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/priority/${r[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(r[`priority-id`]))}`,pathParams:{"priority-id":String(r[`priority-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({labels:r.labels,priority:r.priority,requirement:d(r.requirement,`requirement`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.requests.priority.update({body:e,account_id:f,priority_id:r[`priority-id`]})),{successLabel:`Updated`});return}if(r.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(r.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);r.requirement===void 0&&(r.requirement=await p(`requirement`,`Requirement.`)),r.tlp===void 0&&(r.tlp=await m(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let h=u({labels:r.labels,priority:r.priority,requirement:d(r.requirement,`requirement`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.requests.priority.update({body:h,account_id:f,priority_id:r[`priority-id`]})),{successLabel:`Updated`})}},Nr={command:`priority`,describe:`Operations for requests.priority`,builder:e=>e.command(Sr).command(wr).command(Er).command(Or).command(Ar).command(Mr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One standard requests.`,builder:Pr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests quota`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/quota`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.quota({account_id:l})),{successLabel:`Loaded`})}};function Ir(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Lr={command:`types`,describe:`Lists available request types for Cloudforce One intelligence requests.`,builder:Ir,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests types`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/types`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.requests.types({account_id:l})),{successLabel:`Loaded`})}};function Rr(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`content`,{type:`string`,description:`Request content.`}).option(`priority`,{type:`string`,description:`Priority for analyzing the request.`}).option(`request-type`,{type:`string`,description:`Requested information from request.`}).option(`summary`,{type:`string`,description:`Brief description of the request.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const zr={command:`update <request-id>`,describe:`Updating a request alters the request in the Cloudforce One queue. This API may be used to update any attributes of the request after the initial submission. Only fields that you choose to update need to be add to the request body.`,builder:Rr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one requests update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/requests/${r[`request-id`]==null?`<request-id>`:encodeURIComponent(String(r[`request-id`]))}`,pathParams:{"request-id":String(r[`request-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({content:d(r.content,`content`,`text`),priority:d(r.priority,`priority`,`text`),request_type:d(r[`request-type`],`request-type`,`text`),summary:d(r.summary,`summary`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.requests.update({body:e,account_id:f,request_id:r[`request-id`]})),{successLabel:`Updated`});return}let p=u({content:d(r.content,`content`,`text`),priority:d(r.priority,`priority`,`text`),request_type:d(r[`request-type`],`request-type`,`text`),summary:d(r.summary,`summary`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.requests.update({body:p,account_id:f,request_id:r[`request-id`]})),{successLabel:`Updated`})}},Br={command:`requests`,describe:`Additional request operations — priority listing and asset creation`,builder:e=>e.command(rr).command(ar).command(sr).command(lr).command(dr).command(Fr).command(Lr).command(zr).command(Kn).command(tr).command(br).command(Nr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Vr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the approval.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hr={command:`cancel <id>`,describe:`Cancel a pending rule approval. Only its original requester may cancel it.`,builder:Vr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules approvals cancel`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/approvals/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/cancel`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.cloudforceOne.rules.approvals.cancel({account_id:l,id:r.id})),{successLabel:`Created`})}};function Ur(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the approval.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wr={command:`get <id>`,describe:`Get a single rule approval with current rule data.`,builder:Ur,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules approvals get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/approvals/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.approvals.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function Gr(e){return e.option(`status`,{type:`string`,description:`Selects approval statuses. Repeat the parameter to OR-match statuses (for example, status=pending&status=rejected). Use status=all alone to disable status filtering.`,choices:[`pending`,`approved`,`rejected`,`cancelled`,`all`]}).option(`latest-only`,{type:`string`,description:`When true, returns the newest revision in each approval chain.`,choices:[`true`,`false`]}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`reviewer-scope`,{type:`string`,description:`Limits approvals to the specified reviewer scope.`,choices:[`default`,`email`,`unresolved`]}).option(`change-type`,{type:`string`,description:`Limits approvals to the specified mutation type.`,choices:[`create`,`update`,`delete`]}).option(`rule-id`,{type:`string`,description:`Filter approvals by rule ID.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Kr={command:`list`,describe:`Returns rule approvals with optional status, revision, reviewer-scope, and mutation-type filtering.`,builder:g(Gr),handler:async r=>{let c={status:r.status,latest_only:r[`latest-only`],limit:r.limit,offset:r.offset,reviewer_scope:r[`reviewer-scope`],change_type:r[`change-type`],rule_id:r[`rule-id`]};if(r.dryRun){o({command:`cf cloudforce-one rules approvals list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/approvals`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.rules.approvals.list({account_id:u,...c})),{successLabel:`Loaded`})}};function qr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the approval.`,demandOption:!0}).option(`commit-message`,{type:`string`,description:`The commit_message field`}).option(`content`,{type:`string`,description:`The content field`}).option(`description`,{type:`string`,description:`The description field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`The namespaces field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Jr={command:`resubmit <id>`,describe:`Create a new pending revision from a rejected rule approval. Only the original requester may resubmit the latest revision.`,builder:qr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules approvals resubmit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/approvals/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/resubmit`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?u({commit_message:d(r[`commit-message`],`commit-message`,`text`),content:d(r.content,`content`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`),namespaces:r.namespaces}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.approvals.resubmit({...e,account_id:f,id:r.id})),{successLabel:`Created`});return}let p=u({commit_message:d(r[`commit-message`],`commit-message`,`text`),content:d(r.content,`content`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`),namespaces:r.namespaces});a(await s(`Creating`,async()=>l.cloudforceOne.rules.approvals.resubmit({...p,account_id:f,id:r.id})),{successLabel:`Created`})}},Yr={command:`approvals`,describe:`Operations for rules.approvals`,builder:e=>e.command(Hr).command(Wr).command(Kr).command(Jr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Xr(e){return e.option(`commit-message`,{type:`string`,description:`Human-readable justification for this change. Required for internal-account submissions; optional for customer accounts and automated sync.`}).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:`Optional WfP deployment tags (customer rules only). Internal rules leave empty.`}).option(`path`,{type:`string`,description:`The path field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Zr={command:`create`,describe:`Create a new detection rule.`,builder:Xr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({commit_message:d(r[`commit-message`],`commit-message`,`text`),content:d(r.content,`content`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],name:d(r.name,`name`,`text`),namespaces:r.namespaces,path:d(r.path,`path`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.create({...e,account_id:f})),{successLabel:`Created`});return}r.content===void 0&&(r.content=await p(`content`,`The content field`)),r.name===void 0&&(r.name=await p(`name`,`The name field`)),r.path===void 0&&(r.path=await p(`path`,`The path field`));let m=u({commit_message:d(r[`commit-message`],`commit-message`,`text`),content:d(r.content,`content`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],name:d(r.name,`name`,`text`),namespaces:r.namespaces,path:d(r.path,`path`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.rules.create({...m,account_id:f})),{successLabel:`Created`})}};function Qr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`commit-message`,{type:`string`,description:`Human-readable justification for the deletion. Required for internal-account submissions; optional for customer accounts and automated sync.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const $r={command:`delete <id>`,describe:`Delete an existing rule.`,builder:Qr,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?u({commit_message:d(r[`commit-message`],`commit-message`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,!await h({force:!!r.force})){process.stderr.write(`Aborted.
18
- `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>l.cloudforceOne.rules.delete({...e,account_id:f,id:r.id})),{successLabel:`Deleted`});return}let p=u({commit_message:d(r[`commit-message`],`commit-message`,`text`)});a(await s(`Deleting`,async()=>l.cloudforceOne.rules.delete({...p,account_id:f,id:r.id})),{successLabel:`Deleted`})}};function ei(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ti={command:`deleteAll`,describe:`Delete all rules in an account.`,builder:ei,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules deleteAll`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
19
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.rules.deleteAll({account_id:l})),{successLabel:`Deleted`})}};function ni(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the approval.`,demandOption:!0}).option(`module`,{type:`string`,description:`Structured rule module.`,choices:[`eml`]}).option(`condition-operator`,{type:`string`,description:`The condition.operator field`,choices:[`and`,`or`]}).option(`condition-type`,{type:`string`,description:`The condition.type field`,choices:[`group`]}).option(`description`,{type:`string`,description:`The description field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`,default:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ri={command:`resubmit <id>`,describe:`Validates and compiles a complete structured email rule, then creates an immutable pending revision of its rejected approval.`,builder:g(ni),handler:async r=>{let l={module:r.module};if(r.dryRun){o({command:`cf cloudforce-one rules email approvals resubmit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/approvals/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/resubmit`,pathParams:{id:String(r.id??``)},query:l,bodyKind:`json`,body:r.body===void 0?u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),h=r.local?e:await t();if(r.accountId=h,r.body){let e=c(r.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.cloudforceOne.rules.email.approvals.resubmit({...e,account_id:h,id:r.id,...l})),{successLabel:`Created`});return}r[`condition-operator`]===void 0&&(r[`condition-operator`]=await m(`condition-operator`,`The condition.operator field`,[`and`,`or`])),r[`condition-type`]===void 0&&(r[`condition-type`]=await m(`condition-type`,`The condition.type field`,[`group`])),r.name===void 0&&(r.name=await p(`name`,`The name field`));let g=u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.cloudforceOne.rules.email.approvals.resubmit({...g,account_id:h,id:r.id,...l})),{successLabel:`Created`})}},ii={command:`approvals`,describe:`Operations for rules.email.approvals`,builder:e=>e.command(ri).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ai(e){return e.option(`condition-operator`,{type:`string`,description:`The condition.operator field`,choices:[`and`,`or`]}).option(`condition-type`,{type:`string`,description:`The condition.type field`,choices:[`group`]}).option(`description`,{type:`string`,description:`The description field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`,default:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oi={command:`create`,describe:`Create a structured email rule.`,builder:ai,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.email.create({...e,account_id:f})),{successLabel:`Created`});return}r[`condition-operator`]===void 0&&(r[`condition-operator`]=await m(`condition-operator`,`The condition.operator field`,[`and`,`or`])),r[`condition-type`]===void 0&&(r[`condition-type`]=await m(`condition-type`,`The condition.type field`,[`group`])),r.name===void 0&&(r.name=await p(`name`,`The name field`));let h=u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.rules.email.create({...h,account_id:f})),{successLabel:`Created`})}};function si(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ci={command:`delete <id>`,describe:`Delete an existing structured email rule.`,builder:si,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
20
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.rules.email.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function li(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ui={command:`get <id>`,describe:`Get a structured email rule by ID.`,builder:li,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.email.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function di(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`search`,{type:`string`,description:`Search`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fi={command:`list`,describe:`Returns structured email rules.`,builder:di,handler:async r=>{let c={limit:r.limit,offset:r.offset,search:r.search};if(r.dryRun){o({command:`cf cloudforce-one rules email list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.rules.email.list({account_id:u,...c})),{successLabel:`Loaded`})}};function pi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mi={command:`get`,describe:`Get the field catalog for structured email rules.`,builder:pi,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email schema get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/schema`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.email.schema.get({account_id:l})),{successLabel:`Loaded`})}},hi={command:`schema`,describe:`Operations for rules.email.schema`,builder:e=>e.command(mi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gi(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`sample-json`,{type:`string`,description:`The sample_json field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _i={command:`test <id>`,describe:`Test a structured email rule against sample email JSON.`,builder:gi,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email test`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/test`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?u({sample_json:d(r[`sample-json`],`sample-json`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.email.test({...e,account_id:f,id:r.id})),{successLabel:`Created`});return}r[`sample-json`]===void 0&&(r[`sample-json`]=await p(`sample-json`,`The sample_json field`));let m=u({sample_json:d(r[`sample-json`],`sample-json`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.rules.email.test({...m,account_id:f,id:r.id})),{successLabel:`Created`})}};function vi(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`condition-operator`,{type:`string`,description:`The condition.operator field`,choices:[`and`,`or`]}).option(`condition-type`,{type:`string`,description:`The condition.type field`,choices:[`group`]}).option(`description`,{type:`string`,description:`The description field`}).option(`enabled`,{type:`boolean`,description:`The enabled 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)`}).check(e=>{if([`condition-operator`,`condition-type`].some(t=>e[t]!==void 0)){let t=[`condition-operator`,`condition-type`].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 --condition-* flag is set`)}return!0})}const yi={command:`update <id>`,describe:`Updates an existing structured email rule.`,builder:vi,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.rules.email.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}let p=u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.rules.email.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}};function bi(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the approval.`,demandOption:!0}).option(`module`,{type:`string`,description:`Structured rule module.`,choices:[`eml`]}).option(`description`,{type:`string`,description:`The description field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const xi={command:`updatePendingApproval <id>`,describe:`Validate, compile, and replace the proposed structured email rule on a pending approval. Only the original requester may update it.`,builder:g(bi),handler:async r=>{let l={module:r.module};if(r.dryRun){o({command:`cf cloudforce-one rules email updatePendingApproval`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/approvals/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},query:l,bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.cloudforceOne.rules.email.updatePendingApproval({...e,account_id:m,id:r.id,...l})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await p(`name`,`The name field`));let h=u({description:d(r.description,`description`,`text`),enabled:r.enabled,name:d(r.name,`name`,`text`)});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.cloudforceOne.rules.email.updatePendingApproval({...h,account_id:m,id:r.id,...l})),{successLabel:`Updated`})}};function Si(e){return e.option(`condition-operator`,{type:`string`,description:`The condition.operator field`,choices:[`and`,`or`]}).option(`condition-type`,{type:`string`,description:`The condition.type field`,choices:[`group`]}).option(`description`,{type:`string`,description:`The description field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`,default:!0}).option(`existing-rule-id`,{type:`string`,description:`Existing rule ID to exclude from duplicate-name checks when validating an update.`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ci={command:`validate`,describe:`Validates structured email rule syntax and metadata.`,builder:Si,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules email validate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/structured/validate`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,existing_rule_id:d(r[`existing-rule-id`],`existing-rule-id`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.email.validate({...e,account_id:f})),{successLabel:`Created`});return}r[`condition-operator`]===void 0&&(r[`condition-operator`]=await m(`condition-operator`,`The condition.operator field`,[`and`,`or`])),r[`condition-type`]===void 0&&(r[`condition-type`]=await m(`condition-type`,`The condition.type field`,[`group`])),r.name===void 0&&(r.name=await p(`name`,`The name field`));let h=u({condition:{operator:d(r[`condition-operator`],`condition-operator`,`text`),type:d(r[`condition-type`],`condition-type`,`text`)},description:d(r.description,`description`,`text`),enabled:r.enabled,existing_rule_id:d(r[`existing-rule-id`],`existing-rule-id`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.rules.email.validate({...h,account_id:f})),{successLabel:`Created`})}},wi={command:`email`,describe:`Operations for rules.email`,builder:e=>e.command(oi).command(ci).command(ui).command(fi).command(_i).command(yi).command(xi).command(Ci).command(ii).command(hi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ti(e){return e.option(`namespace`,{type:`string`,array:!0,description:`The namespace field`}).option(`tag-match`,{type:`string`,array:!0,description:`The tag_match field`}).option(`worker-name`,{type:`string`,array:!0,description:`The worker_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ei={command:`create`,describe:`Add regex patterns to per-account exemption rules (union semantics). Missing keys leave that type untouched; duplicates are silently deduped.`,builder:Ti,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules exemptions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/exemptions`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.exemptions.create({body:e,account_id:d})),{successLabel:`Created`});return}let f=u({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]});a(await s(`Creating`,async()=>l.cloudforceOne.rules.exemptions.create({body:f,account_id:d})),{successLabel:`Created`})}};function Di(e){return e.option(`namespace`,{type:`string`,array:!0,description:`The namespace field`}).option(`tag-match`,{type:`string`,array:!0,description:`The tag_match field`}).option(`worker-name`,{type:`string`,array:!0,description:`The worker_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oi={command:`delete`,describe:`Remove regex patterns from per-account exemption rules. Missing keys leave that type untouched; non-existent patterns are silently skipped.`,builder:Di,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules exemptions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/exemptions`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,!await h({force:!!r.force})){process.stderr.write(`Aborted.
21
- `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>l.cloudforceOne.rules.exemptions.delete({body:e,account_id:d})),{successLabel:`Deleted`});return}let f=u({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]});a(await s(`Deleting`,async()=>l.cloudforceOne.rules.exemptions.delete({body:f,account_id:d})),{successLabel:`Deleted`})}};function ki(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ai={command:`get`,describe:`Get all exemption rule patterns for the account, grouped by type.`,builder:ki,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules exemptions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/exemptions`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.exemptions.get({account_id:l})),{successLabel:`Loaded`})}};function ji(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Mi={command:`update`,describe:`Replace existing exemption patterns with new values. Each key maps to an array of {old_pattern, new_pattern} entries. Missing keys leave that type untouched. Fails if any old pattern is not found or any new pattern already exists.`,builder:ji,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules exemptions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/exemptions`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.rules.exemptions.update({...e,account_id:u})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>l.cloudforceOne.rules.exemptions.update({account_id:u})),{successLabel:`Updated`})}},Ni={command:`exemptions`,describe:`Operations for rules.exemptions`,builder:e=>e.command(Ei).command(Oi).command(Ai).command(Mi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pi(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fi={command:`get <id>`,describe:`Get a single rule by ID.`,builder:Pi,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function Ii(e){return e.option(`namespace`,{type:`string`,description:`Selects namespaces. Repeat the parameter to select multiple namespaces (for example, namespace=foo&namespace=bar).`}).option(`path`,{type:`string`,description:"Selects paths with exact-match semantics. Omit the parameter to return rules from all paths. Pass an empty string (path=) to return only rules with an empty or uncategorized path. Pass a value (for example, path=yara) to match that exact path. Repeat the parameter (for example, path=yara&path=expr) to OR-match multiple paths with SQL `IN (...)` semantics. The `recursive` flag affects only customer-account namespace selection."}).option(`recursive`,{type:`string`,description:`For customer accounts, true enables descendant matching for namespaces. Paths always use exact matching.`,choices:[`true`,`false`]}).option(`search`,{type:`string`,description:`Search`}).option(`is-public`,{type:`string`,description:`Limits rules to the specified public visibility.`,choices:[`true`,`false`]}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Li={command:`list`,describe:`Returns all rules for an account with optional filtering.`,builder:g(Ii),handler:async r=>{let c={namespace:r.namespace,path:r.path,recursive:r.recursive,search:r.search,is_public:r[`is-public`],limit:r.limit,offset:r.offset};if(r.dryRun){o({command:`cf cloudforce-one rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.rules.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ri(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zi={command:`get`,describe:`Get DFP managed rule metadata (name and description) from YARA rules.`,builder:Ri,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules managed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/managed`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.managed.get({account_id:l})),{successLabel:`Loaded`})}},Bi={command:`managed`,describe:`Operations for rules.managed`,builder:e=>e.command(zi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Vi(e){return e.option(`namespace`,{type:`string`,description:`Selects namespaces. Repeat the parameter to select multiple namespaces (for example, namespace=foo&namespace=bar).`}).option(`path`,{type:`string`,description:"Selects paths with exact-match semantics. Omit the parameter to return rules from all paths. Pass an empty string (path=) to return only rules with an empty or uncategorized path. Pass a value (for example, path=yara) to match that exact path. Repeat the parameter (for example, path=yara&path=expr) to OR-match multiple paths with SQL `IN (...)` semantics. The `recursive` flag affects only customer-account namespace selection."}).option(`recursive`,{type:`string`,description:`For customer accounts, true enables descendant matching for namespaces. Paths always use exact matching.`,choices:[`true`,`false`]}).option(`search`,{type:`string`,description:`Search`}).option(`is-public`,{type:`string`,description:`Limits rules to the specified public visibility.`,choices:[`true`,`false`]}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`query`,{type:`string`,description:`Natural-language or keyword search query.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Retrieval strategy used for the query.`,choices:[`exact`,`hybrid`,`vector`,`keyword`]}).option(`language`,{type:`string`,description:`Limits results to the specified rule language.`,choices:[`yara`,`js`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hi={command:`search`,describe:`Search rules using hybrid, vector, keyword, or exact retrieval, backed by AI Search with a SQL fallback.`,builder:g(Vi),handler:async r=>{let c={namespace:r.namespace,path:r.path,recursive:r.recursive,search:r.search,is_public:r[`is-public`],limit:r.limit,offset:r.offset,query:r.query,mode:r.mode,language:r.language};if(r.dryRun){o({command:`cf cloudforce-one rules search`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/search`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.rules.search({account_id:u,...c})),{successLabel:`Loaded`})}};function Ui(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get`,describe:`Get statistics about rules for the dashboard.`,builder:Ui,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules stats get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/stats`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.stats.get({account_id:l})),{successLabel:`Loaded`})}},Wi={command:`stats`,describe:`Operations for rules.stats`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ki={command:`get`,describe:`Get the folder tree structure for rules navigation.`,builder:Gi,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules tree get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/tree`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.rules.tree.get({account_id:l})),{successLabel:`Loaded`})}},qi={command:`tree`,describe:`Operations for rules.tree`,builder:e=>e.command(Ki).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ji(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`commit-message`,{type:`string`,description:`Human-readable justification for this change. Required for internal-account submissions; optional for customer accounts and automated sync.`}).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(`path`,{type:`string`,description:`Path change goes through approval workflow.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Yi={command:`update <id>`,describe:`Updates an existing rule.`,builder:Ji,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?u({commit_message:d(r[`commit-message`],`commit-message`,`text`),content:d(r.content,`content`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],name:d(r.name,`name`,`text`),namespaces:r.namespaces,path:d(r.path,`path`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.rules.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}let p=u({commit_message:d(r[`commit-message`],`commit-message`,`text`),content:d(r.content,`content`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],name:d(r.name,`name`,`text`),namespaces:r.namespaces,path:d(r.path,`path`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.rules.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}};function Xi(e){return e.option(`content`,{type:`string`,description:`The content field`}).option(`exclude-rule-id`,{type:`string`,description:`The excludeRuleId field`}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`The namespaces field`}).option(`path`,{type:`string`,description:`The path field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Zi={command:`validate`,describe:`Validates rule syntax, name uniqueness, namespace, and metadata.`,builder:Xi,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one rules validate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/rules/validate`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({content:d(r.content,`content`,`text`),excludeRuleId:d(r[`exclude-rule-id`],`exclude-rule-id`,`text`),name:d(r.name,`name`,`text`),namespaces:r.namespaces,path:d(r.path,`path`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.rules.validate({...e,account_id:f})),{successLabel:`Created`});return}r.content===void 0&&(r.content=await p(`content`,`The content field`)),r.name===void 0&&(r.name=await p(`name`,`The name field`));let m=u({content:d(r.content,`content`,`text`),excludeRuleId:d(r[`exclude-rule-id`],`exclude-rule-id`,`text`),name:d(r.name,`name`,`text`),namespaces:r.namespaces,path:d(r.path,`path`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.rules.validate({...m,account_id:f})),{successLabel:`Created`})}},Qi={command:`rules`,describe:`Rule management operations`,builder:e=>e.command(Zr).command($r).command(ti).command(Fi).command(Li).command(Hi).command(Yi).command(Zi).command(Yr).command(wi).command(Ni).command(Bi).command(Wi).command(qi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $i(e){return e.option(`frequency`,{type:`number`,description:`Defines the number of days between each scan (0 = One-off scan).`}).option(`ips`,{type:`string`,array:!0,description:`Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000.`}).option(`ports`,{type:`string`,array:!0,description:`Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ea={command:`create`,describe:`Creates a new scan configuration for Cloudforce One's network scanning service.`,builder:$i,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({frequency:r.frequency,ips:r.ips,ports:r.ports}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.scans.config.create({...e,account_id:d})),{successLabel:`Created`});return}if(r.ips===void 0)throw Error(`--ips is required (or pass --body with this field set).`);let f=u({frequency:r.frequency,ips:r.ips,ports:r.ports});a(await s(`Creating`,async()=>l.cloudforceOne.scans.config.create({...f,account_id:d})),{successLabel:`Created`})}};function ta(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const na={command:`delete <config-id>`,describe:`Deletes a scan configuration from Cloudforce One's network scanning service.`,builder:ta,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/scans/config/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}`,pathParams:{"config-id":String(r[`config-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
22
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.scans.config.delete({account_id:l,config_id:r[`config-id`]})),{successLabel:`Deleted`})}};function ra(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}).option(`frequency`,{type:`number`,description:`Defines the number of days between each scan (0 = One-off scan).`}).option(`ips`,{type:`string`,array:!0,description:`Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000.`}).option(`ports`,{type:`string`,array:!0,description:`Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ia={command:`edit <config-id>`,describe:`Updates an existing scan configuration in Cloudforce One's network scanning service.`,builder:ra,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/scans/config/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}`,pathParams:{"config-id":String(r[`config-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({frequency:r.frequency,ips:r.ips,ports:r.ports}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.scans.config.edit({...e,account_id:d,config_id:r[`config-id`]})),{successLabel:`Updated`});return}let f=u({frequency:r.frequency,ips:r.ips,ports:r.ports});a(await s(`Updating`,async()=>l.cloudforceOne.scans.config.edit({...f,account_id:d,config_id:r[`config-id`]})),{successLabel:`Updated`})}};function aa(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oa={command:`list`,describe:`Lists scan configurations for Cloudforce One's network scanning service.`,builder:aa,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans config list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.scans.config.list({account_id:l})),{successLabel:`Loaded`})}},sa={command:`config`,describe:`Operations for scans.config`,builder:e=>e.command(ea).command(na).command(ia).command(oa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ca(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const la={command:`get <config-id>`,describe:`Retrieves the latest scan results for a Cloudforce One scan configuration, including discovered open ports.`,builder:ca,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans results get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/scans/results/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}`,pathParams:{"config-id":String(r[`config-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.scans.results.get({account_id:l,config_id:r[`config-id`]})),{successLabel:`Loaded`})}};function ua(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const da={command:`getBanners <config-id>`,describe:`Retrieves the latest banner grab results for a Cloudforce One scan configuration, including service banners from open ports.`,builder:ua,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans results getBanners`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/banner/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}`,pathParams:{"config-id":String(r[`config-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.scans.results.getBanners({account_id:l,config_id:r[`config-id`]})),{successLabel:`Loaded`})}},fa={command:`results`,describe:`Operations for scans.results`,builder:e=>e.command(la).command(da).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},pa={command:`scans`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(sa).command(fa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ma(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`description`,{type:`string`,description:`Optional description`}).option(`metadata`,{type:`string`,description:`Optional custom metadata as JSON object (e.g., '{"key":"value"}')`}).option(`name`,{type:`string`,description:`Collection name (alphanumeric with underscores)`}).option(`project-id`,{type:`string`,description:`Optional project ID`}).option(`tags`,{type:`string`,description:`Optional tags as JSON array (e.g., '["tag1","tag2"]')`})}const ha={command:`create`,describe:`Creates a collection with four patterns: schema-only (empty collection), rows-only (inferred schema), schema+rows (validated data), or file upload (CSV/JSON/JSONL)`,builder:ma,handler:async l=>{if(l.dryRun){o({command:`cf cloudforce-one stakeout collections create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections`,pathParams:{},bodyKind:`multipart`,body:{body:l.body,file:l.file,description:l.description,metadata:l.metadata,name:l.name,"project-id":l[`project-id`],tags:l.tags}});return}let u=await i(l),p=l.local?e:await t();if(l.accountId=p,l.file!==void 0||l.body!==void 0||l.description!==void 0||l.metadata!==void 0||l.name!==void 0||l[`project-id`]!==void 0||l.tags!==void 0){let e=new FormData;if(l.file){let t=f(l.file);e.append(`file`,new Blob([t]),l.file.split(/[\\/]/).filter(Boolean).pop())}else l.body!==void 0&&e.append(`file`,l.body);l.description!==void 0&&e.append(`description`,String(d(l.description,`description`,`text`)??``)),l.metadata!==void 0&&e.append(`metadata`,String(d(l.metadata,`metadata`,`text`)??``)),l.name!==void 0&&e.append(`name`,String(d(l.name,`name`,`text`)??``)),l[`project-id`]!==void 0&&e.append(`project_id`,String(d(l[`project-id`],`project-id`,`text`)??``)),l.tags!==void 0&&e.append(`tags`,String(d(l.tags,`tags`,`text`)??``)),a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${p}/cloudforce-one/v2/collections`,{body:e})),{successLabel:`Created`});return}if(l.body){let e=c(l.body);a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${p}/cloudforce-one/v2/collections`,{body:e})),{successLabel:`Created`});return}if(l.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function ga(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _a={command:`delete <collection-id>`,describe:`Deletes a collection and all its items. This action cannot be undone. The Durable Object storage is deleted asynchronously.`,builder:ga,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout collections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
23
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.collections.delete({account_id:l,collection_id:r[`collection-id`]})),{successLabel:`Deleted`})}};function va(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`include-ids`,{type:`boolean`,description:`Include item IDs in export (default: false)`}).option(`accept`,{type:`string`,description:`Requested format: text/csv (default), application/x-ndjson, text/markdown`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ya={command:`export <collection-id>`,describe:`Streams collection data in the requested format. Supports CSV (default), JSONL, or Markdown via Accept header. Queries items in batches of 1000 to avoid memory/timeout limits.`,builder:va,handler:async r=>{let a={include_ids:r[`include-ids`]},c={};if(r.accept!==void 0&&(c.accept=String(r.accept)),r.dryRun){o({command:`cf cloudforce-one stakeout collections export`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/export`,pathParams:{"collection-id":String(r[`collection-id`]??``)},query:a,bodyKind:`none`});return}await i(r);let l=r.local?e:await t();r.accountId=l;let u=new URLSearchParams(Object.entries(a).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();_((await s(`Loading`,async()=>v(`/accounts/${l}/cloudforce-one/v2/collections/${encodeURIComponent(String(r[`collection-id`]))}/export${u?`?`+u:``}`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}))).toString(`utf-8`))}};function ba(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xa={command:`get <collection-id>`,describe:`Retrieves a single collection by ID with its schema and metadata`,builder:ba,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout collections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.collections.get({account_id:l,collection_id:r[`collection-id`]})),{successLabel:`Loaded`})}};function Sa(e){return e.option(`page`,{type:`number`,description:`Page number`}).option(`limit`,{type:`number`,description:`Items per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ca={command:`list`,describe:`Retrieves all collections for an account with pagination`,builder:Sa,handler:async r=>{let c={page:r.page,limit:r.limit};if(r.dryRun){o({command:`cf cloudforce-one stakeout collections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.stakeout.collections.list({account_id:u,...c})),{successLabel:`Loaded`})}};function wa(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`metadata-description`,{type:`string`,description:`Collection description`}).option(`metadata-project-id`,{type:`string`,description:`Project ID`}).option(`metadata-tags`,{type:`string`,array:!0,description:`The metadata.tags field`}).option(`name`,{type:`string`,description:`Collection name`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ta={command:`update <collection-id>`,describe:`Updates collection name and/or metadata. Schema (columns) cannot be modified.`,builder:wa,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout collections update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({metadata:{description:d(r[`metadata-description`],`metadata-description`,`text`),project_id:d(r[`metadata-project-id`],`metadata-project-id`,`text`),tags:r[`metadata-tags`]},name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.collections.update({...e,account_id:f,collection_id:r[`collection-id`]})),{successLabel:`Updated`});return}let p=u({metadata:{description:d(r[`metadata-description`],`metadata-description`,`text`),project_id:d(r[`metadata-project-id`],`metadata-project-id`,`text`),tags:r[`metadata-tags`]},name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.collections.update({...p,account_id:f,collection_id:r[`collection-id`]})),{successLabel:`Updated`})}},Ea={command:`collections`,describe:`Operations for stakeout.collections`,builder:e=>e.command(ha).command(_a).command(ya).command(xa).command(Ca).command(Ta).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Da(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`required`,{type:`boolean`,description:`The required field`,default:!1}).option(`type`,{type:`string`,description:`The type field`,choices:[`text`,`number`,`boolean`,`date`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oa={command:`create <collection-id>`,describe:`Adds a new column to an existing collection schema. Existing items will have NULL for the new column unless a default value is provided.`,builder:Da,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout columns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/columns`,pathParams:{"collection-id":String(r[`collection-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({name:d(r.name,`name`,`text`),required:r.required,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.columns.create({...e,account_id:f,collection_id:r[`collection-id`]})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await p(`name`,`The name field`)),r.type===void 0&&(r.type=await m(`type`,`The type field`,[`text`,`number`,`boolean`,`date`]));let h=u({name:d(r.name,`name`,`text`),required:r.required,type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.columns.create({...h,account_id:f,collection_id:r[`collection-id`]})),{successLabel:`Created`})}};function ka(e){return e.positional(`column-id`,{type:`string`,description:`Column UUID`,demandOption:!0}).option(`collection-id`,{type:`string`,description:`Collection ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Aa={command:`delete <column-id>`,describe:`Delete a column from the collection schema. Data is preserved as orphaned UUID keys (forensic safety) and filtered from API responses.`,builder:ka,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout columns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/columns/${r[`column-id`]==null?`<column-id>`:encodeURIComponent(String(r[`column-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``),"column-id":String(r[`column-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
24
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.columns.delete({account_id:l,collection_id:r[`collection-id`],column_id:r[`column-id`]})),{successLabel:`Deleted`})}};function ja(e){return e.positional(`column-id`,{type:`string`,description:`Column UUID`,demandOption:!0}).option(`collection-id`,{type:`string`,description:`Collection ID`,demandOption:!0}).option(`name`,{type:`string`,description:`New column name (must be unique)`}).option(`position`,{type:`number`,description:`Column display order`}).option(`required`,{type:`boolean`,description:`Whether column is required`}).option(`type`,{type:`string`,description:`Column type: text, number, boolean, or date`,choices:[`text`,`number`,`boolean`,`date`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ma={command:`update <column-id>`,describe:`Update name, type, required, or position of a column.`,builder:ja,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout columns update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/columns/${r[`column-id`]==null?`<column-id>`:encodeURIComponent(String(r[`column-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``),"column-id":String(r[`column-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({name:d(r.name,`name`,`text`),position:r.position,required:r.required,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.columns.update({...e,account_id:f,collection_id:r[`collection-id`],column_id:r[`column-id`]})),{successLabel:`Updated`});return}let p=u({name:d(r.name,`name`,`text`),position:r.position,required:r.required,type:d(r.type,`type`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.columns.update({...p,account_id:f,collection_id:r[`collection-id`],column_id:r[`column-id`]})),{successLabel:`Updated`})}},Na={command:`columns`,describe:`Operations for stakeout.columns`,builder:e=>e.command(Oa).command(Aa).command(Ma).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pa(e){return e.option(`max-time`,{type:`string`,description:`The max_time field`}).option(`min-time`,{type:`string`,description:`The min_time field`}).option(`scan`,{type:`boolean`,description:`The scan field`}).option(`scan-matches`,{type:`boolean`,description:`The scan_matches field`}).option(`search-lookback`,{type:`boolean`,description:`If true, search recent domain lookback entries for matches`,default:!0}).option(`tag`,{type:`string`,description:`The tag field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Fa={command:`create`,describe:`Create a new saved brand protection query with string match patterns`,builder:Pa,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout domain-queries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({max_time:d(r[`max-time`],`max-time`,`text`),min_time:d(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],tag:d(r.tag,`tag`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.domainQueries.create({...e,account_id:f})),{successLabel:`Created`});return}r.tag===void 0&&(r.tag=await p(`tag`,`The tag field`));let m=u({max_time:d(r[`max-time`],`max-time`,`text`),min_time:d(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],tag:d(r.tag,`tag`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.domainQueries.create({...m,account_id:f})),{successLabel:`Created`})}};function Ia(e){return e.positional(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const La={command:`delete <query-id>`,describe:`Delete a saved brand protection domain query from the account_queries table. This operation will remove the query from the durable object database. Returns 404 if the query ID doesn't exist.`,builder:Ia,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout domain-queries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries/${r[`query-id`]==null?`<query-id>`:encodeURIComponent(String(r[`query-id`]))}`,pathParams:{"query-id":String(r[`query-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
25
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.domainQueries.delete({account_id:l,query_id:r[`query-id`]})),{successLabel:`Deleted`})}};function Ra(e){return e.positional(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`max-time`,{type:`string`,description:`The max_time field`}).option(`min-time`,{type:`string`,description:`The min_time field`}).option(`scan`,{type:`boolean`,description:`The scan field`}).option(`scan-matches`,{type:`boolean`,description:`The scan_matches field`}).option(`search-lookback`,{type:`boolean`,description:`If true, search recent domain lookback entries for matches`}).option(`tag`,{type:`string`,description:`The tag field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const za={command:`update <query-id>`,describe:`Update a saved brand protection domain query with string match patterns`,builder:Ra,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout domain-queries update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries/${r[`query-id`]==null?`<query-id>`:encodeURIComponent(String(r[`query-id`]))}`,pathParams:{"query-id":String(r[`query-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({max_time:d(r[`max-time`],`max-time`,`text`),min_time:d(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],tag:d(r.tag,`tag`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.domainQueries.update({...e,account_id:f,query_id:r[`query-id`]})),{successLabel:`Updated`});return}r.tag===void 0&&(r.tag=await p(`tag`,`The tag field`));let m=u({max_time:d(r[`max-time`],`max-time`,`text`),min_time:d(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],tag:d(r.tag,`tag`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.domainQueries.update({...m,account_id:f,query_id:r[`query-id`]})),{successLabel:`Updated`})}},Ba={command:`domain-queries`,describe:`Operations for stakeout.domain-queries`,builder:e=>e.command(Fa).command(La).command(za).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Va(e){return e.option(`seeds`,{type:`string`,description:`Comma-separated compact seed ids (type:uuid). Example: seeds=event:550e8400-...,indicator:661fa920-... Provide 1–50 entries; omitting seeds returns 400.`}).option(`direction`,{type:`string`,description:`Edge direction relative to each seed: out (seed→neighbors), in (neighbors→seed), both (default).`}).option(`hydration`,{type:`string`,description:`Hydration strategy for neighbor nodes when expand=nodes is set. r2_join (default): use R2 JOIN query + DO fallback. do_only: use plain R2 query + hydrate all neighbors via Durable Objects.`}).option(`limit`,{type:`number`,description:`Max neighbors per seed (default: 100, max: 1000). Values above 1000 return 400.`}).option(`max-nodes`,{type:`number`,description:`Total accumulated node cap across all seeds (default: 500, max: 1000). Values above 1000 return 400.`}).option(`relationship-types`,{type:`string`,description:`Comma-separated relationship types to filter by. Allowed: tagged_with, appears_in, related_to, caused_by, attributed_to.`}).option(`dataset-ids`,{type:`string`,description:`Comma-separated dataset UUIDs to restrict neighbor scope, or one standalone scope value: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. Intersected with access grants.`}).option(`cursor`,{type:`string`,description:`Opaque pagination token. Only valid when seeds has exactly 1 entry; 400 otherwise.`}).option(`expand`,{type:`string`,description:"Comma-separated list of response sections to expand (hydrate). Allowed: `nodes`. Omitting `expand` returns identifier-only nodes."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ha={command:`get`,describe:`Expands the single-level relationship neighborhood of one or more seed nodes (event, indicator, or tag) from R2 Data Catalog. Seeds use compact id format (type:uuid), e.g. "event:550e8400-...". Multi-seed requests merge and deduplicate results server-side. Hydrates neighbor entities with summary data from Durable Objects. Supports filtering by relationship type and dataset scope.`,builder:Va,handler:async r=>{let c={seeds:r.seeds,direction:r.direction,hydration:r.hydration,limit:r.limit,max_nodes:r[`max-nodes`],relationshipTypes:r[`relationship-types`],datasetIds:r[`dataset-ids`],cursor:r.cursor,expand:r.expand};if(r.dryRun){o({command:`cf cloudforce-one stakeout graphs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/graph`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.stakeout.graphs.get({account_id:u,...c})),{successLabel:`Loaded`})}},Ua={command:`graphs`,describe:`Operations for stakeout.graphs`,builder:e=>e.command(Ha).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Wa(e){return e.option(`aggregate-by`,{type:`string`,description:`Column(s) to aggregate by - single column or comma-separated list (e.g., 'indicatorType', 'value', 'indicatorType,value')`,demandOption:!0}).option(`measure`,{type:`string`,description:`What to count per group: 'indicators' (catalog rows, default) or 'relationships' (linked events per indicator). Use 'relationships' for 'top indicator by event activity'.`,choices:[`indicators`,`relationships`]}).option(`tag-uuid`,{type:`string`,description:`Scope to indicators associated with this tag/actor UUID. Combine with measure=relationships for 'top indicator for an actor'.`}).option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to filter by, or one standalone scope value: 'all'/'*' for all accessible datasets, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, aggregates across all accessible datasets.`}).option(`created-after`,{type:`string`,description:`Filter indicators created after this date/datetime (ISO 8601, e.g., '2024-01-01' or '2024-01-01T00:00:00Z')`}).option(`created-before`,{type:`string`,description:`Filter indicators created before this date/datetime (ISO 8601, e.g., '2024-12-31' or '2024-12-31T23:59:59Z')`}).option(`event-date-after`,{type:`string`,description:`For measure=relationships: only count indicator→event links whose relationship was created/observed on or after this date (ISO 8601). Bounds the activity view to recently-observed links. Note: this filters by the relationship's createdAt (link-observation time), not the underlying event's business date.`}).option(`event-date-before`,{type:`string`,description:`For measure=relationships: only count indicator→event links whose relationship was created/observed on or before this date (ISO 8601). Bounds the activity view by the relationship's createdAt (link-observation time), not the underlying event's business date.`}).option(`limit`,{type:`number`,description:`Maximum number of aggregation results to return (1-100)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ga={command:`aggregate`,describe:`Aggregate threat indicators by one or more columns (e.g., indicatorType, value) across datasets. Returns top-N groups ordered by count.`,builder:g(Wa),handler:async r=>{let c={aggregateBy:r[`aggregate-by`],measure:r.measure,tagUuid:r[`tag-uuid`],datasetIds:r[`dataset-ids`],createdAfter:r[`created-after`],createdBefore:r[`created-before`],eventDateAfter:r[`event-date-after`],eventDateBefore:r[`event-date-before`],limit:r.limit};if(r.dryRun){o({command:`cf cloudforce-one stakeout indicators aggregate`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/indicators/aggregate`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.stakeout.indicators.aggregate({account_id:u,...c})),{successLabel:`Loaded`})}},Ka={command:`indicators`,describe:`Operations for stakeout.indicators`,builder:e=>e.command(Ga).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qa(e){return e.positional(`collection-id`,{type:`string`,description:`Collection ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ja={command:`create <collection-id>`,describe:`Create one or more items in a collection. Supports single item (data field) or bulk creation (data array). Item data is validated against the collection schema.`,builder:qa,handler:async l=>{if(l.dryRun){o({command:`cf cloudforce-one stakeout items create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${l[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(l[`collection-id`]))}/items`,pathParams:{"collection-id":String(l[`collection-id`]??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await i(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=c(l.body);a(await s(`Creating`,async()=>u.cloudforceOne.stakeout.items.create({body:e,account_id:d,collection_id:l[`collection-id`]})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/cloudforce-one/v2/collections/${encodeURIComponent(String(l[`collection-id`]))}/items`)),{successLabel:`Created`})}};function Ya(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`collection-id`,{type:`string`,description:`Collection ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Xa={command:`delete <item-id>`,describe:`Delete an item from a collection by its identifier.`,builder:Ya,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``),"item-id":String(r[`item-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
26
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.items.delete({account_id:l,collection_id:r[`collection-id`],item_id:r[`item-id`]})),{successLabel:`Deleted`})}};function Za(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`collection-id`,{type:`string`,description:`Collection ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qa={command:`get <item-id>`,describe:`Retrieve a single item from a collection by its identifier.`,builder:Za,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{"collection-id":String(r[`collection-id`]??``),"item-id":String(r[`item-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.items.get({account_id:l,collection_id:r[`collection-id`],item_id:r[`item-id`]})),{successLabel:`Loaded`})}};function $a(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`cursor`,{type:`string`,description:`Opaque pagination cursor from a previous response. Omit for the first page.`}).option(`limit`,{type:`number`,description:`Items per page`}).option(`q`,{type:`string`,description:`Case-insensitive substring search across all columns. Matches any column containing the term. No relevance ranking.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const eo={command:`query <collection-id>`,describe:`Retrieves items from a collection with keyset pagination and optional column-based filters`,builder:$a,handler:async r=>{let c={cursor:r.cursor,limit:r.limit,q:r.q};if(r.dryRun){o({command:`cf cloudforce-one stakeout items query`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/items`,pathParams:{"collection-id":String(r[`collection-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.stakeout.items.query({account_id:u,collection_id:r[`collection-id`],...c})),{successLabel:`Loaded`})}};function to(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`cursor`,{type:`string`,description:`The cursor field`}).option(`filter-field`,{type:`string`,description:`Column name to filter on`}).option(`filter-op`,{type:`string`,description:`Comparison operator`,choices:[`eq`,`neq`,`gt`,`lt`,`gte`,`lte`,`contains`,`is_empty`,`is_not_empty`]}).option(`limit`,{type:`number`,description:`The limit field`,default:20}).option(`q`,{type:`string`,description:`Case-insensitive substring search across all columns. Matches any column containing the term. No relevance ranking.`}).option(`sort-field`,{type:`string`,description:`Column name to sort by`}).option(`sort-order`,{type:`string`,description:`The sort.order field`,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)`}).implies(`filter-field`,[`filter-op`]).implies(`filter-op`,[`filter-field`]).check(e=>{if([`sort-field`,`sort-order`].some(t=>e[t]!==void 0)){let t=[`sort-field`].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 --sort-* flag is set`)}return!0})}const no={command:`search <collection-id>`,describe:`Search collection items with advanced filtering. Supports operators (eq, neq, gt, lt, gte, lte, contains, is_empty, is_not_empty) and AND/OR logic for complex queries.`,builder:to,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout items search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${r[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(r[`collection-id`]))}/search`,pathParams:{"collection-id":String(r[`collection-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({cursor:d(r.cursor,`cursor`,`text`),filter:{field:d(r[`filter-field`],`filter-field`,`text`),op:d(r[`filter-op`],`filter-op`,`text`)},limit:r.limit,q:d(r.q,`q`,`text`),sort:{field:d(r[`sort-field`],`sort-field`,`text`),order:d(r[`sort-order`],`sort-order`,`text`)}}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Loading`,async()=>l.cloudforceOne.stakeout.items.search({...e,account_id:f,collection_id:r[`collection-id`]})),{successLabel:`Loaded`});return}let p=u({cursor:d(r.cursor,`cursor`,`text`),filter:{field:d(r[`filter-field`],`filter-field`,`text`),op:d(r[`filter-op`],`filter-op`,`text`)},limit:r.limit,q:d(r.q,`q`,`text`),sort:{field:d(r[`sort-field`],`sort-field`,`text`),order:d(r[`sort-order`],`sort-order`,`text`)}});a(await s(`Loading`,async()=>l.cloudforceOne.stakeout.items.search({...p,account_id:f,collection_id:r[`collection-id`]})),{successLabel:`Loaded`})}};function ro(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`collection-id`,{type:`string`,description:`Collection ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const io={command:`update <item-id>`,describe:`Update an item in a collection with partial data.`,builder:ro,handler:async l=>{if(l.dryRun){o({command:`cf cloudforce-one stakeout items update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/collections/${l[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(l[`collection-id`]))}/items/${l[`item-id`]==null?`<item-id>`:encodeURIComponent(String(l[`item-id`]))}`,pathParams:{"collection-id":String(l[`collection-id`]??``),"item-id":String(l[`item-id`]??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await i(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=c(l.body);a(await s(`Updating`,async()=>u.cloudforceOne.stakeout.items.update({...e,account_id:d,collection_id:l[`collection-id`],item_id:l[`item-id`]})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>r(u,`PATCH`,`/accounts/${d}/cloudforce-one/v2/collections/${encodeURIComponent(String(l[`collection-id`]))}/items/${encodeURIComponent(String(l[`item-id`]))}`)),{successLabel:`Updated`})}},ao={command:`items`,describe:`Operations for stakeout.items`,builder:e=>e.command(Ja).command(Xa).command(Qa).command(eo).command(no).command(io).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oo(e){return e.option(`category`,{type:`string`,description:`The category field`}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const so={command:`create`,describe:`Create a new user-defined takedown letter template`,builder:oo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout letter-templates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/templates`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({category:d(r.category,`category`,`text`),description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.letterTemplates.create({...e,account_id:f})),{successLabel:`Created`});return}r.category===void 0&&(r.category=await p(`category`,`The category field`)),r.name===void 0&&(r.name=await p(`name`,`The name field`));let m=u({category:d(r.category,`category`,`text`),description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.letterTemplates.create({...m,account_id:f})),{successLabel:`Created`})}};function co(e){return e.positional(`template-id`,{type:`string`,description:`Template ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const lo={command:`delete <template-id>`,describe:`Delete a user-defined takedown letter template. System templates cannot be deleted.`,builder:co,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout letter-templates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/templates/${r[`template-id`]==null?`<template-id>`:encodeURIComponent(String(r[`template-id`]))}`,pathParams:{"template-id":String(r[`template-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
27
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.letterTemplates.delete({account_id:l,template_id:r[`template-id`]})),{successLabel:`Deleted`})}};function uo(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fo={command:`examples`,describe:`List system-provided example templates that can be used as starting points when creating custom templates. These templates cannot be used directly for letter generation.`,builder:uo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout letter-templates examples`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/templates/examples`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.letterTemplates.examples({account_id:l})),{successLabel:`Loaded`})}};function po(e){return e.positional(`template-id`,{type:`string`,description:`Template ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mo={command:`get <template-id>`,describe:`Get a specific user-defined takedown letter template by ID. System example templates are available via the /templates/examples endpoint.`,builder:po,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout letter-templates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/templates/${r[`template-id`]==null?`<template-id>`:encodeURIComponent(String(r[`template-id`]))}`,pathParams:{"template-id":String(r[`template-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.letterTemplates.get({account_id:l,template_id:r[`template-id`]})),{successLabel:`Loaded`})}};function ho(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const go={command:`list`,describe:`List user-defined takedown letter templates. System example templates are available via the /templates/examples endpoint.`,builder:ho,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout letter-templates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/templates`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.letterTemplates.list({account_id:l})),{successLabel:`Loaded`})}};function _o(e){return e.positional(`template-id`,{type:`string`,description:`Template ID`,demandOption:!0}).option(`category`,{type:`string`,description:`The category field`}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const vo={command:`update <template-id>`,describe:`Update a user-defined takedown letter template. System templates cannot be modified.`,builder:_o,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout letter-templates update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/templates/${r[`template-id`]==null?`<template-id>`:encodeURIComponent(String(r[`template-id`]))}`,pathParams:{"template-id":String(r[`template-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({category:d(r.category,`category`,`text`),description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.letterTemplates.update({...e,account_id:f,template_id:r[`template-id`]})),{successLabel:`Updated`});return}let p=u({category:d(r.category,`category`,`text`),description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.letterTemplates.update({...p,account_id:f,template_id:r[`template-id`]})),{successLabel:`Updated`})}},yo={command:`letter-templates`,describe:`Operations for stakeout.letter-templates`,builder:e=>e.command(so).command(lo).command(fo).command(mo).command(go).command(vo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bo(e){return e.positional(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`fields-discovery-date`,{type:`string`,description:`The fields.discoveryDate field`}).option(`fields-domain`,{type:`string`,description:`The fields.domain field`}).option(`fields-generation-date`,{type:`string`,description:`The fields.generationDate field`}).option(`fields-jurisdiction`,{type:`string`,description:`The fields.jurisdiction field`}).option(`fields-registrant-email`,{type:`string`,description:`The fields.registrantEmail field`}).option(`fields-registrar`,{type:`string`,description:`The fields.registrar field`}).option(`fields-registrar-email`,{type:`string`,description:`The fields.registrarEmail field`}).option(`fields-resolution-by-date`,{type:`string`,description:`The fields.resolutionByDate field`}).option(`fields-sender-company`,{type:`string`,description:`The fields.senderCompany field`}).option(`fields-sender-email`,{type:`string`,description:`The fields.senderEmail field`}).option(`fields-sender-name`,{type:`string`,description:`The fields.senderName field`}).option(`fields-sender-title`,{type:`string`,description:`The fields.senderTitle field`}).option(`fields-trademark-name`,{type:`string`,description:`The fields.trademarkName field`}).option(`fields-trademark-number`,{type:`string`,description:`The fields.trademarkNumber field`}).option(`fields-trademark-owner`,{type:`string`,description:`The fields.trademarkOwner field`}).option(`template-id`,{type:`string`,description:`The templateId field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const xo={command:`create <notice-id>`,describe:`Generate a takedown letter for a notice and persist the rendered text. The PDF is generated lazily on download.`,builder:bo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-letters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}/letters`,pathParams:{"notice-id":String(r[`notice-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({fields:{discoveryDate:d(r[`fields-discovery-date`],`fields-discovery-date`,`text`),domain:d(r[`fields-domain`],`fields-domain`,`text`),generationDate:d(r[`fields-generation-date`],`fields-generation-date`,`text`),jurisdiction:d(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`),registrantEmail:d(r[`fields-registrant-email`],`fields-registrant-email`,`text`),registrar:d(r[`fields-registrar`],`fields-registrar`,`text`),registrarEmail:d(r[`fields-registrar-email`],`fields-registrar-email`,`text`),resolutionByDate:d(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`),senderCompany:d(r[`fields-sender-company`],`fields-sender-company`,`text`),senderEmail:d(r[`fields-sender-email`],`fields-sender-email`,`text`),senderName:d(r[`fields-sender-name`],`fields-sender-name`,`text`),senderTitle:d(r[`fields-sender-title`],`fields-sender-title`,`text`),trademarkName:d(r[`fields-trademark-name`],`fields-trademark-name`,`text`),trademarkNumber:d(r[`fields-trademark-number`],`fields-trademark-number`,`text`),trademarkOwner:d(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)},templateId:d(r[`template-id`],`template-id`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.takedownLetters.create({...e,account_id:f,notice_id:r[`notice-id`]})),{successLabel:`Created`});return}r[`template-id`]===void 0&&(r[`template-id`]=await p(`template-id`,`The templateId field`));let m=u({fields:{discoveryDate:d(r[`fields-discovery-date`],`fields-discovery-date`,`text`),domain:d(r[`fields-domain`],`fields-domain`,`text`),generationDate:d(r[`fields-generation-date`],`fields-generation-date`,`text`),jurisdiction:d(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`),registrantEmail:d(r[`fields-registrant-email`],`fields-registrant-email`,`text`),registrar:d(r[`fields-registrar`],`fields-registrar`,`text`),registrarEmail:d(r[`fields-registrar-email`],`fields-registrar-email`,`text`),resolutionByDate:d(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`),senderCompany:d(r[`fields-sender-company`],`fields-sender-company`,`text`),senderEmail:d(r[`fields-sender-email`],`fields-sender-email`,`text`),senderName:d(r[`fields-sender-name`],`fields-sender-name`,`text`),senderTitle:d(r[`fields-sender-title`],`fields-sender-title`,`text`),trademarkName:d(r[`fields-trademark-name`],`fields-trademark-name`,`text`),trademarkNumber:d(r[`fields-trademark-number`],`fields-trademark-number`,`text`),trademarkOwner:d(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)},templateId:d(r[`template-id`],`template-id`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.takedownLetters.create({...m,account_id:f,notice_id:r[`notice-id`]})),{successLabel:`Created`})}};function So(e){return e.positional(`letter-id`,{type:`string`,description:`Letter ID`,demandOption:!0}).option(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Co={command:`delete <letter-id>`,describe:`Delete a specific takedown letter and its associated PDF from storage.`,builder:So,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-letters delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}/letters/${r[`letter-id`]==null?`<letter-id>`:encodeURIComponent(String(r[`letter-id`]))}`,pathParams:{"notice-id":String(r[`notice-id`]??``),"letter-id":String(r[`letter-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
28
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.takedownLetters.delete({account_id:l,notice_id:r[`notice-id`],letter_id:r[`letter-id`]})),{successLabel:`Deleted`})}};function wo(e){return e.option(`create-notice`,{type:`boolean`,description:`The createNotice field`,default:!1}).option(`fields-discovery-date`,{type:`string`,description:`The fields.discoveryDate field`}).option(`fields-domain`,{type:`string`,description:`The fields.domain field`}).option(`fields-generation-date`,{type:`string`,description:`The fields.generationDate field`}).option(`fields-jurisdiction`,{type:`string`,description:`The fields.jurisdiction field`}).option(`fields-registrant-email`,{type:`string`,description:`The fields.registrantEmail field`}).option(`fields-registrar`,{type:`string`,description:`The fields.registrar field`}).option(`fields-registrar-email`,{type:`string`,description:`The fields.registrarEmail field`}).option(`fields-resolution-by-date`,{type:`string`,description:`The fields.resolutionByDate field`}).option(`fields-sender-company`,{type:`string`,description:`The fields.senderCompany field`}).option(`fields-sender-email`,{type:`string`,description:`The fields.senderEmail field`}).option(`fields-sender-name`,{type:`string`,description:`The fields.senderName field`}).option(`fields-sender-title`,{type:`string`,description:`The fields.senderTitle field`}).option(`fields-trademark-name`,{type:`string`,description:`The fields.trademarkName field`}).option(`fields-trademark-number`,{type:`string`,description:`The fields.trademarkNumber field`}).option(`fields-trademark-owner`,{type:`string`,description:`The fields.trademarkOwner field`}).option(`format`,{type:`string`,description:`The format field`,choices:[`text`,`pdf`],default:`text`}).option(`notice-params-domain`,{type:`string`,description:`The noticeParams.domain field`}).option(`notice-params-query-id`,{type:`number`,description:`The noticeParams.queryId field`}).option(`notice-params-status`,{type:`string`,description:`The noticeParams.status field`,choices:[`draft`,`sent`,`resolved`,`expired`]}).option(`template-id`,{type:`string`,description:`The templateId 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)`}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}).check(e=>{if([`notice-params-domain`,`notice-params-query-id`,`notice-params-status`].some(t=>e[t]!==void 0)){let t=[`notice-params-domain`].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 --noticeParams-* flag is set`)}return!0})}const To={command:`generate`,describe:`Generate a takedown letter from a template. Returns V4 JSON for text format or a PDF binary for pdf format.`,builder:wo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-letters generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/letter/generate`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({createNotice:r[`create-notice`],fields:{discoveryDate:d(r[`fields-discovery-date`],`fields-discovery-date`,`text`),domain:d(r[`fields-domain`],`fields-domain`,`text`),generationDate:d(r[`fields-generation-date`],`fields-generation-date`,`text`),jurisdiction:d(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`),registrantEmail:d(r[`fields-registrant-email`],`fields-registrant-email`,`text`),registrar:d(r[`fields-registrar`],`fields-registrar`,`text`),registrarEmail:d(r[`fields-registrar-email`],`fields-registrar-email`,`text`),resolutionByDate:d(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`),senderCompany:d(r[`fields-sender-company`],`fields-sender-company`,`text`),senderEmail:d(r[`fields-sender-email`],`fields-sender-email`,`text`),senderName:d(r[`fields-sender-name`],`fields-sender-name`,`text`),senderTitle:d(r[`fields-sender-title`],`fields-sender-title`,`text`),trademarkName:d(r[`fields-trademark-name`],`fields-trademark-name`,`text`),trademarkNumber:d(r[`fields-trademark-number`],`fields-trademark-number`,`text`),trademarkOwner:d(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)},format:d(r.format,`format`,`text`),noticeParams:{domain:d(r[`notice-params-domain`],`notice-params-domain`,`text`),queryId:r[`notice-params-query-id`],status:d(r[`notice-params-status`],`notice-params-status`,`text`)},templateId:d(r[`template-id`],`template-id`,`text`)}):c(r.body)});return}await i(r);let a=r.local?e:await t();if(r.accountId=a,r.body){let e=c(r.body),t=await s(`Creating`,async()=>v(`/accounts/${a}/cloudforce-one/v2/brand-protection/letter/generate`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:JSON.stringify(e),contentType:`application/json`}));_(r.text===!0?t.toString(`utf-8`):t);return}r[`template-id`]===void 0&&(r[`template-id`]=await p(`template-id`,`The templateId field`));let f={};r[`create-notice`]!==void 0&&l(f,[`createNotice`],r[`create-notice`]),r[`fields-discovery-date`]!==void 0&&l(f,[`fields`,`discoveryDate`],d(r[`fields-discovery-date`],`fields-discovery-date`,`text`)),r[`fields-domain`]!==void 0&&l(f,[`fields`,`domain`],d(r[`fields-domain`],`fields-domain`,`text`)),r[`fields-generation-date`]!==void 0&&l(f,[`fields`,`generationDate`],d(r[`fields-generation-date`],`fields-generation-date`,`text`)),r[`fields-jurisdiction`]!==void 0&&l(f,[`fields`,`jurisdiction`],d(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`)),r[`fields-registrant-email`]!==void 0&&l(f,[`fields`,`registrantEmail`],d(r[`fields-registrant-email`],`fields-registrant-email`,`text`)),r[`fields-registrar`]!==void 0&&l(f,[`fields`,`registrar`],d(r[`fields-registrar`],`fields-registrar`,`text`)),r[`fields-registrar-email`]!==void 0&&l(f,[`fields`,`registrarEmail`],d(r[`fields-registrar-email`],`fields-registrar-email`,`text`)),r[`fields-resolution-by-date`]!==void 0&&l(f,[`fields`,`resolutionByDate`],d(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`)),r[`fields-sender-company`]!==void 0&&l(f,[`fields`,`senderCompany`],d(r[`fields-sender-company`],`fields-sender-company`,`text`)),r[`fields-sender-email`]!==void 0&&l(f,[`fields`,`senderEmail`],d(r[`fields-sender-email`],`fields-sender-email`,`text`)),r[`fields-sender-name`]!==void 0&&l(f,[`fields`,`senderName`],d(r[`fields-sender-name`],`fields-sender-name`,`text`)),r[`fields-sender-title`]!==void 0&&l(f,[`fields`,`senderTitle`],d(r[`fields-sender-title`],`fields-sender-title`,`text`)),r[`fields-trademark-name`]!==void 0&&l(f,[`fields`,`trademarkName`],d(r[`fields-trademark-name`],`fields-trademark-name`,`text`)),r[`fields-trademark-number`]!==void 0&&l(f,[`fields`,`trademarkNumber`],d(r[`fields-trademark-number`],`fields-trademark-number`,`text`)),r[`fields-trademark-owner`]!==void 0&&l(f,[`fields`,`trademarkOwner`],d(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)),r.format!==void 0&&l(f,[`format`],d(r.format,`format`,`text`)),r[`notice-params-domain`]!==void 0&&l(f,[`noticeParams`,`domain`],d(r[`notice-params-domain`],`notice-params-domain`,`text`)),r[`notice-params-query-id`]!==void 0&&l(f,[`noticeParams`,`queryId`],r[`notice-params-query-id`]),r[`notice-params-status`]!==void 0&&l(f,[`noticeParams`,`status`],d(r[`notice-params-status`],`notice-params-status`,`text`)),r[`template-id`]!==void 0&&l(f,[`templateId`],d(r[`template-id`],`template-id`,`text`));let m=await s(`Creating`,async()=>v(`/accounts/${a}/cloudforce-one/v2/brand-protection/letter/generate`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:Object.keys(f).length>0?f:void 0}));_(r.text===!0?m.toString(`utf-8`):m)}};function Eo(e){return e.positional(`letter-id`,{type:`string`,description:`Letter ID`,demandOption:!0}).option(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const Do={command:`get-pdf <letter-id>`,describe:`Download the PDF for a stored takedown letter. If no PDF exists yet, it is generated from the stored letter text and cached for future downloads.`,builder:Eo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-letters get-pdf`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}/letters/${r[`letter-id`]==null?`<letter-id>`:encodeURIComponent(String(r[`letter-id`]))}/pdf`,pathParams:{"notice-id":String(r[`notice-id`]??``),"letter-id":String(r[`letter-id`]??``)},bodyKind:`none`});return}await i(r);let a=r.local?e:await t();r.accountId=a;let c=await s(`Loading`,async()=>v(`/accounts/${a}/cloudforce-one/v2/brand-protection/takedown-notices/${encodeURIComponent(String(r[`notice-id`]))}/letters/${encodeURIComponent(String(r[`letter-id`]))}/pdf`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}));_(r.text===!0?c.toString(`utf-8`):c)}};function Oo(e){return e.positional(`letter-id`,{type:`string`,description:`Letter ID`,demandOption:!0}).option(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ko={command:`get <letter-id>`,describe:`Get a specific takedown letter by ID, including the rendered text.`,builder:Oo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-letters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}/letters/${r[`letter-id`]==null?`<letter-id>`:encodeURIComponent(String(r[`letter-id`]))}`,pathParams:{"notice-id":String(r[`notice-id`]??``),"letter-id":String(r[`letter-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.takedownLetters.get({account_id:l,notice_id:r[`notice-id`],letter_id:r[`letter-id`]})),{successLabel:`Loaded`})}};function Ao(e){return e.option(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const jo={command:`list`,describe:`List all letters for a specific takedown notice.`,builder:Ao,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-letters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}/letters`,pathParams:{"notice-id":String(r[`notice-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.takedownLetters.list({account_id:l,notice_id:r[`notice-id`]})),{successLabel:`Loaded`})}},Mo={command:`takedown-letters`,describe:`Operations for stakeout.takedown-letters`,builder:e=>e.command(xo).command(Co).command(To).command(ko).command(Do).command(jo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function No(e){return e.option(`domain`,{type:`string`,description:`The domain field`}).option(`match-id`,{type:`number`,description:`The matchId field`}).option(`match-type`,{type:`string`,description:`The matchType field`,choices:[`logo`,`domain`]}).option(`query-id`,{type:`number`,description:`The queryId field`}).option(`status`,{type:`string`,description:`The status field`,choices:[`draft`,`sent`,`resolved`,`expired`],default:`draft`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Po={command:`create`,describe:`Create a new takedown notice for a domain suspected of trademark infringement.`,builder:No,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-notices create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({domain:d(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:d(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:d(r.status,`status`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.takedownNotices.create({...e,account_id:f})),{successLabel:`Created`});return}r.domain===void 0&&(r.domain=await p(`domain`,`The domain field`));let m=u({domain:d(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:d(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:d(r.status,`status`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.takedownNotices.create({...m,account_id:f})),{successLabel:`Created`})}};function Fo(e){return e.positional(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Io={command:`delete <notice-id>`,describe:`Delete a takedown notice and all associated letters. PDFs are also removed from storage.`,builder:Fo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-notices delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}`,pathParams:{"notice-id":String(r[`notice-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
29
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.takedownNotices.delete({account_id:l,notice_id:r[`notice-id`]})),{successLabel:`Deleted`})}};function Lo(e){return e.positional(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ro={command:`get <notice-id>`,describe:`Get a specific takedown notice by ID.`,builder:Lo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-notices get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}`,pathParams:{"notice-id":String(r[`notice-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.takedownNotices.get({account_id:l,notice_id:r[`notice-id`]})),{successLabel:`Loaded`})}};function zo(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Bo={command:`list`,describe:`List all takedown notices for the account.`,builder:zo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-notices list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.takedownNotices.list({account_id:l})),{successLabel:`Loaded`})}};function Vo(e){return e.option(`domains`,{type:`string`,array:!0,description:`The domains field`}).option(`query-id`,{type:`number`,description:`The queryId field`}).option(`query-ids`,{type:`string`,array:!0,description:`The queryIds field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ho={command:`lookup`,describe:`Bulk lookup of takedown notices by domain names. Returns an array of { domain, queryId, notice } entries (notice is null when no match exists). Supports optional queryId or queryIds to scope lookups per query. Uses POST to avoid URL length limits when looking up many domains. This endpoint is read-only. Domains are normalized (trimmed, lowercased) and deduplicated.`,builder:Vo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-notices lookup`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/lookup`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({domains:r.domains,queryId:r[`query-id`],queryIds:r[`query-ids`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.takedownNotices.lookup({...e,account_id:d})),{successLabel:`Created`});return}if(r.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);let f=u({domains:r.domains,queryId:r[`query-id`],queryIds:r[`query-ids`]});a(await s(`Creating`,async()=>l.cloudforceOne.stakeout.takedownNotices.lookup({...f,account_id:d})),{successLabel:`Created`})}};function Uo(e){return e.positional(`notice-id`,{type:`string`,description:`Notice ID`,demandOption:!0}).option(`domain`,{type:`string`,description:`The domain field`}).option(`match-id`,{type:`number`,description:`The matchId field`}).option(`match-type`,{type:`string`,description:`The matchType field`,choices:[`logo`,`domain`]}).option(`query-id`,{type:`number`,description:`The queryId field`}).option(`status`,{type:`string`,description:`The status field`,choices:[`draft`,`sent`,`resolved`,`expired`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Wo={command:`update <notice-id>`,describe:`Update a takedown notice (e.g. change status to sent, resolved, etc.).`,builder:Uo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one stakeout takedown-notices update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/takedown-notices/${r[`notice-id`]==null?`<notice-id>`:encodeURIComponent(String(r[`notice-id`]))}`,pathParams:{"notice-id":String(r[`notice-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({domain:d(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:d(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:d(r.status,`status`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.takedownNotices.update({...e,account_id:f,notice_id:r[`notice-id`]})),{successLabel:`Updated`});return}let p=u({domain:d(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:d(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:d(r.status,`status`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.stakeout.takedownNotices.update({...p,account_id:f,notice_id:r[`notice-id`]})),{successLabel:`Updated`})}},Go={command:`takedown-notices`,describe:`Operations for stakeout.takedown-notices`,builder:e=>e.command(Po).command(Io).command(Ro).command(Bo).command(Ho).command(Wo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ko={command:`stakeout`,describe:`Operations for stakeout`,builder:e=>e.command(Ea).command(Na).command(Ba).command(Ua).command(Ka).command(ao).command(yo).command(Mo).command(Go).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qo(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query attackers from. If not provided, uses the default dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Jo={command:`list`,describe:`Lists known threat attackers tracked in Cloudforce One threat intelligence.`,builder:qo,handler:async r=>{let c={datasetIds:r[`dataset-ids`]};if(r.dryRun){o({command:`cf cloudforce-one threat-events attackers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/attackers`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatEvents.attackers.list({account_id:u,...c})),{successLabel:`Loaded`})}},Yo={command:`attackers`,describe:`Operations for threat-events.attackers`,builder:e=>e.command(Jo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Xo(e){return e.option(`dataset-id`,{type:`string`,description:`The datasetId field`}).option(`include-created-events`,{type:`boolean`,description:`When true, response includes array of created event UUIDs and shard IDs. Useful for tracking which events were created and where.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Zo={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:Xo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/create/bulk`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({datasetId:d(r[`dataset-id`],`dataset-id`,`text`),includeCreatedEvents:r[`include-created-events`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.bulkCreate({...e,account_id:f})),{successLabel:`Created`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await p(`dataset-id`,`The datasetId field`));let m=u({datasetId:d(r[`dataset-id`],`dataset-id`,`text`),includeCreatedEvents:r[`include-created-events`]});a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.bulkCreate({...m,account_id:f})),{successLabel:`Created`})}};function Qo(e){return e.option(`kill-chain`,{type:`number`,description:`The killChain field`}).option(`mitre-attack`,{type:`string`,array:!0,description:`The mitreAttack field`}).option(`mitre-capec`,{type:`string`,array:!0,description:`The mitreCapec field`}).option(`name`,{type:`string`,description:`The name field`}).option(`shortname`,{type:`string`,description:`The shortname field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const $o={command:`create`,describe:`Creates a new threat event category in Cloudforce One for organizing and classifying threat events.`,builder:Qo,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories/create`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:d(r.name,`name`,`text`),shortname:d(r.shortname,`shortname`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.categories.create({...e,account_id:f})),{successLabel:`Created`});return}if(r[`kill-chain`]===void 0)throw Error(`--kill-chain is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await p(`name`,`The name field`));let m=u({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:d(r.name,`name`,`text`),shortname:d(r.shortname,`shortname`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.categories.create({...m,account_id:f})),{successLabel:`Created`})}};function es(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ts={command:`delete <category-id>`,describe:`Removes a threat event category from Cloudforce One.`,builder:es,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories/${r[`category-id`]==null?`<category-id>`:encodeURIComponent(String(r[`category-id`]))}`,pathParams:{"category-id":String(r[`category-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
30
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.categories.delete({account_id:l,category_id:r[`category-id`]})),{successLabel:`Deleted`})}};function ns(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`kill-chain`,{type:`number`,description:`The killChain field`}).option(`mitre-attack`,{type:`string`,array:!0,description:`The mitreAttack field`}).option(`mitre-capec`,{type:`string`,array:!0,description:`The mitreCapec field`}).option(`name`,{type:`string`,description:`The name field`}).option(`shortname`,{type:`string`,description:`The shortname field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const rs={command:`edit <category-id>`,describe:`Partially updates a threat event category in Cloudforce One, modifying specific fields without replacing the entire category.`,builder:ns,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events categories edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories/${r[`category-id`]==null?`<category-id>`:encodeURIComponent(String(r[`category-id`]))}`,pathParams:{"category-id":String(r[`category-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:d(r.name,`name`,`text`),shortname:d(r.shortname,`shortname`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.categories.edit({...e,account_id:f,category_id:r[`category-id`]})),{successLabel:`Updated`});return}let p=u({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:d(r.name,`name`,`text`),shortname:d(r.shortname,`shortname`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.categories.edit({...p,account_id:f,category_id:r[`category-id`]})),{successLabel:`Updated`})}};function is(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const as={command:`get <category-id>`,describe:`Retrieves details for a specific threat event category.`,builder:is,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories/${r[`category-id`]==null?`<category-id>`:encodeURIComponent(String(r[`category-id`]))}`,pathParams:{"category-id":String(r[`category-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.categories.get({account_id:l,category_id:r[`category-id`]})),{successLabel:`Loaded`})}};function os(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query categories from. If not provided, uses the default dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ss={command:`list`,describe:`Lists all threat event categories configured for classifying and organizing threat events.`,builder:os,handler:async r=>{let c={datasetIds:r[`dataset-ids`]};if(r.dryRun){o({command:`cf cloudforce-one threat-events categories list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/categories`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatEvents.categories.list({account_id:u,...c})),{successLabel:`Loaded`})}},cs={command:`categories`,describe:`Operations for threat-events.categories`,builder:e=>e.command($o).command(ts).command(rs).command(as).command(ss).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ls(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const us={command:`list`,describe:`Lists countries referenced in Cloudforce One threat intelligence data.`,builder:ls,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events countries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/countries`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.countries.list({account_id:l})),{successLabel:`Loaded`})}},ds={command:`countries`,describe:`Operations for threat-events.countries`,builder:e=>e.command(us).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fs(e){return e.positional(`account-id-path`,{type:`string`,description:`Account ID.`,demandOption:!0}).option(`account-id`,{type:`number`,description:`The accountId field`}).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(`source-resource-id`,{type:`string`,description:`The source.resourceId field`}).option(`source-resource-type`,{type:`string`,description:`The source.resourceType field`,choices:[`article`]}).option(`source-system`,{type:`string`,description:`The source.system field`,choices:[`threat-signals`]}).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)`}).check(e=>{if([`source-resource-id`,`source-resource-type`,`source-system`].some(t=>e[t]!==void 0)){let t=[`source-resource-id`,`source-resource-type`,`source-system`].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 --source-* flag is set`)}return!0})}const ps={command:`create <account-id-path>`,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:fs,handler:async e=>{if(e.dryRun){o({command:`cf cloudforce-one threat-events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/cloudforce-one/events/create`,pathParams:{"account-id-path":String(e[`account-id-path`]??``)},bodyKind:`json`,body:e.body===void 0?u({accountId:e[`account-id`],attacker:d(e.attacker,`attacker`,`text`),attackerCountry:d(e[`attacker-country`],`attacker-country`,`text`),category:d(e.category,`category`,`text`),datasetId:d(e[`dataset-id`],`dataset-id`,`text`),date:d(e.date,`date`,`text`),event:d(e.event,`event`,`text`),indicator:d(e.indicator,`indicator`,`text`),indicatorType:d(e[`indicator-type`],`indicator-type`,`text`),insight:d(e.insight,`insight`,`text`),raw:{source:d(e[`raw-source`],`raw-source`,`text`),tlp:d(e[`raw-tlp`],`raw-tlp`,`text`)},source:{resourceId:d(e[`source-resource-id`],`source-resource-id`,`text`),resourceType:d(e[`source-resource-type`],`source-resource-type`,`text`),system:d(e[`source-system`],`source-system`,`text`)},tags:e.tags,targetCountry:d(e[`target-country`],`target-country`,`text`),targetIndustry:d(e[`target-industry`],`target-industry`,`text`),tlp:d(e.tlp,`tlp`,`text`)}):c(e.body)});return}let t=await i(e);if(e.body){let n=c(e.body);a(await s(`Creating`,async()=>t.cloudforceOne.threatEvents.create({...n,account_id_path:e[`account-id-path`]})),{successLabel:`Created`});return}e.category===void 0&&(e.category=await p(`category`,`The category field`)),e.date===void 0&&(e.date=await p(`date`,`The date field`)),e.event===void 0&&(e.event=await p(`event`,`The event field`)),e.tlp===void 0&&(e.tlp=await p(`tlp`,`The tlp field`));let n=u({accountId:e[`account-id`],attacker:d(e.attacker,`attacker`,`text`),attackerCountry:d(e[`attacker-country`],`attacker-country`,`text`),category:d(e.category,`category`,`text`),datasetId:d(e[`dataset-id`],`dataset-id`,`text`),date:d(e.date,`date`,`text`),event:d(e.event,`event`,`text`),indicator:d(e.indicator,`indicator`,`text`),indicatorType:d(e[`indicator-type`],`indicator-type`,`text`),insight:d(e.insight,`insight`,`text`),raw:{source:d(e[`raw-source`],`raw-source`,`text`),tlp:d(e[`raw-tlp`],`raw-tlp`,`text`)},source:{resourceId:d(e[`source-resource-id`],`source-resource-id`,`text`),resourceType:d(e[`source-resource-type`],`source-resource-type`,`text`),system:d(e[`source-system`],`source-system`,`text`)},tags:e.tags,targetCountry:d(e[`target-country`],`target-country`,`text`),targetIndustry:d(e[`target-industry`],`target-industry`,`text`),tlp:d(e.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>t.cloudforceOne.threatEvents.create({...n,account_id_path:e[`account-id-path`]})),{successLabel:`Created`})}};function ms(e){return e.option(`is-public`,{type:`boolean`,description:`If true, then anyone can search the dataset. If false, then its limited to the account.`}).option(`name`,{type:`string`,description:`Used to describe the dataset within the account context.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const hs={command:`create`,describe:`Creates a new threat event dataset in Cloudforce One for organizing related threat events.`,builder:ms,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/create`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({isPublic:r[`is-public`],name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.datasets.create({...e,account_id:f})),{successLabel:`Created`});return}if(r[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await p(`name`,`Used to describe the dataset within the account context.`));let m=u({isPublic:r[`is-public`],name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.datasets.create({...m,account_id:f})),{successLabel:`Created`})}};function gs(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`is-public`,{type:`boolean`,description:`If true, then anyone can search the dataset. If false, then its limited to the account.`}).option(`name`,{type:`string`,description:`Used to describe the dataset within the account context.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _s={command:`edit <dataset-id>`,describe:`Partially updates a threat event dataset in Cloudforce One, modifying specific fields without replacing the entire dataset configuration.`,builder:gs,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events datasets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({isPublic:r[`is-public`],name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.datasets.edit({...e,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Updated`});return}if(r[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await p(`name`,`Used to describe the dataset within the account context.`));let m=u({isPublic:r[`is-public`],name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.datasets.edit({...m,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Updated`})}};function vs(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ys={command:`get <dataset-id>`,describe:`Retrieves details for a specific threat event dataset.`,builder:vs,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.datasets.get({account_id:l,dataset_id:r[`dataset-id`]})),{successLabel:`Loaded`})}};function bs(e){return e.option(`include-deleted`,{type:`boolean`,description:"When true, include soft-deleted datasets in the response. Each item includes a `deletedAt` field (ISO 8601 or null). Default: false."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xs={command:`list`,describe:`Lists all threat event datasets configured in Cloudforce One.`,builder:bs,handler:async r=>{let c={includeDeleted:r[`include-deleted`]};if(r.dryRun){o({command:`cf cloudforce-one threat-events datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatEvents.datasets.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ss(e){return e.positional(`event-id`,{type:`string`,description:`Event ID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Cs={command:`raw <event-id>`,describe:`Retrieves the raw data associated with an event. Searches across all shards in the dataset.`,builder:Ss,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events datasets raw`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/raw/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``),"dataset-id":String(r[`dataset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.datasets.raw({account_id:l,dataset_id:r[`dataset-id`],event_id:r[`event-id`]})),{successLabel:`Loaded`})}},ws={command:`datasets`,describe:`Operations for threat-events.datasets`,builder:e=>e.command(hs).command(_s).command(ys).command(xs).command(Cs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ts(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`attacker`,{type:`string`,description:`The attacker field`}).option(`attacker-country`,{type:`string`,description:`The attackerCountry field`}).option(`category`,{type:`string`,description:`The category field`}).option(`created-at`,{type:`string`,description:`The createdAt field`}).option(`dataset-id`,{type:`string`,description:`Dataset ID containing the event to update.`}).option(`date`,{type:`string`,description:`The date field`}).option(`event`,{type:`string`,description:`The event field`}).option(`indicator`,{type:`string`,description:`The indicator field`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Es={command:`edit <event-id>`,describe:`Partially updates a threat event in Cloudforce One, modifying specific fields without replacing the entire event.`,builder:Ts,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({attacker:d(r.attacker,`attacker`,`text`),attackerCountry:d(r[`attacker-country`],`attacker-country`,`text`),category:d(r.category,`category`,`text`),createdAt:d(r[`created-at`],`created-at`,`text`),datasetId:d(r[`dataset-id`],`dataset-id`,`text`),date:d(r.date,`date`,`text`),event:d(r.event,`event`,`text`),indicator:d(r.indicator,`indicator`,`text`),indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),insight:d(r.insight,`insight`,`text`),raw:{source:d(r[`raw-source`],`raw-source`,`text`),tlp:d(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:d(r[`target-country`],`target-country`,`text`),targetIndustry:d(r[`target-industry`],`target-industry`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.edit({...e,account_id:f,event_id:r[`event-id`]})),{successLabel:`Updated`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await p(`dataset-id`,`Dataset ID containing the event to update.`));let m=u({attacker:d(r.attacker,`attacker`,`text`),attackerCountry:d(r[`attacker-country`],`attacker-country`,`text`),category:d(r.category,`category`,`text`),createdAt:d(r[`created-at`],`created-at`,`text`),datasetId:d(r[`dataset-id`],`dataset-id`,`text`),date:d(r.date,`date`,`text`),event:d(r.event,`event`,`text`),indicator:d(r.indicator,`indicator`,`text`),indicatorType:d(r[`indicator-type`],`indicator-type`,`text`),insight:d(r.insight,`insight`,`text`),raw:{source:d(r[`raw-source`],`raw-source`,`text`),tlp:d(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:d(r[`target-country`],`target-country`,`text`),targetIndustry:d(r[`target-industry`],`target-industry`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.edit({...m,account_id:f,event_id:r[`event-id`]})),{successLabel:`Updated`})}};function Ds(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Os={command:`create <event-id>`,describe:`Adds a tag to a threat event in Cloudforce One for classification and filtering.`,builder:Ds,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events event-tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/event_tag/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}/create`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({tags:r.tags}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.eventTags.create({...e,account_id:d,event_id:r[`event-id`]})),{successLabel:`Created`});return}if(r.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let f=u({tags:r.tags});a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.eventTags.create({...f,account_id:d,event_id:r[`event-id`]})),{successLabel:`Created`})}};function ks(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const As={command:`delete <event-id>`,describe:`Removes a tag from a threat event in Cloudforce One.`,builder:ks,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events event-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/event_tag/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({tags:r.tags}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,!await h({force:!!r.force})){process.stderr.write(`Aborted.
31
- `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>l.cloudforceOne.threatEvents.eventTags.delete({...e,account_id:d,event_id:r[`event-id`]})),{successLabel:`Deleted`});return}if(r.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let f=u({tags:r.tags});a(await s(`Deleting`,async()=>l.cloudforceOne.threatEvents.eventTags.delete({...f,account_id:d,event_id:r[`event-id`]})),{successLabel:`Deleted`})}},js={command:`event-tags`,describe:`Operations for threat-events.event-tags`,builder:e=>e.command(Os).command(As).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ms(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ns={command:`get <event-id>`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/events/:event_id instead.`,builder:Ms,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.get({account_id:l,event_id:r[`event-id`]})),{successLabel:`Loaded`})}};function Ps(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fs={command:`list`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes instead.`,builder:Ps,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events indicator-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/indicatorTypes`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.indicatorTypes.list({account_id:l})),{successLabel:`Loaded`})}},Is={command:`indicator-types`,describe:`Operations for threat-events.indicator-types`,builder:e=>e.command(Fs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ls(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination. When provided, filters are embedded in the cursor so you only need to pass cursor and pageSize. Returned in the previous response's result_info.cursor field. Use cursor-based pagination for deep pagination (beyond 100,000 records) or for optimal performance.`}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page number (1-indexed) for offset-based pagination. Limited to offset of 100,000 records. For deep pagination, use cursor-based pagination instead.`}).option(`page-size`,{type:`number`,description:`Number of results per page. Maximum 25,000.`}).option(`order-by`,{type:`string`,description:`OrderBy`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`dataset-id`,{type:`string`,description:`Dataset UUIDs to query, or one standalone scope value: 'all'/'*' for the legacy all-datasets behavior, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, uses the default dataset.`}).option(`force-refresh`,{type:`boolean`,description:`ForceRefresh`}).option(`format`,{type:`string`,description:`Format`,choices:[`json`,`stix2`,`taxii`]}).option(`cache`,{type:`string`,description:`Cache strategy. 'from-graph' serves results from the graph-node KV cache when all requested UUIDs are cached; falls back to normal path on partial/zero hit.`,choices:[`from-graph`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Rs={command:`list`,describe:"Use `datasetId=all` or `datasetId=*` for the legacy all-datasets scope, `datasetId=analytics` for datasets with `isAnalytics=true`, or `datasetId=operational` for datasets with `isAnalytics=false` (limited to 50). Scope values must be used alone. 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:g(Ls),handler:async r=>{let c={cursor:r.cursor,search:r.search,page:r.page,pageSize:r[`page-size`],orderBy:r[`order-by`],order:r.order,datasetId:r[`dataset-id`],forceRefresh:r[`force-refresh`],format:r.format,cache:r.cache};if(r.dryRun){o({command:`cf cloudforce-one threat-events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatEvents.list({account_id:u,...c})),{successLabel:`Loaded`})}};function zs(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`source`,{type:`string`,description:`The source field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Bs={command:`edit <raw-id>`,describe:`Partially updates raw threat event data in Cloudforce One, modifying specific fields of the event.`,builder:zs,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events raw edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}/raw/${r[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(r[`raw-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``),"raw-id":String(r[`raw-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({source:d(r.source,`source`,`text`),tlp:d(r.tlp,`tlp`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.raw.edit({...e,account_id:f,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Updated`});return}let p=u({source:d(r.source,`source`,`text`),tlp:d(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatEvents.raw.edit({...p,account_id:f,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Updated`})}};function Vs(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hs={command:`get <raw-id>`,describe:`Retrieves raw threat event data for a specific event in Cloudforce One.`,builder:Vs,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}/raw/${r[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(r[`raw-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``),"raw-id":String(r[`raw-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatEvents.raw.get({account_id:l,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Loaded`})}},Us={command:`raw`,describe:`Operations for threat-events.raw`,builder:e=>e.command(Bs).command(Hs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ws(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`events`,{type:`string`,array:!0,description:`The events field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Gs={command:`delete <event-id>`,describe:`Removes a reference link between related threat events in Cloudforce One.`,builder:Ws,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events relate delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/relate/${r[`event-id`]==null?`<event-id>`:encodeURIComponent(String(r[`event-id`]))}`,pathParams:{"event-id":String(r[`event-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({events:r.events}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,!await h({force:!!r.force})){process.stderr.write(`Aborted.
32
- `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>l.cloudforceOne.threatEvents.relate.delete({...e,account_id:d,event_id:r[`event-id`]})),{successLabel:`Deleted`});return}if(r.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let f=u({events:r.events});a(await s(`Deleting`,async()=>l.cloudforceOne.threatEvents.relate.delete({...f,account_id:d,event_id:r[`event-id`]})),{successLabel:`Deleted`})}},Ks={command:`relate`,describe:`Operations for threat-events.relate`,builder:e=>e.command(Gs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qs(e){return e.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(`category-uuid`,{type:`string`,description:"Tag type (category) UUID. Optional — when present, `properties` is validated against this category's schema. When absent, the tag is typeless and properties are accepted free-form."}).option(`confidence`,{type:`number`,description:`Overall tag confidence (1-10). Optional.`}).option(`date-of-discovery`,{type:`string`,description:`Date of discovery (ISO YYYY-MM-DD). Optional.`}).option(`description`,{type:`string`,description:`The description field`}).option(`external-reference-links`,{type:`string`,array:!0,description:`The externalReferenceLinks field`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`last-seen`,{type:`string`,description:`The lastSeen field`}).option(`tlp`,{type:`string`,description:`Tag-level TLP handling marking. Optional. Allowed values: red, amber, amber-strict, green, clear, purple, amber+strict.`,choices:[`red`,`amber`,`amber-strict`,`green`,`clear`,`purple`,`amber+strict`]}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Js={command:`create`,describe:`Creates a new tag to be used accross threat events.`,builder:qs,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-events tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/create`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],categoryUuid:d(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:d(r[`date-of-discovery`],`date-of-discovery`,`text`),description:d(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],internalDescription:d(r[`internal-description`],`internal-description`,`text`),lastSeen:d(r[`last-seen`],`last-seen`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.tags.create({...e,account_id:f})),{successLabel:`Created`});return}r.value===void 0&&(r.value=await p(`value`,`The value field`));let m=u({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],categoryUuid:d(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:d(r[`date-of-discovery`],`date-of-discovery`,`text`),description:d(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],internalDescription:d(r[`internal-description`],`internal-description`,`text`),lastSeen:d(r[`last-seen`],`last-seen`,`text`),tlp:d(r.tlp,`tlp`,`text`),value:d(r.value,`value`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatEvents.tags.create({...m,account_id:f})),{successLabel:`Created`})}},Ys={command:`tags`,describe:`Operations for threat-events.tags`,builder:e=>e.command(Js).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Xs(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query target industries from. If not provided, uses the default dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Zs={command:`list`,describe:`Retrieves the catalog of industry classifications used in Cloudforce One threat intelligence.`,builder:Xs,handler:async r=>{let c={datasetIds:r[`dataset-ids`]};if(r.dryRun){o({command:`cf cloudforce-one threat-events target-industries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/targetIndustries`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatEvents.targetIndustries.list({account_id:u,...c})),{successLabel:`Loaded`})}},Qs={command:`target-industries`,describe:`Operations for threat-events.target-industries`,builder:e=>e.command(Zs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$s={command:`threat-events`,describe:`Operations for threat-events`,builder:e=>e.command(Zo).command(ps).command(Es).command(Ns).command(Rs).command(Yo).command(cs).command(ds).command(ws).command(js).command(Is).command(Us).command(Ks).command(Ys).command(Qs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ec(e){return e.option(`article-ids`,{type:`string`,array:!0,description:`The article_ids field`}).option(`read`,{type:`boolean`,description:`The read field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const tc={command:`bulk-mark-read`,describe:`Bulk update Threat Signals article read status.`,builder:ec,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles bulk-mark-read`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({article_ids:r[`article-ids`],read:r.read}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.articles.bulkMarkRead({...e,account_id:d})),{successLabel:`Updated`});return}if(r[`article-ids`]===void 0)throw Error(`--article-ids is required (or pass --body with this field set).`);if(r.read===void 0)throw Error(`--read is required (or pass --body with this field set).`);let f=u({article_ids:r[`article-ids`],read:r.read});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.articles.bulkMarkRead({...f,account_id:d})),{successLabel:`Updated`})}};function nc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`format`,{type:`string`,description:`Format`,choices:[`text`,`html`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rc={command:`get-content <article-id>`,describe:`Get Threat Signals article content.`,builder:g(nc),handler:async r=>{let c={format:r.format};if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles get-content`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/content`,pathParams:{"article-id":String(r[`article-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.articles.getContent({account_id:u,article_id:r[`article-id`],...c})),{successLabel:`Loaded`})}};function ic(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ac={command:`get <article-id>`,describe:`Get Threat Signals article.`,builder:ic,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.articles.get({account_id:l,article_id:r[`article-id`]})),{successLabel:`Loaded`})}};function oc(e){return e.option(`cursor`,{type:`string`,description:`Cursor`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`feed-id`,{type:`string`,description:`Feed ID`}).option(`article-id`,{type:`string`,description:`Article ID`}).option(`read`,{type:`boolean`,description:`Read`}).option(`tag-id`,{type:`string`,description:`Tag ID`}).option(`tag`,{type:`string`,description:`Tag`}).option(`tag-category`,{type:`string`,description:`Tag category`}).option(`include-total`,{type:`boolean`,description:`Include total`}).option(`search`,{type:`string`,description:`Search`}).option(`published-after`,{type:`string`,description:`Published after`}).option(`published-before`,{type:`string`,description:`Published before`}).option(`fetched-after`,{type:`string`,description:`Fetched after`}).option(`fetched-before`,{type:`string`,description:`Fetched before`}).option(`feed-category`,{type:`string`,description:`Feed category`}).option(`source-type`,{type:`string`,description:`Source type`,choices:[`curated`,`custom`]}).option(`tag-applied-by`,{type:`string`,description:`Tag applied by`,choices:[`ai`,`analyst`]}).option(`sort`,{type:`string`,description:`Sort`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const sc={command:`list`,describe:`List Threat Signals articles.`,builder:g(oc),handler:async r=>{let c={cursor:r.cursor,per_page:r[`per-page`],feed_id:r[`feed-id`],article_id:r[`article-id`],read:r.read,tag_id:r[`tag-id`],tag:r.tag,tag_category:r[`tag-category`],include_total:r[`include-total`],search:r.search,published_after:r[`published-after`],published_before:r[`published-before`],fetched_after:r[`fetched-after`],fetched_before:r[`fetched-before`],feed_category:r[`feed-category`],source_type:r[`source-type`],tag_applied_by:r[`tag-applied-by`],sort:r.sort};if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.articles.list({account_id:u,...c})),{successLabel:`Loaded`})}};function cc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`read`,{type:`boolean`,description:`The read field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const lc={command:`mark-read <article-id>`,describe:`Update Threat Signals article read status.`,builder:cc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles mark-read`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({read:r.read}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.articles.markRead({...e,account_id:d,article_id:r[`article-id`]})),{successLabel:`Updated`});return}if(r.read===void 0)throw Error(`--read is required (or pass --body with this field set).`);let f=u({read:r.read});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.articles.markRead({...f,account_id:d,article_id:r[`article-id`]})),{successLabel:`Updated`})}};function uc(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dc={command:`get-output <skill-id>`,describe:`Get Threat Signals article skill output.`,builder:uc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles skills get-output`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}/output`,pathParams:{"article-id":String(r[`article-id`]??``),"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.articles.skills.getOutput({account_id:l,article_id:r[`article-id`],skill_id:r[`skill-id`]})),{successLabel:`Loaded`})}},fc={command:`skills`,describe:`Operations for threat-signals.articles.skills`,builder:e=>e.command(dc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`tag-id`,{type:`string`,description:`The tag_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const mc={command:`add <article-id>`,describe:`Add tag to Threat Signals article.`,builder:pc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles tags add`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/tags`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({tag_id:d(r[`tag-id`],`tag-id`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.articles.tags.add({...e,account_id:f,article_id:r[`article-id`]})),{successLabel:`Created`});return}r[`tag-id`]===void 0&&(r[`tag-id`]=await p(`tag-id`,`The tag_id field`));let m=u({tag_id:d(r[`tag-id`],`tag-id`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.articles.tags.add({...m,account_id:f,article_id:r[`article-id`]})),{successLabel:`Created`})}};function hc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gc={command:`generate <article-id>`,describe:`Generate Threat Signals article AI tags.`,builder:hc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles tags generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/tag`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.articles.tags.generate({account_id:l,article_id:r[`article-id`]})),{successLabel:`Created`})}};function _c(e){return e.positional(`tag-id`,{type:`string`,description:`Tag ID`,demandOption:!0}).option(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const vc={command:`remove <tag-id>`,describe:`Remove tag from Threat Signals article.`,builder:_c,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles tags remove`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/tags/${r[`tag-id`]==null?`<tag-id>`:encodeURIComponent(String(r[`tag-id`]))}`,pathParams:{"article-id":String(r[`article-id`]??``),"tag-id":String(r[`tag-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
33
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.articles.tags.remove({account_id:l,article_id:r[`article-id`],tag_id:r[`tag-id`]})),{successLabel:`Deleted`})}},yc={command:`tags`,describe:`Operations for threat-signals.articles.tags`,builder:e=>e.command(mc).command(gc).command(vc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bc={command:`articles`,describe:`Operations for threat-signals.articles`,builder:e=>e.command(tc).command(ac).command(rc).command(sc).command(lc).command(fc).command(yc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xc(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Sc={command:`bulk-create`,describe:`Bulk create curated Threat Signals feeds.`,builder:xc,handler:async l=>{if(l.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/bulk`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await i(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=c(l.body);a(await s(`Creating`,async()=>u.cloudforceOne.threatSignals.curatedFeeds.bulkCreate({...e,account_id:d})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/cloudforce-one/v2/threat-signals/curated-feeds/bulk`)),{successLabel:`Created`})}};function Cc(e){return e.option(`category`,{type:`string`,description:`The category field`}).option(`display-order`,{type:`number`,description:`The display_order field`}).option(`is-active`,{type:`boolean`,description:`The is_active field`,default:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`url`,{type:`string`,description:`The url field`}).option(`why-valuable`,{type:`string`,description:`The why_valuable field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const wc={command:`create`,describe:`Create curated Threat Signals feed.`,builder:Cc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({category:d(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:d(r.name,`name`,`text`),url:d(r.url,`url`,`text`),why_valuable:d(r[`why-valuable`],`why-valuable`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.create({...e,account_id:f})),{successLabel:`Created`});return}r.category===void 0&&(r.category=await p(`category`,`The category field`)),r.name===void 0&&(r.name=await p(`name`,`The name field`)),r.url===void 0&&(r.url=await p(`url`,`The url field`));let m=u({category:d(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:d(r.name,`name`,`text`),url:d(r.url,`url`,`text`),why_valuable:d(r[`why-valuable`],`why-valuable`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.create({...m,account_id:f})),{successLabel:`Created`})}};function Tc(e){return e.positional(`curated-feed-id`,{type:`string`,description:`Curated feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ec={command:`delete <curated-feed-id>`,describe:`Delete curated Threat Signals feed.`,builder:Tc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/${r[`curated-feed-id`]==null?`<curated-feed-id>`:encodeURIComponent(String(r[`curated-feed-id`]))}`,pathParams:{"curated-feed-id":String(r[`curated-feed-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
34
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.delete({account_id:l,curated_feed_id:r[`curated-feed-id`]})),{successLabel:`Deleted`})}};function Dc(e){return e.option(`category`,{type:`string`,description:`Category`}).option(`include-inactive`,{type:`boolean`,description:`Include inactive`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Oc={command:`list`,describe:`List curated Threat Signals feeds.`,builder:Dc,handler:async r=>{let c={category:r.category,include_inactive:r[`include-inactive`]};if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.list({account_id:u,...c})),{successLabel:`Loaded`})}};function kc(e){return e.option(`opted-out`,{type:`boolean`,description:`The opted_out field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ac={command:`opt-out`,describe:`Opt out of curated Threat Signals feeds.`,builder:kc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds opt-out`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/opt-out`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({opted_out:r[`opted-out`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.optOut({...e,account_id:d})),{successLabel:`Updated`});return}if(r[`opted-out`]===void 0)throw Error(`--opted-out is required (or pass --body with this field set).`);let f=u({opted_out:r[`opted-out`]});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.optOut({...f,account_id:d})),{successLabel:`Updated`})}};function jc(e){return e.positional(`curated-feed-id`,{type:`string`,description:`Curated feed ID`,demandOption:!0}).option(`category`,{type:`string`,description:`The category field`}).option(`display-order`,{type:`number`,description:`The display_order field`}).option(`is-active`,{type:`boolean`,description:`The is_active field`}).option(`name`,{type:`string`,description:`The name field`}).option(`url`,{type:`string`,description:`The url field`}).option(`why-valuable`,{type:`string`,description:`The why_valuable field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Mc={command:`update <curated-feed-id>`,describe:`Update curated Threat Signals feed.`,builder:jc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/${r[`curated-feed-id`]==null?`<curated-feed-id>`:encodeURIComponent(String(r[`curated-feed-id`]))}`,pathParams:{"curated-feed-id":String(r[`curated-feed-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({category:d(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:d(r.name,`name`,`text`),url:d(r.url,`url`,`text`),why_valuable:d(r[`why-valuable`],`why-valuable`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.update({...e,account_id:f,curated_feed_id:r[`curated-feed-id`]})),{successLabel:`Updated`});return}let p=u({category:d(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:d(r.name,`name`,`text`),url:d(r.url,`url`,`text`),why_valuable:d(r[`why-valuable`],`why-valuable`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.update({...p,account_id:f,curated_feed_id:r[`curated-feed-id`]})),{successLabel:`Updated`})}},Nc={command:`curated-feeds`,describe:`Operations for threat-signals.curated-feeds`,builder:e=>e.command(Sc).command(wc).command(Ec).command(Oc).command(Ac).command(Mc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pc(e){return e.option(`category`,{type:`string`,description:`The category field`}).option(`curated-feed-id`,{type:`string`,description:`The curated_feed_id field`}).option(`display-name`,{type:`string`,description:`The display_name field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`,default:!0}).option(`poll-interval-s`,{type:`number`,description:`The poll_interval_s field`,default:300}).option(`title`,{type:`string`,description:`The title field`}).option(`url`,{type:`string`,description:`The url field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Fc={command:`create`,describe:`Create Threat Signals feed.`,builder:Pc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({category:d(r.category,`category`,`text`),curated_feed_id:d(r[`curated-feed-id`],`curated-feed-id`,`text`),display_name:d(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:d(r.title,`title`,`text`),url:d(r.url,`url`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.feeds.create({...e,account_id:f})),{successLabel:`Created`});return}let p=u({category:d(r.category,`category`,`text`),curated_feed_id:d(r[`curated-feed-id`],`curated-feed-id`,`text`),display_name:d(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:d(r.title,`title`,`text`),url:d(r.url,`url`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.feeds.create({...p,account_id:f})),{successLabel:`Created`})}};function Ic(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Lc={command:`delete <feed-id>`,describe:`Delete Threat Signals feed.`,builder:Ic,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
35
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.feeds.delete({account_id:l,feed_id:r[`feed-id`]})),{successLabel:`Deleted`})}};function Rc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`format`,{type:`string`,description:`Format`,choices:[`xml`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zc={command:`get-raw <feed-id>`,describe:`Get Threat Signals feed XML.`,builder:g(Rc),handler:async r=>{let c={format:r.format};if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds get-raw`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}/raw`,pathParams:{"feed-id":String(r[`feed-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.feeds.getRaw({account_id:u,feed_id:r[`feed-id`],...c})),{successLabel:`Loaded`})}};function Bc(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`limit`,{type:`number`,description:`Limit`}).option(`sort`,{type:`string`,description:`Sort`}).option(`category`,{type:`string`,description:`Category`}).option(`source-type`,{type:`string`,description:`Source type`,choices:[`curated`,`custom`]}).option(`enabled`,{type:`boolean`,description:`Enabled`}).option(`status`,{type:`string`,description:`Status`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Vc={command:`list`,describe:`List Threat Signals feeds.`,builder:g(Bc),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],limit:r.limit,sort:r.sort,category:r.category,source_type:r[`source-type`],enabled:r.enabled,status:r.status};if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.feeds.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Hc(e){return e.option(`feed-id`,{type:`string`,description:`Feed ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Uc={command:`poll`,describe:`Trigger Threat Signals feed poll.`,builder:g(Hc),handler:async r=>{let c={feed_id:r[`feed-id`]};if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds poll`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/poll`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.feeds.poll({account_id:u,...c})),{successLabel:`Created`})}};function Wc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Gc={command:`get <feed-id>`,describe:`Get Threat Signals feed skills.`,builder:Wc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds skills get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}/skills`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.feeds.skills.get({account_id:l,feed_id:r[`feed-id`]})),{successLabel:`Loaded`})}};function Kc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`skill-ids`,{type:`string`,array:!0,description:`The skill_ids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qc={command:`update <feed-id>`,describe:`Set Threat Signals feed skills.`,builder:Kc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds skills update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}/skills`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({skill_ids:r[`skill-ids`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.feeds.skills.update({...e,account_id:d,feed_id:r[`feed-id`]})),{successLabel:`Updated`});return}if(r[`skill-ids`]===void 0)throw Error(`--skill-ids is required (or pass --body with this field set).`);let f=u({skill_ids:r[`skill-ids`]});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.feeds.skills.update({...f,account_id:d,feed_id:r[`feed-id`]})),{successLabel:`Updated`})}},Jc={command:`skills`,describe:`Operations for threat-signals.feeds.skills`,builder:e=>e.command(Gc).command(qc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Yc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`category`,{type:`string`,description:`The category field`}).option(`display-name`,{type:`string`,description:`The display_name field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`poll-interval-s`,{type:`number`,description:`The poll_interval_s field`}).option(`title`,{type:`string`,description:`The title field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Xc={command:`update <feed-id>`,describe:`Update Threat Signals feed.`,builder:Yc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({category:d(r.category,`category`,`text`),display_name:d(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:d(r.title,`title`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.feeds.update({...e,account_id:f,feed_id:r[`feed-id`]})),{successLabel:`Updated`});return}let p=u({category:d(r.category,`category`,`text`),display_name:d(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:d(r.title,`title`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.feeds.update({...p,account_id:f,feed_id:r[`feed-id`]})),{successLabel:`Updated`})}},Zc={command:`feeds`,describe:`Operations for threat-signals.feeds`,builder:e=>e.command(Fc).command(Lc).command(zc).command(Vc).command(Uc).command(Xc).command(Jc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qc(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $c={command:`health`,describe:`Check Threat Signals service health.`,builder:Qc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals health`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/health`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.health({account_id:l})),{successLabel:`Loaded`})}};function el(e){return e.option(`feed-id`,{type:`string`,description:`Feed ID`}).option(`article-id`,{type:`string`,description:`Article ID`}).option(`search`,{type:`string`,description:`NFC-normalized and trimmed, case-insensitive literal substring search of indicator values. Requires 3–500 Unicode code points; the upper code-point bound is described here because OpenAPI string length cannot precisely express it without imposing UTF-16 semantics.`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`sort`,{type:`string`,description:`Sort`}).option(`include-total`,{type:`boolean`,description:`Include total`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const tl={command:`list`,describe:`List Threat Signals article indicators.`,builder:el,handler:async r=>{let c={feed_id:r[`feed-id`],article_id:r[`article-id`],search:r.search,per_page:r[`per-page`],sort:r.sort,include_total:r[`include-total`],cursor:r.cursor};if(r.dryRun){o({command:`cf cloudforce-one threat-signals indicators list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/indicators`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.indicators.list({account_id:u,...c})),{successLabel:`Loaded`})}},nl={command:`indicators`,describe:`Operations for threat-signals.indicators`,builder:e=>e.command(tl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rl(e){return e.option(`name`,{type:`string`,description:`The name field`}).option(`output-schema`,{type:`string`,description:`The output_schema field`}).option(`prompt`,{type:`string`,description:`The prompt field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`summary`,`tags`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const il={command:`create`,describe:`Create Threat Signals skill.`,builder:rl,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({name:d(r.name,`name`,`text`),output_schema:d(r[`output-schema`],`output-schema`,`text`),prompt:d(r.prompt,`prompt`,`text`),type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.skills.create({...e,account_id:f})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await p(`name`,`The name field`)),r[`output-schema`]===void 0&&(r[`output-schema`]=await p(`output-schema`,`The output_schema field`)),r.prompt===void 0&&(r.prompt=await p(`prompt`,`The prompt field`)),r.type===void 0&&(r.type=await m(`type`,`The type field`,[`summary`,`tags`]));let h=u({name:d(r.name,`name`,`text`),output_schema:d(r[`output-schema`],`output-schema`,`text`),prompt:d(r.prompt,`prompt`,`text`),type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.skills.create({...h,account_id:f})),{successLabel:`Created`})}};function al(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ol={command:`delete <skill-id>`,describe:`Delete Threat Signals skill.`,builder:al,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
36
- `);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.skills.delete({account_id:l,skill_id:r[`skill-id`]})),{successLabel:`Deleted`})}};function sl(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const cl={command:`get <skill-id>`,describe:`Get Threat Signals skill.`,builder:sl,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.skills.get({account_id:l,skill_id:r[`skill-id`]})),{successLabel:`Loaded`})}};function ll(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ul={command:`list`,describe:`List Threat Signals skills.`,builder:ll,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.skills.list({account_id:u,...c})),{successLabel:`Loaded`})}};function dl(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fl={command:`get <skill-id>`,describe:`Get Threat Signals skill tag categories.`,builder:g(dl),handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills tag-categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}/tag-categories`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.skills.tagCategories.get({account_id:l,skill_id:r[`skill-id`]})),{successLabel:`Loaded`})}};function pl(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`category-uuids`,{type:`string`,array:!0,description:`The category_uuids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ml={command:`update <skill-id>`,describe:`Replace Threat Signals skill tag categories.`,builder:g(pl),handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills tag-categories update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}/tag-categories`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({category_uuids:r[`category-uuids`]}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.skills.tagCategories.update({...e,account_id:d,skill_id:r[`skill-id`]})),{successLabel:`Updated`});return}if(r[`category-uuids`]===void 0)throw Error(`--category-uuids is required (or pass --body with this field set).`);let f=u({category_uuids:r[`category-uuids`]});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.skills.tagCategories.update({...f,account_id:d,skill_id:r[`skill-id`]})),{successLabel:`Updated`})}},hl={command:`tag-categories`,describe:`Operations for threat-signals.skills.tag-categories`,builder:e=>e.command(fl).command(ml).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gl(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`config`,{type:`string`,description:`The config field`}).option(`is-active`,{type:`boolean`,description:`The is_active field`}).option(`name`,{type:`string`,description:`The name field`}).option(`output-schema`,{type:`string`,description:`The output_schema field`}).option(`prompt`,{type:`string`,description:`The prompt field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _l={command:`update <skill-id>`,describe:`Update Threat Signals skill.`,builder:gl,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({config:d(r.config,`config`,`text`),is_active:r[`is-active`],name:d(r.name,`name`,`text`),output_schema:d(r[`output-schema`],`output-schema`,`text`),prompt:d(r.prompt,`prompt`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.skills.update({...e,account_id:f,skill_id:r[`skill-id`]})),{successLabel:`Updated`});return}let p=u({config:d(r.config,`config`,`text`),is_active:r[`is-active`],name:d(r.name,`name`,`text`),output_schema:d(r[`output-schema`],`output-schema`,`text`),prompt:d(r.prompt,`prompt`,`text`)});a(await s(`Updating`,async()=>l.cloudforceOne.threatSignals.skills.update({...p,account_id:f,skill_id:r[`skill-id`]})),{successLabel:`Updated`})}},vl={command:`skills`,describe:`Operations for threat-signals.skills`,builder:e=>e.command(il).command(ol).command(cl).command(ul).command(_l).command(hl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},yl={command:`threat-signals`,describe:`Operations for threat-signals`,builder:e=>e.command($c).command(bc).command(Nc).command(Zc).command(nl).command(vl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bl={command:`cloudforce-one`,describe:`Detection rule management APIs`,builder:e=>e.command(x).command(Un).command(Br).command(Qi).command(pa).command(Ko).command($s).command(yl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{bl as default};