cf 0.9.0 → 0.10.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.
- package/README.md +5 -0
- package/dist/_meta/agent-context.json +34 -35
- package/dist/_meta/commands.json +6834 -10044
- package/dist/_meta/schemas.json +11228 -12752
- package/dist/{abuse-reports-DnNvw2gG.mjs → abuse-reports-CGF4zcKf.mjs} +2 -2
- package/dist/{access-RbqBFrSC.mjs → access-lhLJo1v2.mjs} +1 -1
- package/dist/{account-D7xvYqDx.mjs → account-CYRm3yoN.mjs} +1 -1
- package/dist/account-tags-B88TotoH.mjs +9 -0
- package/dist/accounts-BSIAT_iP.mjs +28 -0
- package/dist/{acm-Szq4CoQN.mjs → acm-VULm1djv.mjs} +1 -1
- package/dist/{addressing-CgTTbuCF.mjs → addressing-BHPBIkRY.mjs} +1 -1
- package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-KBy48G1b.mjs} +1 -1
- package/dist/{agent-memory-C8pT01pR.mjs → agent-memory-DDv_Gxr7.mjs} +2 -2
- package/dist/{ai-audit-CCygMmsh.mjs → ai-audit-BWZGvbca.mjs} +1 -1
- package/dist/{ai-gateway-D4tATNRV.mjs → ai-gateway-jeB-sAgP.mjs} +1 -1
- package/dist/ai-search-BmdskMjR.mjs +7 -0
- package/dist/{ai-security-AUfzagSE.mjs → ai-security-CsmfcaUx.mjs} +1 -1
- package/dist/{ai-Cn0BniR4.mjs → ai-viHB1tgI.mjs} +1 -1
- package/dist/{alerting-DbXVpGv3.mjs → alerting-Bl8OqViR.mjs} +4 -4
- package/dist/analytics-vOxw8Hy0.mjs +3 -0
- package/dist/{analytics_engine-B_bMbfxW.mjs → analytics_engine-DO4-C0wD.mjs} +1 -1
- package/dist/{api-security-pSJdgmtK.mjs → api-security-4FVrD4n8.mjs} +1 -1
- package/dist/argo-CQfCgazW.mjs +2 -0
- package/dist/args-DlUhyGU0.mjs +2 -0
- package/dist/artifacts-CVDGnr2V.mjs +4 -0
- package/dist/{audit-logs-BIHP5-rk.mjs → audit-logs-CzpwvQ6A.mjs} +1 -1
- package/dist/{auth-MeSu8lFz.mjs → auth-D0xZxAEa.mjs} +1 -1
- package/dist/{auth-C6MhC9EZ.mjs → auth-MQEamPN9.mjs} +2 -2
- package/dist/{billing-0RNCYBJM.mjs → billing-aJgapeRm.mjs} +2 -2
- package/dist/{bot-management-uhBRnSPl.mjs → bot-management-Y2q5d-pi.mjs} +1 -1
- package/dist/{botnet-feed-DEbMknrE.mjs → botnet-feed-DANJqfmE.mjs} +1 -1
- package/dist/{brand-protection-DY2qPL8d.mjs → brand-protection-CjpZWBjp.mjs} +1 -1
- package/dist/{browser-extension-DBsmLCUj.mjs → browser-extension-BtpCbh-2.mjs} +1 -1
- package/dist/browser-run-BFn9h2Tz.mjs +4 -0
- package/dist/{build-Nivzj54_.mjs → build-DcflwvqN.mjs} +1 -1
- package/dist/{cache-BgRIDcFJ.mjs → cache-VyWK1SjY.mjs} +1 -1
- package/dist/{calls-JrRne0U0.mjs → calls-BxoRYxs4.mjs} +1 -1
- package/dist/{certificate-authorities-BJ7W8GGQ.mjs → certificate-authorities-D7OAFxF_.mjs} +1 -1
- package/dist/{cf-BUKsENG5.mjs → cf-C7DU4819.mjs} +2 -2
- package/dist/{chunk-LQW53VED-Xakf_rUn.mjs → chunk-LQW53VED-DLrXV-hE.mjs} +2 -2
- package/dist/{client-certificates-6xxvcOgI.mjs → client-certificates-DDUv8K0a.mjs} +1 -1
- package/dist/{client-side-security-cU0Z1tql.mjs → client-side-security-D4ysjwWT.mjs} +1 -1
- package/dist/{cloud-connector-DFooSAcn.mjs → cloud-connector-Bhec6z2P.mjs} +1 -1
- package/dist/cloudforce-one-J_hn9ss9.mjs +36 -0
- package/dist/config.mjs +1 -1
- package/dist/connector-interrupts-Dycx8zFx.mjs +2 -0
- package/dist/{connector-telemetry-events-CTMmX2BA.mjs → connector-telemetry-events-BmxOSNtN.mjs} +1 -1
- package/dist/connector-telemetry-events-latest-BY2556uL.mjs +2 -0
- package/dist/{connector-telemetry-snapshots-5Y7m8Cw8.mjs → connector-telemetry-snapshots-CdcqfKnH.mjs} +1 -1
- package/dist/connector-telemetry-snapshots-latest-BHYdxUEF.mjs +2 -0
- package/dist/{connectors-BRCQSsos.mjs → connectors-BqxYMMtQ.mjs} +1 -1
- package/dist/{containers-CfKOM_f5.mjs → containers-CKW081JA.mjs} +8 -8
- package/dist/{content-scan-CB4xHGv1.mjs → content-scan-Dgd7A8KF.mjs} +1 -1
- package/dist/{csamScanner-AQo_QTlq.mjs → csamScanner-DYL37wLc.mjs} +1 -1
- package/dist/{ct-alerting-Bai-1Z3k.mjs → ct-alerting-CkhSbfAs.mjs} +1 -1
- package/dist/{custom-certificates-D6aQIGu2.mjs → custom-certificates-BzAOnEoT.mjs} +1 -1
- package/dist/custom-csrs-CgzG3pd3.mjs +3 -0
- package/dist/{custom-hostnames-BiOVGwnR.mjs → custom-hostnames-q_nsnlye.mjs} +4 -4
- package/dist/custom-nameservers-BUBmfhUe.mjs +3 -0
- package/dist/custom-pages-M7jA2Hit.mjs +3 -0
- package/dist/{d1-FmAh7T7l.mjs → d1-BFvMd6-S.mjs} +1 -1
- package/dist/{data-security-2fmzF_Me.mjs → data-security-Bji4Or_j.mjs} +2 -2
- package/dist/{dcv-delegation-Cmxxgi9V.mjs → dcv-delegation-BuoRQ1Yh.mjs} +1 -1
- package/dist/{deploy-BzFbjH6a.mjs → deploy-CZ7bgNDu.mjs} +1 -1
- package/dist/{deploy-input-BRMQehgs.mjs → deploy-input-CrvuoDGJ.mjs} +1 -1
- package/dist/{dev-CWaf-qW4.mjs → dev-V10MG-Bg.mjs} +1 -1
- package/dist/{diagnostics-Ca6r_972.mjs → diagnostics-BTH-8nJH.mjs} +2 -2
- package/dist/{directory-CGNWfVQc.mjs → directory-BlH6N6Qy.mjs} +1 -1
- package/dist/{dispatch-namespaces-CBo5kuf7.mjs → dispatch-namespaces-BCjH1JzB.mjs} +1 -1
- package/dist/{dist-COfwjT96.mjs → dist-CgrMkXFx.mjs} +1 -1
- package/dist/{dls-CobKlH4N.mjs → dls-BF5iN78p.mjs} +1 -1
- package/dist/{dns-OfJXNYkK.mjs → dns-CeCTNqRk.mjs} +11 -11
- package/dist/{dns-firewall-DZ2ij-nX.mjs → dns-firewall-B54MaLGm.mjs} +1 -1
- package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wIVDg_fl.mjs} +1 -1
- package/dist/{durable-objects-Cw_y37WB.mjs → durable-objects-D8FQORrL.mjs} +1 -1
- package/dist/{email-auth-DuJHdiwN.mjs → email-auth-DJK0Eb30.mjs} +1 -1
- package/dist/email-routing-NpmiKIrl.mjs +6 -0
- package/dist/{email-security-D-P8ln2L.mjs → email-security-BLZ7WZ9Z.mjs} +2 -2
- package/dist/email-sending-dn-353Nx.mjs +7 -0
- package/dist/fieldExtractors-ahysj57J.mjs +3 -0
- package/dist/firewall-CBPGJ43p.mjs +11 -0
- package/dist/{flagship-CPkQMist.mjs → flagship-BusjRNIb.mjs} +3 -3
- package/dist/{fraud-BhX0QNUl.mjs → fraud-BIhS8pLf.mjs} +1 -1
- package/dist/{google-tag-gateway-CDtRxao4.mjs → google-tag-gateway-TZZ3F1tV.mjs} +1 -1
- package/dist/{healthchecks-D2WwALvQ.mjs → healthchecks-FiXIk-KP.mjs} +2 -2
- package/dist/{hostnames-CGAFkYT1.mjs → hostnames-Bx0mykMR.mjs} +1 -1
- package/dist/{hyperdrive-zLFPWFQj.mjs → hyperdrive-C8qCabBF.mjs} +1 -1
- package/dist/{iam-Su_hpatD.mjs → iam-Cj63Kjc6.mjs} +1 -1
- package/dist/{images-D2ZflvBi.mjs → images-CBWXCDhy.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{intel-DPGzVovJ.mjs → intel-B-9Z_sJs.mjs} +2 -2
- package/dist/{interactive-CM2G03lr.mjs → interactive-DtsCYfrK.mjs} +1 -1
- package/dist/{ips-C5-NH1b0.mjs → ips-qs9eGJnI.mjs} +1 -1
- package/dist/{keyless-certificates-Xx-oAN3Z.mjs → keyless-certificates-THHvoXX3.mjs} +1 -1
- package/dist/{keys-B0FBtlOD.mjs → keys-D7N0j4-x.mjs} +1 -1
- package/dist/{kv-BbZ9st5o.mjs → kv-BFDUCnft.mjs} +1 -1
- package/dist/{leaked-credential-checks-Vonw4inx.mjs → leaked-credential-checks-DUlUCOoJ.mjs} +1 -1
- package/dist/load-balancers-D2zbQ8fT.mjs +6 -0
- package/dist/{local-eEF0NF51.mjs → local-D-aVNu6A.mjs} +1 -1
- package/dist/{local-runtime-BNCCOZ8s.mjs → local-runtime-Dh3keC5v.mjs} +1 -1
- package/dist/logexplorer-CUsfZ_bS.mjs +13 -0
- package/dist/{logo-matches-oHYc8Xaz.mjs → logo-matches-CJcthPHf.mjs} +1 -1
- package/dist/{logos-DS0krPAz.mjs → logos-BS65zN8q.mjs} +1 -1
- package/dist/logpush-BK34mMQs.mjs +4 -0
- package/dist/{logs-C07M9zn-.mjs → logs-CLAqX9h2.mjs} +1 -1
- package/dist/{magic-cloud-networking-ZPEK7O5I.mjs → magic-cloud-networking-h_ozrC5S.mjs} +1 -1
- package/dist/magic-network-monitoring-C7tAPNKP.mjs +4 -0
- package/dist/{magic-transit-CgPZ8iMn.mjs → magic-transit-BtsFePMx.mjs} +5 -5
- package/dist/{managed-transforms-2XyQ14s3.mjs → managed-transforms-Cm_KVCMB.mjs} +1 -1
- package/dist/{matches-CIaCrdrs.mjs → matches-InA1hwII.mjs} +1 -1
- package/dist/{mcp-D2afM8MD.mjs → mcp-mJ7bekNJ.mjs} +1 -1
- package/dist/mesh-BK4S1Ezy.mjs +4 -0
- package/dist/{moq-BBQVNGo1.mjs → moq-qmuVPAO0.mjs} +1 -1
- package/dist/{mtls-certificates-C5j0Gn65.mjs → mtls-certificates-CU4OAAXY.mjs} +1 -1
- package/dist/{network-CmuJqtFJ.mjs → network-D74cSy3t.mjs} +1 -1
- package/dist/{network-interconnects-BlajBQqs.mjs → network-interconnects-BJ0Nc48J.mjs} +1 -1
- package/dist/{oauth-BjHjJtnn.mjs → oauth-B0ETkNcX.mjs} +2 -2
- package/dist/{oauth-clients-BSthfZP-.mjs → oauth-clients-Br-smLxQ.mjs} +1 -1
- package/dist/{oauth-scopes-ByUp5bLU.mjs → oauth-scopes-D5bF11ju.mjs} +1 -1
- package/dist/observability-BWE0Gg3V.mjs +4 -0
- package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-R-qesf18.mjs} +1 -1
- package/dist/{organization-DQIfNVCT.mjs → organization-NX7yCZrq.mjs} +1 -1
- package/dist/{organizations-L_ycAy6r.mjs → organizations-DLhiRt8g.mjs} +1 -1
- package/dist/{origin-ca-certificates-opIcs3_Q.mjs → origin-ca-certificates-Ff4McZRQ.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-TSMXzoEL.mjs → origin-post-quantum-encryption-UuTr4_SW.mjs} +1 -1
- package/dist/{origin-tls-client-auth-5CtcPUR6.mjs → origin-tls-client-auth-DOJ1zlH3.mjs} +1 -1
- package/dist/{output-DgW1hQGX.mjs → output-DrpYYfnB.mjs} +1 -1
- package/dist/{page-rules-DPd1Y3IL.mjs → page-rules-BSz1gO-_.mjs} +1 -1
- package/dist/{pages-CskAn5mR.mjs → pages-DVDogxPs.mjs} +4 -4
- package/dist/{pay-per-crawl-BMa_V40s.mjs → pay-per-crawl-BrLXK7gT.mjs} +1 -1
- package/dist/{pipelines-BbJjj1ZQ.mjs → pipelines-BszRk4sM.mjs} +2 -2
- package/dist/{precursor-DgRWBN9_.mjs → precursor-BPNjQr76.mjs} +1 -1
- package/dist/progress-CsHIt3Tp.mjs +2 -0
- package/dist/{prompt-DM4z101s.mjs → prompt-DdegNPpg.mjs} +1 -1
- package/dist/{queries-DrqcK0ZX.mjs → queries-JL1H1Biz.mjs} +1 -1
- package/dist/{queues-CutvMZcc.mjs → queues-DpkYdRUE.mjs} +1 -1
- package/dist/{r2-sFI62vhq.mjs → r2-CKozthw_.mjs} +4 -4
- package/dist/{r2-data-catalog-3vzU6FE1.mjs → r2-data-catalog-Du7hN9jA.mjs} +1 -1
- package/dist/radar-C-92vggG.mjs +2 -0
- package/dist/{rate-limits-HRZ8zMSl.mjs → rate-limits-yBF3qoYD.mjs} +1 -1
- package/dist/{raw-fetch-25gXED6c.mjs → raw-fetch-CteyTOM2.mjs} +1 -1
- package/dist/realtimekit-CIP7lP-a.mjs +7 -0
- package/dist/{registrar-C0EsXf83.mjs → registrar-DKKN0M29.mjs} +3 -3
- package/dist/{registrar-sandbox-CR9Rr7jV.mjs → registrar-sandbox-DiXg8p_1.mjs} +3 -3
- package/dist/{registry-CJvn75Bq.mjs → registry-Bck_zFkz.mjs} +1 -1
- package/dist/{reporting-BB6sqe6r.mjs → reporting-fg_GKXe1.mjs} +1 -1
- package/dist/{request-tracers-BrsM3zXZ.mjs → request-tracers-CkMya96z.mjs} +1 -1
- package/dist/{resource-sharing-CusU3kiy.mjs → resource-sharing-D1pSDvtf.mjs} +1 -1
- package/dist/{resource-tagging-wXAcblmz.mjs → resource-tagging-z48JGHCq.mjs} +1 -1
- package/dist/{rules-C2BxykEe.mjs → rules-BTmNjDN-.mjs} +1 -1
- package/dist/rulesets-CsoSM-17.mjs +5 -0
- package/dist/{rum-Dyno5zj3.mjs → rum-DB4iO2q5.mjs} +1 -1
- package/dist/{schema-BeXPWeK9.mjs → schema-B34Q9tLF.mjs} +1 -1
- package/dist/{schema-flags-C1BRprT2.mjs → schema-flags-iGoOriJt.mjs} +1 -1
- package/dist/{scim-Bb2xHpIz.mjs → scim-CcSyfKCH.mjs} +1 -1
- package/dist/sdk-ZctLa5jW.mjs +3 -0
- package/dist/{secrets-store-BMhjbceW.mjs → secrets-store-DFmvtphu.mjs} +1 -1
- package/dist/security-center-DFKeHq5c.mjs +2 -0
- package/dist/{security-txt-Bh_2gymk.mjs → security-txt-DqnFpjMI.mjs} +1 -1
- package/dist/{session-Br-q_UIW.mjs → session-D6KHthHf.mjs} +1 -1
- package/dist/{share-DfTpOxhk.mjs → share-BuwYUzOL.mjs} +1 -1
- package/dist/{shared-BNjZc02w.mjs → shared-VppSAQf4.mjs} +1 -1
- package/dist/{smart-shield-rHn-Lckq.mjs → smart-shield-D6X8L7p8.mjs} +2 -2
- package/dist/{snippets-nSLwH8uJ.mjs → snippets-DIpc9pb_.mjs} +1 -1
- package/dist/{spawn-Bj8QRFJ5.mjs → spawn-O1RS01vr.mjs} +2 -2
- package/dist/{spectrum-DuhSUTZI.mjs → spectrum-b7N1ZRAm.mjs} +1 -1
- package/dist/{speed-Dgby_e1J.mjs → speed-cw31yFva.mjs} +1 -1
- package/dist/src-D_HETJNy.mjs +108 -0
- package/dist/{ssl-BsxTHasY.mjs → ssl-CsEhRVTO.mjs} +1 -1
- package/dist/{state-C1m9nwUm.mjs → state-Bb5Cbc_L.mjs} +1 -1
- package/dist/{stream-CkEOX5Ko.mjs → stream-DFOao6Gu.mjs} +3 -3
- package/dist/{submit-BjdywxTq.mjs → submit--xTzyNPy.mjs} +1 -1
- package/dist/{tags-CFAw_Sce.mjs → tags-efICDkah.mjs} +1 -1
- package/dist/{tenant-C66iOy5O.mjs → tenant-CerHuToJ.mjs} +1 -1
- package/dist/{tenant-custom-nameservers-CyJZ_AB0.mjs → tenant-custom-nameservers-C4otMBm2.mjs} +1 -1
- package/dist/{tools-D2Xxfkrc.mjs → tools-BHfBOZOU.mjs} +1 -1
- package/dist/{triggers-Dv22ZXM4.mjs → triggers-BEsiiKAf.mjs} +1 -1
- package/dist/{tunnel-BatkLdds.mjs → tunnel-DkMiNtVY.mjs} +1 -1
- package/dist/{tunnels-CstoXOoq.mjs → tunnels-D0J8lJoI.mjs} +1 -1
- package/dist/{turnstile-IoRtama4.mjs → turnstile-CFmtY5bn.mjs} +2 -2
- package/dist/{ui-DjQ4AQww.mjs → ui-DE8CNn6c.mjs} +1 -1
- package/dist/{url-info-Hjhwr2la.mjs → url-info-DBCeRWwb.mjs} +1 -1
- package/dist/{url-normalization-C2BP_Kl0.mjs → url-normalization-ClfFiruK.mjs} +1 -1
- package/dist/{url-scanner-DmYVTdAE.mjs → url-scanner-CNyvg65L.mjs} +1 -1
- package/dist/{user-CVHm-cnB.mjs → user-bifVEQq5.mjs} +2 -2
- package/dist/{values-Cmlw5wGZ.mjs → values-OxkdP1tV.mjs} +1 -1
- package/dist/{vectorize-BQtIqiNO.mjs → vectorize-CVKu7lEt.mjs} +1 -1
- package/dist/{versions-CU6Av1vh.mjs → versions-BVL-Ludh.mjs} +1 -1
- package/dist/waiting-rooms-CmRAl51T.mjs +11 -0
- package/dist/{web-assets-DmSKaxzf.mjs → web-assets-C2s9kzWf.mjs} +1 -1
- package/dist/{web3-DVv4jNul.mjs → web3-y_cY91V_.mjs} +1 -1
- package/dist/{workers-builds-DgrejrUc.mjs → workers-builds-B55-oXOa.mjs} +4 -4
- package/dist/{workers-D8czeT64.mjs → workers-jDcq14GH.mjs} +6 -6
- package/dist/{workflows-BOi5MTEN.mjs → workflows-B-kGHxFu.mjs} +2 -2
- package/dist/{zaraz-CGSSFJng.mjs → zaraz-27zwjLvv.mjs} +1 -1
- package/dist/zero-trust-DV3sIOvu.mjs +92 -0
- package/dist/{zone-Bx5ElO9U.mjs → zone-BJix2KQ9.mjs} +1 -1
- package/dist/{zones-_SnlZMiM.mjs → zones-Bkj5i92c.mjs} +1 -1
- package/package.json +2 -2
- package/dist/account-tags-CKRh1jra.mjs +0 -9
- package/dist/accounts-2pGhN4s8.mjs +0 -28
- package/dist/ai-search-2xP8FP_W.mjs +0 -7
- package/dist/analytics-UQrIx99t.mjs +0 -3
- package/dist/argo-Br60zF3y.mjs +0 -2
- package/dist/artifacts-D8HMRQmb.mjs +0 -4
- package/dist/browser-run-C5pYOwtf.mjs +0 -4
- package/dist/cloudforce-one-Cp4bQmrG.mjs +0 -30
- package/dist/connector-interrupts-BR47snkh.mjs +0 -2
- package/dist/custom-csrs-D0zBkQT5.mjs +0 -4
- package/dist/custom-nameservers-G2MWpRwY.mjs +0 -3
- package/dist/custom-pages-BINNZTds.mjs +0 -4
- package/dist/email-CGOC_evd.mjs +0 -2
- package/dist/email-routing-CRvIUSFm.mjs +0 -6
- package/dist/email-sending-BwRN8PMW.mjs +0 -7
- package/dist/filters-DczM8qpH.mjs +0 -4
- package/dist/firewall-BMiETRmM.mjs +0 -11
- package/dist/load-balancers-Ct5cyyF9.mjs +0 -7
- package/dist/logexplorer-BhsAWxCr.mjs +0 -24
- package/dist/logpush-CFQBi88z.mjs +0 -5
- package/dist/magic-network-monitoring-CY3CHSpX.mjs +0 -4
- package/dist/media-CnxgOViL.mjs +0 -2
- package/dist/mesh-DLNLi3UT.mjs +0 -4
- package/dist/observability-B5p3iwrq.mjs +0 -4
- package/dist/progress-C-oFUtvC.mjs +0 -2
- package/dist/radar-Cu9rsTw_.mjs +0 -2
- package/dist/realtimekit-msnGHBbf.mjs +0 -7
- package/dist/rulesets-BHvhAeG_.mjs +0 -8
- package/dist/sdk-m4xeaua4.mjs +0 -3
- package/dist/security-center-DRC4Mf3R.mjs +0 -2
- package/dist/src-CgAVPA4I.mjs +0 -108
- package/dist/waiting-rooms-ku9UsAr9.mjs +0 -11
- package/dist/zero-trust-BmA0VkgF.mjs +0 -102
- package/dist/zone-tags-izd3WWmy.mjs +0 -9
- /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
- /package/dist/{alerts-B85uj2Vx.mjs → alerts-CRmjqOZi.mjs} +0 -0
- /package/dist/{autorag-Do9l_LyY.mjs → autorag-BD7cu5NU.mjs} +0 -0
- /package/dist/{body-parser-CYD7PKFC.mjs → body-parser-C-c9gfH1.mjs} +0 -0
- /package/dist/{brands-DateHCdd.mjs → brands-BhALBkX2.mjs} +0 -0
- /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-B7bSMYLe.mjs} +0 -0
- /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
- /package/dist/{clear-CB2kgcEB.mjs → clear-BgF8No7D.mjs} +0 -0
- /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-BsTty22w.mjs} +0 -0
- /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C50W5GhA.mjs} +0 -0
- /package/dist/{health-buY5f5pp.mjs → health-BFNZqiAm.mjs} +0 -0
- /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-Bav2M9F-.mjs} +0 -0
- /package/dist/{internal-CwyoJUHh.mjs → internal-BTeSewwB.mjs} +0 -0
- /package/dist/{live-wEpA5V_n.mjs → live-Dkiyu30_.mjs} +0 -0
- /package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BwQqexwo-CNW_dPly.mjs} +0 -0
- /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-Dz-Wv1T0.mjs} +0 -0
- /package/dist/{ready-CBSCPiHE.mjs → ready-TKOkKeRg.mjs} +0 -0
- /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-3Asm6eIi.mjs} +0 -0
- /package/dist/{refute-u7ZPQJZy.mjs → refute-BVz9nMyd.mjs} +0 -0
- /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-CeBbH6Pq.mjs} +0 -0
- /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-ZteA-PUV.mjs} +0 -0
- /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-DWDSyzQ7.mjs} +0 -0
- /package/dist/{search-D9WDwnV4.mjs → search-DGNc37HK.mjs} +0 -0
- /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-B5Qpn2mn.mjs} +0 -0
- /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-FjUolE6A.mjs} +0 -0
- /package/dist/{theme-BePJemMn.mjs → theme-CeVf-5qG.mjs} +0 -0
- /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-NHJj1HGq.mjs} +0 -0
- /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CniKVHIp.mjs} +0 -0
- /package/dist/{verify-2yi0H93r.mjs → verify-DS1PWAJe.mjs} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,r as l,t as u}from"./body-parser-CYD7PKFC.mjs";import{n as d,t as f}from"./input-validation-BBKJRoRB.mjs";import{a as p,i as m,n as h}from"./prompt-DM4z101s.mjs";import{t as g}from"./cli-types-BWdZbsFE.mjs";import{n as _,t as v}from"./raw-fetch-25gXED6c.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 ID(s) to filter by. Can be a single dataset ID, comma-separated list, or array. If not provided, uses default dataset`}).option(`start-date`,{type:`string`,description:`Start date for filtering (ISO 8601 format, e.g., '2024-01-01')`}).option(`end-date`,{type:`string`,description:`End date for filtering (ISO 8601 format, e.g., '2024-12-31')`}).option(`group-by-date`,{type:`boolean`,description:`Whether to group results by date (daily aggregation)`}).option(`limit`,{type:`number`,description:`Maximum number of results to return`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const 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(`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`),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`),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(`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`),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`),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(`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 Ae={command:`get <dataset-id>`,describe:`Returns all mirrored tags from the indicator dataset (DO mirror table). No pagination.`,builder:ke,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`})}},je={command:`tags`,describe:`Operations for events.dataset.indicators.tags`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Me={command:`indicators`,describe:`Operations for events.dataset.indicators`,builder:e=>e.command(Ce).command(Oe).command(ve).command(xe).command(Ee).command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ne(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 Pe={command:`create <dataset-id>`,describe:`Moves specified events from one dataset to another dataset`,builder:Ne,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`})}},Fe={command:`move`,describe:`Operations for events.dataset.move`,builder:e=>e.command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(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 Le={command:`create <dataset-id>`,describe:`Create a permission`,builder:Ie,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 Re(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 ze={command:`delete <grant-id>`,describe:`Delete a permission`,builder:Re,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.
|
|
7
|
-
`);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 Be(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 Ve={command:`get <dataset-id>`,describe:`List permissions`,builder:Be,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 He(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 Ue={command:`update <grant-id>`,describe:`Update a permission`,builder:He,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`})}},We={command:`permissions`,describe:`Operations for events.dataset.permissions`,builder:e=>e.command(Le).command(ze).command(Ve).command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ge(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 'all' / '*' for every readable indicator dataset. 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 Ke={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 specific datasets.`,builder:g(Ge),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`})}},qe={command:`indicators`,describe:`Operations for events.dataset.tags.indicators`,builder:e=>e.command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Je={command:`tags`,describe:`Operations for events.dataset.tags`,builder:e=>e.command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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:`Lists all target industries for a specific dataset`,builder:Ye,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`})}},Ze={command:`industries`,describe:`Operations for events.dataset.target.industries`,builder:e=>e.command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Qe={command:`target`,describe:`Operations for events.dataset.target`,builder:e=>e.command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$e={command:`dataset`,describe:`Operations for events.dataset`,builder:e=>e.command(L).command(z).command(F).command(H).command(ue).command(he).command(Me).command(Fe).command(We).command(Je).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const tt={command:`create`,describe:`Populate dataset-specific lookup tables from existing Events data with batch processing`,builder:et,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`})}},nt={command:`populate`,describe:`Operations for events.datasets.populate`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},rt={command:`datasets`,describe:`Operations for events.datasets`,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(`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 at={command:`delete <dataset-id>`,describe:`Deletes one or more events`,builder:it,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.
|
|
8
|
-
`);return}a(await s(`Deleting`,async()=>l.cloudforceOne.events.delete.delete({account_id:u,dataset_id:r[`dataset-id`],...c})),{successLabel:`Deleted`})}},ot={command:`delete`,describe:`Operations for events.delete`,builder:e=>e.command(at).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function st(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ct={command:`ql`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:st,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 lt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`qlv2`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:lt,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`})}},dt={command:`graph`,describe:`Operations for events.graphql.create.graph`,builder:e=>e.command(ct).command(ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ft={command:`create`,describe:`Operations for events.graphql.create`,builder:e=>e.command(dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},pt={command:`graphql`,describe:`Operations for events.graphql`,builder:e=>e.command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function mt(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query indicator types from. If not provided, queries all datasets for the account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ht={command:`get`,describe:`Lists indicator types across multiple datasets`,builder:mt,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`})}},gt={command:`types`,describe:`Operations for events.indicator.types`,builder:e=>e.command(ht).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},_t={command:`indicator`,describe:`Operations for events.indicator`,builder:e=>e.command(gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function vt(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset IDs to query indicators from (array of UUIDs), or special value 'all' or '*' to query all datasets. If not provided, uses the default dataset.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType, 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 yt={command:`get`,describe:`Retrieves indicators across specified datasets, ordered by createdAt descending then UUID, dataset ID, and shard ID ascending. Use datasetIds=all or datasetIds=* to query all datasets for the account. If no datasetIds provided, uses the default dataset.`,builder:g(vt),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`})}},bt={command:`indicators`,describe:`Operations for events.indicators`,builder:e=>e.command(yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xt(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 St={command:`create-create`,describe:`Create a new saved event query for the account`,builder:xt,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 Ct(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 wt={command:`create <query-id>`,describe:`Update an existing saved event query by its ID`,builder:Ct,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 Tt(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 Et={command:`delete <query-id>`,describe:`Delete a saved event query by its ID`,builder:Tt,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.
|
|
9
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.queries.delete({account_id:l,query_id:r[`query-id`]})),{successLabel:`Deleted`})}};function Dt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ot={command:`event`,describe:`Retrieve all saved event queries for the account`,builder:Dt,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 kt(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 At={command:`v2 <query-id>`,describe:`Retrieve a saved event query by its ID`,builder:kt,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`})}},jt={command:`get`,describe:`Operations for events.queries.get`,builder:e=>e.command(Ot).command(At).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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:`patch <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 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`})}},Pt={command:`queries`,describe:`Operations for events.queries`,builder:e=>e.command(wt).command(St).command(Et).command(Nt).command(jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ft(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 It={command:`create <raw-id>`,describe:`Updates a raw event`,builder:Ft,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`})}},Lt={command:`raw`,describe:`Operations for events.raw`,builder:e=>e.command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Rt(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 zt={command:`create <event-id>`,describe:`Creates event references for a event`,builder:Rt,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`})}},Bt={command:`create`,describe:`Operations for events.relate.create`,builder:e=>e.command(zt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Vt={command:`relate`,describe:`Operations for events.relate`,builder:e=>e.command(Bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ht(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 Ut={command:`create`,describe:`Creates a directed relationship between two events. The relationship is from parent to child with a specified type.`,builder:Ht,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`})}},Wt={command:`create`,describe:`Operations for events.relationships.create`,builder:e=>e.command(Ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gt(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 Kt={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(Gt),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`})}},qt={command:`relationships`,describe:`Operations for events.relationships`,builder:e=>e.command(Kt).command(Wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Jt(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 Yt={command:`create`,describe:`Creates a new Source-of-Truth tag category for an account.`,builder:Jt,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`})}},Xt={command:`create`,describe:`Operations for events.tags.categories.create`,builder:e=>e.command(Yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zt(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Qt={command:`delete <category-uuid>`,describe:`Deletes a Source-of-Truth tag category by UUID.`,builder:Zt,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.
|
|
10
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.tags.categories.delete({account_id:l,category_uuid:r[`category-uuid`]})),{successLabel:`Deleted`})}};function $t(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 en={command:`get`,describe:`Returns all Source-of-Truth tag categories for an account.`,builder:$t,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 tn(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 nn={command:`patch <category-uuid>`,describe:`Updates a Source-of-Truth tag category by UUID.`,builder:tn,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`})}},rn={command:`categories`,describe:`Operations for events.tags.categories`,builder:e=>e.command(Qt).command(en).command(nn).command(Xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function an(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 on={command:`delete <tag-uuid>`,describe:`Deletes a Source-of-Truth tag by UUID.`,builder:an,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.
|
|
11
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.tags.delete({account_id:l,tag_uuid:r[`tag-uuid`]})),{successLabel:`Deleted`})}};function sn(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 cn={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(sn),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 ln(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`]}).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 un={command:`patch <tag-uuid>`,describe:`Updates a Source-of-Truth tag by UUID.`,builder:ln,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`})}},dn={command:`tags`,describe:`Operations for events.tags`,builder:e=>e.command(on).command(cn).command(un).command(rn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pn={command:`get`,describe:`Lists all target industries from industry map catalog`,builder:fn,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`})}},mn={command:`catalog`,describe:`Operations for events.target.industries.catalog`,builder:e=>e.command(pn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},hn={command:`industries`,describe:`Operations for events.target.industries`,builder:e=>e.command(mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},gn={command:`target`,describe:`Operations for events.target`,builder:e=>e.command(hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _n(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 vn={command:`patch`,describe:`Updates multiple events with the same field values. Maximum 100 events per request.`,builder:_n,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`})}},yn={command:`bulk`,describe:`Operations for events.update.bulk`,builder:e=>e.command(vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bn={command:`update`,describe:`Operations for events.update`,builder:e=>e.command(yn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xn={command:`events`,describe:`Operations for events`,builder:e=>e.command(M).command(w).command(A).command($e).command(rt).command(ot).command(pt).command(_t).command(bt).command(Pt).command(Lt).command(Vt).command(qt).command(dn).command(gn).command(bn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Sn(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 Cn={command:`create <request-id>`,describe:`Uploads a new asset to a Cloudforce One intelligence request.`,builder:Sn,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`})}},wn={command:`asset-new`,describe:`Operations for requests.asset-new`,builder:e=>e.command(Cn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Tn(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 En={command:`create <request-id>`,describe:`Lists assets attached to a Cloudforce One intelligence request.`,builder:Tn,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 Dn(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 On={command:`delete <asset-id>`,describe:`Removes an asset from a Cloudforce One intelligence request.`,builder:Dn,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.
|
|
12
|
-
`);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 kn(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 An={command:`get <asset-id>`,describe:`Retrieves an asset attached to a Cloudforce One intelligence request.`,builder:kn,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 jn(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 Mn={command:`update <asset-id>`,describe:`Updates an asset in a Cloudforce One intelligence request.`,builder:jn,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`})}},Nn={command:`assets`,describe:`Operations for requests.assets`,builder:e=>e.command(En).command(On).command(An).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:`constants`,describe:`Retrieves constant values used in Cloudforce One requests, including valid statuses and types.`,builder:Pn,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 In(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 Ln={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:In,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 Rn(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 zn={command:`delete <request-id>`,describe:`Deletes a Cloudforce One intelligence request and all associated data.`,builder:Rn,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.
|
|
13
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.delete({account_id:l,request_id:r[`request-id`]})),{successLabel:`Deleted`})}};function Bn(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 Vn={command:`get <request-id>`,describe:`Retrieves details for a specific Cloudforce One intelligence request.`,builder:Bn,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 Hn(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 Un={command:`list`,describe:`Lists Cloudforce One intelligence requests with filtering and pagination.`,builder:Hn,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 Wn(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 Gn={command:`create <request-id>`,describe:`Adds a message to a Cloudforce One intelligence request conversation.`,builder:Wn,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 Kn(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 qn={command:`delete <message-id>`,describe:`Removes a message from a Cloudforce One intelligence request thread.`,builder:Kn,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.
|
|
14
|
-
`);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 Jn(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 Yn={command:`get <request-id>`,describe:`Lists messages in a Cloudforce One intelligence request conversation.`,builder:Jn,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 Xn(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 Zn={command:`update <message-id>`,describe:`Updates a message in a Cloudforce One intelligence request thread.`,builder:Xn,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`})}},Qn={command:`message`,describe:`Operations for requests.message`,builder:e=>e.command(Gn).command(qn).command(Yn).command(Zn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $n(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 er={command:`create`,describe:`Creates a new priority intelligence request in Cloudforce One.`,builder:$n,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 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}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const nr={command:`delete <priority-id>`,describe:`Deletes a priority intelligence request from Cloudforce One.`,builder:tr,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.
|
|
15
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.priority.delete({account_id:l,priority_id:r[`priority-id`]})),{successLabel:`Deleted`})}};function rr(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 ir={command:`get <priority-id>`,describe:`Retrieves a specific priority intelligence request from Cloudforce One.`,builder:rr,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 ar(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:ar,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 sr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const cr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One priority requests.`,builder:sr,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 lr(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 ur={command:`update <priority-id>`,describe:`Updates a priority intelligence request in Cloudforce One.`,builder:lr,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`})}},dr={command:`priority`,describe:`Operations for requests.priority`,builder:e=>e.command(er).command(nr).command(ir).command(or).command(cr).command(ur).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One standard requests.`,builder:fr,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 mr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const hr={command:`types`,describe:`Lists available request types for Cloudforce One intelligence requests.`,builder:mr,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 gr(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 _r={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:gr,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`})}},vr={command:`requests`,describe:`Additional request operations — priority listing and asset creation`,builder:e=>e.command(Fn).command(Ln).command(zn).command(Vn).command(Un).command(pr).command(hr).command(_r).command(wn).command(Nn).command(Qn).command(dr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yr(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 br={command:`cancel <id>`,describe:`Cancel a pending rule approval. Only its original requester may cancel it.`,builder:yr,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 xr(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 Sr={command:`get <id>`,describe:`Get a single rule approval with current rule data.`,builder:xr,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 Cr(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 wr={command:`list`,describe:`Returns rule approvals with optional status, revision, reviewer-scope, and mutation-type filtering.`,builder:g(Cr),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 Tr(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 Er={command:`resubmit <id>`,describe:`Create a new pending revision from a rejected rule approval. Only the original requester may resubmit the latest revision.`,builder:Tr,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`})}},Dr={command:`approvals`,describe:`Operations for rules.approvals`,builder:e=>e.command(br).command(Sr).command(wr).command(Er).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Or(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 kr={command:`create`,describe:`Create a new detection rule.`,builder:Or,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 Ar(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 jr={command:`delete <id>`,describe:`Delete an existing rule.`,builder:Ar,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.
|
|
16
|
-
`);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 Mr(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 Nr={command:`deleteAll`,describe:`Delete all rules in an account.`,builder:Mr,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.
|
|
17
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.rules.deleteAll({account_id:l})),{successLabel:`Deleted`})}};function Pr(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 Fr={command:`resubmit <id>`,describe:`Validates and compiles a complete structured email rule, then creates an immutable pending revision of its rejected approval.`,builder:g(Pr),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`})}},Ir={command:`approvals`,describe:`Operations for rules.email.approvals`,builder:e=>e.command(Fr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Lr(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 Rr={command:`create`,describe:`Create a structured email rule.`,builder:Lr,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 zr(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 Br={command:`delete <id>`,describe:`Delete an existing structured email rule.`,builder:zr,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.
|
|
18
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.rules.email.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function Vr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get <id>`,describe:`Get a structured email rule by ID.`,builder:Vr,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 Hr(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 Ur={command:`list`,describe:`Returns structured email rules.`,builder:Hr,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 Wr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Gr={command:`get`,describe:`Get the field catalog for structured email rules.`,builder:Wr,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`})}},Kr={command:`schema`,describe:`Operations for rules.email.schema`,builder:e=>e.command(Gr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qr(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 Jr={command:`test <id>`,describe:`Test a structured email rule against sample email JSON.`,builder:qr,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 Yr(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 Xr={command:`update <id>`,describe:`Updates an existing structured email rule.`,builder:Yr,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 Zr(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 Qr={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(Zr),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 $r(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 ei={command:`validate`,describe:`Validates structured email rule syntax and metadata.`,builder:$r,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`})}},ti={command:`email`,describe:`Operations for rules.email`,builder:e=>e.command(Rr).command(Br).command($).command(Ur).command(Jr).command(Xr).command(Qr).command(ei).command(Ir).command(Kr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ni(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 ri={command:`create`,describe:`Add regex patterns to per-account exemption rules (union semantics). Missing keys leave that type untouched; duplicates are silently deduped.`,builder:ni,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 ii(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 ai={command:`delete`,describe:`Remove regex patterns from per-account exemption rules. Missing keys leave that type untouched; non-existent patterns are silently skipped.`,builder:ii,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.
|
|
19
|
-
`);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 oi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const si={command:`get`,describe:`Get all exemption rule patterns for the account, grouped by type.`,builder:oi,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 ci(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 li={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:ci,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`})}},ui={command:`exemptions`,describe:`Operations for rules.exemptions`,builder:e=>e.command(ri).command(ai).command(si).command(li).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function di(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:di,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 pi(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 mi={command:`list`,describe:`Returns all rules for an account with optional filtering.`,builder:g(pi),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 hi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gi={command:`get`,describe:`Get DFP managed rule metadata (name and description) from YARA rules.`,builder:hi,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`})}},_i={command:`managed`,describe:`Operations for rules.managed`,builder:e=>e.command(gi).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 yi={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 bi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xi={command:`get`,describe:`Get statistics about rules for the dashboard.`,builder:bi,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`})}},Si={command:`stats`,describe:`Operations for rules.stats`,builder:e=>e.command(xi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ci(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const wi={command:`get`,describe:`Get the folder tree structure for rules navigation.`,builder:Ci,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`})}},Ti={command:`tree`,describe:`Operations for rules.tree`,builder:e=>e.command(wi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ei(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 Di={command:`update <id>`,describe:`Updates an existing rule.`,builder:Ei,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 Oi(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 ki={command:`validate`,describe:`Validates rule syntax, name uniqueness, namespace, and metadata.`,builder:Oi,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`})}},Ai={command:`rules`,describe:`Rule management operations`,builder:e=>e.command(kr).command(jr).command(Nr).command(fi).command(mi).command(yi).command(Di).command(ki).command(Dr).command(ti).command(ui).command(_i).command(Si).command(Ti).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ji(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 Mi={command:`create`,describe:`Create a new Scan Config`,builder:ji,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 Ni(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 Pi={command:`delete <config-id>`,describe:`Delete a Scan Config`,builder:Ni,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.
|
|
20
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.scans.config.delete({account_id:l,config_id:r[`config-id`]})),{successLabel:`Deleted`})}};function Fi(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 Ii={command:`edit <config-id>`,describe:`Update an existing Scan Config`,builder:Fi,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 Li(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ri={command:`list`,describe:`List Scan Configs`,builder:Li,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`})}},zi={command:`config`,describe:`Operations for scans.config`,builder:e=>e.command(Mi).command(Pi).command(Ii).command(Ri).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Bi(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 Vi={command:`get <config-id>`,describe:`Get the Latest Scan Result`,builder:Bi,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`})}},Hi={command:`results`,describe:`Operations for scans.results`,builder:e=>e.command(Vi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ui={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(zi).command(Hi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Wi(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 Gi={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:Wi,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 Ki(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 qi={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:Ki,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.
|
|
21
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.collections.delete({account_id:l,collection_id:r[`collection-id`]})),{successLabel:`Deleted`})}};function Ji(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 Yi={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:Ji,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 Xi(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 Zi={command:`get <collection-id>`,describe:`Retrieves a single collection by ID with its schema and metadata`,builder:Xi,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 Qi(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 $i={command:`list`,describe:`Retrieves all collections for an account with pagination`,builder:Qi,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 ea(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:ea,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`})}},na={command:`collections`,describe:`Operations for stakeout.collections`,builder:e=>e.command(Gi).command(qi).command(Yi).command(Zi).command($i).command(ta).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ra(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 ia={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:ra,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 aa(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 oa={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:aa,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.
|
|
22
|
-
`);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 sa(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 ca={command:`update <column-id>`,describe:`Update name, type, required, or position of a column.`,builder:sa,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`})}},la={command:`columns`,describe:`Operations for stakeout.columns`,builder:e=>e.command(ia).command(oa).command(ca).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ua(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 da={command:`create`,describe:`Create a new saved brand protection query with string match patterns`,builder:ua,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 fa(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 pa={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:fa,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.
|
|
23
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.domainQueries.delete({account_id:l,query_id:r[`query-id`]})),{successLabel:`Deleted`})}};function ma(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 ha={command:`update <query-id>`,describe:`Update a saved brand protection domain query with string match patterns`,builder:ma,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`})}},ga={command:`domain-queries`,describe:`Operations for stakeout.domain-queries`,builder:e=>e.command(da).command(pa).command(ha).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _a(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. Intersected with ACL 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 va={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:_a,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`})}},ya={command:`graphs`,describe:`Operations for stakeout.graphs`,builder:e=>e.command(va).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ba(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 ID(s) to filter by. Can be a single dataset ID or comma-separated list. 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 event links whose eventDate is on/after this date (ISO 8601). Use to bound 'top indicator' to recent activity.`}).option(`event-date-before`,{type:`string`,description:`For measure=relationships: only count event links whose eventDate is on/before this date (ISO 8601).`}).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 xa={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(ba),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`})}},Sa={command:`indicators`,describe:`Operations for stakeout.indicators`,builder:e=>e.command(xa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ca(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 wa={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:Ca,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 Ta(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 Ea={command:`delete <item-id>`,describe:`Delete an item from a collection by its identifier.`,builder:Ta,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.
|
|
24
|
-
`);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 Da(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 Oa={command:`get <item-id>`,describe:`Retrieve a single item from a collection by its identifier.`,builder:Da,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 ka(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 Aa={command:`query <collection-id>`,describe:`Retrieves items from a collection with keyset pagination and optional column-based filters`,builder:ka,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 ja(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`],default:`asc`}).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`].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 Ma={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:ja,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 Na(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 Pa={command:`update <item-id>`,describe:`Update an item in a collection with partial data.`,builder:Na,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`})}},Fa={command:`items`,describe:`Operations for stakeout.items`,builder:e=>e.command(wa).command(Ea).command(Oa).command(Aa).command(Ma).command(Pa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ia(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 La={command:`create`,describe:`Create a new user-defined takedown letter template`,builder:Ia,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 Ra(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 za={command:`delete <template-id>`,describe:`Delete a user-defined takedown letter template. System templates cannot be deleted.`,builder:Ra,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.
|
|
25
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.letterTemplates.delete({account_id:l,template_id:r[`template-id`]})),{successLabel:`Deleted`})}};function Ba(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Va={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:Ba,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 Ha(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 Ua={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:Ha,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 Wa(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ga={command:`list`,describe:`List user-defined takedown letter templates. System example templates are available via the /templates/examples endpoint.`,builder:Wa,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 Ka(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 qa={command:`update <template-id>`,describe:`Update a user-defined takedown letter template. System templates cannot be modified.`,builder:Ka,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`})}},Ja={command:`letter-templates`,describe:`Operations for stakeout.letter-templates`,builder:e=>e.command(La).command(za).command(Va).command(Ua).command(Ga).command(qa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ya(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 Xa={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:Ya,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 Za(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 Qa={command:`delete <letter-id>`,describe:`Delete a specific takedown letter and its associated PDF from storage.`,builder:Za,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.
|
|
26
|
-
`);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 $a(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`],default:`sent`}).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`].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 eo={command:`generate`,describe:`Generate a takedown letter from a template. Returns V4 JSON for text format or a PDF binary for pdf format.`,builder:$a,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 to(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 no={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:to,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 ro(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 io={command:`get <letter-id>`,describe:`Get a specific takedown letter by ID, including the rendered text.`,builder:ro,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 oo={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`})}},so={command:`takedown-letters`,describe:`Operations for stakeout.takedown-letters`,builder:e=>e.command(Xa).command(Qa).command(eo).command(io).command(no).command(oo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function co(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 lo={command:`create`,describe:`Create a new takedown notice for a domain suspected of trademark infringement.`,builder:co,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 uo(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 fo={command:`delete <notice-id>`,describe:`Delete a takedown notice and all associated letters. PDFs are also removed from storage.`,builder:uo,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.
|
|
27
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.takedownNotices.delete({account_id:l,notice_id:r[`notice-id`]})),{successLabel:`Deleted`})}};function po(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 mo={command:`get <notice-id>`,describe:`Get a specific takedown notice by ID.`,builder:po,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 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 all takedown notices for the account.`,builder:ho,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 _o(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 vo={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:_o,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 yo(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 bo={command:`update <notice-id>`,describe:`Update a takedown notice (e.g. change status to sent, resolved, etc.).`,builder:yo,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`})}},xo={command:`takedown-notices`,describe:`Operations for stakeout.takedown-notices`,builder:e=>e.command(lo).command(fo).command(mo).command(go).command(vo).command(bo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},So={command:`stakeout`,describe:`Operations for stakeout`,builder:e=>e.command(na).command(la).command(ga).command(ya).command(Sa).command(Fa).command(Ja).command(so).command(xo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Co(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 wo={command:`list`,describe:`Lists known threat attackers tracked in Cloudforce One threat intelligence.`,builder:Co,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`})}},To={command:`attackers`,describe:`Operations for threat-events.attackers`,builder:e=>e.command(wo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Eo(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 Do={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:Eo,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 Oo(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 ko={command:`create`,describe:`Creates a new threat event category in Cloudforce One for organizing and classifying threat events.`,builder:Oo,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 Ao(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 jo={command:`delete <category-id>`,describe:`Removes a threat event category from Cloudforce One.`,builder:Ao,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.
|
|
28
|
-
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.categories.delete({account_id:l,category_id:r[`category-id`]})),{successLabel:`Deleted`})}};function Mo(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 No={command:`edit <category-id>`,describe:`Partially updates a threat event category in Cloudforce One, modifying specific fields without replacing the entire category.`,builder:Mo,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 Po(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 Fo={command:`get <category-id>`,describe:`Retrieves details for a specific threat event category.`,builder:Po,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 Io(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 Lo={command:`list`,describe:`Lists all threat event categories configured for classifying and organizing threat events.`,builder:Io,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`})}},Ro={command:`categories`,describe:`Operations for threat-events.categories`,builder:e=>e.command(ko).command(jo).command(No).command(Fo).command(Lo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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:`Lists countries referenced in Cloudforce One threat intelligence data.`,builder:zo,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`})}},Vo={command:`countries`,describe:`Operations for threat-events.countries`,builder:e=>e.command(Bo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ho(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(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Uo={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:Ho,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`)},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`)},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 Wo(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 Go={command:`create`,describe:`Creates a new threat event dataset in Cloudforce One for organizing related threat events.`,builder:Wo,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 Ko(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 qo={command:`edit <dataset-id>`,describe:`Partially updates a threat event dataset in Cloudforce One, modifying specific fields without replacing the entire dataset configuration.`,builder:Ko,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 Jo(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 Yo={command:`get <dataset-id>`,describe:`Retrieves details for a specific threat event dataset.`,builder:Jo,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 Xo(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 Zo={command:`list`,describe:`Lists all threat event datasets configured in Cloudforce One.`,builder:Xo,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 Qo(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 $o={command:`raw <event-id>`,describe:`Retrieves the raw data associated with an event. Searches across all shards in the dataset.`,builder:Qo,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`})}},es={command:`datasets`,describe:`Operations for threat-events.datasets`,builder:e=>e.command(Go).command(qo).command(Yo).command(Zo).command($o).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 ns={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 rs(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 is={command:`create <event-id>`,describe:`Adds a tag to a threat event in Cloudforce One for classification and filtering.`,builder:rs,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 as(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 os={command:`delete <event-id>`,describe:`Removes a tag from a threat event in Cloudforce One.`,builder:as,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.
|
|
29
|
-
`);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`})}},ss={command:`event-tags`,describe:`Operations for threat-events.event-tags`,builder:e=>e.command(is).command(os).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function cs(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 ls={command:`get <event-id>`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/events/:event_id instead.`,builder:cs,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 us(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ds={command:`list`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes instead.`,builder:us,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`})}},fs={command:`indicator-types`,describe:`Operations for threat-events.indicator-types`,builder:e=>e.command(ds).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ps(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination. When provided, filters are embedded in the cursor so you only need to pass cursor and pageSize. Returned in the previous response's result_info.cursor field. Use cursor-based pagination for deep pagination (beyond 100,000 records) or for optimal performance.`}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page number (1-indexed) for offset-based pagination. Limited to offset of 100,000 records. For deep pagination, use cursor-based pagination instead.`}).option(`page-size`,{type:`number`,description:`Number of results per page. Maximum 25,000.`}).option(`order-by`,{type:`string`,description:`OrderBy`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`dataset-id`,{type:`string`,description:`Dataset IDs to query events from (array of UUIDs), or special value 'all' or '*' to query all event datasets for the account. If not provided, uses the default dataset.`}).option(`force-refresh`,{type:`boolean`,description:`ForceRefresh`}).option(`format`,{type:`string`,description:`Format`,choices:[`json`,`stix2`,`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 ms={command:`list`,describe:"Use `datasetId=all` or `datasetId=*` to query all event datasets for the account (limited to 50). 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(ps),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 hs(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 gs={command:`edit <raw-id>`,describe:`Partially updates raw threat event data in Cloudforce One, modifying specific fields of the event.`,builder:hs,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 _s(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 vs={command:`get <raw-id>`,describe:`Retrieves raw threat event data for a specific event in Cloudforce One.`,builder:_s,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`})}},ys={command:`raw`,describe:`Operations for threat-events.raw`,builder:e=>e.command(gs).command(vs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bs(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 xs={command:`delete <event-id>`,describe:`Removes a reference link between related threat events in Cloudforce One.`,builder:bs,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.
|
|
30
|
-
`);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`})}},Ss={command:`relate`,describe:`Operations for threat-events.relate`,builder:e=>e.command(xs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Cs(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.`,choices:[`red`,`amber`,`amber+strict`,`green`,`clear`,`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 ws={command:`create`,describe:`Creates a new tag to be used accross threat events.`,builder:Cs,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`})}},Ts={command:`tags`,describe:`Operations for threat-events.tags`,builder:e=>e.command(ws).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Es(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 Ds={command:`list`,describe:`Retrieves the catalog of industry classifications used in Cloudforce One threat intelligence.`,builder:Es,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`})}},Os={command:`target-industries`,describe:`Operations for threat-events.target-industries`,builder:e=>e.command(Ds).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ks={command:`threat-events`,describe:`Operations for threat-events`,builder:e=>e.command(Do).command(Uo).command(ns).command(ls).command(ms).command(To).command(Ro).command(Vo).command(es).command(ss).command(fs).command(ys).command(Ss).command(Ts).command(Os).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},As={command:`cloudforce-one`,describe:`Detection rule management APIs`,builder:e=>e.command(x).command(xn).command(vr).command(Ai).command(Ui).command(So).command(ks).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{As as default};
|