cf 0.10.0 → 0.11.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 +15 -5
- package/dist/_meta/agent-context.json +12 -4
- package/dist/_meta/commands.json +2249 -262
- package/dist/_meta/hand-written-commands.json +784 -0
- package/dist/_meta/schemas.json +1882 -155
- package/dist/{abuse-reports-CGF4zcKf.mjs → abuse-reports-sDBTV0qZ.mjs} +2 -2
- package/dist/{access-lhLJo1v2.mjs → access-DcNzuCue.mjs} +1 -1
- package/dist/account-BX90zXn5.mjs +2 -0
- package/dist/{account-tags-B88TotoH.mjs → account-tags-Bz3JG5hI.mjs} +4 -4
- package/dist/{accounts-BSIAT_iP.mjs → accounts-DCuW3xyZ.mjs} +12 -12
- package/dist/{acm-VULm1djv.mjs → acm-zjfShZLS.mjs} +1 -1
- package/dist/{addressing-BHPBIkRY.mjs → addressing-DORQ64Ux.mjs} +11 -11
- package/dist/{agent-context-KBy48G1b.mjs → agent-context-BgPR_aQr.mjs} +1 -1
- package/dist/agent-memory-C0hAUMeC.mjs +6 -0
- package/dist/ai-BpEBGMT2.mjs +5 -0
- package/dist/ai-audit-DnU3vn3E.mjs +2 -0
- package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
- package/dist/ai-search-DKbN9Tyd.mjs +7 -0
- package/dist/ai-security-C_I5lo58.mjs +4 -0
- package/dist/{alerting-Bl8OqViR.mjs → alerting-4T8gmZs-.mjs} +1 -1
- package/dist/analytics-Bxh4TCP7.mjs +3 -0
- package/dist/analytics_engine-fV56bjVN.mjs +2 -0
- package/dist/{api-security-4FVrD4n8.mjs → api-security-COk_i184.mjs} +20 -20
- package/dist/argo-DIRfvxvv.mjs +2 -0
- package/dist/{artifacts-CVDGnr2V.mjs → artifacts-BBfXNfUg.mjs} +1 -1
- package/dist/audit-logs-BlOrlAWe.mjs +2 -0
- package/dist/{auth-MQEamPN9.mjs → auth-D3X9HYhD.mjs} +3 -3
- package/dist/auth-DPhNN3Ly.mjs +5 -0
- package/dist/billing-B9e4PnvN.mjs +3 -0
- package/dist/body-parser-BshbixEq.mjs +2 -0
- package/dist/bot-management-D2JVeS-V.mjs +5 -0
- package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
- package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
- package/dist/{browser-extension-BtpCbh-2.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
- package/dist/browser-run-CHGOCTdG.mjs +4 -0
- package/dist/build-D0FhOj40.mjs +8 -0
- package/dist/{cache-VyWK1SjY.mjs → cache-C6V7PbQM.mjs} +1 -1
- package/dist/{calls-BxoRYxs4.mjs → calls-Bye8Tyy-.mjs} +1 -1
- package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
- package/dist/cf-Ds4JFovl.mjs +18 -0
- package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
- package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
- package/dist/{client-certificates-DDUv8K0a.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
- package/dist/{client-side-security-D4ysjwWT.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
- package/dist/cloud-connector-CL1jPQud.mjs +2 -0
- package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
- package/dist/command-C9VP3xaA.mjs +2 -0
- package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
- package/dist/config.d.mts +1460 -1348
- package/dist/config.mjs +1 -1
- package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
- package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
- package/dist/{connectors-BqxYMMtQ.mjs → connectors-BQwyBJ4_.mjs} +1 -1
- package/dist/{containers-CKW081JA.mjs → containers-BrQtGiNp.mjs} +12 -8
- package/dist/{content-scan-Dgd7A8KF.mjs → content-scan-DNzhXYkY.mjs} +1 -1
- package/dist/{csamScanner-DYL37wLc.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
- package/dist/{ct-alerting-CkhSbfAs.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
- package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
- package/dist/custom-csrs-bhClr2SU.mjs +3 -0
- package/dist/{custom-hostnames-q_nsnlye.mjs → custom-hostnames-C0eiGvG9.mjs} +1 -1
- package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
- package/dist/custom-pages-DTINMR30.mjs +3 -0
- package/dist/d1-sKdExJYF.mjs +20 -0
- package/dist/data-security-mV3a6UfW.mjs +7 -0
- package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-CZ7bgNDu.mjs → deploy-BL59O1O1.mjs} +1 -1
- package/dist/deploy-input-Dz6q-__n.mjs +2 -0
- package/dist/{dev-V10MG-Bg.mjs → dev-BDaavgH1.mjs} +2 -2
- package/dist/{diagnostics-BTH-8nJH.mjs → diagnostics-CJV6qWUA.mjs} +1 -1
- package/dist/{directory-BlH6N6Qy.mjs → directory-B5zCMusW.mjs} +1 -1
- package/dist/{dispatch-namespaces-BCjH1JzB.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
- package/dist/dist-BHi7UhXO.mjs +72 -0
- package/dist/dist-BWpErtDM.mjs +384 -0
- package/dist/{dls-BF5iN78p.mjs → dls-t0hnIe_P.mjs} +1 -1
- package/dist/{dns-CeCTNqRk.mjs → dns-C8FC2hbh.mjs} +13 -13
- package/dist/{dns-firewall-B54MaLGm.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
- package/dist/{dot-prop-6SRZBKHT-wIVDg_fl.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
- package/dist/dry-run-DL2V6yFm.mjs +2 -0
- package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
- package/dist/email-auth-BmYrl0pO.mjs +2 -0
- package/dist/email-routing-CF3_Z957.mjs +6 -0
- package/dist/email-security-F7OYcMkZ.mjs +18 -0
- package/dist/email-sending-EyU3WvGQ.mjs +7 -0
- package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
- package/dist/{firewall-CBPGJ43p.mjs → firewall-8YWWy4iB.mjs} +9 -9
- package/dist/flagship-C4x0l-8J.mjs +4 -0
- package/dist/{fraud-BIhS8pLf.mjs → fraud-HR_SdUx3.mjs} +1 -1
- package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
- package/dist/{healthchecks-FiXIk-KP.mjs → healthchecks-4qOvjrTN.mjs} +1 -1
- package/dist/{hostnames-Bx0mykMR.mjs → hostnames-DehdYOMz.mjs} +1 -1
- package/dist/{hyperdrive-C8qCabBF.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
- package/dist/iam-DR72hmii.mjs +6 -0
- package/dist/images-CeKc5JPh.mjs +8 -0
- package/dist/index.mjs +1 -1
- package/dist/{intel-B-9Z_sJs.mjs → intel-DtFix9WL.mjs} +1 -1
- package/dist/{interactive-DtsCYfrK.mjs → interactive-C7M55Wxx.mjs} +1 -1
- package/dist/ips-CtWCjXAN.mjs +2 -0
- package/dist/{keyless-certificates-THHvoXX3.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
- package/dist/keys-BmhG6Kn1.mjs +2 -0
- package/dist/{kv-BFDUCnft.mjs → kv-BuVPAuZP.mjs} +1 -1
- package/dist/{leaked-credential-checks-DUlUCOoJ.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
- package/dist/load-balancers-CylN-l7n.mjs +6 -0
- package/dist/{local-D-aVNu6A.mjs → local-Be3lg_9E.mjs} +1 -1
- package/dist/{local-runtime-Dh3keC5v.mjs → local-runtime-Ce7k598H.mjs} +1 -1
- package/dist/logexplorer-CvRPoKbj.mjs +17 -0
- package/dist/logo-matches-Heuft3yF.mjs +2 -0
- package/dist/logos-DRYjGBDq.mjs +3 -0
- package/dist/{logpush-BK34mMQs.mjs → logpush-Dve9jOMp.mjs} +1 -1
- package/dist/{logs-CLAqX9h2.mjs → logs-SC86FE89.mjs} +1 -1
- package/dist/{magic-cloud-networking-h_ozrC5S.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
- package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
- package/dist/magic-transit-BK_3asH2.mjs +111 -0
- package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
- package/dist/matches-Iss9Fo4R.mjs +2 -0
- package/dist/mcp-8wxXT6JU.mjs +4 -0
- package/dist/mesh-Bf9UAS4J.mjs +4 -0
- package/dist/{moq-qmuVPAO0.mjs → moq-ZKMFOeVz.mjs} +1 -1
- package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
- package/dist/{network-D74cSy3t.mjs → network-B1lBARU9.mjs} +1 -1
- package/dist/{network-interconnects-BJ0Nc48J.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
- package/dist/oauth-DuEONNgC.mjs +14 -0
- package/dist/{oauth-clients-Br-smLxQ.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
- package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
- package/dist/observability-Jya7-zkl.mjs +4 -0
- package/dist/{open-PBXRGS4R-R-qesf18.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
- package/dist/{organization-NX7yCZrq.mjs → organization-CYxYV4e0.mjs} +6 -6
- package/dist/organizations-SacGUW44.mjs +2 -0
- package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
- package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
- package/dist/{output-DrpYYfnB.mjs → output-Ccqw2WOb.mjs} +1 -1
- package/dist/page-rules-BqEyFR2c.mjs +27 -0
- package/dist/pages-CQ7ZVWk1.mjs +14 -0
- package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
- package/dist/pipelines-6De2Pe2C.mjs +6 -0
- package/dist/precursor-iwK-1P_d.mjs +4 -0
- package/dist/progress-BqQcF5QH.mjs +2 -0
- package/dist/project-settings-C_1-JI6Y.mjs +3 -0
- package/dist/prompt-B0sWIs9c.mjs +3 -0
- package/dist/{public-BwQqexwo-CNW_dPly.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
- package/dist/queries-c7zvnfEQ.mjs +3 -0
- package/dist/queues-BU6y16qS.mjs +6 -0
- package/dist/r2-Jo3QMahK.mjs +24 -0
- package/dist/{r2-data-catalog-Du7hN9jA.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
- package/dist/radar-DIYAMEof.mjs +2 -0
- package/dist/{rate-limits-yBF3qoYD.mjs → rate-limits-DewOcznT.mjs} +1 -1
- package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
- package/dist/{realtimekit-CIP7lP-a.mjs → realtimekit-cnZEVNDn.mjs} +1 -1
- package/dist/registrar-BsWr_aPM.mjs +23 -0
- package/dist/{registrar-sandbox-DiXg8p_1.mjs → registrar-sandbox-BlcpUyIH.mjs} +4 -4
- package/dist/{registry-Bck_zFkz.mjs → registry-jifR3_Y6.mjs} +1 -1
- package/dist/reporting--1AyTV7k.mjs +2 -0
- package/dist/request-tracers-C_VX7X6-.mjs +2 -0
- package/dist/{resource-sharing-D1pSDvtf.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
- package/dist/resource-tagging-C33U6T74.mjs +2 -0
- package/dist/rules-BfjzALMi.mjs +4 -0
- package/dist/rulesets-3i_1Vwt-.mjs +5 -0
- package/dist/rum-CjmIckiR.mjs +4 -0
- package/dist/{schema-B34Q9tLF.mjs → schema-1mwmslUV.mjs} +1 -1
- package/dist/schema-flags-llLJuFFw.mjs +5 -0
- package/dist/{scim-CcSyfKCH.mjs → scim-pApmzA5B.mjs} +1 -1
- package/dist/{secrets-store-DFmvtphu.mjs → secrets-store-DBC9WJau.mjs} +1 -1
- package/dist/security-center-Djm06dq-.mjs +2 -0
- package/dist/{security-txt-DqnFpjMI.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
- package/dist/{share-BuwYUzOL.mjs → share-Dj-MNXrw.mjs} +4 -4
- package/dist/shared-BJvq4DkR.mjs +290 -0
- package/dist/smart-shield--8EpJjrF.mjs +4 -0
- package/dist/snippets-Dyz0PH60.mjs +4 -0
- package/dist/{spawn-O1RS01vr.mjs → spawn-C5Z7oWdp.mjs} +108 -112
- package/dist/{spectrum-b7N1ZRAm.mjs → spectrum-rAHWz8rH.mjs} +1 -1
- package/dist/{speed-cw31yFva.mjs → speed-BKepWBXj.mjs} +1 -1
- package/dist/src-gJma71Ec.mjs +108 -0
- package/dist/{ssl-CsEhRVTO.mjs → ssl-KdFiY3ev.mjs} +1 -1
- package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
- package/dist/{state-Bb5Cbc_L.mjs → state-Cu3cItUg.mjs} +1 -1
- package/dist/{stream-DFOao6Gu.mjs → stream-CKJ6Tb0M.mjs} +13 -13
- package/dist/submit-BxbKKhBn.mjs +2 -0
- package/dist/tags-DA8dq9fx.mjs +2 -0
- package/dist/tenant-DLXw48hS.mjs +2 -0
- package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
- package/dist/{tools-BHfBOZOU.mjs → tools-x8bj9E6b.mjs} +1 -1
- package/dist/{tunnel-DkMiNtVY.mjs → tunnel-CNQA5Flp.mjs} +1 -1
- package/dist/tunnels-CC10EOsU.mjs +2 -0
- package/dist/turnstile-CH58hnf4.mjs +23 -0
- package/dist/{ui-DE8CNn6c.mjs → ui-CmnnBm_O.mjs} +1 -1
- package/dist/url-info-BpCgdUtL.mjs +2 -0
- package/dist/{url-normalization-ClfFiruK.mjs → url-normalization-BzuynEy1.mjs} +1 -1
- package/dist/url-scanner-APIZbhB7.mjs +2 -0
- package/dist/user-2-NGebfI.mjs +12 -0
- package/dist/values-S_bNv819.mjs +2 -0
- package/dist/{vectorize-CVKu7lEt.mjs → vectorize-Bv7feLBC.mjs} +1 -1
- package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
- package/dist/{web-assets-C2s9kzWf.mjs → web-assets-C1UmOyzD.mjs} +1 -1
- package/dist/web3-GnUocVYH.mjs +4 -0
- package/dist/workers-J1-PLwdl.mjs +28 -0
- package/dist/{workers-builds-B55-oXOa.mjs → workers-builds-DCHmWOMS.mjs} +1 -1
- package/dist/{workflows-B-kGHxFu.mjs → workflows-CArfEI2c.mjs} +1 -1
- package/dist/zaraz-mg2YlR3_.mjs +2 -0
- package/dist/{zero-trust-DV3sIOvu.mjs → zero-trust-DVdUPtj1.mjs} +67 -66
- package/dist/zone-DMAfrDJX.mjs +2 -0
- package/dist/zones-CNwxUi7I.mjs +21 -0
- package/package.json +10 -7
- package/dist/account-CYRm3yoN.mjs +0 -2
- package/dist/agent-memory-DDv_Gxr7.mjs +0 -6
- package/dist/ai-audit-BWZGvbca.mjs +0 -2
- package/dist/ai-gateway-jeB-sAgP.mjs +0 -13
- package/dist/ai-search-BmdskMjR.mjs +0 -7
- package/dist/ai-security-CsmfcaUx.mjs +0 -4
- package/dist/ai-viHB1tgI.mjs +0 -5
- package/dist/analytics-vOxw8Hy0.mjs +0 -3
- package/dist/analytics_engine-DO4-C0wD.mjs +0 -2
- package/dist/argo-CQfCgazW.mjs +0 -2
- package/dist/audit-logs-CzpwvQ6A.mjs +0 -2
- package/dist/auth-D0xZxAEa.mjs +0 -5
- package/dist/billing-aJgapeRm.mjs +0 -3
- package/dist/body-parser-C-c9gfH1.mjs +0 -2
- package/dist/bot-management-Y2q5d-pi.mjs +0 -5
- package/dist/botnet-feed-DANJqfmE.mjs +0 -3
- package/dist/brand-protection-CjpZWBjp.mjs +0 -3
- package/dist/browser-run-BFn9h2Tz.mjs +0 -4
- package/dist/build-DcflwvqN.mjs +0 -2
- package/dist/certificate-authorities-D7OAFxF_.mjs +0 -2
- package/dist/cf-C7DU4819.mjs +0 -18
- package/dist/chunk-LQW53VED-DLrXV-hE.mjs +0 -499
- package/dist/cloud-connector-Bhec6z2P.mjs +0 -2
- package/dist/cloudforce-one-J_hn9ss9.mjs +0 -36
- package/dist/connector-interrupts-Dycx8zFx.mjs +0 -2
- package/dist/connector-telemetry-events-BmxOSNtN.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CdcqfKnH.mjs +0 -2
- package/dist/custom-certificates-BzAOnEoT.mjs +0 -5
- package/dist/custom-csrs-CgzG3pd3.mjs +0 -3
- package/dist/custom-nameservers-BUBmfhUe.mjs +0 -3
- package/dist/custom-pages-M7jA2Hit.mjs +0 -3
- package/dist/d1-BFvMd6-S.mjs +0 -20
- package/dist/data-security-Bji4Or_j.mjs +0 -7
- package/dist/dcv-delegation-BuoRQ1Yh.mjs +0 -2
- package/dist/deploy-input-CrvuoDGJ.mjs +0 -242
- package/dist/dist-CgrMkXFx.mjs +0 -72
- package/dist/durable-objects-D8FQORrL.mjs +0 -2
- package/dist/email-auth-DJK0Eb30.mjs +0 -2
- package/dist/email-routing-NpmiKIrl.mjs +0 -6
- package/dist/email-security-BLZ7WZ9Z.mjs +0 -18
- package/dist/email-sending-dn-353Nx.mjs +0 -7
- package/dist/fieldExtractors-ahysj57J.mjs +0 -3
- package/dist/flagship-BusjRNIb.mjs +0 -4
- package/dist/google-tag-gateway-TZZ3F1tV.mjs +0 -2
- package/dist/iam-Cj63Kjc6.mjs +0 -6
- package/dist/images-CBWXCDhy.mjs +0 -8
- package/dist/ips-qs9eGJnI.mjs +0 -2
- package/dist/keys-D7N0j4-x.mjs +0 -2
- package/dist/load-balancers-D2zbQ8fT.mjs +0 -6
- package/dist/logexplorer-CUsfZ_bS.mjs +0 -13
- package/dist/logo-matches-CJcthPHf.mjs +0 -2
- package/dist/logos-BS65zN8q.mjs +0 -3
- package/dist/magic-network-monitoring-C7tAPNKP.mjs +0 -4
- package/dist/magic-transit-BtsFePMx.mjs +0 -111
- package/dist/managed-transforms-Cm_KVCMB.mjs +0 -3
- package/dist/matches-InA1hwII.mjs +0 -2
- package/dist/mcp-mJ7bekNJ.mjs +0 -4
- package/dist/mesh-BK4S1Ezy.mjs +0 -4
- package/dist/mtls-certificates-CU4OAAXY.mjs +0 -3
- package/dist/oauth-B0ETkNcX.mjs +0 -15
- package/dist/oauth-scopes-D5bF11ju.mjs +0 -2
- package/dist/observability-BWE0Gg3V.mjs +0 -4
- package/dist/organizations-DLhiRt8g.mjs +0 -2
- package/dist/origin-ca-certificates-Ff4McZRQ.mjs +0 -3
- package/dist/origin-post-quantum-encryption-UuTr4_SW.mjs +0 -2
- package/dist/origin-tls-client-auth-DOJ1zlH3.mjs +0 -4
- package/dist/page-rules-BSz1gO-_.mjs +0 -18
- package/dist/pages-DVDogxPs.mjs +0 -14
- package/dist/pay-per-crawl-BrLXK7gT.mjs +0 -4
- package/dist/pipelines-BszRk4sM.mjs +0 -6
- package/dist/precursor-BPNjQr76.mjs +0 -4
- package/dist/progress-CsHIt3Tp.mjs +0 -2
- package/dist/prompt-DdegNPpg.mjs +0 -3
- package/dist/queries-JL1H1Biz.mjs +0 -3
- package/dist/queues-DpkYdRUE.mjs +0 -6
- package/dist/r2-CKozthw_.mjs +0 -24
- package/dist/radar-C-92vggG.mjs +0 -2
- package/dist/raw-fetch-CteyTOM2.mjs +0 -2
- package/dist/registrar-DKKN0M29.mjs +0 -21
- package/dist/reporting-fg_GKXe1.mjs +0 -2
- package/dist/request-tracers-CkMya96z.mjs +0 -2
- package/dist/resource-tagging-z48JGHCq.mjs +0 -2
- package/dist/rules-BTmNjDN-.mjs +0 -4
- package/dist/rulesets-CsoSM-17.mjs +0 -5
- package/dist/rum-DB4iO2q5.mjs +0 -4
- package/dist/schema-flags-iGoOriJt.mjs +0 -5
- package/dist/security-center-DFKeHq5c.mjs +0 -2
- package/dist/session-D6KHthHf.mjs +0 -2
- package/dist/shared-VppSAQf4.mjs +0 -2
- package/dist/smart-shield-D6X8L7p8.mjs +0 -4
- package/dist/snippets-DIpc9pb_.mjs +0 -4
- package/dist/src-D_HETJNy.mjs +0 -108
- package/dist/submit--xTzyNPy.mjs +0 -2
- package/dist/tags-efICDkah.mjs +0 -2
- package/dist/tenant-CerHuToJ.mjs +0 -2
- package/dist/tenant-custom-nameservers-C4otMBm2.mjs +0 -3
- package/dist/triggers-BEsiiKAf.mjs +0 -2
- package/dist/tunnels-D0J8lJoI.mjs +0 -2
- package/dist/turnstile-CFmtY5bn.mjs +0 -23
- package/dist/url-info-DBCeRWwb.mjs +0 -2
- package/dist/url-scanner-CNyvg65L.mjs +0 -2
- package/dist/user-bifVEQq5.mjs +0 -12
- package/dist/values-OxkdP1tV.mjs +0 -2
- package/dist/versions-BVL-Ludh.mjs +0 -2
- package/dist/waiting-rooms-CmRAl51T.mjs +0 -11
- package/dist/web3-y_cY91V_.mjs +0 -4
- package/dist/workers-jDcq14GH.mjs +0 -24
- package/dist/zaraz-27zwjLvv.mjs +0 -2
- package/dist/zone-BJix2KQ9.mjs +0 -2
- package/dist/zones-Bkj5i92c.mjs +0 -21
- /package/dist/{alerts-CRmjqOZi.mjs → alerts-15-IW4jE.mjs} +0 -0
- /package/dist/{autorag-BD7cu5NU.mjs → autorag-CFwRkEKw.mjs} +0 -0
- /package/dist/{brands-BhALBkX2.mjs → brands-BgT1vu9B.mjs} +0 -0
- /package/dist/{chunk-6EUZQHAF-B7bSMYLe.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
- /package/dist/{clear-BgF8No7D.mjs → clear-BlCK85Me.mjs} +0 -0
- /package/dist/{cli-types-BsTty22w.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
- /package/dist/{connector-telemetry-events-latest-BY2556uL.mjs → connector-telemetry-events-latest-BbpcII3_.mjs} +0 -0
- /package/dist/{connector-telemetry-snapshots-latest-BHYdxUEF.mjs → connector-telemetry-snapshots-latest-DuCiimXl.mjs} +0 -0
- /package/dist/{domain-info-C50W5GhA.mjs → domain-info-C7LBxPBt.mjs} +0 -0
- /package/dist/{health-BFNZqiAm.mjs → health-DZFfafkX.mjs} +0 -0
- /package/dist/{input-validation-Bav2M9F-.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
- /package/dist/{internal-BTeSewwB.mjs → internal-BKHC2D1Y.mjs} +0 -0
- /package/dist/{live-Dkiyu30_.mjs → live-DwCvDmaH.mjs} +0 -0
- /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
- /package/dist/{rate-limit-analytics-Dz-Wv1T0.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
- /package/dist/{ready-TKOkKeRg.mjs → ready-D9H2zHHI.mjs} +0 -0
- /package/dist/{recent-submissions-3Asm6eIi.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
- /package/dist/{refute-BVz9nMyd.mjs → refute-2W8NLCN4.mjs} +0 -0
- /package/dist/{resolve-CeBbH6Pq.mjs → resolve-B8CyM1mi.mjs} +0 -0
- /package/dist/{scan-logo-ZteA-PUV.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
- /package/dist/{scan-page-DWDSyzQ7.mjs → scan-page-CWhta3x7.mjs} +0 -0
- /package/dist/{search-DGNc37HK.mjs → search-DZmBQJL9.mjs} +0 -0
- /package/dist/{signed-url-B5Qpn2mn.mjs → signed-url-CQrmWgz5.mjs} +0 -0
- /package/dist/{submission-info-FjUolE6A.mjs → submission-info-C98A0bqq.mjs} +0 -0
- /package/dist/{theme-CeVf-5qG.mjs → theme-CrIBazAF.mjs} +0 -0
- /package/dist/{total-queries-NHJj1HGq.mjs → total-queries-BZoaFoDE.mjs} +0 -0
- /package/dist/{tracked-domains-CniKVHIp.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
- /package/dist/{verify-DS1PWAJe.mjs → verify-4e4L9IRk.mjs} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n}from"./oauth-DuEONNgC.mjs";import{a as r,r as i}from"./auth-D3X9HYhD.mjs";import{t as a}from"./output-Ccqw2WOb.mjs";import{t as o}from"./dry-run-DL2V6yFm.mjs";import{t as s}from"./progress-BqQcF5QH.mjs";import{i as c,n as l,r as u,t as d}from"./body-parser-BshbixEq.mjs";import{n as f,t as p}from"./input-validation-QDIYu7Vb.mjs";import{a as m,i as h,n as g}from"./prompt-B0sWIs9c.mjs";import{t as _}from"./cli-types-DAYeL_Mj.mjs";import{n as v,t as y}from"./raw-fetch-Cc-MjHeL.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=p(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=f(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 b(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 x={command:`get <hash>`,describe:`Retrieves a binary file from the Cloudforce One binary storage for analysis.`,builder:b,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`})}},S={command:`binary-storage`,describe:`Upload and retrieve malware samples and suspicious binaries for analysis`,builder:e=>e.command(te).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`aggregate-by`,{type:`string`,description:`Column(s) to aggregate by - single column or comma-separated list (e.g., 'attacker', 'targetIndustry', 'attacker,targetIndustry')`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUIDs to filter by, or one standalone scope value: 'all'/'*' for all accessible non-analytics event datasets (analytics datasets are silently excluded), 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, uses the default dataset.`}).option(`start-date`,{type:`string`,description:`Start date for filtering (ISO 8601 format, e.g., '2024-01-01')`}).option(`end-date`,{type:`string`,description:`End date for filtering (ISO 8601 format, e.g., '2024-12-31')`}).option(`group-by-date`,{type:`boolean`,description:`Whether to group results by date (daily aggregation)`}).option(`limit`,{type:`number`,description:`Maximum number of results to return`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={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:C,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`})}},T={command:`aggregate`,describe:`Operations for events.aggregate`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get`,describe:`Lists categories`,builder:E,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`})}},O={command:`catalog`,describe:`Operations for events.categories.catalog`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(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 A={command:`create <category-id>`,describe:`Updates a category`,builder:k,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?d({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:f(r.name,`name`,`text`),shortname:f(r.shortname,`shortname`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.categories.create({...e,account_id:u,category_id:r[`category-id`]})),{successLabel:`Created`});return}let p=d({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:f(r.name,`name`,`text`),shortname:f(r.shortname,`shortname`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.categories.create({...p,account_id:u,category_id:r[`category-id`]})),{successLabel:`Created`})}},j={command:`categories`,describe:`Operations for events.categories`,builder:e=>e.command(A).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(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 N={command:`create <event-id>`,describe:`Updates an event`,builder:M,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?d({attacker:f(r.attacker,`attacker`,`text`),attackerCountry:f(r[`attacker-country`],`attacker-country`,`text`),category:f(r.category,`category`,`text`),createdAt:f(r[`created-at`],`created-at`,`text`),datasetId:f(r[`dataset-id`],`dataset-id`,`text`),date:f(r.date,`date`,`text`),event:f(r.event,`event`,`text`),indicator:f(r.indicator,`indicator`,`text`),indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),insight:f(r.insight,`insight`,`text`),raw:{source:f(r[`raw-source`],`raw-source`,`text`),tlp:f(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(r[`target-country`],`target-country`,`text`),targetIndustry:f(r[`target-industry`],`target-industry`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.create({...e,account_id:u,event_id:r[`event-id`]})),{successLabel:`Created`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await m(`dataset-id`,`Dataset ID containing the event to update.`));let p=d({attacker:f(r.attacker,`attacker`,`text`),attackerCountry:f(r[`attacker-country`],`attacker-country`,`text`),category:f(r.category,`category`,`text`),createdAt:f(r[`created-at`],`created-at`,`text`),datasetId:f(r[`dataset-id`],`dataset-id`,`text`),date:f(r.date,`date`,`text`),event:f(r.event,`event`,`text`),indicator:f(r.indicator,`indicator`,`text`),indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),insight:f(r.insight,`insight`,`text`),raw:{source:f(r[`raw-source`],`raw-source`,`text`),tlp:f(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(r[`target-country`],`target-country`,`text`),targetIndustry:f(r[`target-industry`],`target-industry`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.create({...p,account_id:u,event_id:r[`event-id`]})),{successLabel:`Created`})}};function P(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 F={command:`create <dataset-id>`,describe:`Copies specified events from one dataset to another dataset`,builder:P,handler:async r=>{let c={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:c,bodyKind:`json`,body:r.body===void 0?d({destDatasetId:f(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]}):l(r.body)});return}let u=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>u.cloudforceOne.events.dataset.copy.create({...e,account_id:p,dataset_id:r[`dataset-id`],...c})),{successLabel:`Created`});return}if(r[`dest-dataset-id`]===void 0&&(r[`dest-dataset-id`]=await m(`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=d({destDatasetId:f(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>u.cloudforceOne.events.dataset.copy.create({...h,account_id:p,dataset_id:r[`dataset-id`],...c})),{successLabel:`Created`})}},I={command:`copy`,describe:`Operations for events.dataset.copy`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(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 R={command:`create <dataset-id>`,describe:`Updates an existing dataset`,builder:L,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?d({isPublic:r[`is-public`],name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.create({...e,account_id:u,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 m(`name`,`Used to describe the dataset within the account context.`));let p=d({isPublic:r[`is-public`],name:f(r.name,`name`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.create({...p,account_id:u,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}};function z(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 B={command:`delete <dataset-id>`,describe:`Soft-deletes a dataset given a datasetId.`,builder:z,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 g({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 V(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 H={command:`get <event-id>`,describe:`Retrieves a specific event by its UUID.`,builder:V,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`})}},U={command:`events`,describe:`Operations for events.dataset.events`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(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 G={command:`create`,describe:`Create a group`,builder:W,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?d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.groups.create({...e,account_id:u})),{successLabel:`Created`});return}r.description===void 0&&(r.description=await m(`description`,`The description field`)),r.name===void 0&&(r.name=await m(`name`,`The name field`));let p=d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.groups.create({...p,account_id:u})),{successLabel:`Created`})}};function K(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 q={command:`delete <group-id>`,describe:`Delete a group for an account`,builder:K,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 g({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 J(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`group`,describe:`List groups for an account`,builder:J,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 X(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 Z={command:`v2 <group-id>`,describe:`Read a group for an account`,builder:X,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`})}},Q={command:`get`,describe:`Operations for events.dataset.groups.get`,builder:e=>e.command(Y).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(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 re={command:`create <group-id>`,describe:`Create a group member`,builder:ne,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?d({accountTag:f(r[`account-tag`],`account-tag`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.groups.members.create({...e,account_id:u,group_id:r[`group-id`]})),{successLabel:`Created`});return}let p=d({accountTag:f(r[`account-tag`],`account-tag`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.groups.members.create({...p,account_id:u,group_id:r[`group-id`]})),{successLabel:`Created`})}};function ie(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 ae={command:`delete <member-id>`,describe:`Delete a group member`,builder:ie,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 g({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 oe(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 se={command:`get <group-id>`,describe:`List group members`,builder:oe,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`})}},ce={command:`members`,describe:`Operations for events.dataset.groups.members`,builder:e=>e.command(re).command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(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 ue={command:`update <group-id>`,describe:`Update a group`,builder:le,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?d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.groups.update({...e,account_id:u,group_id:r[`group-id`]})),{successLabel:`Updated`});return}r.description===void 0&&(r.description=await m(`description`,`The description field`)),r.name===void 0&&(r.name=await m(`name`,`The name field`));let p=d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.groups.update({...p,account_id:u,group_id:r[`group-id`]})),{successLabel:`Updated`})}},de={command:`groups`,describe:`Operations for events.dataset.groups`,builder:e=>e.command(G).command(q).command(ue).command(Q).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(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 pe={command:`create <dataset-id>`,describe:`Creates a new indicator type and initializes its dedicated Durable Object`,builder:fe,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?d({description:f(r.description,`description`,`text`),indicatorType:f(r[`indicator-type`],`indicator-type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicator.types.create.create({...e,account_id:u,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}r[`indicator-type`]===void 0&&(r[`indicator-type`]=await m(`indicator-type`,`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`));let p=d({description:f(r.description,`description`,`text`),indicatorType:f(r[`indicator-type`],`indicator-type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicator.types.create.create({...p,account_id:u,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}},me={command:`create`,describe:`Operations for events.dataset.indicator.types.create`,builder:e=>e.command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},he={command:`types`,describe:`Operations for events.dataset.indicator.types`,builder:e=>e.command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ge={command:`indicator`,describe:`Operations for events.dataset.indicator`,builder:e=>e.command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _e(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(`indicators`,{type:`string`,description:`The indicators field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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 ve={command:`create <dataset-id>`,describe:`Creates multiple indicators at once with their respective types and related datasets.`,builder:_e,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?d({autoCreateType:r[`auto-create-type`],indicators:u(r.indicators,`indicators`)}):l(r.body)});return}let c=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicators.bulk.create({...e,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}if(r.indicators===void 0)throw Error(`--indicators is required (or pass --body with this field set).`);let p=d({autoCreateType:r[`auto-create-type`],indicators:u(r.indicators,`indicators`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicators.bulk.create({...p,account_id:f,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}},ye={command:`bulk`,describe:`Operations for events.dataset.indicators.bulk`,builder:e=>e.command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(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(`related-events`,{type:`string`,description:`The relatedEvents field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`tlp`,{type:`string`,description:`Traffic Light Protocol designation. Case-insensitive on input, stored and returned as UPPERCASE. Allowed values: clear, green, amber, amber-strict, red, purple.`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const xe={command:`create <dataset-id>`,describe:`Creates a new indicator with the specified type and related datasets.`,builder:be,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?d({autoCreateType:r[`auto-create-type`],indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),relatedEvents:u(r[`related-events`],`related-events`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicators.create.create({...e,account_id:p,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}r[`indicator-type`]===void 0&&(r[`indicator-type`]=await m(`indicator-type`,`The indicatorType field`)),r.value===void 0&&(r.value=await m(`value`,`The value field`));let h=d({autoCreateType:r[`auto-create-type`],indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),relatedEvents:u(r[`related-events`],`related-events`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicators.create.create({...h,account_id:p,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}},Se={command:`create`,describe:`Operations for events.dataset.indicators.create`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(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 we={command:`delete <indicator-id>`,describe:`Deletes a specific indicator by its UUID.`,builder:Ce,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 g({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 Te(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 Ee={command:`indicator <indicator-id>`,describe:`Retrieves a specific indicator by its UUID.`,builder:Te,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`})}},De={command:`get`,describe:`Operations for events.dataset.indicators.get`,builder:e=>e.command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oe(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(`related-events`,{type:`string`,description:`The relatedEvents field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`tlp`,{type:`string`,description:`Traffic Light Protocol designation. Case-insensitive on input, stored and returned as UPPERCASE. Allowed values: clear, green, amber, amber-strict, red, purple.`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ke={command:`patch <indicator-id>`,describe:`Updates an existing indicator's properties.`,builder:Oe,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?d({indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),relatedEvents:u(r[`related-events`],`related-events`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.indicators.patch({...e,account_id:p,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Updated`});return}let m=d({indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),relatedEvents:u(r[`related-events`],`related-events`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.indicators.patch({...m,account_id:p,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Updated`})}};function Ae(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Confidence score 0–100.`}).option(`target-id`,{type:`string`,description:`UUID of the target entity.`}).option(`target-type`,{type:`string`,description:`Target type. "indicator" is not allowed (indicator↔indicator relationships are not supported).`,choices:[`event`,`tag`]}).option(`type`,{type:`string`,description:`Relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const je={command:`create <indicator-id>`,describe:`Creates a new relationship with the indicator as the source entity. Indicator↔indicator relationships are not supported.`,builder:Ae,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({confidence:r.confidence,targetId:f(r[`target-id`],`target-id`,`text`),targetType:f(r[`target-type`],`target-type`,`text`),type:f(r.type,`type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicators.relationships.create({...e,account_id:u,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Created`});return}r[`target-id`]===void 0&&(r[`target-id`]=await m(`target-id`,`UUID of the target entity.`)),r[`target-type`]===void 0&&(r[`target-type`]=await h(`target-type`,`Target type. "indicator" is not allowed (indicator↔indicator relationships are not supported).`,[`event`,`tag`])),r.type===void 0&&(r.type=await m(`type`,`Relationship type.`));let p=d({confidence:r.confidence,targetId:f(r[`target-id`],`target-id`,`text`),targetType:f(r[`target-type`],`target-type`,`text`),type:f(r.type,`type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.indicators.relationships.create({...p,account_id:u,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`]})),{successLabel:`Created`})}};function Me(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ne={command:`delete <rel-uuid>`,describe:`Deletes a relationship by UUID. Idempotent: returns deleted=false if not found.`,builder:Me,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.indicators.relationships.delete({account_id:l,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],rel_uuid:r[`rel-uuid`]})),{successLabel:`Deleted`})}};function Pe(e){return e.option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`search`,{type:`string`,description:`JSON array of {field, op, value} filters, AND-combined. Fields: entityType (other-end type), type (relationship type), confidence (0–100), metadata.<key>. Example: [{"field":"type","op":"equals","value":"appears_in"},{"field":"confidence","op":"gte","value":50}]`}).option(`expand`,{type:`string`,description:`Comma-separated entity types to hydrate (event, indicator, tag).`}).option(`cursor`,{type:`string`,description:`Keyset cursor from a previous page.`}).option(`page-size`,{type:`number`,description:`Page size (1–100, default 25).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:"Returns sparse relationship edges. Optionally hydrate related entities via `expand`.",builder:_(Pe),handler:async r=>{let c={search:r.search,expand:r.expand,cursor:r.cursor,pageSize:r[`page-size`]};if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.dataset.indicators.relationships.list({account_id:u,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],...c})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Updated confidence. null clears it.`}).option(`type`,{type:`string`,description:`Updated relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Le={command:`update <rel-uuid>`,describe:`Partially updates a relationship by UUID. Only provided fields are changed.`,builder:Ie,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events dataset indicators relationships update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/dataset/${r[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(r[`dataset-id`]))}/indicators/${r[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(r[`indicator-id`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"dataset-id":String(r[`dataset-id`]??``),"indicator-id":String(r[`indicator-id`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},bodyKind:`json`,body:r.body===void 0?d({confidence:r.confidence,type:f(r.type,`type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.indicators.relationships.update({...e,account_id:u,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],rel_uuid:r[`rel-uuid`]})),{successLabel:`Updated`});return}let p=d({confidence:r.confidence,type:f(r.type,`type`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.indicators.relationships.update({...p,account_id:u,dataset_id:r[`dataset-id`],indicator_id:r[`indicator-id`],rel_uuid:r[`rel-uuid`]})),{successLabel:`Updated`})}},Re={command:`relationships`,describe:`Operations for events.dataset.indicators.relationships`,builder:e=>e.command(je).command(Ne).command(Fe).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ze(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 Be={command:`get <dataset-id>`,describe:`Returns all mirrored tags from the indicator dataset (DO mirror table). No pagination.`,builder:ze,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`})}},Ve={command:`tags`,describe:`Operations for events.dataset.indicators.tags`,builder:e=>e.command(Be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`indicators`,describe:`Operations for events.dataset.indicators`,builder:e=>e.command(we).command(ke).command(ye).command(Se).command(De).command(Re).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ue(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 We={command:`create <dataset-id>`,describe:`Moves specified events from one dataset to another dataset`,builder:Ue,handler:async r=>{let c={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:c,bodyKind:`json`,body:r.body===void 0?d({destDatasetId:f(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]}):l(r.body)});return}let u=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>u.cloudforceOne.events.dataset.move.create({...e,account_id:p,dataset_id:r[`dataset-id`],...c})),{successLabel:`Created`});return}if(r[`dest-dataset-id`]===void 0&&(r[`dest-dataset-id`]=await m(`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=d({destDatasetId:f(r[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:r[`event-ids`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>u.cloudforceOne.events.dataset.move.create({...h,account_id:p,dataset_id:r[`dataset-id`],...c})),{successLabel:`Created`})}},Ge={command:`move`,describe:`Operations for events.dataset.move`,builder:e=>e.command(We).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ke(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 qe={command:`create <dataset-id>`,describe:`Create a permission`,builder:Ke,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?d({role:f(r.role,`role`,`text`),subjectId:f(r[`subject-id`],`subject-id`,`text`),subjectType:f(r[`subject-type`],`subject-type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.permissions.create({...e,account_id:u,dataset_id:r[`dataset-id`]})),{successLabel:`Created`});return}r.role===void 0&&(r.role=await h(`role`,`The role field`,[`read`,`write`])),r[`subject-id`]===void 0&&(r[`subject-id`]=await m(`subject-id`,`The subjectId field`)),r[`subject-type`]===void 0&&(r[`subject-type`]=await h(`subject-type`,`The subjectType field`,[`account`,`group`]));let p=d({role:f(r.role,`role`,`text`),subjectId:f(r[`subject-id`],`subject-id`,`text`),subjectType:f(r[`subject-type`],`subject-type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.dataset.permissions.create({...p,account_id:u,dataset_id:r[`dataset-id`]})),{successLabel:`Created`})}};function Je(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 Ye={command:`delete <grant-id>`,describe:`Delete a permission`,builder:Je,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.dataset.permissions.delete({account_id:l,dataset_id:r[`dataset-id`],grant_id:r[`grant-id`]})),{successLabel:`Deleted`})}};function Xe(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 Ze={command:`get <dataset-id>`,describe:`List permissions`,builder:Xe,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 Qe(e){return e.positional(`grant-id`,{type:`string`,description:`Grant ID`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`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 $e={command:`update <grant-id>`,describe:`Update a permission`,builder:Qe,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?d({role:f(r.role,`role`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.permissions.update({...e,account_id:u,dataset_id:r[`dataset-id`],grant_id:r[`grant-id`]})),{successLabel:`Updated`});return}r.role===void 0&&(r.role=await h(`role`,`The role field`,[`read`,`write`]));let p=d({role:f(r.role,`role`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.dataset.permissions.update({...p,account_id:u,dataset_id:r[`dataset-id`],grant_id:r[`grant-id`]})),{successLabel:`Updated`})}},et={command:`permissions`,describe:`Operations for events.dataset.permissions`,builder:e=>e.command(qe).command(Ye).command(Ze).command($e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tt(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to scope to (repeat the param for multiple), or one standalone scope: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. Analytics datasets do not expose tag associations, so 'analytics' returns an empty result. Omit to search all readable datasets.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-event`,{type:`string`,description:`Filter indicators by related event UUID(s). Multiple UUIDs can be provided by repeating the parameter.`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType. Multiple conditions are AND'd together. Max 10 conditions per request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nt={command:`get <tag-uuid>`,describe:`Returns indicators associated with the provided tag UUID, with pagination. By default fans out across every indicator dataset the account can read; pass datasetIds to scope to UUIDs, analytics datasets, or operational datasets. Analytics datasets do not expose tag associations, so the analytics scope returns an empty result.`,builder:_(tt),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`})}},rt={command:`indicators`,describe:`Operations for events.dataset.tags.indicators`,builder:e=>e.command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},it={command:`tags`,describe:`Operations for events.dataset.tags`,builder:e=>e.command(rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function at(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 ot={command:`get <dataset-id>`,describe:`Lists all target industries for a specific dataset`,builder:at,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`})}},st={command:`industries`,describe:`Operations for events.dataset.target.industries`,builder:e=>e.command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ct={command:`target`,describe:`Operations for events.dataset.target`,builder:e=>e.command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},lt={command:`dataset`,describe:`Operations for events.dataset`,builder:e=>e.command(R).command(B).command(I).command(U).command(de).command(ge).command(He).command(Ge).command(et).command(it).command(ct).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ut(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dt={command:`create`,describe:`Populate dataset-specific lookup tables from existing Events data with batch processing`,builder:ut,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`})}},ft={command:`populate`,describe:`Operations for events.datasets.populate`,builder:e=>e.command(dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},pt={command:`datasets`,describe:`Operations for events.datasets`,builder:e=>e.command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function mt(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 ht={command:`delete <dataset-id>`,describe:`Deletes one or more events`,builder:mt,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}a(await s(`Deleting`,async()=>l.cloudforceOne.events.delete.delete({account_id:u,dataset_id:r[`dataset-id`],...c})),{successLabel:`Deleted`})}},gt={command:`delete`,describe:`Operations for events.delete`,builder:e=>e.command(ht).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 vt={command:`ql`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:_t,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 yt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bt={command:`qlv2`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:yt,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`})}},xt={command:`graph`,describe:`Operations for events.graphql.create.graph`,builder:e=>e.command(vt).command(bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},St={command:`create`,describe:`Operations for events.graphql.create`,builder:e=>e.command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ct={command:`graphql`,describe:`Operations for events.graphql`,builder:e=>e.command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function wt(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to query, or one standalone scope value: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, queries all accessible datasets.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tt={command:`get`,describe:`Lists indicator types across multiple datasets`,builder:wt,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`})}},Et={command:`types`,describe:`Operations for events.indicator.types`,builder:e=>e.command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Dt={command:`indicator`,describe:`Operations for events.indicator`,builder:e=>e.command(Et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ot(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to query, or one standalone scope value: 'all'/'*' for legacy all-datasets behavior, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, uses the default dataset.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType, uuid. Supports operators: equals, not, contains, startsWith, endsWith, gt, lt, gte, lte, like, in, find. Use the 'in' operator with an array value to bulk-check up to 100 indicators in a single request, e.g. search=[{"field":"value","op":"in","value":["evil.com","bad.org"]}]. Multiple conditions are AND'd together. Max 10 conditions per request.`}).option(`name`,{type:`string`,description:`Filter indicators by value using substring match (LIKE). Legacy alternative to structured search.`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-events`,{type:`string`,description:`Filter by related event IDs`}).option(`tags`,{type:`string`,description:`Filter by tag values or UUIDs. Indicators must have at least one of the specified tags (OR logic). Supports both tag UUID and tag value.`}).option(`tag-search`,{type:`string`,description:'Structured tag-metadata filter as a JSON array of {field, op, value} objects. Operates against the per-dataset IndicatorTag mirror so you can find indicators by tag attributes (origin country, motive, sophistication, priority, etc.) without a separate Tags lookup. Common dashboard usage: drill from a country into indicators, e.g. tagSearch=[{"field":"originCountryISO","op":"in","value":["IR","CN"]}]. Country values may be passed as alpha-2, alpha-3, name, or alias (e.g. "iran"). Operators: equals, not, gt/gte/lt/lte (numeric only), contains/like/find/startsWith/endsWith (string only), in. AND-joined across entries; combined with `tags`, a matching tag must satisfy both. Max 10 entries per request, max 100 values per \'in\'. Performance notes: `originCountryISO` uses its B-tree index for equals/not/in. `priority` uses its B-tree index for numeric comparisons. Other string columns (`actorCategory`, `motive`, etc.) are case-insensitive and unindexed; current catalog size makes this a non-issue. `endsWith` and `aliasGroupNames` contains/like are leading-wildcard scans and slow on large result sets. `aliasGroupNames` matches on the JSON-encoded text, so substrings can cross alias boundaries ("apt28" also matches "apt280" when both appear in the same tag\'s alias list).'}).option(`created-after`,{type:`string`,description:`Filter indicators created on or after this date. Must use ISO 8601 format (e.g., '2024-01-15T00:00:00Z').`}).option(`created-before`,{type:`string`,description:`Filter indicators created on or before this date. Must use ISO 8601 format (e.g., '2024-12-31T23:59:59Z').`}).option(`related-events-limit`,{type:`number`,description:`Limit the number of related events returned per indicator. Default: 2. Set to 0 for none, -1 for all events.`}).option(`include-tags`,{type:`boolean`,description:`Whether to include full tag details for each indicator. Defaults to true.`}).option(`include-total-count`,{type:`boolean`,description:`Whether to compute total count via COUNT(*). Defaults to false for performance. total_count is null unless this is true and the complete fan-out succeeds.`}).option(`format`,{type:`string`,description:`Output format for indicator data. 'json' returns the default format, 'stix2' returns STIX 2.1 Indicator SDOs, 'taxii' returns a TAXII 2.1 Envelope with Content-Type application/taxii+json;version=2.1.`,choices:[`json`,`stix2`,`taxii`]}).option(`cache`,{type:`string`,description:"Cache strategy. 'from-graph' serves results from the graph-node KV cache when all requested UUIDs are cached; falls back to normal path on partial/zero hit. Cannot be combined with `cursor`.",choices:[`from-graph`]}).option(`cursor`,{type:`string`,description:"Opaque cursor from a previous response's `pagination.cursor`. When provided, all filters, datasetIds, page, `pageSize`, `includeTags` and `relatedEventsLimit` come from the cursor — do not resend them. Sending any filter, `page`, `pageSize`, `includeTags`, `relatedEventsLimit`, `includeTotalCount=true`, or `cache=from-graph` alongside a cursor yields a 400 `CursorFilterConflictError`. A cursor issued for a different entity, an unsupported version, or a dataset that has since been reconfigured as analytics-only yields a 400 `InvalidCursorError`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kt={command:`get`,describe:`Retrieves indicators across specified datasets, ordered by createdAt descending then UUID, dataset ID, and shard ID ascending. Use the standalone datasetIds value 'all'/'*' for legacy all-datasets behavior, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If no datasetIds are provided, uses the default dataset.`,builder:_(Ot),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`})}},At={command:`indicators`,describe:`Operations for events.indicators`,builder:e=>e.command(kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function jt(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 Mt={command:`create-create`,describe:`Create a new saved event query for the account`,builder:jt,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?d({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:f(r.name,`name`,`text`),query_json:f(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:f(r[`rule-scope`],`rule-scope`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.queries.createCreate({...e,account_id:u})),{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 m(`name`,`Unique name for the saved query`)),r[`query-json`]===void 0&&(r[`query-json`]=await m(`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 p=d({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:f(r.name,`name`,`text`),query_json:f(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:f(r[`rule-scope`],`rule-scope`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.queries.createCreate({...p,account_id:u})),{successLabel:`Created`})}};function Nt(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 Pt={command:`create <query-id>`,describe:`Update an existing saved event query by its ID`,builder:Nt,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?d({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:f(r.name,`name`,`text`),query_json:f(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:f(r[`rule-scope`],`rule-scope`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.queries.create({...e,account_id:u,query_id:r[`query-id`]})),{successLabel:`Created`});return}let p=d({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:f(r.name,`name`,`text`),query_json:f(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:f(r[`rule-scope`],`rule-scope`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.queries.create({...p,account_id:u,query_id:r[`query-id`]})),{successLabel:`Created`})}};function Ft(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 It={command:`delete <query-id>`,describe:`Delete a saved event query by its ID`,builder:Ft,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
10
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.queries.delete({account_id:l,query_id:r[`query-id`]})),{successLabel:`Deleted`})}};function Lt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Rt={command:`event`,describe:`Retrieve all saved event queries for the account`,builder:Lt,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 zt(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 Bt={command:`v2 <query-id>`,describe:`Retrieve a saved event query by its ID`,builder:zt,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`})}},Vt={command:`get`,describe:`Operations for events.queries.get`,builder:e=>e.command(Rt).command(Bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ht(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 Ut={command:`patch <query-id>`,describe:`Update an existing saved event query by its ID`,builder:Ht,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?d({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:f(r.name,`name`,`text`),query_json:f(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:f(r[`rule-scope`],`rule-scope`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.queries.patch({...e,account_id:u,query_id:r[`query-id`]})),{successLabel:`Updated`});return}let p=d({alert_enabled:r[`alert-enabled`],alert_rollup_enabled:r[`alert-rollup-enabled`],name:f(r.name,`name`,`text`),query_json:f(r[`query-json`],`query-json`,`text`),rule_enabled:r[`rule-enabled`],rule_scope:f(r[`rule-scope`],`rule-scope`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.queries.patch({...p,account_id:u,query_id:r[`query-id`]})),{successLabel:`Updated`})}},Wt={command:`queries`,describe:`Operations for events.queries`,builder:e=>e.command(Pt).command(Mt).command(It).command(Ut).command(Vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gt(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 Kt={command:`create <raw-id>`,describe:`Updates a raw event`,builder:Gt,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?d({source:f(r.source,`source`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.raw.create({...e,account_id:u,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Created`});return}let p=d({source:f(r.source,`source`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.raw.create({...p,account_id:u,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Created`})}},qt={command:`raw`,describe:`Operations for events.raw`,builder:e=>e.command(Kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Jt(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 Yt={command:`create <event-id>`,describe:`Creates event references for a event`,builder:Jt,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?d({events:r.events}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.relate.create.create({...e,account_id:u,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=d({events:r.events});a(await s(`Creating`,async()=>c.cloudforceOne.events.relate.create.create({...f,account_id:u,event_id:r[`event-id`]})),{successLabel:`Created`})}},Xt={command:`create`,describe:`Operations for events.relate.create`,builder:e=>e.command(Yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Zt={command:`relate`,describe:`Operations for events.relate`,builder:e=>e.command(Xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qt(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 $t={command:`create`,describe:`Creates a directed relationship between two events. The relationship is from parent to child with a specified type.`,builder:Qt,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?d({childIds:r[`child-ids`],datasetId:f(r[`dataset-id`],`dataset-id`,`text`),parentId:f(r[`parent-id`],`parent-id`,`text`),relationshipType:f(r[`relationship-type`],`relationship-type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.relationships.create.create({...e,account_id:u})),{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 m(`dataset-id`,`Dataset identifier where the events are stored`)),r[`parent-id`]===void 0&&(r[`parent-id`]=await m(`parent-id`,`UUID of the parent event that will be the source of the relationship`)),r[`relationship-type`]===void 0&&(r[`relationship-type`]=await h(`relationship-type`,`Type of relationship to create between parent and child events`,[`related_to`,`caused_by`,`attributed_to`]));let p=d({childIds:r[`child-ids`],datasetId:f(r[`dataset-id`],`dataset-id`,`text`),parentId:f(r[`parent-id`],`parent-id`,`text`),relationshipType:f(r[`relationship-type`],`relationship-type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.relationships.create.create({...p,account_id:u})),{successLabel:`Created`})}},en={command:`create`,describe:`Operations for events.relationships.create`,builder:e=>e.command($t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tn(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 nn={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:_(tn),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`})}},rn={command:`relationships`,describe:`Operations for events.relationships`,builder:e=>e.command(nn).command(en).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function an(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`schema`,{type:`string`,description:`Optional array of FieldDefinition objects defining custom fields for tags in this category. Persisted as JSON; returned as a parsed array. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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 on={command:`create`,describe:`Creates a new Source-of-Truth tag category for an account.`,builder:an,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?d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),schema:u(r.schema,`schema`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.tags.categories.create.create({...e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await m(`name`,`The name field`));let h=d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),schema:u(r.schema,`schema`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.tags.categories.create.create({...h,account_id:p})),{successLabel:`Created`})}},sn={command:`create`,describe:`Operations for events.tags.categories.create`,builder:e=>e.command(on).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function cn(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 ln={command:`delete <category-uuid>`,describe:`Deletes a Source-of-Truth tag category by UUID.`,builder:cn,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
11
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.tags.categories.delete({account_id:l,category_uuid:r[`category-uuid`]})),{successLabel:`Deleted`})}};function un(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dn={command:`get-by-id <category-uuid>`,describe:`Returns a single Source-of-Truth tag category by UUID, including its full schema.`,builder:un,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags categories get-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/categories/${r[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(r[`category-uuid`]))}`,pathParams:{"category-uuid":String(r[`category-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.tags.categories.getById({account_id:l,category_uuid:r[`category-uuid`]})),{successLabel:`Loaded`})}};function fn(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 pn={command:`get`,describe:`Returns all Source-of-Truth tag categories for an account.`,builder:fn,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 mn(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(`schema`,{type:`string`,description:`Optional array of FieldDefinition objects. When provided, replaces the existing field schema. When omitted, the existing schema is preserved. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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 hn={command:`patch <category-uuid>`,describe:`Updates a Source-of-Truth tag category by UUID.`,builder:mn,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?d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),schema:u(r.schema,`schema`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.tags.categories.patch({...e,account_id:p,category_uuid:r[`category-uuid`]})),{successLabel:`Updated`});return}let m=d({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),schema:u(r.schema,`schema`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.tags.categories.patch({...m,account_id:p,category_uuid:r[`category-uuid`]})),{successLabel:`Updated`})}},gn={command:`categories`,describe:`Operations for events.tags.categories`,builder:e=>e.command(ln).command(pn).command(dn).command(hn).command(sn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _n(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 vn={command:`delete <tag-uuid>`,describe:`Deletes a Source-of-Truth tag by UUID.`,builder:_n,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
12
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.events.tags.delete({account_id:l,tag_uuid:r[`tag-uuid`]})),{successLabel:`Deleted`})}};function yn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bn={command:`get-by-id <tag-uuid>`,describe:`Returns a single Source-of-Truth tag by UUID, including custom fields (properties).`,builder:yn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags get-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.events.tags.getById({account_id:l,tag_uuid:r[`tag-uuid`]})),{successLabel:`Loaded`})}};function xn(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 Sn={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:_(xn),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 Cn(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(`aliases`,{type:`string`,description:`Structured aliases ({ value, confidence 1-10, tlp }). Public: returned to all accounts with per-entry TLP filtering (entries with tlp: purple are removed for non-CFONE accounts). Provide as a JSON array of objects or @path/to/file.json.`}).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(`external-references`,{type:`string`,description:`Structured external references ({ url, description }). Public: returned to all accounts. Provide as a JSON array of objects or @path/to/file.json.`}).option(`internal-aliases`,{type:`string`,description:`Internal structured aliases ({ value, confidence 1-10, tlp }). CFONE-only: never returned to non-CFONE accounts. Provide as a JSON array of objects or @path/to/file.json.`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`last-seen`,{type:`string`,description:`The lastSeen field`}).option(`tlp`,{type:`string`,description:`Tag-level TLP marking. Omit to preserve existing. Cannot be cleared to null.`,choices:[`red`,`amber`,`amber-strict`,`green`,`clear`,`purple`,`amber+strict`]}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const wn={command:`patch <tag-uuid>`,describe:`Updates a Source-of-Truth tag by UUID.`,builder:Cn,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?d({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],aliases:u(r.aliases,`aliases`),categoryUuid:f(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:f(r[`date-of-discovery`],`date-of-discovery`,`text`),description:f(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],externalReferences:u(r[`external-references`],`external-references`),internalAliases:u(r[`internal-aliases`],`internal-aliases`),internalDescription:f(r[`internal-description`],`internal-description`,`text`),lastSeen:f(r[`last-seen`],`last-seen`,`text`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.tags.patch({...e,account_id:p,tag_uuid:r[`tag-uuid`]})),{successLabel:`Updated`});return}let m=d({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],aliases:u(r.aliases,`aliases`),categoryUuid:f(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:f(r[`date-of-discovery`],`date-of-discovery`,`text`),description:f(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],externalReferences:u(r[`external-references`],`external-references`),internalAliases:u(r[`internal-aliases`],`internal-aliases`),internalDescription:f(r[`internal-description`],`internal-description`,`text`),lastSeen:f(r[`last-seen`],`last-seen`,`text`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.events.tags.patch({...m,account_id:p,tag_uuid:r[`tag-uuid`]})),{successLabel:`Updated`})}};function Tn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Confidence score 0–100.`}).option(`dataset-id`,{type:`string`,description:`Dataset UUID where the relationship row will be stored (locates the Indicators DO).`}).option(`target-id`,{type:`string`,description:`UUID of the target entity.`}).option(`target-type`,{type:`string`,description:`Target type. "tag" is not allowed (tag↔tag relationships are not supported).`,choices:[`event`,`indicator`]}).option(`type`,{type:`string`,description:`Relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const En={command:`create <tag-uuid>`,describe:`Creates a new relationship with the tag as the source entity. Requires a datasetId to locate the Indicators DO.`,builder:Tn,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one events tags relationships create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},bodyKind:`json`,body:r.body===void 0?d({confidence:r.confidence,datasetId:f(r[`dataset-id`],`dataset-id`,`text`),targetId:f(r[`target-id`],`target-id`,`text`),targetType:f(r[`target-type`],`target-type`,`text`),type:f(r.type,`type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.events.tags.relationships.create({...e,account_id:u,tag_uuid:r[`tag-uuid`]})),{successLabel:`Created`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await m(`dataset-id`,`Dataset UUID where the relationship row will be stored (locates the Indicators DO).`)),r[`target-id`]===void 0&&(r[`target-id`]=await m(`target-id`,`UUID of the target entity.`)),r[`target-type`]===void 0&&(r[`target-type`]=await h(`target-type`,`Target type. "tag" is not allowed (tag↔tag relationships are not supported).`,[`event`,`indicator`])),r.type===void 0&&(r.type=await m(`type`,`Relationship type.`));let p=d({confidence:r.confidence,datasetId:f(r[`dataset-id`],`dataset-id`,`text`),targetId:f(r[`target-id`],`target-id`,`text`),targetType:f(r[`target-type`],`target-type`,`text`),type:f(r.type,`type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.events.tags.relationships.create({...p,account_id:u,tag_uuid:r[`tag-uuid`]})),{successLabel:`Created`})}};function Dn(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID containing the relationship.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const On={command:`delete <rel-uuid>`,describe:`Deletes a relationship by UUID. Idempotent: returns deleted=false if not found. Requires datasetId query param.`,builder:Dn,handler:async r=>{let c={datasetId:r[`dataset-id`]};if(r.dryRun){o({command:`cf cloudforce-one events tags relationships delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
13
|
+
`);return}a(await s(`Deleting`,async()=>l.cloudforceOne.events.tags.relationships.delete({account_id:u,tag_uuid:r[`tag-uuid`],rel_uuid:r[`rel-uuid`],...c})),{successLabel:`Deleted`})}};function kn(e){return e.option(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`datasets`,{type:`string`,description:`Comma-separated dataset UUIDs to scope to, or one standalone scope: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. Analytics datasets do not expose tag associations, so 'analytics' returns an empty result. Omit for all.`}).option(`search`,{type:`string`,description:`JSON array of {field, op, value} filters (same as indicator list search).`}).option(`expand`,{type:`string`,description:`Comma-separated entity types to hydrate (event, indicator, tag).`}).option(`cursor`,{type:`string`,description:`Offset cursor from a previous page.`}).option(`page-size`,{type:`number`,description:`Page size (1–100, default 25).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const An={command:`list`,describe:"Returns sparse relationship edges. Optionally hydrate related entities via `expand`. Fans out across all accessible indicator dataset shards. Analytics datasets do not expose tag associations, so the analytics scope returns an empty result.",builder:_(kn),handler:async r=>{let c={datasets:r.datasets,search:r.search,expand:r.expand,cursor:r.cursor,pageSize:r[`page-size`]};if(r.dryRun){o({command:`cf cloudforce-one events tags relationships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.events.tags.relationships.list({account_id:u,tag_uuid:r[`tag-uuid`],...c})),{successLabel:`Loaded`})}};function jn(e){return e.positional(`rel-uuid`,{type:`string`,description:`Relationship UUID.`,demandOption:!0}).option(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID containing the relationship.`,demandOption:!0}).option(`confidence`,{type:`number`,description:`Updated confidence. null clears it.`}).option(`type`,{type:`string`,description:`Updated relationship type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Mn={command:`update <rel-uuid>`,describe:`Partially updates a relationship by UUID. Requires datasetId query param.`,builder:jn,handler:async r=>{let c={datasetId:r[`dataset-id`]};if(r.dryRun){o({command:`cf cloudforce-one events tags relationships update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/events/tags/${r[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(r[`tag-uuid`]))}/relationships/${r[`rel-uuid`]==null?`<rel-uuid>`:encodeURIComponent(String(r[`rel-uuid`]))}`,pathParams:{"tag-uuid":String(r[`tag-uuid`]??``),"rel-uuid":String(r[`rel-uuid`]??``)},query:c,bodyKind:`json`,body:r.body===void 0?d({confidence:r.confidence,type:f(r.type,`type`,`text`)}):l(r.body)});return}let u=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>u.cloudforceOne.events.tags.relationships.update({...e,account_id:p,tag_uuid:r[`tag-uuid`],rel_uuid:r[`rel-uuid`],...c})),{successLabel:`Updated`});return}let m=d({confidence:r.confidence,type:f(r.type,`type`,`text`)});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>u.cloudforceOne.events.tags.relationships.update({...m,account_id:p,tag_uuid:r[`tag-uuid`],rel_uuid:r[`rel-uuid`],...c})),{successLabel:`Updated`})}},Nn={command:`relationships`,describe:`Operations for events.tags.relationships`,builder:e=>e.command(En).command(On).command(An).command(Mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pn={command:`tags`,describe:`Operations for events.tags`,builder:e=>e.command(vn).command(Sn).command(bn).command(wn).command(gn).command(Nn).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 In={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`})}},Ln={command:`catalog`,describe:`Operations for events.target.industries.catalog`,builder:e=>e.command(In).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Rn={command:`industries`,describe:`Operations for events.target.industries`,builder:e=>e.command(Ln).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},zn={command:`target`,describe:`Operations for events.target`,builder:e=>e.command(Rn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Bn(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:Bn,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?d({datasetId:f(r[`dataset-id`],`dataset-id`,`text`),eventIds:r[`event-ids`],updates:{attacker:f(r[`updates-attacker`],`updates-attacker`,`text`),attackerCountry:f(r[`updates-attacker-country`],`updates-attacker-country`,`text`),category:f(r[`updates-category`],`updates-category`,`text`),createdAt:f(r[`updates-created-at`],`updates-created-at`,`text`),event:f(r[`updates-event`],`updates-event`,`text`),indicator:f(r[`updates-indicator`],`updates-indicator`,`text`),indicatorType:f(r[`updates-indicator-type`],`updates-indicator-type`,`text`),insight:f(r[`updates-insight`],`updates-insight`,`text`),raw:{source:f(r[`updates-raw-source`],`updates-raw-source`,`text`),tlp:f(r[`updates-raw-tlp`],`updates-raw-tlp`,`text`)},targetCountry:f(r[`updates-target-country`],`updates-target-country`,`text`),targetIndustry:f(r[`updates-target-industry`],`updates-target-industry`,`text`),tlp:f(r[`updates-tlp`],`updates-tlp`,`text`)}}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.events.update.bulk.patch({...e,account_id:u})),{successLabel:`Updated`});return}if(r[`dataset-id`]===void 0&&(r[`dataset-id`]=await m(`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 p=d({datasetId:f(r[`dataset-id`],`dataset-id`,`text`),eventIds:r[`event-ids`],updates:{attacker:f(r[`updates-attacker`],`updates-attacker`,`text`),attackerCountry:f(r[`updates-attacker-country`],`updates-attacker-country`,`text`),category:f(r[`updates-category`],`updates-category`,`text`),createdAt:f(r[`updates-created-at`],`updates-created-at`,`text`),event:f(r[`updates-event`],`updates-event`,`text`),indicator:f(r[`updates-indicator`],`updates-indicator`,`text`),indicatorType:f(r[`updates-indicator-type`],`updates-indicator-type`,`text`),insight:f(r[`updates-insight`],`updates-insight`,`text`),raw:{source:f(r[`updates-raw-source`],`updates-raw-source`,`text`),tlp:f(r[`updates-raw-tlp`],`updates-raw-tlp`,`text`)},targetCountry:f(r[`updates-target-country`],`updates-target-country`,`text`),targetIndustry:f(r[`updates-target-industry`],`updates-target-industry`,`text`),tlp:f(r[`updates-tlp`],`updates-tlp`,`text`)}});a(await s(`Updating`,async()=>c.cloudforceOne.events.update.bulk.patch({...p,account_id:u})),{successLabel:`Updated`})}},Hn={command:`bulk`,describe:`Operations for events.update.bulk`,builder:e=>e.command(Vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Un={command:`update`,describe:`Operations for events.update`,builder:e=>e.command(Hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Wn={command:`events`,describe:`Operations for events`,builder:e=>e.command(N).command(T).command(j).command(lt).command(pt).command(gt).command(Ct).command(Dt).command(At).command(Wt).command(qt).command(Zt).command(rn).command(Pn).command(zn).command(Un).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gn(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 Kn={command:`create <request-id>`,describe:`Uploads a new asset to a Cloudforce One intelligence request.`,builder:Gn,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=p(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(f(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=f(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`})}},qn={command:`asset-new`,describe:`Operations for requests.asset-new`,builder:e=>e.command(Kn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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(`dry-run`,{type:`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:`create <request-id>`,describe:`Lists assets attached to a Cloudforce One intelligence request.`,builder:Jn,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?d({page:r.page,per_page:r[`per-page`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.assets.create({...e,account_id:u,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=d({page:r.page,per_page:r[`per-page`]});a(await s(`Creating`,async()=>c.cloudforceOne.requests.assets.create({...f,account_id:u,request_id:r[`request-id`]})),{successLabel:`Created`})}};function Xn(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 Zn={command:`delete <asset-id>`,describe:`Removes an asset from a Cloudforce One intelligence request.`,builder:Xn,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
14
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.assets.delete({account_id:l,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Deleted`})}};function Qn(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 $n={command:`get <asset-id>`,describe:`Retrieves an asset attached to a Cloudforce One intelligence request.`,builder:Qn,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 er(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 tr={command:`update <asset-id>`,describe:`Updates an asset in a Cloudforce One intelligence request.`,builder:er,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?d({source:f(r.source,`source`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.requests.assets.update({...e,account_id:u,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Updated`});return}let p=d({source:f(r.source,`source`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.requests.assets.update({...p,account_id:u,request_id:r[`request-id`],asset_id:r[`asset-id`]})),{successLabel:`Updated`})}},nr={command:`assets`,describe:`Operations for requests.assets`,builder:e=>e.command(Yn).command(Zn).command($n).command(tr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ir={command:`constants`,describe:`Retrieves constant values used in Cloudforce One requests, including valid statuses and types.`,builder:rr,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 ar(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 or={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:ar,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?d({content:f(r.content,`content`,`text`),priority:f(r.priority,`priority`,`text`),request_type:f(r[`request-type`],`request-type`,`text`),summary:f(r.summary,`summary`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.create({body:e,account_id:u})),{successLabel:`Created`});return}let p=d({content:f(r.content,`content`,`text`),priority:f(r.priority,`priority`,`text`),request_type:f(r[`request-type`],`request-type`,`text`),summary:f(r.summary,`summary`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.requests.create({body:p,account_id:u})),{successLabel:`Created`})}};function sr(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 cr={command:`delete <request-id>`,describe:`Deletes a Cloudforce One intelligence request and all associated data.`,builder:sr,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
15
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.delete({account_id:l,request_id:r[`request-id`]})),{successLabel:`Deleted`})}};function lr(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 ur={command:`get <request-id>`,describe:`Retrieves details for a specific Cloudforce One intelligence request.`,builder:lr,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 dr(e){return e.option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`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 fr={command:`list`,describe:`Lists Cloudforce One intelligence requests with filtering and pagination.`,builder:dr,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?d({page:r.page,per_page:r[`per-page`],request_type:f(r[`request-type`],`request-type`,`text`),sort_by:f(r[`sort-by`],`sort-by`,`text`),sort_order:f(r[`sort-order`],`sort-order`,`text`),status:f(r.status,`status`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.list({...e,account_id:u})),{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=d({page:r.page,per_page:r[`per-page`],request_type:f(r[`request-type`],`request-type`,`text`),sort_by:f(r[`sort-by`],`sort-by`,`text`),sort_order:f(r[`sort-order`],`sort-order`,`text`),status:f(r.status,`status`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.requests.list({...p,account_id:u})),{successLabel:`Created`})}};function pr(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 mr={command:`create <request-id>`,describe:`Adds a message to a Cloudforce One intelligence request conversation.`,builder:pr,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?d({content:f(r.content,`content`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.message.create({body:e,account_id:u,request_id:r[`request-id`]})),{successLabel:`Created`});return}let p=d({content:f(r.content,`content`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.requests.message.create({body:p,account_id:u,request_id:r[`request-id`]})),{successLabel:`Created`})}};function hr(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 gr={command:`delete <message-id>`,describe:`Removes a message from a Cloudforce One intelligence request thread.`,builder:hr,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
16
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.message.delete({account_id:l,request_id:r[`request-id`],message_id:r[`message-id`]})),{successLabel:`Deleted`})}};function _r(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 vr={command:`get <request-id>`,describe:`Lists messages in a Cloudforce One intelligence request conversation.`,builder:_r,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?d({page:r.page,per_page:r[`per-page`],sort_by:f(r[`sort-by`],`sort-by`,`text`),sort_order:f(r[`sort-order`],`sort-order`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.message.get({...e,account_id:u,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=d({page:r.page,per_page:r[`per-page`],sort_by:f(r[`sort-by`],`sort-by`,`text`),sort_order:f(r[`sort-order`],`sort-order`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.requests.message.get({...p,account_id:u,request_id:r[`request-id`]})),{successLabel:`Created`})}};function yr(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 br={command:`update <message-id>`,describe:`Updates a message in a Cloudforce One intelligence request thread.`,builder:yr,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?d({content:f(r.content,`content`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.requests.message.update({body:e,account_id:u,request_id:r[`request-id`],message_id:r[`message-id`]})),{successLabel:`Updated`});return}let p=d({content:f(r.content,`content`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.requests.message.update({body:p,account_id:u,request_id:r[`request-id`],message_id:r[`message-id`]})),{successLabel:`Updated`})}},xr={command:`message`,describe:`Operations for requests.message`,builder:e=>e.command(mr).command(gr).command(vr).command(br).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Sr(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 Cr={command:`create`,describe:`Creates a new priority intelligence request in Cloudforce One.`,builder:Sr,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?d({labels:r.labels,priority:r.priority,requirement:f(r.requirement,`requirement`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.priority.create({body:e,account_id:u})),{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 m(`requirement`,`Requirement.`)),r.tlp===void 0&&(r.tlp=await h(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let p=d({labels:r.labels,priority:r.priority,requirement:f(r.requirement,`requirement`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.requests.priority.create({body:p,account_id:u})),{successLabel:`Created`})}};function wr(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 Tr={command:`delete <priority-id>`,describe:`Deletes a priority intelligence request from Cloudforce One.`,builder:wr,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
17
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.requests.priority.delete({account_id:l,priority_id:r[`priority-id`]})),{successLabel:`Deleted`})}};function Er(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 Dr={command:`get <priority-id>`,describe:`Retrieves a specific priority intelligence request from Cloudforce One.`,builder:Er,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 Or(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 kr={command:`list`,describe:`Lists priority intelligence requests in Cloudforce One.`,builder:Or,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?d({page:r.page,per_page:r[`per-page`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.requests.priority.list({...e,account_id:u})),{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=d({page:r.page,per_page:r[`per-page`]});a(await s(`Creating`,async()=>c.cloudforceOne.requests.priority.list({...f,account_id:u})),{successLabel:`Created`})}};function Ar(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const jr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One priority requests.`,builder:Ar,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 Mr(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 Nr={command:`update <priority-id>`,describe:`Updates a priority intelligence request in Cloudforce One.`,builder:Mr,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?d({labels:r.labels,priority:r.priority,requirement:f(r.requirement,`requirement`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.requests.priority.update({body:e,account_id:u,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 m(`requirement`,`Requirement.`)),r.tlp===void 0&&(r.tlp=await h(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let p=d({labels:r.labels,priority:r.priority,requirement:f(r.requirement,`requirement`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.requests.priority.update({body:p,account_id:u,priority_id:r[`priority-id`]})),{successLabel:`Updated`})}},Pr={command:`priority`,describe:`Operations for requests.priority`,builder:e=>e.command(Cr).command(Tr).command(Dr).command(kr).command(jr).command(Nr).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 Ir={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 Lr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Rr={command:`types`,describe:`Lists available request types for Cloudforce One intelligence requests.`,builder:Lr,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 zr(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 Br={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:zr,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?d({content:f(r.content,`content`,`text`),priority:f(r.priority,`priority`,`text`),request_type:f(r[`request-type`],`request-type`,`text`),summary:f(r.summary,`summary`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.requests.update({body:e,account_id:u,request_id:r[`request-id`]})),{successLabel:`Updated`});return}let p=d({content:f(r.content,`content`,`text`),priority:f(r.priority,`priority`,`text`),request_type:f(r[`request-type`],`request-type`,`text`),summary:f(r.summary,`summary`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.requests.update({body:p,account_id:u,request_id:r[`request-id`]})),{successLabel:`Updated`})}},Vr={command:`requests`,describe:`Additional request operations — priority listing and asset creation`,builder:e=>e.command(ir).command(or).command(cr).command(ur).command(fr).command(Ir).command(Rr).command(Br).command(qn).command(nr).command(xr).command(Pr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Hr(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 Ur={command:`cancel <id>`,describe:`Cancel a pending rule approval. Only its original requester may cancel it.`,builder:Hr,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 Wr(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 Gr={command:`get <id>`,describe:`Get a single rule approval with current rule data.`,builder:Wr,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 Kr(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 qr={command:`list`,describe:`Returns rule approvals with optional status, revision, reviewer-scope, and mutation-type filtering.`,builder:_(Kr),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 Jr(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 Yr={command:`resubmit <id>`,describe:`Create a new pending revision from a rejected rule approval. Only the original requester may resubmit the latest revision.`,builder:Jr,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?d({commit_message:f(r[`commit-message`],`commit-message`,`text`),content:f(r.content,`content`,`text`),description:f(r.description,`description`,`text`),enabled:r.enabled,name:f(r.name,`name`,`text`),namespaces:r.namespaces}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.approvals.resubmit({...e,account_id:u,id:r.id})),{successLabel:`Created`});return}let p=d({commit_message:f(r[`commit-message`],`commit-message`,`text`),content:f(r.content,`content`,`text`),description:f(r.description,`description`,`text`),enabled:r.enabled,name:f(r.name,`name`,`text`),namespaces:r.namespaces});a(await s(`Creating`,async()=>c.cloudforceOne.rules.approvals.resubmit({...p,account_id:u,id:r.id})),{successLabel:`Created`})}},Xr={command:`approvals`,describe:`Operations for rules.approvals`,builder:e=>e.command(Ur).command(Gr).command(qr).command(Yr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zr(e){return e.option(`actions`,{type:`string`,description:`The actions field. Provide as a JSON array of objects or @path/to/file.json.`}).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(`meta`,{type:`string`,description:`Adds YARA meta entries to the rule's meta block and stores them in rule_meta alongside content metadata. Use valid YARA identifiers for keys; exclude 'name', 'enabled', and 'description'. You may repeat keys. Provide as a JSON array of objects or @path/to/file.json.`}).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 Qr={command:`create`,describe:`Create a new detection rule.`,builder:Zr,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?d({actions:u(r.actions,`actions`),commit_message:f(r[`commit-message`],`commit-message`,`text`),content:f(r.content,`content`,`text`),description:f(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),namespaces:r.namespaces,path:f(r.path,`path`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.create({...e,account_id:p})),{successLabel:`Created`});return}r.content===void 0&&(r.content=await m(`content`,`The content field`)),r.name===void 0&&(r.name=await m(`name`,`The name field`)),r.path===void 0&&(r.path=await m(`path`,`The path field`));let h=d({actions:u(r.actions,`actions`),commit_message:f(r[`commit-message`],`commit-message`,`text`),content:f(r.content,`content`,`text`),description:f(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),namespaces:r.namespaces,path:f(r.path,`path`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.rules.create({...h,account_id:p})),{successLabel:`Created`})}};function $r(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 ei={command:`delete <id>`,describe:`Delete an existing rule.`,builder:$r,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?d({commit_message:f(r[`commit-message`],`commit-message`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
18
|
+
`);return}if(r.body){let e=l(r.body);a(await s(`Deleting`,async()=>c.cloudforceOne.rules.delete({...e,account_id:u,id:r.id})),{successLabel:`Deleted`});return}let p=d({commit_message:f(r[`commit-message`],`commit-message`,`text`)});a(await s(`Deleting`,async()=>c.cloudforceOne.rules.delete({...p,account_id:u,id:r.id})),{successLabel:`Deleted`})}};function ti(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 ni={command:`deleteAll`,describe:`Delete all rules in an account.`,builder:ti,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
19
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.rules.deleteAll({account_id:l})),{successLabel:`Deleted`})}};function ri(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(`meta`,{type:`string`,description:`The meta field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`The name field`}).option(`strings`,{type:`string`,description:`The strings field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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:`resubmit <id>`,describe:`Validates and compiles a complete structured email rule, then creates an immutable pending revision of its rejected approval.`,builder:_(ri),handler:async r=>{let c={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:c,bodyKind:`json`,body:r.body===void 0?d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)}):l(r.body)});return}let p=await i(r),g=r.local?e:await t();if(r.accountId=g,r.body){let e=l(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>p.cloudforceOne.rules.email.approvals.resubmit({...e,account_id:g,id:r.id,...c})),{successLabel:`Created`});return}r[`condition-operator`]===void 0&&(r[`condition-operator`]=await h(`condition-operator`,`The condition.operator field`,[`and`,`or`])),r[`condition-type`]===void 0&&(r[`condition-type`]=await h(`condition-type`,`The condition.type field`,[`group`])),r.name===void 0&&(r.name=await m(`name`,`The name field`));let _=d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>p.cloudforceOne.rules.email.approvals.resubmit({..._,account_id:g,id:r.id,...c})),{successLabel:`Created`})}},ai={command:`approvals`,describe:`Operations for rules.email.approvals`,builder:e=>e.command(ii).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oi(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(`meta`,{type:`string`,description:`The meta field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`The name field`}).option(`strings`,{type:`string`,description:`The strings field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const si={command:`create`,describe:`Create a structured email rule.`,builder:oi,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?d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.email.create({...e,account_id:p})),{successLabel:`Created`});return}r[`condition-operator`]===void 0&&(r[`condition-operator`]=await h(`condition-operator`,`The condition.operator field`,[`and`,`or`])),r[`condition-type`]===void 0&&(r[`condition-type`]=await h(`condition-type`,`The condition.type field`,[`group`])),r.name===void 0&&(r.name=await m(`name`,`The name field`));let g=d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)});a(await s(`Creating`,async()=>c.cloudforceOne.rules.email.create({...g,account_id:p})),{successLabel:`Created`})}};function ci(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 li={command:`delete <id>`,describe:`Delete an existing structured email rule.`,builder:ci,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
20
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.rules.email.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function ui(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 di={command:`get <id>`,describe:`Get a structured email rule by ID.`,builder:ui,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 fi(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 pi={command:`list`,describe:`Returns structured email rules.`,builder:fi,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 mi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const hi={command:`get`,describe:`Get the field catalog for structured email rules.`,builder:mi,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`})}},gi={command:`schema`,describe:`Operations for rules.email.schema`,builder:e=>e.command(hi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _i(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 vi={command:`test <id>`,describe:`Test a structured email rule against sample email JSON.`,builder:_i,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?d({sample_json:f(r[`sample-json`],`sample-json`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.email.test({...e,account_id:u,id:r.id})),{successLabel:`Created`});return}r[`sample-json`]===void 0&&(r[`sample-json`]=await m(`sample-json`,`The sample_json field`));let p=d({sample_json:f(r[`sample-json`],`sample-json`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.rules.email.test({...p,account_id:u,id:r.id})),{successLabel:`Created`})}};function yi(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(`meta`,{type:`string`,description:`The meta field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`The name field`}).option(`strings`,{type:`string`,description:`The strings field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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 bi={command:`update <id>`,describe:`Updates an existing structured email rule.`,builder:yi,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?d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.rules.email.update({...e,account_id:p,id:r.id})),{successLabel:`Updated`});return}let m=d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)});a(await s(`Updating`,async()=>c.cloudforceOne.rules.email.update({...m,account_id:p,id:r.id})),{successLabel:`Updated`})}};function xi(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(`meta`,{type:`string`,description:`The meta field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`The name field`}).option(`strings`,{type:`string`,description:`The strings field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Si={command:`updatePendingApproval <id>`,describe:`Validate, compile, and replace the proposed structured email rule on a pending approval. Only the original requester may update it.`,builder:_(xi),handler:async r=>{let c={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:c,bodyKind:`json`,body:r.body===void 0?d({description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)}):l(r.body)});return}let p=await i(r),h=r.local?e:await t();if(r.accountId=h,r.body){let e=l(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>p.cloudforceOne.rules.email.updatePendingApproval({...e,account_id:h,id:r.id,...c})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await m(`name`,`The name field`));let g=d({description:f(r.description,`description`,`text`),enabled:r.enabled,meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>p.cloudforceOne.rules.email.updatePendingApproval({...g,account_id:h,id:r.id,...c})),{successLabel:`Updated`})}};function Ci(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(`meta`,{type:`string`,description:`The meta field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`The name field`}).option(`strings`,{type:`string`,description:`The strings field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const wi={command:`validate`,describe:`Validates structured email rule syntax and metadata.`,builder:Ci,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?d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,existing_rule_id:f(r[`existing-rule-id`],`existing-rule-id`,`text`),meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.email.validate({...e,account_id:p})),{successLabel:`Created`});return}r[`condition-operator`]===void 0&&(r[`condition-operator`]=await h(`condition-operator`,`The condition.operator field`,[`and`,`or`])),r[`condition-type`]===void 0&&(r[`condition-type`]=await h(`condition-type`,`The condition.type field`,[`group`])),r.name===void 0&&(r.name=await m(`name`,`The name field`));let g=d({condition:{operator:f(r[`condition-operator`],`condition-operator`,`text`),type:f(r[`condition-type`],`condition-type`,`text`)},description:f(r.description,`description`,`text`),enabled:r.enabled,existing_rule_id:f(r[`existing-rule-id`],`existing-rule-id`,`text`),meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),strings:u(r.strings,`strings`)});a(await s(`Creating`,async()=>c.cloudforceOne.rules.email.validate({...g,account_id:p})),{successLabel:`Created`})}},Ti={command:`email`,describe:`Operations for rules.email`,builder:e=>e.command(si).command(li).command(di).command(pi).command(vi).command(bi).command(Si).command(wi).command(ai).command(gi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ei(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 Di={command:`create`,describe:`Add regex patterns to per-account exemption rules (union semantics). Missing keys leave that type untouched; duplicates are silently deduped.`,builder:Ei,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?d({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.exemptions.create({body:e,account_id:u})),{successLabel:`Created`});return}let f=d({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]});a(await s(`Creating`,async()=>c.cloudforceOne.rules.exemptions.create({body:f,account_id:u})),{successLabel:`Created`})}};function Oi(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 ki={command:`delete`,describe:`Remove regex patterns from per-account exemption rules. Missing keys leave that type untouched; non-existent patterns are silently skipped.`,builder:Oi,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?d({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
21
|
+
`);return}if(r.body){let e=l(r.body);a(await s(`Deleting`,async()=>c.cloudforceOne.rules.exemptions.delete({body:e,account_id:u})),{successLabel:`Deleted`});return}let f=d({namespace:r.namespace,tag_match:r[`tag-match`],worker_name:r[`worker-name`]});a(await s(`Deleting`,async()=>c.cloudforceOne.rules.exemptions.delete({body:f,account_id:u})),{successLabel:`Deleted`})}};function Ai(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ji={command:`get`,describe:`Get all exemption rule patterns for the account, grouped by type.`,builder:Ai,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 Mi(e){return e.option(`namespace`,{type:`string`,description:`The namespace field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`tag-match`,{type:`string`,description:`The tag_match field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`worker-name`,{type:`string`,description:`The worker_name field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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 Ni={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:Mi,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?d({namespace:u(r.namespace,`namespace`),tag_match:u(r[`tag-match`],`tag-match`),worker_name:u(r[`worker-name`],`worker-name`)}):l(r.body)});return}let c=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.rules.exemptions.update({...e,account_id:f})),{successLabel:`Updated`});return}let p=d({namespace:u(r.namespace,`namespace`),tag_match:u(r[`tag-match`],`tag-match`),worker_name:u(r[`worker-name`],`worker-name`)});a(await s(`Updating`,async()=>c.cloudforceOne.rules.exemptions.update({...p,account_id:f})),{successLabel:`Updated`})}},Pi={command:`exemptions`,describe:`Operations for rules.exemptions`,builder:e=>e.command(Di).command(ki).command(ji).command(Ni).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fi(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 Ii={command:`get <id>`,describe:`Get a single rule by ID.`,builder:Fi,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 Li(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 Ri={command:`list`,describe:`Returns all rules for an account with optional filtering.`,builder:_(Li),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 zi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Bi={command:`get`,describe:`Get DFP managed rule metadata (name and description) from YARA rules.`,builder:zi,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`})}},Vi={command:`managed`,describe:`Operations for rules.managed`,builder:e=>e.command(Bi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Hi(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(`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 Ui={command:`search`,describe:`Search rules using hybrid, vector, keyword, or exact retrieval, backed by AI Search with a SQL fallback.`,builder:_(Hi),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,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 Wi(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 statistics about rules for the dashboard.`,builder:Wi,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`})}},Ki={command:`stats`,describe:`Operations for rules.stats`,builder:e=>e.command(Gi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get`,describe:`Get the folder tree structure for rules navigation.`,builder:qi,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`})}},Ji={command:`tree`,describe:`Operations for rules.tree`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Yi(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(`meta`,{type:`string`,description:`Adds YARA meta entries to the rule's meta block and stores them in rule_meta alongside content metadata. Use valid YARA identifiers for keys; exclude 'name', 'enabled', and 'description'. You may repeat keys. Provide as a JSON array of objects or @path/to/file.json.`}).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 Xi={command:`update <id>`,describe:`Updates an existing rule.`,builder:Yi,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?d({commit_message:f(r[`commit-message`],`commit-message`,`text`),content:f(r.content,`content`,`text`),description:f(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),namespaces:r.namespaces,path:f(r.path,`path`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.rules.update({...e,account_id:p,id:r.id})),{successLabel:`Updated`});return}let m=d({commit_message:f(r[`commit-message`],`commit-message`,`text`),content:f(r.content,`content`,`text`),description:f(r.description,`description`,`text`),enabled:r.enabled,is_public:r[`is-public`],meta:u(r.meta,`meta`),name:f(r.name,`name`,`text`),namespaces:r.namespaces,path:f(r.path,`path`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.rules.update({...m,account_id:p,id:r.id})),{successLabel:`Updated`})}};function Zi(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 Qi={command:`validate`,describe:`Validates rule syntax, name uniqueness, namespace, and metadata.`,builder:Zi,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?d({content:f(r.content,`content`,`text`),excludeRuleId:f(r[`exclude-rule-id`],`exclude-rule-id`,`text`),name:f(r.name,`name`,`text`),namespaces:r.namespaces,path:f(r.path,`path`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.rules.validate({...e,account_id:u})),{successLabel:`Created`});return}r.content===void 0&&(r.content=await m(`content`,`The content field`)),r.name===void 0&&(r.name=await m(`name`,`The name field`));let p=d({content:f(r.content,`content`,`text`),excludeRuleId:f(r[`exclude-rule-id`],`exclude-rule-id`,`text`),name:f(r.name,`name`,`text`),namespaces:r.namespaces,path:f(r.path,`path`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.rules.validate({...p,account_id:u})),{successLabel:`Created`})}},$i={command:`rules`,describe:`Rule management operations`,builder:e=>e.command(Qr).command(ei).command(ni).command(Ii).command(Ri).command(Ui).command(Xi).command(Qi).command(Xr).command(Ti).command(Pi).command(Vi).command(Ki).command(Ji).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ea(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 ta={command:`create`,describe:`Creates a new scan configuration for Cloudforce One's network scanning service.`,builder:ea,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?d({frequency:r.frequency,ips:r.ips,ports:r.ports}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.scans.config.create({...e,account_id:u})),{successLabel:`Created`});return}if(r.ips===void 0)throw Error(`--ips is required (or pass --body with this field set).`);let f=d({frequency:r.frequency,ips:r.ips,ports:r.ports});a(await s(`Creating`,async()=>c.cloudforceOne.scans.config.create({...f,account_id:u})),{successLabel:`Created`})}};function na(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 ra={command:`delete <config-id>`,describe:`Deletes a scan configuration from Cloudforce One's network scanning service.`,builder:na,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
22
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.scans.config.delete({account_id:l,config_id:r[`config-id`]})),{successLabel:`Deleted`})}};function ia(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 aa={command:`edit <config-id>`,describe:`Updates an existing scan configuration in Cloudforce One's network scanning service.`,builder:ia,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?d({frequency:r.frequency,ips:r.ips,ports:r.ports}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.scans.config.edit({...e,account_id:u,config_id:r[`config-id`]})),{successLabel:`Updated`});return}let f=d({frequency:r.frequency,ips:r.ips,ports:r.ports});a(await s(`Updating`,async()=>c.cloudforceOne.scans.config.edit({...f,account_id:u,config_id:r[`config-id`]})),{successLabel:`Updated`})}};function oa(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const sa={command:`list`,describe:`Lists scan configurations for Cloudforce One's network scanning service.`,builder:oa,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`})}},ca={command:`config`,describe:`Operations for scans.config`,builder:e=>e.command(ta).command(ra).command(aa).command(sa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function la(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 ua={command:`get <config-id>`,describe:`Retrieves the latest scan results for a Cloudforce One scan configuration, including discovered open ports.`,builder:la,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans results get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/scans/results/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}`,pathParams:{"config-id":String(r[`config-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.scans.results.get({account_id:l,config_id:r[`config-id`]})),{successLabel:`Loaded`})}};function da(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 fa={command:`getBanners <config-id>`,describe:`Retrieves the latest banner grab results for a Cloudforce One scan configuration, including service banners from open ports.`,builder:da,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one scans results getBanners`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/banner/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}`,pathParams:{"config-id":String(r[`config-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.scans.results.getBanners({account_id:l,config_id:r[`config-id`]})),{successLabel:`Loaded`})}},pa={command:`results`,describe:`Operations for scans.results`,builder:e=>e.command(ua).command(fa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ma={command:`scans`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(ca).command(pa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ha(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 ga={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:ha,handler:async c=>{if(c.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:c.body,file:c.file,description:c.description,metadata:c.metadata,name:c.name,"project-id":c[`project-id`],tags:c.tags}});return}let u=await i(c),d=c.local?e:await t();if(c.accountId=d,c.file!==void 0||c.body!==void 0||c.description!==void 0||c.metadata!==void 0||c.name!==void 0||c[`project-id`]!==void 0||c.tags!==void 0){let e=new FormData;if(c.file){let t=p(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.description!==void 0&&e.append(`description`,String(f(c.description,`description`,`text`)??``)),c.metadata!==void 0&&e.append(`metadata`,String(f(c.metadata,`metadata`,`text`)??``)),c.name!==void 0&&e.append(`name`,String(f(c.name,`name`,`text`)??``)),c[`project-id`]!==void 0&&e.append(`project_id`,String(f(c[`project-id`],`project-id`,`text`)??``)),c.tags!==void 0&&e.append(`tags`,String(f(c.tags,`tags`,`text`)??``)),a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/cloudforce-one/v2/collections`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=l(c.body);a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/cloudforce-one/v2/collections`,{body:e})),{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 _a(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 va={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:_a,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
23
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.collections.delete({account_id:l,collection_id:r[`collection-id`]})),{successLabel:`Deleted`})}};function ya(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 ba={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:ya,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();v((await s(`Loading`,async()=>y(`/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 xa(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 Sa={command:`get <collection-id>`,describe:`Retrieves a single collection by ID with its schema and metadata`,builder:xa,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 Ca(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 wa={command:`list`,describe:`Retrieves all collections for an account with pagination`,builder:Ca,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 Ta(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 Ea={command:`update <collection-id>`,describe:`Updates collection name and/or metadata. Schema (columns) cannot be modified.`,builder:Ta,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?d({metadata:{description:f(r[`metadata-description`],`metadata-description`,`text`),project_id:f(r[`metadata-project-id`],`metadata-project-id`,`text`),tags:r[`metadata-tags`]},name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.collections.update({...e,account_id:u,collection_id:r[`collection-id`]})),{successLabel:`Updated`});return}let p=d({metadata:{description:f(r[`metadata-description`],`metadata-description`,`text`),project_id:f(r[`metadata-project-id`],`metadata-project-id`,`text`),tags:r[`metadata-tags`]},name:f(r.name,`name`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.collections.update({...p,account_id:u,collection_id:r[`collection-id`]})),{successLabel:`Updated`})}},Da={command:`collections`,describe:`Operations for stakeout.collections`,builder:e=>e.command(ga).command(va).command(ba).command(Sa).command(wa).command(Ea).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oa(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 ka={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:Oa,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?d({name:f(r.name,`name`,`text`),required:r.required,type:f(r.type,`type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.columns.create({...e,account_id:u,collection_id:r[`collection-id`]})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await m(`name`,`The name field`)),r.type===void 0&&(r.type=await h(`type`,`The type field`,[`text`,`number`,`boolean`,`date`]));let p=d({name:f(r.name,`name`,`text`),required:r.required,type:f(r.type,`type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.columns.create({...p,account_id:u,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 ja={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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
24
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.columns.delete({account_id:l,collection_id:r[`collection-id`],column_id:r[`column-id`]})),{successLabel:`Deleted`})}};function Ma(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 Na={command:`update <column-id>`,describe:`Update name, type, required, or position of a column.`,builder:Ma,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?d({name:f(r.name,`name`,`text`),position:r.position,required:r.required,type:f(r.type,`type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.columns.update({...e,account_id:u,collection_id:r[`collection-id`],column_id:r[`column-id`]})),{successLabel:`Updated`});return}let p=d({name:f(r.name,`name`,`text`),position:r.position,required:r.required,type:f(r.type,`type`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.columns.update({...p,account_id:u,collection_id:r[`collection-id`],column_id:r[`column-id`]})),{successLabel:`Updated`})}},Pa={command:`columns`,describe:`Operations for stakeout.columns`,builder:e=>e.command(ka).command(ja).command(Na).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fa(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(`string-matches`,{type:`string`,description:`The string_matches field. Provide as a JSON array of objects or @path/to/file.json.`}).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 Ia={command:`create`,describe:`Create a new saved brand protection query with string match patterns`,builder:Fa,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?d({max_time:f(r[`max-time`],`max-time`,`text`),min_time:f(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],string_matches:u(r[`string-matches`],`string-matches`),tag:f(r.tag,`tag`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.domainQueries.create({...e,account_id:p})),{successLabel:`Created`});return}if(r[`string-matches`]===void 0)throw Error(`--string-matches is required (or pass --body with this field set).`);r.tag===void 0&&(r.tag=await m(`tag`,`The tag field`));let h=d({max_time:f(r[`max-time`],`max-time`,`text`),min_time:f(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],string_matches:u(r[`string-matches`],`string-matches`),tag:f(r.tag,`tag`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.domainQueries.create({...h,account_id:p})),{successLabel:`Created`})}};function La(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 Ra={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:La,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
25
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.domainQueries.delete({account_id:l,query_id:r[`query-id`]})),{successLabel:`Deleted`})}};function za(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(`string-matches`,{type:`string`,description:`The string_matches field. Provide as a JSON array of objects or @path/to/file.json.`}).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 Ba={command:`update <query-id>`,describe:`Update a saved brand protection domain query with string match patterns`,builder:za,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?d({max_time:f(r[`max-time`],`max-time`,`text`),min_time:f(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],string_matches:u(r[`string-matches`],`string-matches`),tag:f(r.tag,`tag`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.domainQueries.update({...e,account_id:p,query_id:r[`query-id`]})),{successLabel:`Updated`});return}if(r[`string-matches`]===void 0)throw Error(`--string-matches is required (or pass --body with this field set).`);r.tag===void 0&&(r.tag=await m(`tag`,`The tag field`));let h=d({max_time:f(r[`max-time`],`max-time`,`text`),min_time:f(r[`min-time`],`min-time`,`text`),scan:r.scan,scan_matches:r[`scan-matches`],search_lookback:r[`search-lookback`],string_matches:u(r[`string-matches`],`string-matches`),tag:f(r.tag,`tag`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.domainQueries.update({...h,account_id:p,query_id:r[`query-id`]})),{successLabel:`Updated`})}},Va={command:`domain-queries`,describe:`Operations for stakeout.domain-queries`,builder:e=>e.command(Ia).command(Ra).command(Ba).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ha(e){return e.option(`seeds`,{type:`string`,description:`Comma-separated compact seed ids (type:uuid). Example: seeds=event:550e8400-...,indicator:661fa920-... Provide 1–50 entries; omitting seeds returns 400.`}).option(`direction`,{type:`string`,description:`Edge direction relative to each seed: out (seed→neighbors), in (neighbors→seed), both (default).`}).option(`hydration`,{type:`string`,description:`Hydration strategy for neighbor nodes when expand=nodes is set. r2_join (default): use R2 JOIN query + DO fallback. do_only: use plain R2 query + hydrate all neighbors via Durable Objects.`}).option(`limit`,{type:`number`,description:`Max neighbors per seed (default: 100, max: 1000). Values above 1000 return 400.`}).option(`max-nodes`,{type:`number`,description:`Total accumulated node cap across all seeds (default: 500, max: 1000). Values above 1000 return 400.`}).option(`relationship-types`,{type:`string`,description:`Comma-separated relationship types to filter by. Allowed: tagged_with, appears_in, related_to, caused_by, attributed_to.`}).option(`dataset-ids`,{type:`string`,description:`Comma-separated dataset UUIDs to restrict neighbor scope, or one standalone scope value: 'all'/'*', 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. Intersected with access grants.`}).option(`cursor`,{type:`string`,description:`Opaque pagination token. Only valid when seeds has exactly 1 entry; 400 otherwise.`}).option(`expand`,{type:`string`,description:"Comma-separated list of response sections to expand (hydrate). Allowed: `nodes`. Omitting `expand` returns identifier-only nodes."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ua={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:Ha,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`})}},Wa={command:`graphs`,describe:`Operations for stakeout.graphs`,builder:e=>e.command(Ua).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ga(e){return e.option(`aggregate-by`,{type:`string`,description:`Column(s) to aggregate by - single column or comma-separated list (e.g., 'indicatorType', 'value', 'indicatorType,value')`,demandOption:!0}).option(`measure`,{type:`string`,description:`What to count per group: 'indicators' (catalog rows, default) or 'relationships' (linked events per indicator). Use 'relationships' for 'top indicator by event activity'.`,choices:[`indicators`,`relationships`]}).option(`tag-uuid`,{type:`string`,description:`Scope to indicators associated with this tag/actor UUID. Combine with measure=relationships for 'top indicator for an actor'.`}).option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to filter by, or one standalone scope value: 'all'/'*' for all accessible datasets, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, aggregates across all accessible datasets.`}).option(`created-after`,{type:`string`,description:`Filter indicators created after this date/datetime (ISO 8601, e.g., '2024-01-01' or '2024-01-01T00:00:00Z')`}).option(`created-before`,{type:`string`,description:`Filter indicators created before this date/datetime (ISO 8601, e.g., '2024-12-31' or '2024-12-31T23:59:59Z')`}).option(`event-date-after`,{type:`string`,description:`For measure=relationships: only count indicator→event links whose relationship was created/observed on or after this date (ISO 8601). Bounds the activity view to recently-observed links. Note: this filters by the relationship's createdAt (link-observation time), not the underlying event's business date.`}).option(`event-date-before`,{type:`string`,description:`For measure=relationships: only count indicator→event links whose relationship was created/observed on or before this date (ISO 8601). Bounds the activity view by the relationship's createdAt (link-observation time), not the underlying event's business date.`}).option(`limit`,{type:`number`,description:`Maximum number of aggregation results to return (1-100)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ka={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:_(Ga),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`})}},qa={command:`indicators`,describe:`Operations for stakeout.indicators`,builder:e=>e.command(Ka).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ja(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 Ya={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:Ja,handler:async c=>{if(c.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/${c[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(c[`collection-id`]))}/items`,pathParams:{"collection-id":String(c[`collection-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:l(c.body)});return}let u=await i(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=l(c.body);a(await s(`Creating`,async()=>u.cloudforceOne.stakeout.items.create({body:e,account_id:d,collection_id:c[`collection-id`]})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/cloudforce-one/v2/collections/${encodeURIComponent(String(c[`collection-id`]))}/items`)),{successLabel:`Created`})}};function Xa(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 Za={command:`delete <item-id>`,describe:`Delete an item from a collection by its identifier.`,builder:Xa,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
26
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.items.delete({account_id:l,collection_id:r[`collection-id`],item_id:r[`item-id`]})),{successLabel:`Deleted`})}};function Qa(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 $a={command:`get <item-id>`,describe:`Retrieve a single item from a collection by its identifier.`,builder:Qa,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 eo(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 to={command:`query <collection-id>`,describe:`Retrieves items from a collection with keyset pagination and optional column-based filters`,builder:eo,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 no(e){return e.positional(`collection-id`,{type:`string`,description:`Collection UUID`,demandOption:!0}).option(`cursor`,{type:`string`,description:`The cursor field`}).option(`filter-field`,{type:`string`,description:`Column name to filter on`}).option(`filter-op`,{type:`string`,description:`Comparison operator`,choices:[`eq`,`neq`,`gt`,`lt`,`gte`,`lte`,`contains`,`is_empty`,`is_not_empty`]}).option(`limit`,{type:`number`,description:`The limit field`,default:20}).option(`q`,{type:`string`,description:`Case-insensitive substring search across all columns. Matches any column containing the term. No relevance ranking.`}).option(`sort-field`,{type:`string`,description:`Column name to sort by`}).option(`sort-order`,{type:`string`,description:`The sort.order field`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).implies(`filter-field`,[`filter-op`]).implies(`filter-op`,[`filter-field`]).check(e=>{if([`sort-field`,`sort-order`].some(t=>e[t]!==void 0)){let t=[`sort-field`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --sort-* flag is set`)}return!0})}const ro={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:no,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?d({cursor:f(r.cursor,`cursor`,`text`),filter:{field:f(r[`filter-field`],`filter-field`,`text`),op:f(r[`filter-op`],`filter-op`,`text`)},limit:r.limit,q:f(r.q,`q`,`text`),sort:{field:f(r[`sort-field`],`sort-field`,`text`),order:f(r[`sort-order`],`sort-order`,`text`)}}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.items.search({...e,account_id:u,collection_id:r[`collection-id`]})),{successLabel:`Loaded`});return}let p=d({cursor:f(r.cursor,`cursor`,`text`),filter:{field:f(r[`filter-field`],`filter-field`,`text`),op:f(r[`filter-op`],`filter-op`,`text`)},limit:r.limit,q:f(r.q,`q`,`text`),sort:{field:f(r[`sort-field`],`sort-field`,`text`),order:f(r[`sort-order`],`sort-order`,`text`)}});a(await s(`Loading`,async()=>c.cloudforceOne.stakeout.items.search({...p,account_id:u,collection_id:r[`collection-id`]})),{successLabel:`Loaded`})}};function io(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 ao={command:`update <item-id>`,describe:`Update an item in a collection with partial data.`,builder:io,handler:async c=>{if(c.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/${c[`collection-id`]==null?`<collection-id>`:encodeURIComponent(String(c[`collection-id`]))}/items/${c[`item-id`]==null?`<item-id>`:encodeURIComponent(String(c[`item-id`]))}`,pathParams:{"collection-id":String(c[`collection-id`]??``),"item-id":String(c[`item-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:l(c.body)});return}let u=await i(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=l(c.body);a(await s(`Updating`,async()=>u.cloudforceOne.stakeout.items.update({...e,account_id:d,collection_id:c[`collection-id`],item_id:c[`item-id`]})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>r(u,`PATCH`,`/accounts/${d}/cloudforce-one/v2/collections/${encodeURIComponent(String(c[`collection-id`]))}/items/${encodeURIComponent(String(c[`item-id`]))}`)),{successLabel:`Updated`})}},oo={command:`items`,describe:`Operations for stakeout.items`,builder:e=>e.command(Ya).command(Za).command($a).command(to).command(ro).command(ao).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function so(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 co={command:`create`,describe:`Create a new user-defined takedown letter template`,builder:so,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?d({category:f(r.category,`category`,`text`),description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.letterTemplates.create({...e,account_id:u})),{successLabel:`Created`});return}r.category===void 0&&(r.category=await m(`category`,`The category field`)),r.name===void 0&&(r.name=await m(`name`,`The name field`));let p=d({category:f(r.category,`category`,`text`),description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.letterTemplates.create({...p,account_id:u})),{successLabel:`Created`})}};function lo(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 uo={command:`delete <template-id>`,describe:`Delete a user-defined takedown letter template. System templates cannot be deleted.`,builder:lo,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
27
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.letterTemplates.delete({account_id:l,template_id:r[`template-id`]})),{successLabel:`Deleted`})}};function fo(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const po={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:fo,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 mo(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 ho={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:mo,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 go(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _o={command:`list`,describe:`List user-defined takedown letter templates. System example templates are available via the /templates/examples endpoint.`,builder:go,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 vo(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 yo={command:`update <template-id>`,describe:`Update a user-defined takedown letter template. System templates cannot be modified.`,builder:vo,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?d({category:f(r.category,`category`,`text`),description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.letterTemplates.update({...e,account_id:u,template_id:r[`template-id`]})),{successLabel:`Updated`});return}let p=d({category:f(r.category,`category`,`text`),description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.letterTemplates.update({...p,account_id:u,template_id:r[`template-id`]})),{successLabel:`Updated`})}},bo={command:`letter-templates`,describe:`Operations for stakeout.letter-templates`,builder:e=>e.command(co).command(uo).command(po).command(ho).command(_o).command(yo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xo(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 So={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:xo,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?d({fields:{discoveryDate:f(r[`fields-discovery-date`],`fields-discovery-date`,`text`),domain:f(r[`fields-domain`],`fields-domain`,`text`),generationDate:f(r[`fields-generation-date`],`fields-generation-date`,`text`),jurisdiction:f(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`),registrantEmail:f(r[`fields-registrant-email`],`fields-registrant-email`,`text`),registrar:f(r[`fields-registrar`],`fields-registrar`,`text`),registrarEmail:f(r[`fields-registrar-email`],`fields-registrar-email`,`text`),resolutionByDate:f(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`),senderCompany:f(r[`fields-sender-company`],`fields-sender-company`,`text`),senderEmail:f(r[`fields-sender-email`],`fields-sender-email`,`text`),senderName:f(r[`fields-sender-name`],`fields-sender-name`,`text`),senderTitle:f(r[`fields-sender-title`],`fields-sender-title`,`text`),trademarkName:f(r[`fields-trademark-name`],`fields-trademark-name`,`text`),trademarkNumber:f(r[`fields-trademark-number`],`fields-trademark-number`,`text`),trademarkOwner:f(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)},templateId:f(r[`template-id`],`template-id`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.takedownLetters.create({...e,account_id:u,notice_id:r[`notice-id`]})),{successLabel:`Created`});return}r[`template-id`]===void 0&&(r[`template-id`]=await m(`template-id`,`The templateId field`));let p=d({fields:{discoveryDate:f(r[`fields-discovery-date`],`fields-discovery-date`,`text`),domain:f(r[`fields-domain`],`fields-domain`,`text`),generationDate:f(r[`fields-generation-date`],`fields-generation-date`,`text`),jurisdiction:f(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`),registrantEmail:f(r[`fields-registrant-email`],`fields-registrant-email`,`text`),registrar:f(r[`fields-registrar`],`fields-registrar`,`text`),registrarEmail:f(r[`fields-registrar-email`],`fields-registrar-email`,`text`),resolutionByDate:f(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`),senderCompany:f(r[`fields-sender-company`],`fields-sender-company`,`text`),senderEmail:f(r[`fields-sender-email`],`fields-sender-email`,`text`),senderName:f(r[`fields-sender-name`],`fields-sender-name`,`text`),senderTitle:f(r[`fields-sender-title`],`fields-sender-title`,`text`),trademarkName:f(r[`fields-trademark-name`],`fields-trademark-name`,`text`),trademarkNumber:f(r[`fields-trademark-number`],`fields-trademark-number`,`text`),trademarkOwner:f(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)},templateId:f(r[`template-id`],`template-id`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.takedownLetters.create({...p,account_id:u,notice_id:r[`notice-id`]})),{successLabel:`Created`})}};function Co(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 wo={command:`delete <letter-id>`,describe:`Delete a specific takedown letter and its associated PDF from storage.`,builder:Co,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
28
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.takedownLetters.delete({account_id:l,notice_id:r[`notice-id`],letter_id:r[`letter-id`]})),{successLabel:`Deleted`})}};function To(e){return e.option(`create-notice`,{type:`boolean`,description:`The createNotice field`,default:!1}).option(`fields-discovery-date`,{type:`string`,description:`The fields.discoveryDate field`}).option(`fields-domain`,{type:`string`,description:`The fields.domain field`}).option(`fields-generation-date`,{type:`string`,description:`The fields.generationDate field`}).option(`fields-jurisdiction`,{type:`string`,description:`The fields.jurisdiction field`}).option(`fields-registrant-email`,{type:`string`,description:`The fields.registrantEmail field`}).option(`fields-registrar`,{type:`string`,description:`The fields.registrar field`}).option(`fields-registrar-email`,{type:`string`,description:`The fields.registrarEmail field`}).option(`fields-resolution-by-date`,{type:`string`,description:`The fields.resolutionByDate field`}).option(`fields-sender-company`,{type:`string`,description:`The fields.senderCompany field`}).option(`fields-sender-email`,{type:`string`,description:`The fields.senderEmail field`}).option(`fields-sender-name`,{type:`string`,description:`The fields.senderName field`}).option(`fields-sender-title`,{type:`string`,description:`The fields.senderTitle field`}).option(`fields-trademark-name`,{type:`string`,description:`The fields.trademarkName field`}).option(`fields-trademark-number`,{type:`string`,description:`The fields.trademarkNumber field`}).option(`fields-trademark-owner`,{type:`string`,description:`The fields.trademarkOwner field`}).option(`format`,{type:`string`,description:`The format field`,choices:[`text`,`pdf`],default:`text`}).option(`notice-params-domain`,{type:`string`,description:`The noticeParams.domain field`}).option(`notice-params-query-id`,{type:`number`,description:`The noticeParams.queryId field`}).option(`notice-params-status`,{type:`string`,description:`The noticeParams.status field`,choices:[`draft`,`sent`,`resolved`,`expired`]}).option(`template-id`,{type:`string`,description:`The templateId field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}).check(e=>{if([`notice-params-domain`,`notice-params-query-id`,`notice-params-status`].some(t=>e[t]!==void 0)){let t=[`notice-params-domain`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --noticeParams-* flag is set`)}return!0})}const 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:To,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?d({createNotice:r[`create-notice`],fields:{discoveryDate:f(r[`fields-discovery-date`],`fields-discovery-date`,`text`),domain:f(r[`fields-domain`],`fields-domain`,`text`),generationDate:f(r[`fields-generation-date`],`fields-generation-date`,`text`),jurisdiction:f(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`),registrantEmail:f(r[`fields-registrant-email`],`fields-registrant-email`,`text`),registrar:f(r[`fields-registrar`],`fields-registrar`,`text`),registrarEmail:f(r[`fields-registrar-email`],`fields-registrar-email`,`text`),resolutionByDate:f(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`),senderCompany:f(r[`fields-sender-company`],`fields-sender-company`,`text`),senderEmail:f(r[`fields-sender-email`],`fields-sender-email`,`text`),senderName:f(r[`fields-sender-name`],`fields-sender-name`,`text`),senderTitle:f(r[`fields-sender-title`],`fields-sender-title`,`text`),trademarkName:f(r[`fields-trademark-name`],`fields-trademark-name`,`text`),trademarkNumber:f(r[`fields-trademark-number`],`fields-trademark-number`,`text`),trademarkOwner:f(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)},format:f(r.format,`format`,`text`),noticeParams:{domain:f(r[`notice-params-domain`],`notice-params-domain`,`text`),queryId:r[`notice-params-query-id`],status:f(r[`notice-params-status`],`notice-params-status`,`text`)},templateId:f(r[`template-id`],`template-id`,`text`)}):l(r.body)});return}await i(r);let a=r.local?e:await t();if(r.accountId=a,r.body){let e=l(r.body),t=await s(`Creating`,async()=>y(`/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`}));v(r.text===!0?t.toString(`utf-8`):t);return}r[`template-id`]===void 0&&(r[`template-id`]=await m(`template-id`,`The templateId field`));let u={};r[`create-notice`]!==void 0&&c(u,[`createNotice`],r[`create-notice`]),r[`fields-discovery-date`]!==void 0&&c(u,[`fields`,`discoveryDate`],f(r[`fields-discovery-date`],`fields-discovery-date`,`text`)),r[`fields-domain`]!==void 0&&c(u,[`fields`,`domain`],f(r[`fields-domain`],`fields-domain`,`text`)),r[`fields-generation-date`]!==void 0&&c(u,[`fields`,`generationDate`],f(r[`fields-generation-date`],`fields-generation-date`,`text`)),r[`fields-jurisdiction`]!==void 0&&c(u,[`fields`,`jurisdiction`],f(r[`fields-jurisdiction`],`fields-jurisdiction`,`text`)),r[`fields-registrant-email`]!==void 0&&c(u,[`fields`,`registrantEmail`],f(r[`fields-registrant-email`],`fields-registrant-email`,`text`)),r[`fields-registrar`]!==void 0&&c(u,[`fields`,`registrar`],f(r[`fields-registrar`],`fields-registrar`,`text`)),r[`fields-registrar-email`]!==void 0&&c(u,[`fields`,`registrarEmail`],f(r[`fields-registrar-email`],`fields-registrar-email`,`text`)),r[`fields-resolution-by-date`]!==void 0&&c(u,[`fields`,`resolutionByDate`],f(r[`fields-resolution-by-date`],`fields-resolution-by-date`,`text`)),r[`fields-sender-company`]!==void 0&&c(u,[`fields`,`senderCompany`],f(r[`fields-sender-company`],`fields-sender-company`,`text`)),r[`fields-sender-email`]!==void 0&&c(u,[`fields`,`senderEmail`],f(r[`fields-sender-email`],`fields-sender-email`,`text`)),r[`fields-sender-name`]!==void 0&&c(u,[`fields`,`senderName`],f(r[`fields-sender-name`],`fields-sender-name`,`text`)),r[`fields-sender-title`]!==void 0&&c(u,[`fields`,`senderTitle`],f(r[`fields-sender-title`],`fields-sender-title`,`text`)),r[`fields-trademark-name`]!==void 0&&c(u,[`fields`,`trademarkName`],f(r[`fields-trademark-name`],`fields-trademark-name`,`text`)),r[`fields-trademark-number`]!==void 0&&c(u,[`fields`,`trademarkNumber`],f(r[`fields-trademark-number`],`fields-trademark-number`,`text`)),r[`fields-trademark-owner`]!==void 0&&c(u,[`fields`,`trademarkOwner`],f(r[`fields-trademark-owner`],`fields-trademark-owner`,`text`)),r.format!==void 0&&c(u,[`format`],f(r.format,`format`,`text`)),r[`notice-params-domain`]!==void 0&&c(u,[`noticeParams`,`domain`],f(r[`notice-params-domain`],`notice-params-domain`,`text`)),r[`notice-params-query-id`]!==void 0&&c(u,[`noticeParams`,`queryId`],r[`notice-params-query-id`]),r[`notice-params-status`]!==void 0&&c(u,[`noticeParams`,`status`],f(r[`notice-params-status`],`notice-params-status`,`text`)),r[`template-id`]!==void 0&&c(u,[`templateId`],f(r[`template-id`],`template-id`,`text`));let p=await s(`Creating`,async()=>y(`/accounts/${a}/cloudforce-one/v2/brand-protection/letter/generate`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:Object.keys(u).length>0?u:void 0}));v(r.text===!0?p.toString(`utf-8`):p)}};function Do(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 Oo={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:Do,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()=>y(`/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}));v(r.text===!0?c.toString(`utf-8`):c)}};function ko(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 Ao={command:`get <letter-id>`,describe:`Get a specific takedown letter by ID, including the rendered text.`,builder:ko,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 jo(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 Mo={command:`list`,describe:`List all letters for a specific takedown notice.`,builder:jo,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`})}},No={command:`takedown-letters`,describe:`Operations for stakeout.takedown-letters`,builder:e=>e.command(So).command(wo).command(Eo).command(Ao).command(Oo).command(Mo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Po(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 Fo={command:`create`,describe:`Create a new takedown notice for a domain suspected of trademark infringement.`,builder:Po,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?d({domain:f(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:f(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:f(r.status,`status`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.takedownNotices.create({...e,account_id:u})),{successLabel:`Created`});return}r.domain===void 0&&(r.domain=await m(`domain`,`The domain field`));let p=d({domain:f(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:f(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:f(r.status,`status`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.takedownNotices.create({...p,account_id:u})),{successLabel:`Created`})}};function Io(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 Lo={command:`delete <notice-id>`,describe:`Delete a takedown notice and all associated letters. PDFs are also removed from storage.`,builder:Io,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
29
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.stakeout.takedownNotices.delete({account_id:l,notice_id:r[`notice-id`]})),{successLabel:`Deleted`})}};function Ro(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 zo={command:`get <notice-id>`,describe:`Get a specific takedown notice by ID.`,builder:Ro,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 Bo(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Vo={command:`list`,describe:`List all takedown notices for the account.`,builder:Bo,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 Ho(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 Uo={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:Ho,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?d({domains:r.domains,queryId:r[`query-id`],queryIds:r[`query-ids`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.takedownNotices.lookup({...e,account_id:u})),{successLabel:`Created`});return}if(r.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);let f=d({domains:r.domains,queryId:r[`query-id`],queryIds:r[`query-ids`]});a(await s(`Creating`,async()=>c.cloudforceOne.stakeout.takedownNotices.lookup({...f,account_id:u})),{successLabel:`Created`})}};function Wo(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 Go={command:`update <notice-id>`,describe:`Update a takedown notice (e.g. change status to sent, resolved, etc.).`,builder:Wo,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?d({domain:f(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:f(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:f(r.status,`status`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.takedownNotices.update({...e,account_id:u,notice_id:r[`notice-id`]})),{successLabel:`Updated`});return}let p=d({domain:f(r.domain,`domain`,`text`),matchId:r[`match-id`],matchType:f(r[`match-type`],`match-type`,`text`),queryId:r[`query-id`],status:f(r.status,`status`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.stakeout.takedownNotices.update({...p,account_id:u,notice_id:r[`notice-id`]})),{successLabel:`Updated`})}},Ko={command:`takedown-notices`,describe:`Operations for stakeout.takedown-notices`,builder:e=>e.command(Fo).command(Lo).command(zo).command(Vo).command(Uo).command(Go).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},qo={command:`stakeout`,describe:`Operations for stakeout`,builder:e=>e.command(Da).command(Pa).command(Va).command(Wa).command(qa).command(oo).command(bo).command(No).command(Ko).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Jo(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 Yo={command:`list`,describe:`Lists known threat attackers tracked in Cloudforce One threat intelligence.`,builder:Jo,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`})}},Xo={command:`attackers`,describe:`Operations for threat-events.attackers`,builder:e=>e.command(Yo).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zo(e){return e.option(`data`,{type:`string`,description:`The data field. Provide as a JSON array of objects or @path/to/file.json.`}).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 Qo={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:Zo,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?d({data:u(r.data,`data`),datasetId:f(r[`dataset-id`],`dataset-id`,`text`),includeCreatedEvents:r[`include-created-events`]}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.bulkCreate({...e,account_id:p})),{successLabel:`Created`});return}if(r.data===void 0)throw Error(`--data is required (or pass --body with this field set).`);r[`dataset-id`]===void 0&&(r[`dataset-id`]=await m(`dataset-id`,`The datasetId field`));let h=d({data:u(r.data,`data`),datasetId:f(r[`dataset-id`],`dataset-id`,`text`),includeCreatedEvents:r[`include-created-events`]});a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.bulkCreate({...h,account_id:p})),{successLabel:`Created`})}};function $o(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 es={command:`create`,describe:`Creates a new threat event category in Cloudforce One for organizing and classifying threat events.`,builder:$o,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?d({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:f(r.name,`name`,`text`),shortname:f(r.shortname,`shortname`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.categories.create({...e,account_id:u})),{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 m(`name`,`The name field`));let p=d({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:f(r.name,`name`,`text`),shortname:f(r.shortname,`shortname`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.categories.create({...p,account_id:u})),{successLabel:`Created`})}};function ts(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 ns={command:`delete <category-id>`,describe:`Removes a threat event category from Cloudforce One.`,builder:ts,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 g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
30
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.categories.delete({account_id:l,category_id:r[`category-id`]})),{successLabel:`Deleted`})}};function rs(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 is={command:`edit <category-id>`,describe:`Partially updates a threat event category in Cloudforce One, modifying specific fields without replacing the entire category.`,builder:rs,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?d({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:f(r.name,`name`,`text`),shortname:f(r.shortname,`shortname`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.categories.edit({...e,account_id:u,category_id:r[`category-id`]})),{successLabel:`Updated`});return}let p=d({killChain:r[`kill-chain`],mitreAttack:r[`mitre-attack`],mitreCapec:r[`mitre-capec`],name:f(r.name,`name`,`text`),shortname:f(r.shortname,`shortname`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.categories.edit({...p,account_id:u,category_id:r[`category-id`]})),{successLabel:`Updated`})}};function as(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 os={command:`get <category-id>`,describe:`Retrieves details for a specific threat event category.`,builder:as,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 ss(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 cs={command:`list`,describe:`Lists all threat event categories configured for classifying and organizing threat events.`,builder:ss,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`})}},ls={command:`categories`,describe:`Operations for threat-events.categories`,builder:e=>e.command(es).command(ns).command(is).command(os).command(cs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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:`Lists countries referenced in Cloudforce One threat intelligence data.`,builder:us,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`})}},fs={command:`countries`,describe:`Operations for threat-events.countries`,builder:e=>e.command(ds).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ps(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(`indicators`,{type:`string`,description:`Array of indicators for this event. Supports multiple indicators per event for complex scenarios. Provide as a JSON array of objects or @path/to/file.json.`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`source-resource-id`,{type:`string`,description:`The source.resourceId field`}).option(`source-resource-type`,{type:`string`,description:`The source.resourceType field`,choices:[`article`]}).option(`source-system`,{type:`string`,description:`The source.system field`,choices:[`threat-signals`]}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`source-resource-id`,`source-resource-type`,`source-system`].some(t=>e[t]!==void 0)){let t=[`source-resource-id`,`source-resource-type`,`source-system`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --source-* flag is set`)}return!0})}const ms={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:ps,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?d({accountId:e[`account-id`],attacker:f(e.attacker,`attacker`,`text`),attackerCountry:f(e[`attacker-country`],`attacker-country`,`text`),category:f(e.category,`category`,`text`),datasetId:f(e[`dataset-id`],`dataset-id`,`text`),date:f(e.date,`date`,`text`),event:f(e.event,`event`,`text`),indicator:f(e.indicator,`indicator`,`text`),indicatorType:f(e[`indicator-type`],`indicator-type`,`text`),indicators:u(e.indicators,`indicators`),insight:f(e.insight,`insight`,`text`),raw:{source:f(e[`raw-source`],`raw-source`,`text`),tlp:f(e[`raw-tlp`],`raw-tlp`,`text`)},source:{resourceId:f(e[`source-resource-id`],`source-resource-id`,`text`),resourceType:f(e[`source-resource-type`],`source-resource-type`,`text`),system:f(e[`source-system`],`source-system`,`text`)},tags:e.tags,targetCountry:f(e[`target-country`],`target-country`,`text`),targetIndustry:f(e[`target-industry`],`target-industry`,`text`),tlp:f(e.tlp,`tlp`,`text`)}):l(e.body)});return}let t=await i(e);if(e.body){let n=l(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 m(`category`,`The category field`)),e.date===void 0&&(e.date=await m(`date`,`The date field`)),e.event===void 0&&(e.event=await m(`event`,`The event field`)),e.tlp===void 0&&(e.tlp=await m(`tlp`,`The tlp field`));let n=d({accountId:e[`account-id`],attacker:f(e.attacker,`attacker`,`text`),attackerCountry:f(e[`attacker-country`],`attacker-country`,`text`),category:f(e.category,`category`,`text`),datasetId:f(e[`dataset-id`],`dataset-id`,`text`),date:f(e.date,`date`,`text`),event:f(e.event,`event`,`text`),indicator:f(e.indicator,`indicator`,`text`),indicatorType:f(e[`indicator-type`],`indicator-type`,`text`),indicators:u(e.indicators,`indicators`),insight:f(e.insight,`insight`,`text`),raw:{source:f(e[`raw-source`],`raw-source`,`text`),tlp:f(e[`raw-tlp`],`raw-tlp`,`text`)},source:{resourceId:f(e[`source-resource-id`],`source-resource-id`,`text`),resourceType:f(e[`source-resource-type`],`source-resource-type`,`text`),system:f(e[`source-system`],`source-system`,`text`)},tags:e.tags,targetCountry:f(e[`target-country`],`target-country`,`text`),targetIndustry:f(e[`target-industry`],`target-industry`,`text`),tlp:f(e.tlp,`tlp`,`text`)});a(await s(`Creating`,async()=>t.cloudforceOne.threatEvents.create({...n,account_id_path:e[`account-id-path`]})),{successLabel:`Created`})}};function hs(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 gs={command:`create`,describe:`Creates a new threat event dataset in Cloudforce One for organizing related threat events.`,builder:hs,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?d({isPublic:r[`is-public`],name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.datasets.create({...e,account_id:u})),{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 m(`name`,`Used to describe the dataset within the account context.`));let p=d({isPublic:r[`is-public`],name:f(r.name,`name`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.datasets.create({...p,account_id:u})),{successLabel:`Created`})}};function _s(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 vs={command:`edit <dataset-id>`,describe:`Partially updates a threat event dataset in Cloudforce One, modifying specific fields without replacing the entire dataset configuration.`,builder:_s,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?d({isPublic:r[`is-public`],name:f(r.name,`name`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.datasets.edit({...e,account_id:u,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 m(`name`,`Used to describe the dataset within the account context.`));let p=d({isPublic:r[`is-public`],name:f(r.name,`name`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.datasets.edit({...p,account_id:u,dataset_id:r[`dataset-id`]})),{successLabel:`Updated`})}};function ys(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 bs={command:`get <dataset-id>`,describe:`Retrieves details for a specific threat event dataset.`,builder:ys,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 xs(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 Ss={command:`list`,describe:`Lists all threat event datasets configured in Cloudforce One.`,builder:xs,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 Cs(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 ws={command:`raw <event-id>`,describe:`Retrieves the raw data associated with an event. Searches across all shards in the dataset.`,builder:Cs,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`})}},Ts={command:`datasets`,describe:`Operations for threat-events.datasets`,builder:e=>e.command(gs).command(vs).command(bs).command(Ss).command(ws).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Es(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 Ds={command:`edit <event-id>`,describe:`Partially updates a threat event in Cloudforce One, modifying specific fields without replacing the entire event.`,builder:Es,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?d({attacker:f(r.attacker,`attacker`,`text`),attackerCountry:f(r[`attacker-country`],`attacker-country`,`text`),category:f(r.category,`category`,`text`),createdAt:f(r[`created-at`],`created-at`,`text`),datasetId:f(r[`dataset-id`],`dataset-id`,`text`),date:f(r.date,`date`,`text`),event:f(r.event,`event`,`text`),indicator:f(r.indicator,`indicator`,`text`),indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),insight:f(r.insight,`insight`,`text`),raw:{source:f(r[`raw-source`],`raw-source`,`text`),tlp:f(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(r[`target-country`],`target-country`,`text`),targetIndustry:f(r[`target-industry`],`target-industry`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.edit({...e,account_id:u,event_id:r[`event-id`]})),{successLabel:`Updated`});return}r[`dataset-id`]===void 0&&(r[`dataset-id`]=await m(`dataset-id`,`Dataset ID containing the event to update.`));let p=d({attacker:f(r.attacker,`attacker`,`text`),attackerCountry:f(r[`attacker-country`],`attacker-country`,`text`),category:f(r.category,`category`,`text`),createdAt:f(r[`created-at`],`created-at`,`text`),datasetId:f(r[`dataset-id`],`dataset-id`,`text`),date:f(r.date,`date`,`text`),event:f(r.event,`event`,`text`),indicator:f(r.indicator,`indicator`,`text`),indicatorType:f(r[`indicator-type`],`indicator-type`,`text`),insight:f(r.insight,`insight`,`text`),raw:{source:f(r[`raw-source`],`raw-source`,`text`),tlp:f(r[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(r[`target-country`],`target-country`,`text`),targetIndustry:f(r[`target-industry`],`target-industry`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.edit({...p,account_id:u,event_id:r[`event-id`]})),{successLabel:`Updated`})}};function Os(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 ks={command:`create <event-id>`,describe:`Adds a tag to a threat event in Cloudforce One for classification and filtering.`,builder:Os,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?d({tags:r.tags}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.eventTags.create({...e,account_id:u,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=d({tags:r.tags});a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.eventTags.create({...f,account_id:u,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 js={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?d({tags:r.tags}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
31
|
+
`);return}if(r.body){let e=l(r.body);a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.eventTags.delete({...e,account_id:u,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=d({tags:r.tags});a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.eventTags.delete({...f,account_id:u,event_id:r[`event-id`]})),{successLabel:`Deleted`})}},Ms={command:`event-tags`,describe:`Operations for threat-events.event-tags`,builder:e=>e.command(ks).command(js).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ns(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 Ps={command:`get <event-id>`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/events/:event_id instead.`,builder:Ns,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 Fs(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Is={command:`list`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes instead.`,builder:Fs,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`})}},Ls={command:`indicator-types`,describe:`Operations for threat-events.indicator-types`,builder:e=>e.command(Is).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Rs(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination. When provided, filters are embedded in the cursor so you only need to pass cursor and pageSize. Returned in the previous response's result_info.cursor field. Use cursor-based pagination for deep pagination (beyond 100,000 records) or for optimal performance.`}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page number (1-indexed) for offset-based pagination. Limited to offset of 100,000 records. For deep pagination, use cursor-based pagination instead.`}).option(`page-size`,{type:`number`,description:`Number of results per page. Maximum 25,000.`}).option(`order-by`,{type:`string`,description:`OrderBy`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`dataset-id`,{type:`string`,description:`Dataset UUIDs to query, or one standalone scope value: 'all'/'*' for the legacy all-datasets behavior, 'analytics' for isAnalytics=true datasets, or 'operational' for isAnalytics=false datasets. If not provided, uses the default dataset.`}).option(`force-refresh`,{type:`boolean`,description:`ForceRefresh`}).option(`format`,{type:`string`,description:`Format`,choices:[`json`,`stix2`,`taxii`]}).option(`cache`,{type:`string`,description:`Cache strategy. 'from-graph' serves results from the graph-node KV cache when all requested UUIDs are cached; falls back to normal path on partial/zero hit.`,choices:[`from-graph`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zs={command:`list`,describe:"Use `datasetId=all` or `datasetId=*` for the legacy all-datasets scope, `datasetId=analytics` for datasets with `isAnalytics=true`, or `datasetId=operational` for datasets with `isAnalytics=false` (limited to 50). Scope values must be used alone. When `datasetId` is unspecified, events are listed from the default Cloudforce One Threat Events dataset. To list existing datasets, use the [`List Datasets`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/list/) endpoint.",builder:_(Rs),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 Bs(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 Vs={command:`edit <raw-id>`,describe:`Partially updates raw threat event data in Cloudforce One, modifying specific fields of the event.`,builder:Bs,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?d({source:f(r.source,`source`,`text`),tlp:f(r.tlp,`tlp`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.raw.edit({...e,account_id:u,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Updated`});return}let p=d({source:f(r.source,`source`,`text`),tlp:f(r.tlp,`tlp`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatEvents.raw.edit({...p,account_id:u,event_id:r[`event-id`],raw_id:r[`raw-id`]})),{successLabel:`Updated`})}};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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Us={command:`get <raw-id>`,describe:`Retrieves raw threat event data for a specific event in Cloudforce One.`,builder:Hs,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`})}},Ws={command:`raw`,describe:`Operations for threat-events.raw`,builder:e=>e.command(Vs).command(Us).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gs(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 Ks={command:`delete <event-id>`,describe:`Removes a reference link between related threat events in Cloudforce One.`,builder:Gs,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?d({events:r.events}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
32
|
+
`);return}if(r.body){let e=l(r.body);a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.relate.delete({...e,account_id:u,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=d({events:r.events});a(await s(`Deleting`,async()=>c.cloudforceOne.threatEvents.relate.delete({...f,account_id:u,event_id:r[`event-id`]})),{successLabel:`Deleted`})}},qs={command:`relate`,describe:`Operations for threat-events.relate`,builder:e=>e.command(Ks).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Js(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(`aliases`,{type:`string`,description:`Structured aliases ({ value, confidence 1-10, tlp }). Public: returned to all accounts with per-entry TLP filtering (entries with tlp: purple are removed for non-CFONE accounts). Provide as a JSON array of objects or @path/to/file.json.`}).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(`external-references`,{type:`string`,description:`Structured external references ({ url, description }). Public: returned to all accounts. Provide as a JSON array of objects or @path/to/file.json.`}).option(`internal-aliases`,{type:`string`,description:`Internal structured aliases ({ value, confidence 1-10, tlp }). CFONE-only: never returned to non-CFONE accounts. Provide as a JSON array of objects or @path/to/file.json.`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`last-seen`,{type:`string`,description:`The lastSeen field`}).option(`tlp`,{type:`string`,description:`Tag-level TLP handling marking. Optional. Allowed values: red, amber, amber-strict, green, clear, purple, amber+strict.`,choices:[`red`,`amber`,`amber-strict`,`green`,`clear`,`purple`,`amber+strict`]}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ys={command:`create`,describe:`Creates a new tag to be used accross threat events.`,builder:Js,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?d({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],aliases:u(r.aliases,`aliases`),categoryUuid:f(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:f(r[`date-of-discovery`],`date-of-discovery`,`text`),description:f(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],externalReferences:u(r[`external-references`],`external-references`),internalAliases:u(r[`internal-aliases`],`internal-aliases`),internalDescription:f(r[`internal-description`],`internal-description`,`text`),lastSeen:f(r[`last-seen`],`last-seen`,`text`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)}):l(r.body)});return}let c=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.tags.create({...e,account_id:p})),{successLabel:`Created`});return}r.value===void 0&&(r.value=await m(`value`,`The value field`));let h=d({aliasGroupNames:r[`alias-group-names`],aliasGroupNamesInternal:r[`alias-group-names-internal`],aliases:u(r.aliases,`aliases`),categoryUuid:f(r[`category-uuid`],`category-uuid`,`text`),confidence:r.confidence,dateOfDiscovery:f(r[`date-of-discovery`],`date-of-discovery`,`text`),description:f(r.description,`description`,`text`),externalReferenceLinks:r[`external-reference-links`],externalReferences:u(r[`external-references`],`external-references`),internalAliases:u(r[`internal-aliases`],`internal-aliases`),internalDescription:f(r[`internal-description`],`internal-description`,`text`),lastSeen:f(r[`last-seen`],`last-seen`,`text`),tlp:f(r.tlp,`tlp`,`text`),value:f(r.value,`value`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatEvents.tags.create({...h,account_id:p})),{successLabel:`Created`})}},Xs={command:`tags`,describe:`Operations for threat-events.tags`,builder:e=>e.command(Ys).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zs(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 Qs={command:`list`,describe:`Retrieves the catalog of industry classifications used in Cloudforce One threat intelligence.`,builder:Zs,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`})}},$s={command:`target-industries`,describe:`Operations for threat-events.target-industries`,builder:e=>e.command(Qs).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ec={command:`threat-events`,describe:`Operations for threat-events`,builder:e=>e.command(Qo).command(ms).command(Ds).command(Ps).command(zs).command(Xo).command(ls).command(fs).command(Ts).command(Ms).command(Ls).command(Ws).command(qs).command(Xs).command($s).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tc(e){return e.option(`article-ids`,{type:`string`,array:!0,description:`The article_ids field`}).option(`read`,{type:`boolean`,description:`The read field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const nc={command:`bulk-mark-read`,describe:`Bulk update Threat Signals article read status.`,builder:tc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles bulk-mark-read`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({article_ids:r[`article-ids`],read:r.read}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.articles.bulkMarkRead({...e,account_id:u})),{successLabel:`Updated`});return}if(r[`article-ids`]===void 0)throw Error(`--article-ids is required (or pass --body with this field set).`);if(r.read===void 0)throw Error(`--read is required (or pass --body with this field set).`);let f=d({article_ids:r[`article-ids`],read:r.read});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.articles.bulkMarkRead({...f,account_id:u})),{successLabel:`Updated`})}};function rc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`format`,{type:`string`,description:`Format`,choices:[`text`,`html`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ic={command:`get-content <article-id>`,describe:`Get Threat Signals article content.`,builder:_(rc),handler:async r=>{let c={format:r.format};if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles get-content`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/content`,pathParams:{"article-id":String(r[`article-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.articles.getContent({account_id:u,article_id:r[`article-id`],...c})),{successLabel:`Loaded`})}};function ac(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oc={command:`get <article-id>`,describe:`Get Threat Signals article.`,builder:ac,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.articles.get({account_id:l,article_id:r[`article-id`]})),{successLabel:`Loaded`})}};function sc(e){return e.option(`cursor`,{type:`string`,description:`Cursor`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`feed-id`,{type:`string`,description:`Feed ID`}).option(`article-id`,{type:`string`,description:`Article ID`}).option(`read`,{type:`boolean`,description:`Read`}).option(`tag-id`,{type:`string`,description:`Tag ID`}).option(`tag`,{type:`string`,description:`Tag`}).option(`tag-category`,{type:`string`,description:`Tag category`}).option(`include-total`,{type:`boolean`,description:`Include total`}).option(`search`,{type:`string`,description:`Search`}).option(`published-after`,{type:`string`,description:`Published after`}).option(`published-before`,{type:`string`,description:`Published before`}).option(`fetched-after`,{type:`string`,description:`Fetched after`}).option(`fetched-before`,{type:`string`,description:`Fetched before`}).option(`feed-category`,{type:`string`,description:`Feed category`}).option(`source-type`,{type:`string`,description:`Source type`,choices:[`curated`,`custom`]}).option(`tag-applied-by`,{type:`string`,description:`Tag applied by`,choices:[`ai`,`analyst`]}).option(`sort`,{type:`string`,description:`Sort`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const cc={command:`list`,describe:`List Threat Signals articles.`,builder:_(sc),handler:async r=>{let c={cursor:r.cursor,per_page:r[`per-page`],feed_id:r[`feed-id`],article_id:r[`article-id`],read:r.read,tag_id:r[`tag-id`],tag:r.tag,tag_category:r[`tag-category`],include_total:r[`include-total`],search:r.search,published_after:r[`published-after`],published_before:r[`published-before`],fetched_after:r[`fetched-after`],fetched_before:r[`fetched-before`],feed_category:r[`feed-category`],source_type:r[`source-type`],tag_applied_by:r[`tag-applied-by`],sort:r.sort};if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.articles.list({account_id:u,...c})),{successLabel:`Loaded`})}};function lc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`read`,{type:`boolean`,description:`The read field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const uc={command:`mark-read <article-id>`,describe:`Update Threat Signals article read status.`,builder:lc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles mark-read`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({read:r.read}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.articles.markRead({...e,account_id:u,article_id:r[`article-id`]})),{successLabel:`Updated`});return}if(r.read===void 0)throw Error(`--read is required (or pass --body with this field set).`);let f=d({read:r.read});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.articles.markRead({...f,account_id:u,article_id:r[`article-id`]})),{successLabel:`Updated`})}};function dc(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fc={command:`get-output <skill-id>`,describe:`Get Threat Signals article skill output.`,builder:dc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles skills get-output`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}/output`,pathParams:{"article-id":String(r[`article-id`]??``),"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.articles.skills.getOutput({account_id:l,article_id:r[`article-id`],skill_id:r[`skill-id`]})),{successLabel:`Loaded`})}},pc={command:`skills`,describe:`Operations for threat-signals.articles.skills`,builder:e=>e.command(fc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function mc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`tag-id`,{type:`string`,description:`The tag_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const hc={command:`add <article-id>`,describe:`Add tag to Threat Signals article.`,builder:mc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles tags add`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/tags`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({tag_id:f(r[`tag-id`],`tag-id`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.articles.tags.add({...e,account_id:u,article_id:r[`article-id`]})),{successLabel:`Created`});return}r[`tag-id`]===void 0&&(r[`tag-id`]=await m(`tag-id`,`The tag_id field`));let p=d({tag_id:f(r[`tag-id`],`tag-id`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.articles.tags.add({...p,account_id:u,article_id:r[`article-id`]})),{successLabel:`Created`})}};function gc(e){return e.positional(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _c={command:`generate <article-id>`,describe:`Generate Threat Signals article AI tags.`,builder:gc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles tags generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/tag`,pathParams:{"article-id":String(r[`article-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.articles.tags.generate({account_id:l,article_id:r[`article-id`]})),{successLabel:`Created`})}};function vc(e){return e.positional(`tag-id`,{type:`string`,description:`Tag ID`,demandOption:!0}).option(`article-id`,{type:`string`,description:`Article ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const yc={command:`remove <tag-id>`,describe:`Remove tag from Threat Signals article.`,builder:vc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals articles tags remove`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/articles/${r[`article-id`]==null?`<article-id>`:encodeURIComponent(String(r[`article-id`]))}/tags/${r[`tag-id`]==null?`<tag-id>`:encodeURIComponent(String(r[`tag-id`]))}`,pathParams:{"article-id":String(r[`article-id`]??``),"tag-id":String(r[`tag-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
33
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.articles.tags.remove({account_id:l,article_id:r[`article-id`],tag_id:r[`tag-id`]})),{successLabel:`Deleted`})}},bc={command:`tags`,describe:`Operations for threat-signals.articles.tags`,builder:e=>e.command(hc).command(_c).command(yc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xc={command:`articles`,describe:`Operations for threat-signals.articles`,builder:e=>e.command(nc).command(oc).command(ic).command(cc).command(uc).command(pc).command(bc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Sc(e){return e.option(`feeds`,{type:`string`,description:`The feeds field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`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 Cc={command:`bulk-create`,describe:`Bulk create curated Threat Signals feeds.`,builder:Sc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/bulk`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({feeds:u(r.feeds,`feeds`)}):l(r.body)});return}let c=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.bulkCreate({...e,account_id:f})),{successLabel:`Created`});return}if(r.feeds===void 0)throw Error(`--feeds is required (or pass --body with this field set).`);let p=d({feeds:u(r.feeds,`feeds`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.bulkCreate({...p,account_id:f})),{successLabel:`Created`})}};function wc(e){return e.option(`category`,{type:`string`,description:`The category field`}).option(`display-order`,{type:`number`,description:`The display_order field`}).option(`is-active`,{type:`boolean`,description:`The is_active field`,default:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`url`,{type:`string`,description:`The url field`}).option(`why-valuable`,{type:`string`,description:`The why_valuable field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Tc={command:`create`,describe:`Create curated Threat Signals feed.`,builder:wc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({category:f(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:f(r.name,`name`,`text`),url:f(r.url,`url`,`text`),why_valuable:f(r[`why-valuable`],`why-valuable`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.create({...e,account_id:u})),{successLabel:`Created`});return}r.category===void 0&&(r.category=await m(`category`,`The category field`)),r.name===void 0&&(r.name=await m(`name`,`The name field`)),r.url===void 0&&(r.url=await m(`url`,`The url field`));let p=d({category:f(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:f(r.name,`name`,`text`),url:f(r.url,`url`,`text`),why_valuable:f(r[`why-valuable`],`why-valuable`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.create({...p,account_id:u})),{successLabel:`Created`})}};function Ec(e){return e.positional(`curated-feed-id`,{type:`string`,description:`Curated feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Dc={command:`delete <curated-feed-id>`,describe:`Delete curated Threat Signals feed.`,builder:Ec,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/${r[`curated-feed-id`]==null?`<curated-feed-id>`:encodeURIComponent(String(r[`curated-feed-id`]))}`,pathParams:{"curated-feed-id":String(r[`curated-feed-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
34
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.delete({account_id:l,curated_feed_id:r[`curated-feed-id`]})),{successLabel:`Deleted`})}};function Oc(e){return e.option(`category`,{type:`string`,description:`Category`}).option(`include-inactive`,{type:`boolean`,description:`Include inactive`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kc={command:`list`,describe:`List curated Threat Signals feeds.`,builder:Oc,handler:async r=>{let c={category:r.category,include_inactive:r[`include-inactive`]};if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.curatedFeeds.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ac(e){return e.option(`opted-out`,{type:`boolean`,description:`The opted_out field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const jc={command:`opt-out`,describe:`Opt out of curated Threat Signals feeds.`,builder:Ac,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds opt-out`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/opt-out`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({opted_out:r[`opted-out`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.optOut({...e,account_id:u})),{successLabel:`Updated`});return}if(r[`opted-out`]===void 0)throw Error(`--opted-out is required (or pass --body with this field set).`);let f=d({opted_out:r[`opted-out`]});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.optOut({...f,account_id:u})),{successLabel:`Updated`})}};function Mc(e){return e.positional(`curated-feed-id`,{type:`string`,description:`Curated feed ID`,demandOption:!0}).option(`category`,{type:`string`,description:`The category field`}).option(`display-order`,{type:`number`,description:`The display_order field`}).option(`is-active`,{type:`boolean`,description:`The is_active field`}).option(`name`,{type:`string`,description:`The name field`}).option(`url`,{type:`string`,description:`The url field`}).option(`why-valuable`,{type:`string`,description:`The why_valuable field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Nc={command:`update <curated-feed-id>`,describe:`Update curated Threat Signals feed.`,builder:Mc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals curated-feeds update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/curated-feeds/${r[`curated-feed-id`]==null?`<curated-feed-id>`:encodeURIComponent(String(r[`curated-feed-id`]))}`,pathParams:{"curated-feed-id":String(r[`curated-feed-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({category:f(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:f(r.name,`name`,`text`),url:f(r.url,`url`,`text`),why_valuable:f(r[`why-valuable`],`why-valuable`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.update({...e,account_id:u,curated_feed_id:r[`curated-feed-id`]})),{successLabel:`Updated`});return}let p=d({category:f(r.category,`category`,`text`),display_order:r[`display-order`],is_active:r[`is-active`],name:f(r.name,`name`,`text`),url:f(r.url,`url`,`text`),why_valuable:f(r[`why-valuable`],`why-valuable`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.curatedFeeds.update({...p,account_id:u,curated_feed_id:r[`curated-feed-id`]})),{successLabel:`Updated`})}},Pc={command:`curated-feeds`,describe:`Operations for threat-signals.curated-feeds`,builder:e=>e.command(Cc).command(Tc).command(Dc).command(kc).command(jc).command(Nc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fc(e){return e.option(`category`,{type:`string`,description:`The category field`}).option(`curated-feed-id`,{type:`string`,description:`The curated_feed_id field`}).option(`display-name`,{type:`string`,description:`The display_name field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`,default:!0}).option(`poll-interval-s`,{type:`number`,description:`The poll_interval_s field`,default:300}).option(`title`,{type:`string`,description:`The title field`}).option(`url`,{type:`string`,description:`The url field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ic={command:`create`,describe:`Create Threat Signals feed.`,builder:Fc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({category:f(r.category,`category`,`text`),curated_feed_id:f(r[`curated-feed-id`],`curated-feed-id`,`text`),display_name:f(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:f(r.title,`title`,`text`),url:f(r.url,`url`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.feeds.create({...e,account_id:u})),{successLabel:`Created`});return}let p=d({category:f(r.category,`category`,`text`),curated_feed_id:f(r[`curated-feed-id`],`curated-feed-id`,`text`),display_name:f(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:f(r.title,`title`,`text`),url:f(r.url,`url`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.feeds.create({...p,account_id:u})),{successLabel:`Created`})}};function Lc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Rc={command:`delete <feed-id>`,describe:`Delete Threat Signals feed.`,builder:Lc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
35
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.feeds.delete({account_id:l,feed_id:r[`feed-id`]})),{successLabel:`Deleted`})}};function zc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`format`,{type:`string`,description:`Format`,choices:[`xml`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Bc={command:`get-raw <feed-id>`,describe:`Get Threat Signals feed XML.`,builder:_(zc),handler:async r=>{let c={format:r.format};if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds get-raw`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}/raw`,pathParams:{"feed-id":String(r[`feed-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.feeds.getRaw({account_id:u,feed_id:r[`feed-id`],...c})),{successLabel:`Loaded`})}};function Vc(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`limit`,{type:`number`,description:`Limit`}).option(`sort`,{type:`string`,description:`Sort`}).option(`category`,{type:`string`,description:`Category`}).option(`source-type`,{type:`string`,description:`Source type`,choices:[`curated`,`custom`]}).option(`enabled`,{type:`boolean`,description:`Enabled`}).option(`status`,{type:`string`,description:`Status`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hc={command:`list`,describe:`List Threat Signals feeds.`,builder:_(Vc),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],limit:r.limit,sort:r.sort,category:r.category,source_type:r[`source-type`],enabled:r.enabled,status:r.status};if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.feeds.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Uc(e){return e.option(`feed-id`,{type:`string`,description:`Feed ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wc={command:`poll`,describe:`Trigger Threat Signals feed poll.`,builder:_(Uc),handler:async r=>{let c={feed_id:r[`feed-id`]};if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds poll`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/poll`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Creating`,async()=>l.cloudforceOne.threatSignals.feeds.poll({account_id:u,...c})),{successLabel:`Created`})}};function Gc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Kc={command:`get <feed-id>`,describe:`Get Threat Signals feed skills.`,builder:Gc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds skills get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}/skills`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.feeds.skills.get({account_id:l,feed_id:r[`feed-id`]})),{successLabel:`Loaded`})}};function qc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`skill-ids`,{type:`string`,array:!0,description:`The skill_ids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Jc={command:`update <feed-id>`,describe:`Set Threat Signals feed skills.`,builder:qc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds skills update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}/skills`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({skill_ids:r[`skill-ids`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.feeds.skills.update({...e,account_id:u,feed_id:r[`feed-id`]})),{successLabel:`Updated`});return}if(r[`skill-ids`]===void 0)throw Error(`--skill-ids is required (or pass --body with this field set).`);let f=d({skill_ids:r[`skill-ids`]});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.feeds.skills.update({...f,account_id:u,feed_id:r[`feed-id`]})),{successLabel:`Updated`})}},Yc={command:`skills`,describe:`Operations for threat-signals.feeds.skills`,builder:e=>e.command(Kc).command(Jc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Xc(e){return e.positional(`feed-id`,{type:`string`,description:`Feed ID`,demandOption:!0}).option(`category`,{type:`string`,description:`The category field`}).option(`display-name`,{type:`string`,description:`The display_name field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`poll-interval-s`,{type:`number`,description:`The poll_interval_s field`}).option(`title`,{type:`string`,description:`The title field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Zc={command:`update <feed-id>`,describe:`Update Threat Signals feed.`,builder:Xc,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals feeds update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/feeds/${r[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(r[`feed-id`]))}`,pathParams:{"feed-id":String(r[`feed-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({category:f(r.category,`category`,`text`),display_name:f(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:f(r.title,`title`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.feeds.update({...e,account_id:u,feed_id:r[`feed-id`]})),{successLabel:`Updated`});return}let p=d({category:f(r.category,`category`,`text`),display_name:f(r[`display-name`],`display-name`,`text`),enabled:r.enabled,poll_interval_s:r[`poll-interval-s`],title:f(r.title,`title`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.feeds.update({...p,account_id:u,feed_id:r[`feed-id`]})),{successLabel:`Updated`})}},Qc={command:`feeds`,describe:`Operations for threat-signals.feeds`,builder:e=>e.command(Ic).command(Rc).command(Bc).command(Hc).command(Wc).command(Zc).command(Yc).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const el={command:`health`,describe:`Check Threat Signals service health.`,builder:$c,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals health`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/health`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.health({account_id:l})),{successLabel:`Loaded`})}};function tl(e){return e.option(`feed-id`,{type:`string`,description:`Feed ID`}).option(`article-id`,{type:`string`,description:`Article ID`}).option(`search`,{type:`string`,description:`NFC-normalized and trimmed, case-insensitive literal substring search of indicator values. Requires 3–500 Unicode code points; the upper code-point bound is described here because OpenAPI string length cannot precisely express it without imposing UTF-16 semantics.`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`sort`,{type:`string`,description:`Sort`}).option(`include-total`,{type:`boolean`,description:`Include total`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nl={command:`list`,describe:`List Threat Signals article indicators.`,builder:tl,handler:async r=>{let c={feed_id:r[`feed-id`],article_id:r[`article-id`],search:r.search,per_page:r[`per-page`],sort:r.sort,include_total:r[`include-total`],cursor:r.cursor};if(r.dryRun){o({command:`cf cloudforce-one threat-signals indicators list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/indicators`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.indicators.list({account_id:u,...c})),{successLabel:`Loaded`})}},rl={command:`indicators`,describe:`Operations for threat-signals.indicators`,builder:e=>e.command(nl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function il(e){return e.option(`name`,{type:`string`,description:`The name field`}).option(`output-schema`,{type:`string`,description:`The output_schema field`}).option(`prompt`,{type:`string`,description:`The prompt field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`summary`,`tags`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const al={command:`create`,describe:`Create Threat Signals skill.`,builder:il,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({name:f(r.name,`name`,`text`),output_schema:f(r[`output-schema`],`output-schema`,`text`),prompt:f(r.prompt,`prompt`,`text`),type:f(r.type,`type`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.skills.create({...e,account_id:u})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await m(`name`,`The name field`)),r[`output-schema`]===void 0&&(r[`output-schema`]=await m(`output-schema`,`The output_schema field`)),r.prompt===void 0&&(r.prompt=await m(`prompt`,`The prompt field`)),r.type===void 0&&(r.type=await h(`type`,`The type field`,[`summary`,`tags`]));let p=d({name:f(r.name,`name`,`text`),output_schema:f(r[`output-schema`],`output-schema`,`text`),prompt:f(r.prompt,`prompt`,`text`),type:f(r.type,`type`,`text`)});a(await s(`Creating`,async()=>c.cloudforceOne.threatSignals.skills.create({...p,account_id:u})),{successLabel:`Created`})}};function ol(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const sl={command:`delete <skill-id>`,describe:`Delete Threat Signals skill.`,builder:ol,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await g({force:!!r.force})){process.stderr.write(`Aborted.
|
|
36
|
+
`);return}a(await s(`Deleting`,async()=>c.cloudforceOne.threatSignals.skills.delete({account_id:l,skill_id:r[`skill-id`]})),{successLabel:`Deleted`})}};function cl(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ll={command:`get <skill-id>`,describe:`Get Threat Signals skill.`,builder:cl,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.skills.get({account_id:l,skill_id:r[`skill-id`]})),{successLabel:`Loaded`})}};function ul(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dl={command:`list`,describe:`List Threat Signals skills.`,builder:ul,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.cloudforceOne.threatSignals.skills.list({account_id:u,...c})),{successLabel:`Loaded`})}};function fl(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pl={command:`get <skill-id>`,describe:`Get Threat Signals skill tag categories.`,builder:_(fl),handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills tag-categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}/tag-categories`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.cloudforceOne.threatSignals.skills.tagCategories.get({account_id:l,skill_id:r[`skill-id`]})),{successLabel:`Loaded`})}};function ml(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`category-uuids`,{type:`string`,array:!0,description:`The category_uuids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const hl={command:`update <skill-id>`,describe:`Replace Threat Signals skill tag categories.`,builder:_(ml),handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills tag-categories update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}/tag-categories`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({category_uuids:r[`category-uuids`]}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.skills.tagCategories.update({...e,account_id:u,skill_id:r[`skill-id`]})),{successLabel:`Updated`});return}if(r[`category-uuids`]===void 0)throw Error(`--category-uuids is required (or pass --body with this field set).`);let f=d({category_uuids:r[`category-uuids`]});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.skills.tagCategories.update({...f,account_id:u,skill_id:r[`skill-id`]})),{successLabel:`Updated`})}},gl={command:`tag-categories`,describe:`Operations for threat-signals.skills.tag-categories`,builder:e=>e.command(pl).command(hl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _l(e){return e.positional(`skill-id`,{type:`string`,description:`Skill ID`,demandOption:!0}).option(`config`,{type:`string`,description:`The config field`}).option(`is-active`,{type:`boolean`,description:`The is_active field`}).option(`name`,{type:`string`,description:`The name field`}).option(`output-schema`,{type:`string`,description:`The output_schema field`}).option(`prompt`,{type:`string`,description:`The prompt field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const vl={command:`update <skill-id>`,describe:`Update Threat Signals skill.`,builder:_l,handler:async r=>{if(r.dryRun){o({command:`cf cloudforce-one threat-signals skills update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/threat-signals/skills/${r[`skill-id`]==null?`<skill-id>`:encodeURIComponent(String(r[`skill-id`]))}`,pathParams:{"skill-id":String(r[`skill-id`]??``)},bodyKind:`json`,body:r.body===void 0?d({config:f(r.config,`config`,`text`),is_active:r[`is-active`],name:f(r.name,`name`,`text`),output_schema:f(r[`output-schema`],`output-schema`,`text`),prompt:f(r.prompt,`prompt`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.skills.update({...e,account_id:u,skill_id:r[`skill-id`]})),{successLabel:`Updated`});return}let p=d({config:f(r.config,`config`,`text`),is_active:r[`is-active`],name:f(r.name,`name`,`text`),output_schema:f(r[`output-schema`],`output-schema`,`text`),prompt:f(r.prompt,`prompt`,`text`)});a(await s(`Updating`,async()=>c.cloudforceOne.threatSignals.skills.update({...p,account_id:u,skill_id:r[`skill-id`]})),{successLabel:`Updated`})}},yl={command:`skills`,describe:`Operations for threat-signals.skills`,builder:e=>e.command(al).command(sl).command(ll).command(dl).command(vl).command(gl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bl={command:`threat-signals`,describe:`Operations for threat-signals`,builder:e=>e.command(el).command(xc).command(Pc).command(Qc).command(rl).command(yl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xl={command:`cloudforce-one`,describe:`Detection rule management APIs`,builder:e=>e.command(S).command(Wn).command(Vr).command($i).command(ma).command(qo).command(ec).command(bl).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{xl as default};
|