cf 0.5.0 → 0.6.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/dist/{abuse-reports-Ina5TlsU.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/acm-SqcV8o5o.mjs +3 -0
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-DMPfi54f.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-DSSRDZz8.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/{audit-logs-BuExU_nz.mjs → audit-logs-BvQ9uwuy.mjs} +1 -1
- package/dist/{auth-CSC4yhEJ.mjs → auth-DX9KnJ0P.mjs} +3 -3
- package/dist/{auth-D5hNsOFq.mjs → auth-TYwGydWg.mjs} +1 -1
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/bot-management-DgW--8wM.mjs +5 -0
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/cache-CeN5t6_W.mjs +5 -0
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/{certificate-authorities-CtqzAtxQ.mjs → certificate-authorities-BzZnWCac.mjs} +1 -1
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/{cloud-connector-BA5IRZUP.mjs → cloud-connector-D5h8Dzzg.mjs} +1 -1
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-DOeHPdCG.mjs → completions-Bvzav4Mj.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/{context-jpewmual.mjs → context-C-WbewL6.mjs} +1 -1
- package/dist/custom-certificates-CfRj7QZb.mjs +5 -0
- package/dist/{custom-hostnames-CtuTdFcX.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/{dcv-delegation-Bgf86J-r.mjs → dcv-delegation-BYsNl3qc.mjs} +1 -1
- package/dist/{deploy-dVrgDUOp.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-C01_Lby6.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-DYZcTtIC.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-C03MtdZb.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/healthchecks-BBtW8vRh.mjs +4 -0
- package/dist/hostnames-Bh2IFxIw.mjs +3 -0
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-nv9INuWZ.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/keyless-certificates-CfJmXccT.mjs +3 -0
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{organizations-BqJHyvMK.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/origin-tls-client-auth-B30_2_dO.mjs +4 -0
- package/dist/{page-rules-EZHJePmn.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-CXJioWPs.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/{progress-DrDErV9w.mjs → progress-CL8I-7YK.mjs} +1 -1
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-D986zPJr.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/{raw-fetch-_n0lMAnD.mjs → raw-fetch-bIXC9D1m.mjs} +1 -1
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-CDIwTz3G.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-BR31o4P6.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{secrets-store-BAK9G12O.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/{session-DHYCE-PM.mjs → session-B8r8LNQN.mjs} +1 -1
- package/dist/{build-HuS9-R0V.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/smart-shield-BreBC1Ap.mjs +3 -0
- package/dist/snippets-BAJoWMSJ.mjs +4 -0
- package/dist/{spawn-CCGzKlC4.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-pVGxb7u5.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/{src-DU7FBCOX.mjs → src-BQ1dr9xR.mjs} +4 -4
- package/dist/ssl-D3Pixs8M.mjs +15 -0
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-HLGUazms.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/token-validation-DUvtXWur.mjs +10 -0
- package/dist/{tools-D_hfUU_Z.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-erjBdVKL.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-CBHwWPAM.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-u6KwrzWd.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/zaraz-9l7KuLqh.mjs +2 -0
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-BXtdwt6E.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-B_joQcMi.mjs +0 -22
- package/dist/acm-_kIHqYME.mjs +0 -3
- package/dist/addressing-CaFlw8y1.mjs +0 -12
- package/dist/ai-CqnhNb_c.mjs +0 -2
- package/dist/ai-gateway-pgYGI519.mjs +0 -8
- package/dist/ai-search-eqQMPQol.mjs +0 -7
- package/dist/ai_gateway--vuVLnOm.mjs +0 -4
- package/dist/alerting-CPxHiYHb.mjs +0 -6
- package/dist/analytics_engine-gWyfnsCs.mjs +0 -2
- package/dist/api-gateway-BXXGFCVR.mjs +0 -33
- package/dist/argo-aC6A3JyX.mjs +0 -2
- package/dist/artifacts-HD4V2xpK.mjs +0 -4
- package/dist/billing-COaghyxl.mjs +0 -2
- package/dist/bot-management-DmEzeV1Y.mjs +0 -5
- package/dist/botnet-feed-ByEAXAkw.mjs +0 -3
- package/dist/brand-protection-dPrGe8sL.mjs +0 -3
- package/dist/browser-rendering-BiSGnpBf.mjs +0 -4
- package/dist/cache-CY-7Lt71.mjs +0 -5
- package/dist/calls-wOQGDWPl.mjs +0 -4
- package/dist/client-certificates-CRf41xLe.mjs +0 -3
- package/dist/cloudforce-one-Bq_qPAWs.mjs +0 -21
- package/dist/connectivity-Bx3MgTHX.mjs +0 -3
- package/dist/connector-interrupts-D7ylweJZ.mjs +0 -2
- package/dist/connector-telemetry-events-6izV1kbP.mjs +0 -2
- package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +0 -2
- package/dist/connectors-DRt4e6d_.mjs +0 -3
- package/dist/content-scanning-Cd2vy5Sz.mjs +0 -4
- package/dist/custom-certificates-DYE-9epx.mjs +0 -5
- package/dist/custom-nameservers-CWqA51in.mjs +0 -3
- package/dist/custom-pages-DeUKEFGe.mjs +0 -4
- package/dist/d1-DvWY9Gp4.mjs +0 -4
- package/dist/data-security-BPo6dIWu.mjs +0 -6
- package/dist/diagnostics-6nKPmVgz.mjs +0 -3
- package/dist/dispatch-namespaces-64lXx2WJ.mjs +0 -7
- package/dist/dist-t_YrL25p.mjs +0 -82
- package/dist/dns-ClciFGxx.mjs +0 -29
- package/dist/dns-firewall-DfUmXDCe.mjs +0 -57
- package/dist/durable-objects-CMaYZ-YU.mjs +0 -2
- package/dist/email-routing-CGXhFqF5.mjs +0 -10
- package/dist/email-security-D5viPq8S.mjs +0 -8
- package/dist/email-sending-C2jpc3gh.mjs +0 -3
- package/dist/filters-bzsFcWt0.mjs +0 -4
- package/dist/google-tag-gateway-Dfy887yA.mjs +0 -2
- package/dist/healthchecks-DRoAlWgr.mjs +0 -4
- package/dist/hostnames-CFgIVI3s.mjs +0 -3
- package/dist/hyperdrive-C7-gwTSV.mjs +0 -18
- package/dist/iam-DqVPzGrb.mjs +0 -6
- package/dist/images-BYfl4YgR.mjs +0 -7
- package/dist/intel-duTEPIHc.mjs +0 -3
- package/dist/keyless-certificates-CRCDVd3g.mjs +0 -3
- package/dist/kv-CZoV4tiv.mjs +0 -5
- package/dist/leaked-credential-checks-DNIBg7Pe.mjs +0 -3
- package/dist/load-balancers--OMg0HNt.mjs +0 -6
- package/dist/logpush-C0_lZTyY.mjs +0 -4
- package/dist/logs-BtpWZQfV.mjs +0 -3
- package/dist/magic-cloud-networking-u6rwYbGg.mjs +0 -5
- package/dist/magic-network-monitoring-CKgQyRj4.mjs +0 -4
- package/dist/magic-transit-CLhMcJ_-.mjs +0 -89
- package/dist/managed-transforms-D0Z2mlth.mjs +0 -3
- package/dist/mtls-certificates-BL65NK5T.mjs +0 -3
- package/dist/network-interconnects-Bgu9gmaG.mjs +0 -36
- package/dist/oauth-Bk-F-tIO.mjs +0 -52
- package/dist/observability-BynRbTF4.mjs +0 -4
- package/dist/origin-ca-certificates-BGvYwm3C.mjs +0 -3
- package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +0 -2
- package/dist/origin-tls-client-auth-d3snC3vr.mjs +0 -4
- package/dist/pages-D4aYteKk.mjs +0 -11
- package/dist/pipelines-G8Iusxq-.mjs +0 -6
- package/dist/queues-DEkbKqZX.mjs +0 -6
- package/dist/r2-CV0IkCAW.mjs +0 -21
- package/dist/r2-data-catalog-NtqGC_a_.mjs +0 -14
- package/dist/rate-limits-B2wRsUX1.mjs +0 -5
- package/dist/realtime-kit-Ld3c5eU6.mjs +0 -18
- package/dist/request-tracers-D7SFMDik.mjs +0 -2
- package/dist/resource-sharing-YIQ04jXE.mjs +0 -5
- package/dist/resource-tagging-Bd6Y03sg.mjs +0 -16
- package/dist/rules-DHjLP5Kx.mjs +0 -4
- package/dist/rulesets-q4QABpKs.mjs +0 -8
- package/dist/rum-SmT4HZmM.mjs +0 -4
- package/dist/schema-validation-vVetgC_P.mjs +0 -24
- package/dist/scim-ChOkZpNx.mjs +0 -3
- package/dist/security-center-eScuYDKP.mjs +0 -2
- package/dist/security-txt-x7R4gmQu.mjs +0 -3
- package/dist/shared-BAjo72Lz.mjs +0 -2
- package/dist/smart-shield-CWlSsNi8.mjs +0 -3
- package/dist/snippets-DrlgYJYp.mjs +0 -4
- package/dist/speed-ZFrMWDgd.mjs +0 -4
- package/dist/ssl-9JY05sYt.mjs +0 -15
- package/dist/stream-tRU39b8K.mjs +0 -14
- package/dist/token-validation-_VdamKpz.mjs +0 -10
- package/dist/turnstile-BRzXd28B.mjs +0 -23
- package/dist/url-normalization-D-NxuLtN.mjs +0 -3
- package/dist/url-scanner-BzzR6iDx.mjs +0 -2
- package/dist/user-C4omq__w.mjs +0 -10
- package/dist/vectorize-By6EqcNR.mjs +0 -4
- package/dist/web3-DQ5dmE9W.mjs +0 -4
- package/dist/workers-D8Be7_as.mjs +0 -18
- package/dist/workers-builds-BE3W3qNk.mjs +0 -7
- package/dist/workflows-BWWufqFA.mjs +0 -4
- package/dist/zaraz-Bsa9AvVL.mjs +0 -2
- package/dist/zero-trust-UNVZFnKu.mjs +0 -118
- package/dist/zero_trust-B0_Rk4p2.mjs +0 -3
- /package/dist/{cli-types-BeyOc81z.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{metadata-OOwvpR8m.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-C3h-mwp7.mjs → resolve-DGD57PFH.mjs} +0 -0
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{i as a,n as o}from"./auth-CSC4yhEJ.mjs";import{n as s,t as c}from"./body-parser-DWSy7uZ8.mjs";import{t as l}from"./output-B6fBFRqe.mjs";import{n as u,t as d}from"./progress-DrDErV9w.mjs";import{n as f,t as p}from"./input-validation-_fMCApaH.mjs";import{t as m}from"./local-CYc9q7l2.mjs";import{t as h}from"./cli-types-BeyOc81z.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 e=>{if(e.dryRun){u({command:`cf cloudforce-one binary-storage create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/binary`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file}});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.file!==void 0||e.body!==void 0){let t=new FormData;if(e.file){let n=p(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/cloudforce-one/binary`,{body:t})),{successLabel:`Created`});return}if(e.body){let t=f(e.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/cloudforce-one/binary`,{body:t,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function g(e){return e.positional(`hash`,{type:`string`,description:`hash of the binary`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <hash>`,describe:`Retrieves a binary file from the Cloudforce One binary storage for analysis.`,builder:g,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one binary-storage get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/binary/${e.hash==null?`<hash>`:encodeURIComponent(String(e.hash))}`,pathParams:{hash:String(e.hash??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.binaryStorage.get({account_id:i,hash:e.hash})),{successLabel:`Loaded`})}},v={command:`binary-storage`,describe:`Upload and retrieve malware samples and suspicious binaries for analysis`,builder:e=>e.command(te).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`aggregate-by`,{type:`string`,description:`Column(s) to aggregate by - single column or comma-separated list (e.g., 'attacker', 'targetIndustry', 'attacker,targetIndustry')`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID(s) to filter by. Can be a single dataset ID, comma-separated list, or array. If not provided, uses default dataset`}).option(`start-date`,{type:`string`,description:`Start date for filtering (ISO 8601 format, e.g., '2024-01-01')`}).option(`end-date`,{type:`string`,description:`End date for filtering (ISO 8601 format, e.g., '2024-12-31')`}).option(`group-by-date`,{type:`boolean`,description:`Whether to group results by date (daily aggregation)`}).option(`limit`,{type:`number`,description:`Maximum number of results to return`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={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:y,handler:async e=>{let n={aggregateBy:e[`aggregate-by`],datasetId:e[`dataset-id`],startDate:e[`start-date`],endDate:e[`end-date`],groupByDate:e[`group-by-date`],limit:e.limit};if(e.dryRun){u({command:`cf cloudforce-one events aggregate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/aggregate`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.aggregate.get({account_id:a,...n})),{successLabel:`Loaded`})}},x={command:`aggregate`,describe:`Events operations`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`List all categories stored in the account catalog.`,builder:S,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events categories catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories/catalog`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.categories.catalog.get({account_id:i})),{successLabel:`Loaded`})}},w={command:`catalog`,describe:`Events operations`,builder:e=>e.command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(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 E={command:`create <category-id>`,describe:`Update an existing category by its identifier.`,builder:T,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({killChain:e[`kill-chain`],mitreAttack:e[`mitre-attack`],mitreCapec:e[`mitre-capec`],name:f(e.name,`name`,`text`),shortname:f(e.shortname,`shortname`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.events.categories.create({...t,account_id:i,category_id:e[`category-id`]})),{successLabel:`Created`});return}let a=c({killChain:e[`kill-chain`],mitreAttack:e[`mitre-attack`],mitreCapec:e[`mitre-capec`],name:f(e.name,`name`,`text`),shortname:f(e.shortname,`shortname`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.events.categories.create({...a,account_id:i,category_id:e[`category-id`]})),{successLabel:`Created`})}},D={command:`categories`,describe:`Events operations`,builder:e=>e.command(E).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(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 k={command:`create <event-id>`,describe:`Update an existing event by its identifier.`,builder:O,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${n[`event-id`]==null?`<event-id>`:encodeURIComponent(String(n[`event-id`]))}`,pathParams:{"event-id":String(n[`event-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({attacker:f(n.attacker,`attacker`,`text`),attackerCountry:f(n[`attacker-country`],`attacker-country`,`text`),category:f(n.category,`category`,`text`),createdAt:f(n[`created-at`],`created-at`,`text`),datasetId:f(n[`dataset-id`],`dataset-id`,`text`),date:f(n.date,`date`,`text`),event:f(n.event,`event`,`text`),indicator:f(n.indicator,`indicator`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),insight:f(n.insight,`insight`,`text`),raw:{source:f(n[`raw-source`],`raw-source`,`text`),tlp:f(n[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(n[`target-country`],`target-country`,`text`),targetIndustry:f(n[`target-industry`],`target-industry`,`text`),tlp:f(n.tlp,`tlp`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.create({...e,account_id:a,event_id:n[`event-id`]})),{successLabel:`Created`});return}n[`dataset-id`]===void 0&&(n[`dataset-id`]=await e(`dataset-id`,`Dataset ID containing the event to update.`));let p=c({attacker:f(n.attacker,`attacker`,`text`),attackerCountry:f(n[`attacker-country`],`attacker-country`,`text`),category:f(n.category,`category`,`text`),createdAt:f(n[`created-at`],`created-at`,`text`),datasetId:f(n[`dataset-id`],`dataset-id`,`text`),date:f(n.date,`date`,`text`),event:f(n.event,`event`,`text`),indicator:f(n.indicator,`indicator`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),insight:f(n.insight,`insight`,`text`),raw:{source:f(n[`raw-source`],`raw-source`,`text`),tlp:f(n[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(n[`target-country`],`target-country`,`text`),targetIndustry:f(n[`target-industry`],`target-industry`,`text`),tlp:f(n.tlp,`tlp`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.create({...p,account_id:a,event_id:n[`event-id`]})),{successLabel:`Created`})}};function A(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 j={command:`create <dataset-id>`,describe:`Copy one or more events from a source dataset to a destination dataset.`,builder:A,handler:async n=>{let i={keepRawData:n[`keep-raw-data`]};if(n.dryRun){u({command:`cf cloudforce-one events dataset copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${n[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(n[`dataset-id`]))}/copy`,pathParams:{"dataset-id":String(n[`dataset-id`]??``)},query:i,bodyKind:`json`,body:n.body===void 0?c({destDatasetId:f(n[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:n[`event-ids`]}):s(n.body)});return}let a=await o(n),p=n.local?m:await r(a);if(n.accountId=p,n.body){let e=s(n.body);new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),l(await d(`Creating`,async()=>a.cloudforceOne.events.dataset.copy.create({...e,account_id:p,dataset_id:n[`dataset-id`],...i})),{successLabel:`Created`});return}if(n[`dest-dataset-id`]===void 0&&(n[`dest-dataset-id`]=await e(`dest-dataset-id`,`The destDatasetId field`)),n[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h=c({destDatasetId:f(n[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:n[`event-ids`]});new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),l(await d(`Creating`,async()=>a.cloudforceOne.events.dataset.copy.create({...h,account_id:p,dataset_id:n[`dataset-id`],...i})),{successLabel:`Created`})}},M={command:`copy`,describe:`Events operations`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(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 P={command:`create <dataset-id>`,describe:`Update an existing dataset by its identifier.`,builder:N,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events dataset create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${n[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(n[`dataset-id`]))}`,pathParams:{"dataset-id":String(n[`dataset-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({isPublic:n[`is-public`],name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.create({...e,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Created`});return}if(n[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await e(`name`,`Used to describe the dataset within the account context.`));let p=c({isPublic:n[`is-public`],name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.create({...p,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Created`})}};function F(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 I={command:`delete <dataset-id>`,describe:`Soft-deletes a dataset given a datasetId.`,builder:F,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.dataset.delete({account_id:a,dataset_id:e[`dataset-id`]})),{successLabel:`Deleted`})}};function L(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 R={command:`get <event-id>`,describe:`Retrieves a specific event by its UUID.`,builder:L,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"event-id":String(e[`event-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.events.get({account_id:i,dataset_id:e[`dataset-id`],event_id:e[`event-id`]})),{successLabel:`Loaded`})}},z={command:`events`,describe:`Events operations`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(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 V={command:`create`,describe:`Create a group`,builder:B,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events dataset groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.groups.create({...e,account_id:a})),{successLabel:`Created`});return}n.description===void 0&&(n.description=await e(`description`,`The description field`)),n.name===void 0&&(n.name=await e(`name`,`The name field`));let p=c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.groups.create({...p,account_id:a})),{successLabel:`Created`})}};function H(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 U={command:`delete <group-id>`,describe:`Delete a group for an account`,builder:H,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.dataset.groups.delete({account_id:a,group_id:e[`group-id`]})),{successLabel:`Deleted`})}};function W(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`group`,describe:`List groups for an account`,builder:W,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset groups get group`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.groups.get.group({account_id:i})),{successLabel:`Loaded`})}};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})}const q={command:`v2 <group-id>`,describe:`Read a group for an account`,builder:K,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset groups get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.groups.get.v2({account_id:i,group_id:e[`group-id`]})),{successLabel:`Loaded`})}},J={command:`get`,describe:`Events operations`,builder:e=>e.command(G).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Y(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 X={command:`create <group-id>`,describe:`Create a group member`,builder:Y,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}/members`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({accountTag:f(e[`account-tag`],`account-tag`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.events.dataset.groups.members.create({...t,account_id:i,group_id:e[`group-id`]})),{successLabel:`Created`});return}let a=c({accountTag:f(e[`account-tag`],`account-tag`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.events.dataset.groups.members.create({...a,account_id:i,group_id:e[`group-id`]})),{successLabel:`Created`})}};function Z(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 Q={command:`delete <member-id>`,describe:`Delete a group member`,builder:Z,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}/members/${e[`member-id`]==null?`<member-id>`:encodeURIComponent(String(e[`member-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"member-id":String(e[`member-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.dataset.groups.members.delete({account_id:a,group_id:e[`group-id`],member_id:e[`member-id`]})),{successLabel:`Deleted`})}};function ne(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 re={command:`get <group-id>`,describe:`List group members`,builder:ne,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset groups members get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}/members`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.groups.members.get({account_id:i,group_id:e[`group-id`]})),{successLabel:`Loaded`})}},ie={command:`members`,describe:`Events operations`,builder:e=>e.command(X).command(Q).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(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 oe={command:`update <group-id>`,describe:`Update a group`,builder:ae,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events dataset groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${n[`group-id`]==null?`<group-id>`:encodeURIComponent(String(n[`group-id`]))}`,pathParams:{"group-id":String(n[`group-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>i.cloudforceOne.events.dataset.groups.update({...e,account_id:a,group_id:n[`group-id`]})),{successLabel:`Updated`});return}n.description===void 0&&(n.description=await e(`description`,`The description field`)),n.name===void 0&&(n.name=await e(`name`,`The name field`));let p=c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)});l(await d(`Updating`,async()=>i.cloudforceOne.events.dataset.groups.update({...p,account_id:a,group_id:n[`group-id`]})),{successLabel:`Updated`})}},se={command:`groups`,describe:`Events operations`,builder:e=>e.command(V).command(U).command(oe).command(J).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(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 le={command:`create <dataset-id>`,describe:`Creates a new indicator type and initializes its dedicated Durable Object`,builder:ce,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events dataset indicator types create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${n[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(n[`dataset-id`]))}/indicatorTypes/create`,pathParams:{"dataset-id":String(n[`dataset-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({description:f(n.description,`description`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.indicator.types.create.create({...e,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Created`});return}n[`indicator-type`]===void 0&&(n[`indicator-type`]=await e(`indicator-type`,`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`));let p=c({description:f(n.description,`description`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.indicator.types.create.create({...p,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Created`})}},ue={command:`create`,describe:`Events operations`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},de={command:`types`,describe:`Operations for events.dataset.indicator.types`,builder:e=>e.command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`indicator`,describe:`Operations for events.dataset.indicator`,builder:e=>e.command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`auto-create-type`,{type:`boolean`,description:`Global flag to automatically create indicator types if they don't exist. Individual indicators can override this with their own autoCreateType flag.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`create <dataset-id>`,describe:`Creates multiple indicators at once with their respective types and related datasets.`,builder:pe,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset indicators bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/bulk`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({autoCreateType:e[`auto-create-type`]}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.events.dataset.indicators.bulk.create({...t,account_id:i,dataset_id:e[`dataset-id`]})),{successLabel:`Created`});return}let a=c({autoCreateType:e[`auto-create-type`]});l(await d(`Creating`,async()=>n.cloudforceOne.events.dataset.indicators.bulk.create({...a,account_id:i,dataset_id:e[`dataset-id`]})),{successLabel:`Created`})}},he={command:`bulk`,describe:`Events operations`,builder:e=>e.command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ge(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`auto-create-type`,{type:`boolean`,description:`If true, automatically create the indicator type if it doesn't exist. If false (default), throw an error when the indicator type doesn't exist.`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _e={command:`create <dataset-id>`,describe:`Creates a new indicator with the specified type and related datasets.`,builder:ge,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events dataset indicators create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${n[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(n[`dataset-id`]))}/indicators/create`,pathParams:{"dataset-id":String(n[`dataset-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({autoCreateType:n[`auto-create-type`],indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),value:f(n.value,`value`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.indicators.create.create({...e,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Created`});return}n[`indicator-type`]===void 0&&(n[`indicator-type`]=await e(`indicator-type`,`The indicatorType field`)),n.value===void 0&&(n.value=await e(`value`,`The value field`));let p=c({autoCreateType:n[`auto-create-type`],indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),value:f(n.value,`value`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.dataset.indicators.create.create({...p,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Created`})}},ve={command:`create`,describe:`Events operations`,builder:e=>e.command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const be={command:`delete <indicator-id>`,describe:`Deletes a specific indicator by its UUID.`,builder:ye,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset indicators delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/${e[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(e[`indicator-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"indicator-id":String(e[`indicator-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.dataset.indicators.delete({account_id:a,dataset_id:e[`dataset-id`],indicator_id:e[`indicator-id`]})),{successLabel:`Deleted`})}};function xe(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 Se={command:`indicator <indicator-id>`,describe:`Retrieves a specific indicator by its UUID.`,builder:xe,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset indicators get indicator`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/${e[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(e[`indicator-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"indicator-id":String(e[`indicator-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.indicators.get.indicator({account_id:i,dataset_id:e[`dataset-id`],indicator_id:e[`indicator-id`]})),{successLabel:`Loaded`})}},Ce={command:`get`,describe:`Events operations`,builder:e=>e.command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Te={command:`patch <indicator-id>`,describe:`Updates an existing indicator's properties.`,builder:we,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset indicators patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/${e[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(e[`indicator-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"indicator-id":String(e[`indicator-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({indicatorType:f(e[`indicator-type`],`indicator-type`,`text`),value:f(e.value,`value`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.events.dataset.indicators.patch({...t,account_id:i,dataset_id:e[`dataset-id`],indicator_id:e[`indicator-id`]})),{successLabel:`Updated`});return}let a=c({indicatorType:f(e[`indicator-type`],`indicator-type`,`text`),value:f(e.value,`value`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.events.dataset.indicators.patch({...a,account_id:i,dataset_id:e[`dataset-id`],indicator_id:e[`indicator-id`]})),{successLabel:`Updated`})}};function Ee(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 De={command:`get <dataset-id>`,describe:`Returns all mirrored tags from the indicator dataset (DO mirror table). No pagination.`,builder:Ee,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset indicators tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/tags`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.indicators.tags.get({account_id:i,dataset_id:e[`dataset-id`]})),{successLabel:`Loaded`})}},Oe={command:`tags`,describe:`Events operations`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ke={command:`indicators`,describe:`Events operations`,builder:e=>e.command(be).command(Te).command(he).command(ve).command(Ce).command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(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 je={command:`create <dataset-id>`,describe:`Move one or more events from a source dataset to a destination dataset.`,builder:Ae,handler:async n=>{let i={keepRawData:n[`keep-raw-data`]};if(n.dryRun){u({command:`cf cloudforce-one events dataset move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${n[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(n[`dataset-id`]))}/move`,pathParams:{"dataset-id":String(n[`dataset-id`]??``)},query:i,bodyKind:`json`,body:n.body===void 0?c({destDatasetId:f(n[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:n[`event-ids`]}):s(n.body)});return}let a=await o(n),p=n.local?m:await r(a);if(n.accountId=p,n.body){let e=s(n.body);new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),l(await d(`Creating`,async()=>a.cloudforceOne.events.dataset.move.create({...e,account_id:p,dataset_id:n[`dataset-id`],...i})),{successLabel:`Created`});return}if(n[`dest-dataset-id`]===void 0&&(n[`dest-dataset-id`]=await e(`dest-dataset-id`,`The destDatasetId field`)),n[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h=c({destDatasetId:f(n[`dest-dataset-id`],`dest-dataset-id`,`text`),eventIds:n[`event-ids`]});new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),l(await d(`Creating`,async()=>a.cloudforceOne.events.dataset.move.create({...h,account_id:p,dataset_id:n[`dataset-id`],...i})),{successLabel:`Created`})}},Me={command:`move`,describe:`Events operations`,builder:e=>e.command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ne(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`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 Pe={command:`create <dataset-id>`,describe:`Create a permission`,builder:Ne,handler:async i=>{if(i.dryRun){u({command:`cf cloudforce-one events dataset permissions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${i[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(i[`dataset-id`]))}/permissions`,pathParams:{"dataset-id":String(i[`dataset-id`]??``)},bodyKind:`json`,body:i.body===void 0?c({role:f(i.role,`role`,`text`),subjectId:f(i[`subject-id`],`subject-id`,`text`),subjectType:f(i[`subject-type`],`subject-type`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.cloudforceOne.events.dataset.permissions.create({...e,account_id:p,dataset_id:i[`dataset-id`]})),{successLabel:`Created`});return}i.role===void 0&&(i.role=await n(`role`,`The role field`,[`read`,`write`])),i[`subject-id`]===void 0&&(i[`subject-id`]=await e(`subject-id`,`The subjectId field`)),i[`subject-type`]===void 0&&(i[`subject-type`]=await n(`subject-type`,`The subjectType field`,[`account`,`group`]));let h=c({role:f(i.role,`role`,`text`),subjectId:f(i[`subject-id`],`subject-id`,`text`),subjectType:f(i[`subject-type`],`subject-type`,`text`)});l(await d(`Creating`,async()=>a.cloudforceOne.events.dataset.permissions.create({...h,account_id:p,dataset_id:i[`dataset-id`]})),{successLabel:`Created`})}};function Fe(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 Ie={command:`delete <grant-id>`,describe:`Delete a permission`,builder:Fe,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset permissions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/permissions/${e[`grant-id`]==null?`<grant-id>`:encodeURIComponent(String(e[`grant-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"grant-id":String(e[`grant-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.dataset.permissions.delete({account_id:a,dataset_id:e[`dataset-id`],grant_id:e[`grant-id`]})),{successLabel:`Deleted`})}};function Le(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 Re={command:`get <dataset-id>`,describe:`List permissions`,builder:Le,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset permissions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/permissions`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.permissions.get({account_id:i,dataset_id:e[`dataset-id`]})),{successLabel:`Loaded`})}};function ze(e){return e.positional(`grant-id`,{type:`string`,description:`Grant ID`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`role`,{type:`string`,description:`The role field`,choices:[`read`,`write`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Be={command:`update <grant-id>`,describe:`Update a permission`,builder:ze,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset permissions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/permissions/${e[`grant-id`]==null?`<grant-id>`:encodeURIComponent(String(e[`grant-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"grant-id":String(e[`grant-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({role:f(e.role,`role`,`text`)}):s(e.body)});return}let i=await o(e),a=e.local?m:await r(i);if(e.accountId=a,e.body){let t=s(e.body);l(await d(`Updating`,async()=>i.cloudforceOne.events.dataset.permissions.update({...t,account_id:a,dataset_id:e[`dataset-id`],grant_id:e[`grant-id`]})),{successLabel:`Updated`});return}e.role===void 0&&(e.role=await n(`role`,`The role field`,[`read`,`write`]));let p=c({role:f(e.role,`role`,`text`)});l(await d(`Updating`,async()=>i.cloudforceOne.events.dataset.permissions.update({...p,account_id:a,dataset_id:e[`dataset-id`],grant_id:e[`grant-id`]})),{successLabel:`Updated`})}},Ve={command:`permissions`,describe:`Events operations`,builder:e=>e.command(Pe).command(Ie).command(Re).command(Be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function He(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-ids`,{type:`string`,description:`Dataset UUIDs to scope to (repeat the param for multiple), or 'all' / '*' for every readable indicator dataset. Omit to search all readable datasets.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-event`,{type:`string`,description:`Filter indicators by related event UUID(s). Multiple UUIDs can be provided by repeating the parameter.`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType. Multiple conditions are AND'd together. Max 10 conditions per request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ue={command:`get <tag-uuid>`,describe:`Returns indicators associated with the provided tag UUID, with pagination. By default fans out across every indicator dataset the account can read; pass datasetIds to scope to specific datasets.`,builder:h(He),handler:async e=>{let n={datasetIds:e[`dataset-ids`],page:e.page,pageSize:e[`page-size`],indicatorType:e[`indicator-type`],relatedEvent:e[`related-event`],search:e.search};if(e.dryRun){u({command:`cf cloudforce-one events dataset tags indicators get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/${e[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(e[`tag-uuid`]))}/indicators`,pathParams:{"tag-uuid":String(e[`tag-uuid`]??``)},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.dataset.tags.indicators.get({account_id:a,tag_uuid:e[`tag-uuid`],...n})),{successLabel:`Loaded`})}},We={command:`indicators`,describe:`Events operations`,builder:e=>e.command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ge={command:`tags`,describe:`Operations for events.dataset.tags`,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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qe={command:`get <dataset-id>`,describe:`List all target industries referenced in events for a specific dataset.`,builder:Ke,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events dataset target industries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/targetIndustries`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.dataset.target.industries.get({account_id:i,dataset_id:e[`dataset-id`]})),{successLabel:`Loaded`})}},Je={command:`industries`,describe:`Events operations`,builder:e=>e.command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ye={command:`target`,describe:`Operations for events.dataset.target`,builder:e=>e.command(Je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Xe={command:`dataset`,describe:`Events operations`,builder:e=>e.command(P).command(I).command(M).command(z).command(se).command(fe).command(ke).command(Me).command(Ve).command(Ge).command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qe={command:`create`,describe:`Populate dataset-specific lookup tables by scanning existing event data with batch processing.`,builder:Ze,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events datasets populate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/datasets/populate`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Creating`,async()=>n.cloudforceOne.events.datasets.populate.create({account_id:i})),{successLabel:`Created`})}},$e={command:`populate`,describe:`Events operations`,builder:e=>e.command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},et={command:`datasets`,describe:`Operations for events.datasets`,builder:e=>e.command($e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tt(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 nt={command:`delete <dataset-id>`,describe:`Delete one or more events from a dataset.`,builder:tt,handler:async e=>{let n={eventIds:e[`event-ids`]};if(e.dryRun){u({command:`cf cloudforce-one events delete delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/delete`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},query:n,bodyKind:`none`});return}let a=await o(e),s=e.local?m:await r(a);if(e.accountId=s,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}l(await d(`Deleting`,async()=>a.cloudforceOne.events.delete.delete({account_id:s,dataset_id:e[`dataset-id`],...n})),{successLabel:`Deleted`})}},rt={command:`delete`,describe:`Events operations`,builder:e=>e.command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function it(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`ql`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:it,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events graphql create graph ql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/graphql`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Creating`,async()=>n.cloudforceOne.events.graphql.create.graph.ql({account_id:i})),{successLabel:`Created`})}};function ot(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const st={command:`qlv2`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:ot,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events graphql create graph qlv2`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/events/graphql`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Creating`,async()=>n.cloudforceOne.events.graphql.create.graph.qlv2({account_id:i})),{successLabel:`Created`})}},ct={command:`graph`,describe:`Events operations`,builder:e=>e.command(at).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},lt={command:`create`,describe:`Operations for events.graphql.create`,builder:e=>e.command(ct).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ut={command:`graphql`,describe:`Operations for events.graphql`,builder:e=>e.command(lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dt(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query indicator types from. If not provided, queries all datasets for the account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ft={command:`get`,describe:`List indicator types across one or more datasets for the account.`,builder:dt,handler:async e=>{let n={datasetIds:e[`dataset-ids`]};if(e.dryRun){u({command:`cf cloudforce-one events indicator types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/indicator-types`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.indicator.types.get({account_id:a,...n})),{successLabel:`Loaded`})}},pt={command:`types`,describe:`Events operations`,builder:e=>e.command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},mt={command:`indicator`,describe:`Operations for events.indicator`,builder:e=>e.command(pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ht(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset IDs to query indicators from (array of UUIDs), or special value 'all' or '*' to query all datasets. If not provided, uses the default dataset.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType. Supports operators: equals, not, contains, startsWith, endsWith, gt, lt, gte, lte, like, in, find. Use the 'in' operator with an array value to bulk-check up to 100 indicators in a single request, e.g. search=[{"field":"value","op":"in","value":["evil.com","bad.org"]}]. Multiple conditions are AND'd together. Max 10 conditions per request.`}).option(`name`,{type:`string`,description:`Filter indicators by value using substring match (LIKE). Legacy alternative to structured search.`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-events`,{type:`string`,description:`Filter by related event IDs`}).option(`tags`,{type:`string`,description:`Filter by tag values or UUIDs. Indicators must have at least one of the specified tags (OR logic). Supports both tag UUID and tag value.`}).option(`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 accurate total count via COUNT(*). Defaults to false for performance. When false, total_count is an approximation.`}).option(`format`,{type:`string`,description:`Output format for indicator data. 'json' returns the default format, 'stix2' returns STIX 2.1 Indicator SDOs, 'taxii' returns a TAXII 2.1 Envelope with Content-Type application/taxii+json;version=2.1.`,choices:[`json`,`stix2`,`taxii`]}).option(`source`,{type:`string`,description:`Read backend. 'do' (default) reads Durable Object storage. 'r2catalog' reads R2 Data Catalog (admin-only, experimental; supports a subset of search fields).`,choices:[`do`,`r2catalog`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gt={command:`get`,describe:`Retrieves a paginated list of indicators across specified datasets. Use datasetIds=all or datasetIds=* to query all datasets for the account. If no datasetIds provided, uses the default dataset.`,builder:h(ht),handler:async e=>{let n={datasetIds:e[`dataset-ids`],page:e.page,pageSize:e[`page-size`],search:e.search,name:e.name,indicatorType:e[`indicator-type`],relatedEvents:e[`related-events`],tags:e.tags,tagSearch:e[`tag-search`],createdAfter:e[`created-after`],createdBefore:e[`created-before`],relatedEventsLimit:e[`related-events-limit`],includeTags:e[`include-tags`],includeTotalCount:e[`include-total-count`],format:e.format,source:e.source};if(e.dryRun){u({command:`cf cloudforce-one events indicators get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/indicators`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.indicators.get({account_id:a,...n})),{successLabel:`Loaded`})}},_t={command:`indicators`,describe:`Events operations`,builder:e=>e.command(gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function vt(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 yt={command:`create-create`,describe:`Create a new saved event query for the account`,builder:vt,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events queries create-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/queries/create`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({alert_enabled:n[`alert-enabled`],alert_rollup_enabled:n[`alert-rollup-enabled`],name:f(n.name,`name`,`text`),query_json:f(n[`query-json`],`query-json`,`text`),rule_enabled:n[`rule-enabled`],rule_scope:f(n[`rule-scope`],`rule-scope`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.queries.createCreate({...e,account_id:a})),{successLabel:`Created`});return}if(n[`alert-enabled`]===void 0)throw Error(`--alert-enabled is required (or pass --body with this field set).`);if(n[`alert-rollup-enabled`]===void 0)throw Error(`--alert-rollup-enabled is required (or pass --body with this field set).`);if(n.name===void 0&&(n.name=await e(`name`,`Unique name for the saved query`)),n[`query-json`]===void 0&&(n[`query-json`]=await e(`query-json`,`JSON string containing the query parameters`)),n[`rule-enabled`]===void 0)throw Error(`--rule-enabled is required (or pass --body with this field set).`);let p=c({alert_enabled:n[`alert-enabled`],alert_rollup_enabled:n[`alert-rollup-enabled`],name:f(n.name,`name`,`text`),query_json:f(n[`query-json`],`query-json`,`text`),rule_enabled:n[`rule-enabled`],rule_scope:f(n[`rule-scope`],`rule-scope`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.queries.createCreate({...p,account_id:a})),{successLabel:`Created`})}};function bt(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 xt={command:`create <query-id>`,describe:`Update an existing saved event query by its ID`,builder:h(bt),handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events queries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({alert_enabled:e[`alert-enabled`],alert_rollup_enabled:e[`alert-rollup-enabled`],name:f(e.name,`name`,`text`),query_json:f(e[`query-json`],`query-json`,`text`),rule_enabled:e[`rule-enabled`],rule_scope:f(e[`rule-scope`],`rule-scope`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.events.queries.create({...t,account_id:i,query_id:e[`query-id`]})),{successLabel:`Created`});return}let a=c({alert_enabled:e[`alert-enabled`],alert_rollup_enabled:e[`alert-rollup-enabled`],name:f(e.name,`name`,`text`),query_json:f(e[`query-json`],`query-json`,`text`),rule_enabled:e[`rule-enabled`],rule_scope:f(e[`rule-scope`],`rule-scope`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.events.queries.create({...a,account_id:i,query_id:e[`query-id`]})),{successLabel:`Created`})}};function St(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 Ct={command:`delete <query-id>`,describe:`Delete a saved event query by its ID`,builder:h(St),handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events queries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.queries.delete({account_id:a,query_id:e[`query-id`]})),{successLabel:`Deleted`})}};function wt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tt={command:`event`,describe:`Retrieve all saved event queries for the account`,builder:wt,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events queries get event`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/queries`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.queries.get.event({account_id:i})),{successLabel:`Loaded`})}};function Et(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 Dt={command:`v2 <query-id>`,describe:`Retrieve a saved event query by its ID`,builder:h(Et),handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events queries get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.queries.get.v2({account_id:i,query_id:e[`query-id`]})),{successLabel:`Loaded`})}},Ot={command:`get`,describe:`Events operations`,builder:e=>e.command(Tt).command(Dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function kt(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 At={command:`patch <query-id>`,describe:`Update an existing saved event query by its ID`,builder:h(kt),handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events queries patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({alert_enabled:e[`alert-enabled`],alert_rollup_enabled:e[`alert-rollup-enabled`],name:f(e.name,`name`,`text`),query_json:f(e[`query-json`],`query-json`,`text`),rule_enabled:e[`rule-enabled`],rule_scope:f(e[`rule-scope`],`rule-scope`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.events.queries.patch({...t,account_id:i,query_id:e[`query-id`]})),{successLabel:`Updated`});return}let a=c({alert_enabled:e[`alert-enabled`],alert_rollup_enabled:e[`alert-rollup-enabled`],name:f(e.name,`name`,`text`),query_json:f(e[`query-json`],`query-json`,`text`),rule_enabled:e[`rule-enabled`],rule_scope:f(e[`rule-scope`],`rule-scope`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.events.queries.patch({...a,account_id:i,query_id:e[`query-id`]})),{successLabel:`Updated`})}},jt={command:`queries`,describe:`Events operations`,builder:e=>e.command(xt).command(yt).command(Ct).command(At).command(Ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mt(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 Nt={command:`create <raw-id>`,describe:`Update raw data for a specific event.`,builder:Mt,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events raw create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/raw/${e[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(e[`raw-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"raw-id":String(e[`raw-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({source:f(e.source,`source`,`text`),tlp:f(e.tlp,`tlp`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.events.raw.create({...t,account_id:i,event_id:e[`event-id`],raw_id:e[`raw-id`]})),{successLabel:`Created`});return}let a=c({source:f(e.source,`source`,`text`),tlp:f(e.tlp,`tlp`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.events.raw.create({...a,account_id:i,event_id:e[`event-id`],raw_id:e[`raw-id`]})),{successLabel:`Created`})}},Pt={command:`raw`,describe:`Events operations`,builder:e=>e.command(Nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ft(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 It={command:`create <event-id>`,describe:`Create one or more references between events.`,builder:Ft,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events relate create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/relate/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/create`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({events:e.events}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.events.relate.create.create({...t,account_id:i,event_id:e[`event-id`]})),{successLabel:`Created`});return}if(e.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let a=c({events:e.events});l(await d(`Creating`,async()=>n.cloudforceOne.events.relate.create.create({...a,account_id:i,event_id:e[`event-id`]})),{successLabel:`Created`})}},Lt={command:`create`,describe:`Events operations`,builder:e=>e.command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Rt={command:`relate`,describe:`Operations for events.relate`,builder:e=>e.command(Lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function zt(e){return e.option(`child-ids`,{type:`string`,array:!0,description:`Array of UUIDs for child events. Single child = 1:1 relationship, multiple = 1:many relationships`}).option(`dataset-id`,{type:`string`,description:`Dataset identifier where the events are stored`}).option(`parent-id`,{type:`string`,description:`UUID of the parent event that will be the source of the relationship`}).option(`relationship-type`,{type:`string`,description:`Type of relationship to create between parent and child events`,choices:[`related_to`,`caused_by`,`attributed_to`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Bt={command:`create`,describe:`Creates a directed relationship between two events. The relationship is from parent to child with a specified type.`,builder:zt,handler:async i=>{if(i.dryRun){u({command:`cf cloudforce-one events relationships create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/relationships/create`,pathParams:{},bodyKind:`json`,body:i.body===void 0?c({childIds:i[`child-ids`],datasetId:f(i[`dataset-id`],`dataset-id`,`text`),parentId:f(i[`parent-id`],`parent-id`,`text`),relationshipType:f(i[`relationship-type`],`relationship-type`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.cloudforceOne.events.relationships.create.create({...e,account_id:p})),{successLabel:`Created`});return}if(i[`child-ids`]===void 0)throw Error(`--child-ids is required (or pass --body with this field set).`);i[`dataset-id`]===void 0&&(i[`dataset-id`]=await e(`dataset-id`,`Dataset identifier where the events are stored`)),i[`parent-id`]===void 0&&(i[`parent-id`]=await e(`parent-id`,`UUID of the parent event that will be the source of the relationship`)),i[`relationship-type`]===void 0&&(i[`relationship-type`]=await n(`relationship-type`,`Type of relationship to create between parent and child events`,[`related_to`,`caused_by`,`attributed_to`]));let h=c({childIds:i[`child-ids`],datasetId:f(i[`dataset-id`],`dataset-id`,`text`),parentId:f(i[`parent-id`],`parent-id`,`text`),relationshipType:f(i[`relationship-type`],`relationship-type`,`text`)});l(await d(`Creating`,async()=>a.cloudforceOne.events.relationships.create.create({...h,account_id:p})),{successLabel:`Created`})}},Vt={command:`create`,describe:`Events operations`,builder:e=>e.command(Bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ht(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 Ut={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:h(Ht),handler:async e=>{let n={direction:e.direction,maxDepth:e[`max-depth`],relationshipTypes:e[`relationship-types`],indicatorTypeIds:e[`indicator-type-ids`],datasetId:e[`dataset-id`],includeParent:e[`include-parent`],page:e.page,pageSize:e[`page-size`]};if(e.dryRun){u({command:`cf cloudforce-one events relationships get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/relationships`,pathParams:{"event-id":String(e[`event-id`]??``)},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.relationships.get({account_id:a,event_id:e[`event-id`],...n})),{successLabel:`Loaded`})}},Wt={command:`relationships`,describe:`Events operations`,builder:e=>e.command(Ut).command(Vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gt(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 Kt={command:`create`,describe:`Creates a new Source-of-Truth tag category for an account.`,builder:Gt,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events tags categories create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/categories/create`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.events.tags.categories.create.create({...e,account_id:a})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await e(`name`,`The name field`));let p=c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.events.tags.categories.create.create({...p,account_id:a})),{successLabel:`Created`})}},qt={command:`create`,describe:`Events operations`,builder:e=>e.command(Kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Jt(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 Yt={command:`delete <category-uuid>`,describe:`Deletes a Source-of-Truth tag category by UUID.`,builder:Jt,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events tags categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/categories/${e[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(e[`category-uuid`]))}`,pathParams:{"category-uuid":String(e[`category-uuid`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.tags.categories.delete({account_id:a,category_uuid:e[`category-uuid`]})),{successLabel:`Deleted`})}};function Xt(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 Zt={command:`get`,describe:`Returns all Source-of-Truth tag categories for an account.`,builder:Xt,handler:async e=>{let n={search:e.search};if(e.dryRun){u({command:`cf cloudforce-one events tags categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/categories`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.tags.categories.get({account_id:a,...n})),{successLabel:`Loaded`})}};function Qt(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const $t={command:`patch <category-uuid>`,describe:`Updates a Source-of-Truth tag category by UUID.`,builder:Qt,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events tags categories patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/categories/${e[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(e[`category-uuid`]))}`,pathParams:{"category-uuid":String(e[`category-uuid`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.events.tags.categories.patch({...t,account_id:i,category_uuid:e[`category-uuid`]})),{successLabel:`Updated`});return}let a=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.events.tags.categories.patch({...a,account_id:i,category_uuid:e[`category-uuid`]})),{successLabel:`Updated`})}},en={command:`categories`,describe:`Events operations`,builder:e=>e.command(Yt).command(Zt).command($t).command(qt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tn(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 nn={command:`delete <tag-uuid>`,describe:`Deletes a Source-of-Truth tag by UUID.`,builder:tn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/${e[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(e[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(e[`tag-uuid`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.events.tags.delete({account_id:a,tag_uuid:e[`tag-uuid`]})),{successLabel:`Deleted`})}};function rn(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:`Legacy free-text substring match on tag value.`}).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, actorCategory, actorCategoryConfidence, aliasGroupNames, attributionConfidence, attributionConfidenceScore, attributionOrganization, categoryName, motive, motiveConfidence, opsecLevel, originCountryISO, originCountryConfidence, sophisticationLevel, priority, analyticPriority. 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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const an={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:h(rn),handler:async e=>{let n={page:e.page,pageSize:e[`page-size`],search:e.search,categoryUuid:e[`category-uuid`],filters:e.filters};if(e.dryRun){u({command:`cf cloudforce-one events tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.events.tags.get({account_id:a,...n})),{successLabel:`Loaded`})}};function on(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`active-duration`,{type:`string`,description:`The activeDuration field`}).option(`actor-category`,{type:`string`,description:`Actor variety. Allowed values: Activist, Competitor, Customer, Crime Syndicate, Former Employee, Nation State, Organized Crime, Nation State Affiliated, Terrorist, Unaffiliated.`}).option(`actor-category-confidence`,{type:`number`,description:`Confidence (1-10) in the actor variety (actorCategory). CFONE-only: stripped from responses to non-CFONE accounts.`}).option(`alias-group-names`,{type:`string`,array:!0,description:`The aliasGroupNames field`}).option(`alias-group-names-internal`,{type:`string`,array:!0,description:`The aliasGroupNamesInternal field`}).option(`analytic-priority`,{type:`number`,description:`The analyticPriority field`}).option(`attribution-confidence`,{type:`string`,description:`The attributionConfidence field`}).option(`attribution-confidence-score`,{type:`number`,description:`The attributionConfidenceScore field`}).option(`attribution-organization`,{type:`string`,description:`The attributionOrganization field`}).option(`category-uuid`,{type:`string`,description:`The categoryUuid field`}).option(`date-of-discovery`,{type:`string`,description:`Date the actor was discovered (ISO YYYY-MM-DD).`}).option(`external-reference-links`,{type:`string`,array:!0,description:`The externalReferenceLinks field`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`motive`,{type:`string`,description:`Actor motive. Allowed values: Convenience, Fear, Fun, Financial, Grudge, Ideology, Espionage.`}).option(`motive-confidence`,{type:`number`,description:`Confidence (1-10) in the actor motive. CFONE-only: stripped from responses to non-CFONE accounts.`}).option(`opsec-level`,{type:`string`,description:`The opsecLevel field`}).option(`origin-country-confidence`,{type:`number`,description:`Confidence (1-10) in the origin-country attribution. CFONE-only: stripped from responses to non-CFONE accounts.`}).option(`origin-country-iso`,{type:`string`,description:`The originCountryISO field`}).option(`origin-country-tlp`,{type:`string`,description:`TLP marking for the origin-country attribution. CFONE-only: stripped from responses to non-CFONE accounts.`,choices:[`red`,`amber`,`green`,`white`]}).option(`priority`,{type:`number`,description:`The priority field`}).option(`sophistication-level`,{type:`string`,description:`The sophisticationLevel field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const sn={command:`patch <tag-uuid>`,describe:`Updates a Source-of-Truth tag by UUID.`,builder:on,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events tags patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/${e[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(e[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(e[`tag-uuid`]??``)},bodyKind:`json`,body:e.body===void 0?c({activeDuration:f(e[`active-duration`],`active-duration`,`text`),actorCategory:f(e[`actor-category`],`actor-category`,`text`),actorCategoryConfidence:e[`actor-category-confidence`],aliasGroupNames:e[`alias-group-names`],aliasGroupNamesInternal:e[`alias-group-names-internal`],analyticPriority:e[`analytic-priority`],attributionConfidence:f(e[`attribution-confidence`],`attribution-confidence`,`text`),attributionConfidenceScore:e[`attribution-confidence-score`],attributionOrganization:f(e[`attribution-organization`],`attribution-organization`,`text`),categoryUuid:f(e[`category-uuid`],`category-uuid`,`text`),dateOfDiscovery:f(e[`date-of-discovery`],`date-of-discovery`,`text`),externalReferenceLinks:e[`external-reference-links`],internalDescription:f(e[`internal-description`],`internal-description`,`text`),motive:f(e.motive,`motive`,`text`),motiveConfidence:e[`motive-confidence`],opsecLevel:f(e[`opsec-level`],`opsec-level`,`text`),originCountryConfidence:e[`origin-country-confidence`],originCountryISO:f(e[`origin-country-iso`],`origin-country-iso`,`text`),originCountryTlp:f(e[`origin-country-tlp`],`origin-country-tlp`,`text`),priority:e.priority,sophisticationLevel:f(e[`sophistication-level`],`sophistication-level`,`text`),value:f(e.value,`value`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.events.tags.patch({...t,account_id:i,tag_uuid:e[`tag-uuid`]})),{successLabel:`Updated`});return}let a=c({activeDuration:f(e[`active-duration`],`active-duration`,`text`),actorCategory:f(e[`actor-category`],`actor-category`,`text`),actorCategoryConfidence:e[`actor-category-confidence`],aliasGroupNames:e[`alias-group-names`],aliasGroupNamesInternal:e[`alias-group-names-internal`],analyticPriority:e[`analytic-priority`],attributionConfidence:f(e[`attribution-confidence`],`attribution-confidence`,`text`),attributionConfidenceScore:e[`attribution-confidence-score`],attributionOrganization:f(e[`attribution-organization`],`attribution-organization`,`text`),categoryUuid:f(e[`category-uuid`],`category-uuid`,`text`),dateOfDiscovery:f(e[`date-of-discovery`],`date-of-discovery`,`text`),externalReferenceLinks:e[`external-reference-links`],internalDescription:f(e[`internal-description`],`internal-description`,`text`),motive:f(e.motive,`motive`,`text`),motiveConfidence:e[`motive-confidence`],opsecLevel:f(e[`opsec-level`],`opsec-level`,`text`),originCountryConfidence:e[`origin-country-confidence`],originCountryISO:f(e[`origin-country-iso`],`origin-country-iso`,`text`),originCountryTlp:f(e[`origin-country-tlp`],`origin-country-tlp`,`text`),priority:e.priority,sophisticationLevel:f(e[`sophistication-level`],`sophistication-level`,`text`),value:f(e.value,`value`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.events.tags.patch({...a,account_id:i,tag_uuid:e[`tag-uuid`]})),{successLabel:`Updated`})}},cn={command:`tags`,describe:`Events operations`,builder:e=>e.command(nn).command(an).command(sn).command(en).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ln(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const un={command:`get`,describe:`List all predefined target industries from the industry map catalog.`,builder:ln,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one events target industries catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/targetIndustries/catalog`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.events.target.industries.catalog.get({account_id:i})),{successLabel:`Loaded`})}},dn={command:`catalog`,describe:`Events operations`,builder:e=>e.command(un).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fn={command:`industries`,describe:`Operations for events.target.industries`,builder:e=>e.command(dn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},pn={command:`target`,describe:`Operations for events.target`,builder:e=>e.command(fn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function mn(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 hn={command:`patch`,describe:`Updates multiple events with the same field values. Maximum 100 events per request.`,builder:mn,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one events update bulk patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/update/bulk`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({datasetId:f(n[`dataset-id`],`dataset-id`,`text`),eventIds:n[`event-ids`],updates:{attacker:f(n[`updates-attacker`],`updates-attacker`,`text`),attackerCountry:f(n[`updates-attacker-country`],`updates-attacker-country`,`text`),category:f(n[`updates-category`],`updates-category`,`text`),createdAt:f(n[`updates-created-at`],`updates-created-at`,`text`),event:f(n[`updates-event`],`updates-event`,`text`),indicator:f(n[`updates-indicator`],`updates-indicator`,`text`),indicatorType:f(n[`updates-indicator-type`],`updates-indicator-type`,`text`),insight:f(n[`updates-insight`],`updates-insight`,`text`),raw:{source:f(n[`updates-raw-source`],`updates-raw-source`,`text`),tlp:f(n[`updates-raw-tlp`],`updates-raw-tlp`,`text`)},targetCountry:f(n[`updates-target-country`],`updates-target-country`,`text`),targetIndustry:f(n[`updates-target-industry`],`updates-target-industry`,`text`),tlp:f(n[`updates-tlp`],`updates-tlp`,`text`)}}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>i.cloudforceOne.events.update.bulk.patch({...e,account_id:a})),{successLabel:`Updated`});return}if(n[`dataset-id`]===void 0&&(n[`dataset-id`]=await e(`dataset-id`,`Dataset ID containing the events to update. Required to prevent cross-account modifications.`)),n[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let p=c({datasetId:f(n[`dataset-id`],`dataset-id`,`text`),eventIds:n[`event-ids`],updates:{attacker:f(n[`updates-attacker`],`updates-attacker`,`text`),attackerCountry:f(n[`updates-attacker-country`],`updates-attacker-country`,`text`),category:f(n[`updates-category`],`updates-category`,`text`),createdAt:f(n[`updates-created-at`],`updates-created-at`,`text`),event:f(n[`updates-event`],`updates-event`,`text`),indicator:f(n[`updates-indicator`],`updates-indicator`,`text`),indicatorType:f(n[`updates-indicator-type`],`updates-indicator-type`,`text`),insight:f(n[`updates-insight`],`updates-insight`,`text`),raw:{source:f(n[`updates-raw-source`],`updates-raw-source`,`text`),tlp:f(n[`updates-raw-tlp`],`updates-raw-tlp`,`text`)},targetCountry:f(n[`updates-target-country`],`updates-target-country`,`text`),targetIndustry:f(n[`updates-target-industry`],`updates-target-industry`,`text`),tlp:f(n[`updates-tlp`],`updates-tlp`,`text`)}});l(await d(`Updating`,async()=>i.cloudforceOne.events.update.bulk.patch({...p,account_id:a})),{successLabel:`Updated`})}},gn={command:`bulk`,describe:`Events operations`,builder:e=>e.command(hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},_n={command:`update`,describe:`Operations for events.update`,builder:e=>e.command(gn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},vn={command:`events`,describe:`Events operations`,builder:e=>e.command(k).command(x).command(D).command(Xe).command(et).command(rt).command(ut).command(mt).command(_t).command(jt).command(Pt).command(Rt).command(Wt).command(cn).command(pn).command(_n).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yn(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 bn={command:`create <request-id>`,describe:`Uploads a new asset to a Cloudforce One intelligence request.`,builder:yn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests asset-new create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/new`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,source:e.source}});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.file!==void 0||e.body!==void 0||e.source!==void 0){let t=new FormData;if(e.file){let n=p(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);e.source!==void 0&&t.append(`source`,String(f(e.source,`source`,`text`)??``)),l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset/new`,{body:t})),{successLabel:`Created`});return}if(e.body){let t=f(e.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset/new`,{body:t,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>n.cloudforceOne.requests.assetNew.create({account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`})}},xn={command:`asset-new`,describe:`Additional request operations — priority listing and asset creation`,builder:e=>e.command(bn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Sn(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 Cn={command:`create <request-id>`,describe:`Lists assets attached to a Cloudforce One intelligence request.`,builder:Sn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests assets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({page:e.page,per_page:e[`per-page`]}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.requests.assets.create({...t,account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let a=c({page:e.page,per_page:e[`per-page`]});l(await d(`Creating`,async()=>n.cloudforceOne.requests.assets.create({...a,account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`})}};function $(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const wn={command:`delete <asset-id>`,describe:`Removes an asset from a Cloudforce One intelligence request.`,builder:$,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests assets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/${e[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(e[`asset-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"asset-id":String(e[`asset-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
12
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.requests.assets.delete({account_id:a,request_id:e[`request-id`],asset_id:e[`asset-id`]})),{successLabel:`Deleted`})}};function Tn(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 En={command:`get <asset-id>`,describe:`Retrieves an asset attached to a Cloudforce One intelligence request.`,builder:Tn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests assets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/${e[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(e[`asset-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"asset-id":String(e[`asset-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.assets.get({account_id:i,request_id:e[`request-id`],asset_id:e[`asset-id`]})),{successLabel:`Loaded`})}};function Dn(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 On={command:`update <asset-id>`,describe:`Updates an asset in a Cloudforce One intelligence request.`,builder:Dn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests assets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/${e[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(e[`asset-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"asset-id":String(e[`asset-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({source:f(e.source,`source`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.requests.assets.update({...t,account_id:i,request_id:e[`request-id`],asset_id:e[`asset-id`]})),{successLabel:`Updated`});return}let a=c({source:f(e.source,`source`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.requests.assets.update({...a,account_id:i,request_id:e[`request-id`],asset_id:e[`asset-id`]})),{successLabel:`Updated`})}},kn={command:`assets`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(Cn).command(wn).command(En).command(On).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function An(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const jn={command:`constants`,describe:`Retrieves constant values used in Cloudforce One requests, including valid statuses and types.`,builder:An,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests constants`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/constants`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.constants({account_id:i})),{successLabel:`Loaded`})}};function Mn(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 Nn={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:Mn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/new`,pathParams:{},bodyKind:`json`,body:e.body===void 0?c({content:f(e.content,`content`,`text`),priority:f(e.priority,`priority`,`text`),request_type:f(e[`request-type`],`request-type`,`text`),summary:f(e.summary,`summary`,`text`),tlp:f(e.tlp,`tlp`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.requests.create({body:t,account_id:i})),{successLabel:`Created`});return}let a=c({content:f(e.content,`content`,`text`),priority:f(e.priority,`priority`,`text`),request_type:f(e[`request-type`],`request-type`,`text`),summary:f(e.summary,`summary`,`text`),tlp:f(e.tlp,`tlp`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.requests.create({body:a,account_id:i})),{successLabel:`Created`})}};function Pn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Fn={command:`delete <request-id>`,describe:`Deletes a Cloudforce One intelligence request and all associated data.`,builder:Pn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.requests.delete({account_id:a,request_id:e[`request-id`]})),{successLabel:`Deleted`})}};function In(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 Ln={command:`get <request-id>`,describe:`Retrieves details for a specific Cloudforce One intelligence request.`,builder:In,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.get({account_id:i,request_id:e[`request-id`]})),{successLabel:`Loaded`})}};function Rn(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 zn={command:`list`,describe:`Lists Cloudforce One intelligence requests with filtering and pagination.`,builder:Rn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests`,pathParams:{},bodyKind:`json`,body:e.body===void 0?c({page:e.page,per_page:e[`per-page`],request_type:f(e[`request-type`],`request-type`,`text`),sort_by:f(e[`sort-by`],`sort-by`,`text`),sort_order:f(e[`sort-order`],`sort-order`,`text`),status:f(e.status,`status`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.requests.list({...t,account_id:i})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let a=c({page:e.page,per_page:e[`per-page`],request_type:f(e[`request-type`],`request-type`,`text`),sort_by:f(e[`sort-by`],`sort-by`,`text`),sort_order:f(e[`sort-order`],`sort-order`,`text`),status:f(e.status,`status`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.requests.list({...a,account_id:i})),{successLabel:`Created`})}};function Bn(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 Vn={command:`create <request-id>`,describe:`Adds a message to a Cloudforce One intelligence request conversation.`,builder:Bn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests message create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message/new`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({content:f(e.content,`content`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.requests.message.create({body:t,account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`});return}let a=c({content:f(e.content,`content`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.requests.message.create({body:a,account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`})}};function Hn(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 Un={command:`delete <message-id>`,describe:`Removes a message from a Cloudforce One intelligence request thread.`,builder:h(Hn),handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests message delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message/${e[`message-id`]==null?`<message-id>`:encodeURIComponent(String(e[`message-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"message-id":String(e[`message-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
14
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.requests.message.delete({account_id:a,request_id:e[`request-id`],message_id:e[`message-id`]})),{successLabel:`Deleted`})}};function Wn(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 Gn={command:`get <request-id>`,describe:`Lists messages in a Cloudforce One intelligence request conversation.`,builder:Wn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests message get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({page:e.page,per_page:e[`per-page`],sort_by:f(e[`sort-by`],`sort-by`,`text`),sort_order:f(e[`sort-order`],`sort-order`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.requests.message.get({...t,account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let a=c({page:e.page,per_page:e[`per-page`],sort_by:f(e[`sort-by`],`sort-by`,`text`),sort_order:f(e[`sort-order`],`sort-order`,`text`)});l(await d(`Creating`,async()=>n.cloudforceOne.requests.message.get({...a,account_id:i,request_id:e[`request-id`]})),{successLabel:`Created`})}};function Kn(e){return e.positional(`message-id`,{type:`string`,description:`Message ID`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`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 qn={command:`update <message-id>`,describe:`Updates a message in a Cloudforce One intelligence request thread.`,builder:h(Kn),handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests message update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message/${e[`message-id`]==null?`<message-id>`:encodeURIComponent(String(e[`message-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"message-id":String(e[`message-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({content:f(e.content,`content`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.requests.message.update({body:t,account_id:i,request_id:e[`request-id`],message_id:e[`message-id`]})),{successLabel:`Updated`});return}let a=c({content:f(e.content,`content`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.requests.message.update({body:a,account_id:i,request_id:e[`request-id`],message_id:e[`message-id`]})),{successLabel:`Updated`})}},Jn={command:`message`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(Vn).command(Un).command(Gn).command(qn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Yn(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 Xn={command:`create`,describe:`Creates a new priority intelligence request in Cloudforce One.`,builder:Yn,handler:async i=>{if(i.dryRun){u({command:`cf cloudforce-one requests priority create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/priority/new`,pathParams:{},bodyKind:`json`,body:i.body===void 0?c({labels:i.labels,priority:i.priority,requirement:f(i.requirement,`requirement`,`text`),tlp:f(i.tlp,`tlp`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.cloudforceOne.requests.priority.create({body:e,account_id:p})),{successLabel:`Created`});return}if(i.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(i.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);i.requirement===void 0&&(i.requirement=await e(`requirement`,`Requirement.`)),i.tlp===void 0&&(i.tlp=await n(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let h=c({labels:i.labels,priority:i.priority,requirement:f(i.requirement,`requirement`,`text`),tlp:f(i.tlp,`tlp`,`text`)});l(await d(`Creating`,async()=>a.cloudforceOne.requests.priority.create({body:h,account_id:p})),{successLabel:`Created`})}};function Zn(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Qn={command:`delete <priority-id>`,describe:`Deletes a priority intelligence request from Cloudforce One.`,builder:Zn,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests priority delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/priority/${e[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(e[`priority-id`]))}`,pathParams:{"priority-id":String(e[`priority-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
15
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.requests.priority.delete({account_id:a,priority_id:e[`priority-id`]})),{successLabel:`Deleted`})}};function $n(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const er={command:`get <priority-id>`,describe:`Retrieves a specific priority intelligence request from Cloudforce One.`,builder:$n,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests priority get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/priority/${e[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(e[`priority-id`]))}`,pathParams:{"priority-id":String(e[`priority-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.priority.get({account_id:i,priority_id:e[`priority-id`]})),{successLabel:`Loaded`})}};function tr(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 nr={command:`list`,describe:`Lists priority intelligence requests in Cloudforce One.`,builder:tr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests priority list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/priority`,pathParams:{},bodyKind:`json`,body:e.body===void 0?c({page:e.page,per_page:e[`per-page`]}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.requests.priority.list({...t,account_id:i})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let a=c({page:e.page,per_page:e[`per-page`]});l(await d(`Creating`,async()=>n.cloudforceOne.requests.priority.list({...a,account_id:i})),{successLabel:`Created`})}};function rr(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 priority requests.`,builder:rr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests priority quota`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/priority/quota`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.priority.quota({account_id:i})),{successLabel:`Loaded`})}};function ar(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 or={command:`update <priority-id>`,describe:`Updates a priority intelligence request in Cloudforce One.`,builder:ar,handler:async i=>{if(i.dryRun){u({command:`cf cloudforce-one requests priority update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/priority/${i[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(i[`priority-id`]))}`,pathParams:{"priority-id":String(i[`priority-id`]??``)},bodyKind:`json`,body:i.body===void 0?c({labels:i.labels,priority:i.priority,requirement:f(i.requirement,`requirement`,`text`),tlp:f(i.tlp,`tlp`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Updating`,async()=>a.cloudforceOne.requests.priority.update({body:e,account_id:p,priority_id:i[`priority-id`]})),{successLabel:`Updated`});return}if(i.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(i.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);i.requirement===void 0&&(i.requirement=await e(`requirement`,`Requirement.`)),i.tlp===void 0&&(i.tlp=await n(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let h=c({labels:i.labels,priority:i.priority,requirement:f(i.requirement,`requirement`,`text`),tlp:f(i.tlp,`tlp`,`text`)});l(await d(`Updating`,async()=>a.cloudforceOne.requests.priority.update({body:h,account_id:p,priority_id:i[`priority-id`]})),{successLabel:`Updated`})}},sr={command:`priority`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(Xn).command(Qn).command(er).command(nr).command(ir).command(or).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function cr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One standard requests.`,builder:cr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests quota`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/quota`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.quota({account_id:i})),{successLabel:`Loaded`})}};function ur(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dr={command:`types`,describe:`Lists available request types for Cloudforce One intelligence requests.`,builder:ur,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests types`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/types`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.requests.types({account_id:i})),{successLabel:`Loaded`})}};function fr(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 pr={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:fr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one requests update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({content:f(e.content,`content`,`text`),priority:f(e.priority,`priority`,`text`),request_type:f(e[`request-type`],`request-type`,`text`),summary:f(e.summary,`summary`,`text`),tlp:f(e.tlp,`tlp`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.requests.update({body:t,account_id:i,request_id:e[`request-id`]})),{successLabel:`Updated`});return}let a=c({content:f(e.content,`content`,`text`),priority:f(e.priority,`priority`,`text`),request_type:f(e[`request-type`],`request-type`,`text`),summary:f(e.summary,`summary`,`text`),tlp:f(e.tlp,`tlp`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.requests.update({body:a,account_id:i,request_id:e[`request-id`]})),{successLabel:`Updated`})}},mr={command:`requests`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(jn).command(Nn).command(Fn).command(Ln).command(zn).command(lr).command(dr).command(pr).command(xn).command(kn).command(Jn).command(sr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function hr(e){return e.option(`content`,{type:`string`,description:`The content field`}).option(`description`,{type:`string`,description:`Human-readable description of the rule. Auto-extracted from YARA meta if present.`}).option(`enabled`,{type:`boolean`,description:`Whether this rule is active for dice consumers.`,default:!0}).option(`is-public`,{type:`boolean`,description:`Whether this rule is visible to other internal accounts.`,default:!1}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`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 gr={command:`create`,describe:`Create a new detection rule.`,builder:hr,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({content:f(n.content,`content`,`text`),description:f(n.description,`description`,`text`),enabled:n.enabled,is_public:n[`is-public`],name:f(n.name,`name`,`text`),namespaces:n.namespaces,path:f(n.path,`path`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.rules.create({...e,account_id:a})),{successLabel:`Created`});return}n.content===void 0&&(n.content=await e(`content`,`The content field`)),n.name===void 0&&(n.name=await e(`name`,`The name field`)),n.path===void 0&&(n.path=await e(`path`,`The path field`));let p=c({content:f(n.content,`content`,`text`),description:f(n.description,`description`,`text`),enabled:n.enabled,is_public:n[`is-public`],name:f(n.name,`name`,`text`),namespaces:n.namespaces,path:f(n.path,`path`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.rules.create({...p,account_id:a})),{successLabel:`Created`})}};function _r(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 vr={command:`rules`,describe:`Delete all rules in an account.`,builder:_r,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one rules delete all rules`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
16
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.rules.delete.all.rules({account_id:a})),{successLabel:`Deleted`})}},yr={command:`all`,describe:`Rules operations`,builder:e=>e.command(vr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function br(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 xr={command:`rule <id>`,describe:`Delete an existing rule.`,builder:br,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one rules delete one rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
17
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.rules.delete.one.rule({account_id:a,id:e.id})),{successLabel:`Deleted`})}},Sr={command:`one`,describe:`Rules operations`,builder:e=>e.command(xr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Cr={command:`delete`,describe:`Operations for rules.delete`,builder:e=>e.command(yr).command(Sr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function wr(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 Tr={command:`get <id>`,describe:`Get a single rule by ID.`,builder:wr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.rules.get({account_id:i,id:e.id})),{successLabel:`Loaded`})}};function Er(e){return e.option(`namespace`,{type:`string`,description:`Filter by namespace. Repeat the parameter to filter by multiple namespaces (e.g. namespace=foo&namespace=bar).`}).option(`path`,{type:`string`,description:"Filter by path using exact-match semantics (no descendant matching). Omit the parameter to return rules from all paths. Pass an empty string (path=) to return only rules with an empty/uncategorized path. Pass a non-empty value (e.g. path=yara) for an exact match against that path. Repeat the parameter (e.g. path=yara&path=expr) to OR-match across multiple paths (SQL `IN (...)` semantics). Note: the `recursive` flag does NOT affect path filtering — it only affects namespace filtering for customer accounts."}).option(`recursive`,{type:`string`,description:`Customer accounts only: when true, namespace filtering matches descendants. Does NOT affect path filtering (paths are always exact-match).`,choices:[`true`,`false`]}).option(`search`,{type:`string`,description:`Search`}).option(`is-public`,{type:`string`,description:`Filter by public visibility.`,choices:[`true`,`false`]}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Dr={command:`list`,describe:`List all rules for an account with optional filtering.`,builder:h(Er),handler:async e=>{let n={namespace:e.namespace,path:e.path,recursive:e.recursive,search:e.search,is_public:e[`is-public`],limit:e.limit,offset:e.offset};if(e.dryRun){u({command:`cf cloudforce-one rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.rules.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Or(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kr={command:`get`,describe:`Get statistics about rules for the dashboard.`,builder:Or,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one rules stats get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules/stats`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.rules.stats.get({account_id:i})),{successLabel:`Loaded`})}},Ar={command:`stats`,describe:`Rules operations`,builder:e=>e.command(kr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function jr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Mr={command:`get`,describe:`Get the folder tree structure for rules navigation.`,builder:jr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one rules tree get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules/tree`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.rules.tree.get({account_id:i})),{successLabel:`Loaded`})}},Nr={command:`tree`,describe:`Rules operations`,builder:e=>e.command(Mr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`content`,{type:`string`,description:`The content field`}).option(`description`,{type:`string`,description:`Human-readable description of the rule. Auto-extracted from YARA meta if present.`}).option(`enabled`,{type:`boolean`,description:`Whether this rule is active for dice consumers.`}).option(`is-public`,{type:`boolean`,description:`Whether this rule is visible to other internal accounts.`}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`The namespaces field`}).option(`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 Fr={command:`update <id>`,describe:`Update an existing rule.`,builder:Pr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`json`,body:e.body===void 0?c({content:f(e.content,`content`,`text`),description:f(e.description,`description`,`text`),enabled:e.enabled,is_public:e[`is-public`],name:f(e.name,`name`,`text`),namespaces:e.namespaces,path:f(e.path,`path`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.rules.update({...t,account_id:i,id:e.id})),{successLabel:`Updated`});return}let a=c({content:f(e.content,`content`,`text`),description:f(e.description,`description`,`text`),enabled:e.enabled,is_public:e[`is-public`],name:f(e.name,`name`,`text`),namespaces:e.namespaces,path:f(e.path,`path`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.rules.update({...a,account_id:i,id:e.id})),{successLabel:`Updated`})}};function Ir(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 Lr={command:`create`,describe:`Validate rule syntax, name uniqueness, namespace, and meta checks.`,builder:Ir,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one rules validate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/rules/validate`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({content:f(n.content,`content`,`text`),excludeRuleId:f(n[`exclude-rule-id`],`exclude-rule-id`,`text`),name:f(n.name,`name`,`text`),namespaces:n.namespaces,path:f(n.path,`path`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.rules.validate.create({...e,account_id:a})),{successLabel:`Created`});return}n.content===void 0&&(n.content=await e(`content`,`The content field`)),n.name===void 0&&(n.name=await e(`name`,`The name field`));let p=c({content:f(n.content,`content`,`text`),excludeRuleId:f(n[`exclude-rule-id`],`exclude-rule-id`,`text`),name:f(n.name,`name`,`text`),namespaces:n.namespaces,path:f(n.path,`path`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.rules.validate.create({...p,account_id:a})),{successLabel:`Created`})}},Rr={command:`validate`,describe:`Rules operations`,builder:e=>e.command(Lr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},zr={command:`rules`,describe:`Rules operations`,builder:e=>e.command(gr).command(Tr).command(Dr).command(Fr).command(Cr).command(Ar).command(Nr).command(Rr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Br(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 Vr={command:`create`,describe:`Create a new Scan Config`,builder:Br,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one scans config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`json`,body:e.body===void 0?c({frequency:e.frequency,ips:e.ips,ports:e.ports}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.scans.config.create({...t,account_id:i})),{successLabel:`Created`});return}if(e.ips===void 0)throw Error(`--ips is required (or pass --body with this field set).`);let a=c({frequency:e.frequency,ips:e.ips,ports:e.ports});l(await d(`Creating`,async()=>n.cloudforceOne.scans.config.create({...a,account_id:i})),{successLabel:`Created`})}};function Hr(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 Ur={command:`delete <config-id>`,describe:`Delete a Scan Config`,builder:Hr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one scans config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/scans/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"config-id":String(e[`config-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
18
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.scans.config.delete({account_id:a,config_id:e[`config-id`]})),{successLabel:`Deleted`})}};function Wr(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 Gr={command:`edit <config-id>`,describe:`Update an existing Scan Config`,builder:Wr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one scans config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/scans/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({frequency:e.frequency,ips:e.ips,ports:e.ports}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.scans.config.edit({...t,account_id:i,config_id:e[`config-id`]})),{successLabel:`Updated`});return}let a=c({frequency:e.frequency,ips:e.ips,ports:e.ports});l(await d(`Updating`,async()=>n.cloudforceOne.scans.config.edit({...a,account_id:i,config_id:e[`config-id`]})),{successLabel:`Updated`})}};function Kr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qr={command:`list`,describe:`List Scan Configs`,builder:Kr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one scans config list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.scans.config.list({account_id:i})),{successLabel:`Loaded`})}},Jr={command:`config`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(Vr).command(Ur).command(Gr).command(qr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Yr(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 Xr={command:`get <config-id>`,describe:`Get the Latest Scan Result`,builder:Yr,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one scans results get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/scans/results/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"config-id":String(e[`config-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.scans.results.get({account_id:i,config_id:e[`config-id`]})),{successLabel:`Loaded`})}},Zr={command:`results`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(Xr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Qr={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(Jr).command(Zr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $r(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 ei={command:`list`,describe:`List attacker names referenced in events across one or more datasets.`,builder:$r,handler:async e=>{let n={datasetIds:e[`dataset-ids`]};if(e.dryRun){u({command:`cf cloudforce-one threat-events attackers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/attackers`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.threatEvents.attackers.list({account_id:a,...n})),{successLabel:`Loaded`})}},ti={command:`attackers`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ei).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ni(e){return e.option(`dataset-id`,{type:`string`,description:`The datasetId field`}).option(`include-created-events`,{type:`boolean`,description:`When true, response includes array of created event UUIDs and shard IDs. Useful for tracking which events were created and where.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ri={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:ni,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/create/bulk`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({datasetId:f(n[`dataset-id`],`dataset-id`,`text`),includeCreatedEvents:n[`include-created-events`]}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.bulkCreate({...e,account_id:a})),{successLabel:`Created`});return}n[`dataset-id`]===void 0&&(n[`dataset-id`]=await e(`dataset-id`,`The datasetId field`));let p=c({datasetId:f(n[`dataset-id`],`dataset-id`,`text`),includeCreatedEvents:n[`include-created-events`]});l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.bulkCreate({...p,account_id:a})),{successLabel:`Created`})}};function ii(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 ai={command:`create`,describe:`Create a new event category for the account.`,builder:ii,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories/create`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({killChain:n[`kill-chain`],mitreAttack:n[`mitre-attack`],mitreCapec:n[`mitre-capec`],name:f(n.name,`name`,`text`),shortname:f(n.shortname,`shortname`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.categories.create({...e,account_id:a})),{successLabel:`Created`});return}if(n[`kill-chain`]===void 0)throw Error(`--kill-chain is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await e(`name`,`The name field`));let p=c({killChain:n[`kill-chain`],mitreAttack:n[`mitre-attack`],mitreCapec:n[`mitre-capec`],name:f(n.name,`name`,`text`),shortname:f(n.shortname,`shortname`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.categories.create({...p,account_id:a})),{successLabel:`Created`})}};function oi(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 si={command:`delete <category-id>`,describe:`Delete a category by its identifier.`,builder:oi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
19
|
-
`);return}l(await d(`Deleting`,async()=>n.cloudforceOne.threatEvents.categories.delete({account_id:a,category_id:e[`category-id`]})),{successLabel:`Deleted`})}};function ci(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 li={command:`edit <category-id>`,describe:`Update an existing category by its identifier.`,builder:ci,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events categories edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({killChain:e[`kill-chain`],mitreAttack:e[`mitre-attack`],mitreCapec:e[`mitre-capec`],name:f(e.name,`name`,`text`),shortname:f(e.shortname,`shortname`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.threatEvents.categories.edit({...t,account_id:i,category_id:e[`category-id`]})),{successLabel:`Updated`});return}let a=c({killChain:e[`kill-chain`],mitreAttack:e[`mitre-attack`],mitreCapec:e[`mitre-capec`],name:f(e.name,`name`,`text`),shortname:f(e.shortname,`shortname`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.threatEvents.categories.edit({...a,account_id:i,category_id:e[`category-id`]})),{successLabel:`Updated`})}};function ui(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 di={command:`get <category-id>`,describe:`Retrieve a single category by its identifier.`,builder:ui,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.categories.get({account_id:i,category_id:e[`category-id`]})),{successLabel:`Loaded`})}};function fi(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 pi={command:`list`,describe:`List categories across one or more datasets for the account.`,builder:fi,handler:async e=>{let n={datasetIds:e[`dataset-ids`]};if(e.dryRun){u({command:`cf cloudforce-one threat-events categories list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/categories`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.threatEvents.categories.list({account_id:a,...n})),{successLabel:`Loaded`})}},mi={command:`categories`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ai).command(si).command(li).command(di).command(pi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function hi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gi={command:`list`,describe:`Retrieve country code information for all supported countries.`,builder:hi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events countries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/countries`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.countries.list({account_id:i})),{successLabel:`Loaded`})}},_i={command:`countries`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(gi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function vi(e){return e.option(`attacker`,{type:`string`,description:`The attacker field`}).option(`attacker-country`,{type:`string`,description:`The attackerCountry field`}).option(`category`,{type:`string`,description:`The category field`}).option(`dataset-id`,{type:`string`,description:`The datasetId field`}).option(`date`,{type:`string`,description:`The date field`}).option(`event`,{type:`string`,description:`The event field`}).option(`indicator`,{type:`string`,description:`The indicator field`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const yi={command:`create`,describe:"To create a dataset, see the [`Create Dataset`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/create/) endpoint. When `datasetId` parameter is unspecified, it will be created in a default dataset named `Cloudforce One Threat Events`.",builder:vi,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/create`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({attacker:f(n.attacker,`attacker`,`text`),attackerCountry:f(n[`attacker-country`],`attacker-country`,`text`),category:f(n.category,`category`,`text`),datasetId:f(n[`dataset-id`],`dataset-id`,`text`),date:f(n.date,`date`,`text`),event:f(n.event,`event`,`text`),indicator:f(n.indicator,`indicator`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),insight:f(n.insight,`insight`,`text`),raw:{source:f(n[`raw-source`],`raw-source`,`text`),tlp:f(n[`raw-tlp`],`raw-tlp`,`text`)},tags:n.tags,targetCountry:f(n[`target-country`],`target-country`,`text`),targetIndustry:f(n[`target-industry`],`target-industry`,`text`),tlp:f(n.tlp,`tlp`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.create({...e,account_id:a})),{successLabel:`Created`});return}n.category===void 0&&(n.category=await e(`category`,`The category field`)),n.date===void 0&&(n.date=await e(`date`,`The date field`)),n.event===void 0&&(n.event=await e(`event`,`The event field`)),n.tlp===void 0&&(n.tlp=await e(`tlp`,`The tlp field`));let p=c({attacker:f(n.attacker,`attacker`,`text`),attackerCountry:f(n[`attacker-country`],`attacker-country`,`text`),category:f(n.category,`category`,`text`),datasetId:f(n[`dataset-id`],`dataset-id`,`text`),date:f(n.date,`date`,`text`),event:f(n.event,`event`,`text`),indicator:f(n.indicator,`indicator`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),insight:f(n.insight,`insight`,`text`),raw:{source:f(n[`raw-source`],`raw-source`,`text`),tlp:f(n[`raw-tlp`],`raw-tlp`,`text`)},tags:n.tags,targetCountry:f(n[`target-country`],`target-country`,`text`),targetIndustry:f(n[`target-industry`],`target-industry`,`text`),tlp:f(n.tlp,`tlp`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.create({...p,account_id:a})),{successLabel:`Created`})}};function bi(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 xi={command:`create`,describe:`Create a new dataset in the account.`,builder:bi,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/create`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({isPublic:n[`is-public`],name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.datasets.create({...e,account_id:a})),{successLabel:`Created`});return}if(n[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await e(`name`,`Used to describe the dataset within the account context.`));let p=c({isPublic:n[`is-public`],name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.datasets.create({...p,account_id:a})),{successLabel:`Created`})}};function Si(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 Ci={command:`edit <dataset-id>`,describe:`Update an existing dataset by its identifier.`,builder:Si,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events datasets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${n[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(n[`dataset-id`]))}`,pathParams:{"dataset-id":String(n[`dataset-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({isPublic:n[`is-public`],name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>i.cloudforceOne.threatEvents.datasets.edit({...e,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Updated`});return}if(n[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await e(`name`,`Used to describe the dataset within the account context.`));let p=c({isPublic:n[`is-public`],name:f(n.name,`name`,`text`)});l(await d(`Updating`,async()=>i.cloudforceOne.threatEvents.datasets.edit({...p,account_id:a,dataset_id:n[`dataset-id`]})),{successLabel:`Updated`})}};function wi(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 Ti={command:`get <dataset-id>`,describe:`Retrieve metadata for a specific dataset.`,builder:wi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.datasets.get({account_id:i,dataset_id:e[`dataset-id`]})),{successLabel:`Loaded`})}};function Ei(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 Di={command:`list`,describe:`List all datasets accessible to the account.`,builder:Ei,handler:async e=>{let n={includeDeleted:e[`include-deleted`]};if(e.dryRun){u({command:`cf cloudforce-one threat-events datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/dataset`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.threatEvents.datasets.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Oi(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 ki={command:`raw <event-id>`,describe:`Retrieves the raw data associated with an event. Searches across all shards in the dataset.`,builder:Oi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events datasets raw`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/raw/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.datasets.raw({account_id:i,dataset_id:e[`dataset-id`],event_id:e[`event-id`]})),{successLabel:`Loaded`})}},Ai={command:`datasets`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(xi).command(Ci).command(Ti).command(Di).command(ki).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ji(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`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 Mi={command:`edit <event-id>`,describe:`Update an existing event by its identifier.`,builder:ji,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${n[`event-id`]==null?`<event-id>`:encodeURIComponent(String(n[`event-id`]))}`,pathParams:{"event-id":String(n[`event-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({attacker:f(n.attacker,`attacker`,`text`),attackerCountry:f(n[`attacker-country`],`attacker-country`,`text`),category:f(n.category,`category`,`text`),createdAt:f(n[`created-at`],`created-at`,`text`),datasetId:f(n[`dataset-id`],`dataset-id`,`text`),date:f(n.date,`date`,`text`),event:f(n.event,`event`,`text`),indicator:f(n.indicator,`indicator`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),insight:f(n.insight,`insight`,`text`),raw:{source:f(n[`raw-source`],`raw-source`,`text`),tlp:f(n[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(n[`target-country`],`target-country`,`text`),targetIndustry:f(n[`target-industry`],`target-industry`,`text`),tlp:f(n.tlp,`tlp`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>i.cloudforceOne.threatEvents.edit({...e,account_id:a,event_id:n[`event-id`]})),{successLabel:`Updated`});return}n[`dataset-id`]===void 0&&(n[`dataset-id`]=await e(`dataset-id`,`Dataset ID containing the event to update.`));let p=c({attacker:f(n.attacker,`attacker`,`text`),attackerCountry:f(n[`attacker-country`],`attacker-country`,`text`),category:f(n.category,`category`,`text`),createdAt:f(n[`created-at`],`created-at`,`text`),datasetId:f(n[`dataset-id`],`dataset-id`,`text`),date:f(n.date,`date`,`text`),event:f(n.event,`event`,`text`),indicator:f(n.indicator,`indicator`,`text`),indicatorType:f(n[`indicator-type`],`indicator-type`,`text`),insight:f(n.insight,`insight`,`text`),raw:{source:f(n[`raw-source`],`raw-source`,`text`),tlp:f(n[`raw-tlp`],`raw-tlp`,`text`)},targetCountry:f(n[`target-country`],`target-country`,`text`),targetIndustry:f(n[`target-industry`],`target-industry`,`text`),tlp:f(n.tlp,`tlp`,`text`)});l(await d(`Updating`,async()=>i.cloudforceOne.threatEvents.edit({...p,account_id:a,event_id:n[`event-id`]})),{successLabel:`Updated`})}};function Ni(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pi={command:`create <event-id>`,describe:`Add one or more tags to an event.`,builder:Ni,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events event-tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/event_tag/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/create`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({tags:e.tags}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.cloudforceOne.threatEvents.eventTags.create({...t,account_id:i,event_id:e[`event-id`]})),{successLabel:`Created`});return}if(e.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let a=c({tags:e.tags});l(await d(`Creating`,async()=>n.cloudforceOne.threatEvents.eventTags.create({...a,account_id:i,event_id:e[`event-id`]})),{successLabel:`Created`})}};function Fi(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 Ii={command:`delete <event-id>`,describe:`Remove one or more tags from an event.`,builder:Fi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events event-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/event_tag/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({tags:e.tags}):s(e.body)});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
20
|
-
`);return}if(e.body){let t=s(e.body);l(await d(`Deleting`,async()=>n.cloudforceOne.threatEvents.eventTags.delete({...t,account_id:a,event_id:e[`event-id`]})),{successLabel:`Deleted`});return}if(e.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let f=c({tags:e.tags});l(await d(`Deleting`,async()=>n.cloudforceOne.threatEvents.eventTags.delete({...f,account_id:a,event_id:e[`event-id`]})),{successLabel:`Deleted`})}},Li={command:`event-tags`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Pi).command(Ii).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ri(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 zi={command:`get <event-id>`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/events/:event_id instead.`,builder:Ri,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.get({account_id:i,event_id:e[`event-id`]})),{successLabel:`Loaded`})}};function Bi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Vi={command:`list`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes instead.`,builder:Bi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events indicator-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/indicatorTypes`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.indicatorTypes.list({account_id:i})),{successLabel:`Loaded`})}},Hi={command:`indicator-types`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Vi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ui(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination. When provided, filters are embedded in the cursor so you only need to pass cursor and pageSize. Returned in the previous response's result_info.cursor field. Use cursor-based pagination for deep pagination (beyond 100,000 records) or for optimal performance.`}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page number (1-indexed) for offset-based pagination. Limited to offset of 100,000 records. For deep pagination, use cursor-based pagination instead.`}).option(`page-size`,{type:`number`,description:`Number of results per page. Maximum 25,000.`}).option(`order-by`,{type:`string`,description:`OrderBy`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`dataset-id`,{type:`string`,description:`Dataset IDs to query events from (array of UUIDs), or special value 'all' or '*' to query all event datasets for the account. If not provided, uses the default dataset.`}).option(`force-refresh`,{type:`boolean`,description:`ForceRefresh`}).option(`format`,{type:`string`,description:`Format`,choices:[`json`,`stix2`,`taxii`]}).option(`source`,{type:`string`,description:`Read backend. 'do' (default) reads Durable Object storage. 'r2catalog' reads R2 Data Catalog (admin-only, experimental; supports a subset of search fields — no 'tags').`,choices:[`do`,`r2catalog`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wi={command:`list`,describe:"Use `datasetId=all` or `datasetId=*` to query all event datasets for the account (limited to 50). When `datasetId` is unspecified, events are listed from the default Cloudforce One Threat Events dataset. To list existing datasets, use the [`List Datasets`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/list/) endpoint.",builder:h(Ui),handler:async e=>{let n={cursor:e.cursor,search:e.search,page:e.page,pageSize:e[`page-size`],orderBy:e[`order-by`],order:e.order,datasetId:e[`dataset-id`],forceRefresh:e[`force-refresh`],format:e.format,source:e.source};if(e.dryRun){u({command:`cf cloudforce-one threat-events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.threatEvents.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Gi(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`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 Ki={command:`edit <raw-id>`,describe:`Update raw data for a specific event.`,builder:Gi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events raw edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/raw/${e[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(e[`raw-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"raw-id":String(e[`raw-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({source:f(e.source,`source`,`text`),tlp:f(e.tlp,`tlp`,`text`)}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.cloudforceOne.threatEvents.raw.edit({...t,account_id:i,event_id:e[`event-id`],raw_id:e[`raw-id`]})),{successLabel:`Updated`});return}let a=c({source:f(e.source,`source`,`text`),tlp:f(e.tlp,`tlp`,`text`)});l(await d(`Updating`,async()=>n.cloudforceOne.threatEvents.raw.edit({...a,account_id:i,event_id:e[`event-id`],raw_id:e[`raw-id`]})),{successLabel:`Updated`})}};function qi(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 Ji={command:`get <raw-id>`,describe:`Retrieve raw data for a specific event.`,builder:qi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/raw/${e[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(e[`raw-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"raw-id":String(e[`raw-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.cloudforceOne.threatEvents.raw.get({account_id:i,event_id:e[`event-id`],raw_id:e[`raw-id`]})),{successLabel:`Loaded`})}},Yi={command:`raw`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Ki).command(Ji).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Xi(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 Zi={command:`delete <event-id>`,describe:`Remove one or more references from an event.`,builder:Xi,handler:async e=>{if(e.dryRun){u({command:`cf cloudforce-one threat-events relate delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/relate/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({events:e.events}):s(e.body)});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
21
|
-
`);return}if(e.body){let t=s(e.body);l(await d(`Deleting`,async()=>n.cloudforceOne.threatEvents.relate.delete({...t,account_id:a,event_id:e[`event-id`]})),{successLabel:`Deleted`});return}if(e.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let f=c({events:e.events});l(await d(`Deleting`,async()=>n.cloudforceOne.threatEvents.relate.delete({...f,account_id:a,event_id:e[`event-id`]})),{successLabel:`Deleted`})}},Qi={command:`relate`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Zi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $i(e){return e.option(`active-duration`,{type:`string`,description:`The activeDuration field`}).option(`actor-category`,{type:`string`,description:`Actor variety. Allowed values: Activist, Competitor, Customer, Crime Syndicate, Former Employee, Nation State, Organized Crime, Nation State Affiliated, Terrorist, Unaffiliated.`}).option(`actor-category-confidence`,{type:`number`,description:`Confidence (1-10) in the actor variety (actorCategory). CFONE-only: stripped from responses to non-CFONE accounts.`}).option(`alias-group-names`,{type:`string`,array:!0,description:`The aliasGroupNames field`}).option(`alias-group-names-internal`,{type:`string`,array:!0,description:`The aliasGroupNamesInternal field`}).option(`analytic-priority`,{type:`number`,description:`The analyticPriority field`}).option(`attribution-confidence`,{type:`string`,description:`The attributionConfidence field`}).option(`attribution-confidence-score`,{type:`number`,description:`The attributionConfidenceScore field`}).option(`attribution-organization`,{type:`string`,description:`The attributionOrganization field`}).option(`category-uuid`,{type:`string`,description:`The categoryUuid field`}).option(`date-of-discovery`,{type:`string`,description:`Date the actor was discovered (ISO YYYY-MM-DD).`}).option(`external-reference-links`,{type:`string`,array:!0,description:`The externalReferenceLinks field`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`motive`,{type:`string`,description:`Actor motive. Allowed values: Convenience, Fear, Fun, Financial, Grudge, Ideology, Espionage.`}).option(`motive-confidence`,{type:`number`,description:`Confidence (1-10) in the actor motive. CFONE-only: stripped from responses to non-CFONE accounts.`}).option(`opsec-level`,{type:`string`,description:`The opsecLevel field`}).option(`origin-country-confidence`,{type:`number`,description:`Confidence (1-10) in the origin-country attribution. CFONE-only: stripped from responses to non-CFONE accounts.`}).option(`origin-country-iso`,{type:`string`,description:`The originCountryISO field`}).option(`origin-country-tlp`,{type:`string`,description:`TLP marking for the origin-country attribution. CFONE-only: stripped from responses to non-CFONE accounts.`,choices:[`red`,`amber`,`green`,`white`]}).option(`priority`,{type:`number`,description:`The priority field`}).option(`sophistication-level`,{type:`string`,description:`The sophisticationLevel field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ea={command:`create`,describe:`Creates a new tag to be used accross threat events.`,builder:$i,handler:async n=>{if(n.dryRun){u({command:`cf cloudforce-one threat-events tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/tags/create`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({activeDuration:f(n[`active-duration`],`active-duration`,`text`),actorCategory:f(n[`actor-category`],`actor-category`,`text`),actorCategoryConfidence:n[`actor-category-confidence`],aliasGroupNames:n[`alias-group-names`],aliasGroupNamesInternal:n[`alias-group-names-internal`],analyticPriority:n[`analytic-priority`],attributionConfidence:f(n[`attribution-confidence`],`attribution-confidence`,`text`),attributionConfidenceScore:n[`attribution-confidence-score`],attributionOrganization:f(n[`attribution-organization`],`attribution-organization`,`text`),categoryUuid:f(n[`category-uuid`],`category-uuid`,`text`),dateOfDiscovery:f(n[`date-of-discovery`],`date-of-discovery`,`text`),externalReferenceLinks:n[`external-reference-links`],internalDescription:f(n[`internal-description`],`internal-description`,`text`),motive:f(n.motive,`motive`,`text`),motiveConfidence:n[`motive-confidence`],opsecLevel:f(n[`opsec-level`],`opsec-level`,`text`),originCountryConfidence:n[`origin-country-confidence`],originCountryISO:f(n[`origin-country-iso`],`origin-country-iso`,`text`),originCountryTlp:f(n[`origin-country-tlp`],`origin-country-tlp`,`text`),priority:n.priority,sophisticationLevel:f(n[`sophistication-level`],`sophistication-level`,`text`),value:f(n.value,`value`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.tags.create({...e,account_id:a})),{successLabel:`Created`});return}n.value===void 0&&(n.value=await e(`value`,`The value field`));let p=c({activeDuration:f(n[`active-duration`],`active-duration`,`text`),actorCategory:f(n[`actor-category`],`actor-category`,`text`),actorCategoryConfidence:n[`actor-category-confidence`],aliasGroupNames:n[`alias-group-names`],aliasGroupNamesInternal:n[`alias-group-names-internal`],analyticPriority:n[`analytic-priority`],attributionConfidence:f(n[`attribution-confidence`],`attribution-confidence`,`text`),attributionConfidenceScore:n[`attribution-confidence-score`],attributionOrganization:f(n[`attribution-organization`],`attribution-organization`,`text`),categoryUuid:f(n[`category-uuid`],`category-uuid`,`text`),dateOfDiscovery:f(n[`date-of-discovery`],`date-of-discovery`,`text`),externalReferenceLinks:n[`external-reference-links`],internalDescription:f(n[`internal-description`],`internal-description`,`text`),motive:f(n.motive,`motive`,`text`),motiveConfidence:n[`motive-confidence`],opsecLevel:f(n[`opsec-level`],`opsec-level`,`text`),originCountryConfidence:n[`origin-country-confidence`],originCountryISO:f(n[`origin-country-iso`],`origin-country-iso`,`text`),originCountryTlp:f(n[`origin-country-tlp`],`origin-country-tlp`,`text`),priority:n.priority,sophisticationLevel:f(n[`sophistication-level`],`sophistication-level`,`text`),value:f(n.value,`value`,`text`)});l(await d(`Creating`,async()=>i.cloudforceOne.threatEvents.tags.create({...p,account_id:a})),{successLabel:`Created`})}},ta={command:`tags`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ea).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function na(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 ra={command:`list`,describe:`List target industries referenced in events across one or more datasets.`,builder:na,handler:async e=>{let n={datasetIds:e[`dataset-ids`]};if(e.dryRun){u({command:`cf cloudforce-one threat-events target-industries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/events/targetIndustries`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.cloudforceOne.threatEvents.targetIndustries.list({account_id:a,...n})),{successLabel:`Loaded`})}},ia={command:`target-industries`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ra).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},aa={command:`threat-events`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ri).command(yi).command(Mi).command(zi).command(Wi).command(ti).command(mi).command(_i).command(Ai).command(Li).command(Hi).command(Yi).command(Qi).command(ta).command(ia).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},oa={command:`cloudforce-one`,describe:`Threat intelligence platform — request investigations, scan indicators, and track threat events`,builder:e=>e.command(v).command(vn).command(mr).command(zr).command(Qr).command(aa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{oa as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";import{t as p}from"./cli-types-BeyOc81z.mjs";function m(e){return e.option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin.\n\n- `"verify_full"` — verify certificate chain and hostname (default)\n- `"verify_ca"` — verify certificate chain only, skip hostname check\n- `"disabled"` — do not verify the server certificate at all',choices:[`verify_full`,`verify_ca`,`disabled`]}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0})}const h={command:`create`,describe:`Create Workers VPC connectivity service`,builder:m,handler:async i=>{if(i.dryRun){l({command:`cf connectivity directory services create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/connectivity/directory/services`,pathParams:{},bodyKind:`json`,body:i.body===void 0?s({host:{ipv4:d(i[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(i[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(i[`host-ipv6`],`host-ipv6`,`text`),hostname:d(i[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:i[`host-resolver-network-resolver-ips`],tunnel_id:d(i[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(i.name,`name`,`text`),tls_settings:{cert_verification_mode:d(i[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(i.type,`type`,`text`),http_port:i[`http-port`],https_port:i[`https-port`],app_protocol:d(i[`app-protocol`],`app-protocol`,`text`),tcp_port:i[`tcp-port`]}):o(i.body)});return}let p=await a(i),m=i.local?f:await r(p);if(i.accountId=m,i.body){let e=o(i.body);c(await u(`Creating`,async()=>p.connectivity.directory.services.create({body:e,account_id:m})),{successLabel:`Created`});return}i.name===void 0&&(i.name=await e(`name`,`The name field`)),i.type===void 0&&(i.type=await n(`type`,`The type field`,[`tcp`,`http`]));let h=s({host:{ipv4:d(i[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(i[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(i[`host-ipv6`],`host-ipv6`,`text`),hostname:d(i[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:i[`host-resolver-network-resolver-ips`],tunnel_id:d(i[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(i.name,`name`,`text`),tls_settings:{cert_verification_mode:d(i[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(i.type,`type`,`text`),http_port:i[`http-port`],https_port:i[`https-port`],app_protocol:d(i[`app-protocol`],`app-protocol`,`text`),tcp_port:i[`tcp-port`]});c(await u(`Creating`,async()=>p.connectivity.directory.services.create({body:h,account_id:m})),{successLabel:`Created`})}};function g(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <service-id>`,describe:`Delete Workers VPC connectivity service`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf connectivity directory services delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/connectivity/directory/services/${e[`service-id`]==null?`<service-id>`:encodeURIComponent(String(e[`service-id`]))}`,pathParams:{"service-id":String(e[`service-id`]??``)},bodyKind:`none`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}c(await u(`Deleting`,async()=>n.connectivity.directory.services.delete({account_id:o,service_id:e[`service-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <service-id>`,describe:`Get Workers VPC connectivity service`,builder:v,handler:async e=>{if(e.dryRun){l({command:`cf connectivity directory services get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/connectivity/directory/services/${e[`service-id`]==null?`<service-id>`:encodeURIComponent(String(e[`service-id`]))}`,pathParams:{"service-id":String(e[`service-id`]??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.connectivity.directory.services.get({account_id:i,service_id:e[`service-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`type`,{type:`string`,description:`Type`,choices:[`tcp`,`http`]}).option(`page`,{type:`number`,description:`Current page in the response`}).option(`per-page`,{type:`number`,description:`Max amount of entries returned per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`List Workers VPC connectivity services`,builder:p(b),handler:async e=>{let n={type:e.type,page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf connectivity directory services list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/connectivity/directory/services`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await r(i);e.accountId=o,c(await u(`Loading`,async()=>i.connectivity.directory.services.list({account_id:o,...n})),{successLabel:`Loaded`})}};function S(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin.\n\n- `"verify_full"` — verify certificate chain and hostname (default)\n- `"verify_ca"` — verify certificate chain only, skip hostname check\n- `"disabled"` — do not verify the server certificate at all',choices:[`verify_full`,`verify_ca`,`disabled`]}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0})}const C={command:`update <service-id>`,describe:`Update Workers VPC connectivity service`,builder:S,handler:async e=>{if(e.dryRun){l({command:`cf connectivity directory services update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/connectivity/directory/services/${e[`service-id`]==null?`<service-id>`:encodeURIComponent(String(e[`service-id`]))}`,pathParams:{"service-id":String(e[`service-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({host:{ipv4:d(e[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(e[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(e[`host-ipv6`],`host-ipv6`,`text`),hostname:d(e[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:e[`host-resolver-network-resolver-ips`],tunnel_id:d(e[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(e.name,`name`,`text`),tls_settings:{cert_verification_mode:d(e[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(e.type,`type`,`text`),http_port:e[`http-port`],https_port:e[`https-port`],app_protocol:d(e[`app-protocol`],`app-protocol`,`text`),tcp_port:e[`tcp-port`]}):o(e.body)});return}let n=await a(e),i=e.local?f:await r(n);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>n.connectivity.directory.services.update({body:t,account_id:i,service_id:e[`service-id`]})),{successLabel:`Updated`});return}let p=s({host:{ipv4:d(e[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(e[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(e[`host-ipv6`],`host-ipv6`,`text`),hostname:d(e[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:e[`host-resolver-network-resolver-ips`],tunnel_id:d(e[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(e.name,`name`,`text`),tls_settings:{cert_verification_mode:d(e[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(e.type,`type`,`text`),http_port:e[`http-port`],https_port:e[`https-port`],app_protocol:d(e[`app-protocol`],`app-protocol`,`text`),tcp_port:e[`tcp-port`]});c(await u(`Updating`,async()=>n.connectivity.directory.services.update({body:p,account_id:i,service_id:e[`service-id`]})),{successLabel:`Updated`})}},w={command:`services`,describe:`Connectivity service entries that define available network endpoints and their properties`,builder:e=>e.command(h).command(_).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},T={command:`directory`,describe:`Operations for directory`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},E={command:`connectivity`,describe:`Service directory for network connectivity endpoints and their configurations`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{E as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{t as c}from"./local-CYc9q7l2.mjs";function l(e){return e.positional(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`reboot-purge`,{type:`boolean`,description:`Purge connector state.`,default:!1}).option(`restart-purge`,{type:`boolean`,description:`Purge connector state.`,default:!1}).option(`shutdown-purge`,{type:`boolean`,description:`Purge connector state.`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Interrupt action for a connector.`})}const u={command:`create <connector-id>`,describe:`Creates an interrupt for a Magic WAN Connector.`,builder:l,handler:async l=>{if(l.dryRun){o({command:`cf connector-interrupts create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${l[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(l[`connector-id`]))}/interrupts`,pathParams:{"connector-id":String(l[`connector-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({reboot:{purge:l[`reboot-purge`]},restart:{purge:l[`restart-purge`]},shutdown:{purge:l[`shutdown-purge`]}}):r(l.body)});return}let u=await n(l),d=l.local?c:await t(u);if(l.accountId=d,l.body){let e=r(l.body);a(await s(`Creating`,async()=>u.connectorInterrupts.create({...e,account_id:d,connector_id:l[`connector-id`]})),{successLabel:`Created`});return}let f=i({reboot:{purge:l[`reboot-purge`]},restart:{purge:l[`restart-purge`]},shutdown:{purge:l[`shutdown-purge`]}});a(await s(`Creating`,async()=>u.connectorInterrupts.create({...f,account_id:d,connector_id:l[`connector-id`]})),{successLabel:`Created`})}};function d(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`list`,describe:`Lists interrupts for a Magic WAN Connector.`,builder:d,handler:async r=>{if(r.dryRun){o({command:`cf connector-interrupts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${r[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(r[`connector-id`]))}/interrupts`,pathParams:{"connector-id":String(r[`connector-id`]??``)},bodyKind:`none`});return}let i=await n(r),l=r.local?c:await t(i);r.accountId=l,a(await s(`Loading`,async()=>i.connectorInterrupts.list({account_id:l,connector_id:r[`connector-id`]})),{successLabel:`Loaded`})}},p={command:`connector-interrupts`,describe:`connector-interrupts`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-DrDErV9w.mjs";import{t as o}from"./local-CYc9q7l2.mjs";import{t as s}from"./cli-types-BeyOc81z.mjs";function c(e){return e.positional(`event-n`,{type:`string`,description:`Event n`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`event-t`,{type:`string`,description:`Event t`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get <event-n>`,describe:`Gets Magic WAN Connector Telemetry Event`,builder:s(c),handler:async s=>{if(s.dryRun){i({command:`cf connector-telemetry-events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/events/${s[`event-t`]==null?`<event-t>`:encodeURIComponent(String(s[`event-t`]))}.${s[`event-n`]==null?`<event-n>`:encodeURIComponent(String(s[`event-n`]))}`,pathParams:{"connector-id":String(s[`connector-id`]??``),"event-t":String(s[`event-t`]??``),"event-n":String(s[`event-n`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.connectorTelemetryEvents.get({account_id:l,connector_id:s[`connector-id`],event_t:s[`event-t`],event_n:s[`event-n`]})),{successLabel:`Loaded`})}};function u(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`k`,{type:`string`,description:`Filter by event kind`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`Lists Magic WAN Connector Telemetry Events`,builder:u,handler:async s=>{let c={from:s.from,to:s.to,limit:s.limit,cursor:s.cursor,k:s.k};if(s.dryRun){i({command:`cf connector-telemetry-events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/events`,pathParams:{"connector-id":String(s[`connector-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t(l);s.accountId=u,r(await a(`Loading`,async()=>l.connectorTelemetryEvents.list({account_id:u,connector_id:s[`connector-id`],...c})),{successLabel:`Loaded`})}},f={command:`connector-telemetry-events`,describe:`connector-telemetry-events`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-DrDErV9w.mjs";import{t as o}from"./local-CYc9q7l2.mjs";import{t as s}from"./cli-types-BeyOc81z.mjs";function c(e){return e.positional(`snapshot-t`,{type:`string`,description:`Snapshot t`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get <snapshot-t>`,describe:`Gets Magic WAN Connector Telemetry Snapshot`,builder:s(c),handler:async s=>{if(s.dryRun){i({command:`cf connector-telemetry-snapshots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/snapshots/${s[`snapshot-t`]==null?`<snapshot-t>`:encodeURIComponent(String(s[`snapshot-t`]))}`,pathParams:{"connector-id":String(s[`connector-id`]??``),"snapshot-t":String(s[`snapshot-t`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.connectorTelemetrySnapshots.get({account_id:l,connector_id:s[`connector-id`],snapshot_t:s[`snapshot-t`]})),{successLabel:`Loaded`})}};function u(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`Lists Magic WAN Connector Telemetry Snapshots`,builder:u,handler:async s=>{let c={from:s.from,to:s.to,limit:s.limit,cursor:s.cursor};if(s.dryRun){i({command:`cf connector-telemetry-snapshots list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/snapshots`,pathParams:{"connector-id":String(s[`connector-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t(l);s.accountId=u,r(await a(`Loading`,async()=>l.connectorTelemetrySnapshots.list({account_id:u,connector_id:s[`connector-id`],...c})),{successLabel:`Loaded`})}},f={command:`connector-telemetry-snapshots`,describe:`connector-telemetry-snapshots`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
|