cf 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/_meta/agent-context.json +34 -35
- package/dist/_meta/commands.json +6834 -10044
- package/dist/_meta/schemas.json +11228 -12752
- package/dist/{abuse-reports-DnNvw2gG.mjs → abuse-reports-CGF4zcKf.mjs} +2 -2
- package/dist/{access-RbqBFrSC.mjs → access-lhLJo1v2.mjs} +1 -1
- package/dist/{account-D7xvYqDx.mjs → account-CYRm3yoN.mjs} +1 -1
- package/dist/account-tags-B88TotoH.mjs +9 -0
- package/dist/accounts-BSIAT_iP.mjs +28 -0
- package/dist/{acm-Szq4CoQN.mjs → acm-VULm1djv.mjs} +1 -1
- package/dist/{addressing-CgTTbuCF.mjs → addressing-BHPBIkRY.mjs} +1 -1
- package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-KBy48G1b.mjs} +1 -1
- package/dist/{agent-memory-C8pT01pR.mjs → agent-memory-DDv_Gxr7.mjs} +2 -2
- package/dist/{ai-audit-CCygMmsh.mjs → ai-audit-BWZGvbca.mjs} +1 -1
- package/dist/{ai-gateway-D4tATNRV.mjs → ai-gateway-jeB-sAgP.mjs} +1 -1
- package/dist/ai-search-BmdskMjR.mjs +7 -0
- package/dist/{ai-security-AUfzagSE.mjs → ai-security-CsmfcaUx.mjs} +1 -1
- package/dist/{ai-Cn0BniR4.mjs → ai-viHB1tgI.mjs} +1 -1
- package/dist/{alerting-DbXVpGv3.mjs → alerting-Bl8OqViR.mjs} +4 -4
- package/dist/analytics-vOxw8Hy0.mjs +3 -0
- package/dist/{analytics_engine-B_bMbfxW.mjs → analytics_engine-DO4-C0wD.mjs} +1 -1
- package/dist/{api-security-pSJdgmtK.mjs → api-security-4FVrD4n8.mjs} +1 -1
- package/dist/argo-CQfCgazW.mjs +2 -0
- package/dist/args-DlUhyGU0.mjs +2 -0
- package/dist/artifacts-CVDGnr2V.mjs +4 -0
- package/dist/{audit-logs-BIHP5-rk.mjs → audit-logs-CzpwvQ6A.mjs} +1 -1
- package/dist/{auth-MeSu8lFz.mjs → auth-D0xZxAEa.mjs} +1 -1
- package/dist/{auth-C6MhC9EZ.mjs → auth-MQEamPN9.mjs} +2 -2
- package/dist/{billing-0RNCYBJM.mjs → billing-aJgapeRm.mjs} +2 -2
- package/dist/{bot-management-uhBRnSPl.mjs → bot-management-Y2q5d-pi.mjs} +1 -1
- package/dist/{botnet-feed-DEbMknrE.mjs → botnet-feed-DANJqfmE.mjs} +1 -1
- package/dist/{brand-protection-DY2qPL8d.mjs → brand-protection-CjpZWBjp.mjs} +1 -1
- package/dist/{browser-extension-DBsmLCUj.mjs → browser-extension-BtpCbh-2.mjs} +1 -1
- package/dist/browser-run-BFn9h2Tz.mjs +4 -0
- package/dist/{build-Nivzj54_.mjs → build-DcflwvqN.mjs} +1 -1
- package/dist/{cache-BgRIDcFJ.mjs → cache-VyWK1SjY.mjs} +1 -1
- package/dist/{calls-JrRne0U0.mjs → calls-BxoRYxs4.mjs} +1 -1
- package/dist/{certificate-authorities-BJ7W8GGQ.mjs → certificate-authorities-D7OAFxF_.mjs} +1 -1
- package/dist/{cf-BUKsENG5.mjs → cf-C7DU4819.mjs} +2 -2
- package/dist/{chunk-LQW53VED-Xakf_rUn.mjs → chunk-LQW53VED-DLrXV-hE.mjs} +2 -2
- package/dist/{client-certificates-6xxvcOgI.mjs → client-certificates-DDUv8K0a.mjs} +1 -1
- package/dist/{client-side-security-cU0Z1tql.mjs → client-side-security-D4ysjwWT.mjs} +1 -1
- package/dist/{cloud-connector-DFooSAcn.mjs → cloud-connector-Bhec6z2P.mjs} +1 -1
- package/dist/cloudforce-one-J_hn9ss9.mjs +36 -0
- package/dist/config.mjs +1 -1
- package/dist/connector-interrupts-Dycx8zFx.mjs +2 -0
- package/dist/{connector-telemetry-events-CTMmX2BA.mjs → connector-telemetry-events-BmxOSNtN.mjs} +1 -1
- package/dist/connector-telemetry-events-latest-BY2556uL.mjs +2 -0
- package/dist/{connector-telemetry-snapshots-5Y7m8Cw8.mjs → connector-telemetry-snapshots-CdcqfKnH.mjs} +1 -1
- package/dist/connector-telemetry-snapshots-latest-BHYdxUEF.mjs +2 -0
- package/dist/{connectors-BRCQSsos.mjs → connectors-BqxYMMtQ.mjs} +1 -1
- package/dist/{containers-CfKOM_f5.mjs → containers-CKW081JA.mjs} +8 -8
- package/dist/{content-scan-CB4xHGv1.mjs → content-scan-Dgd7A8KF.mjs} +1 -1
- package/dist/{csamScanner-AQo_QTlq.mjs → csamScanner-DYL37wLc.mjs} +1 -1
- package/dist/{ct-alerting-Bai-1Z3k.mjs → ct-alerting-CkhSbfAs.mjs} +1 -1
- package/dist/{custom-certificates-D6aQIGu2.mjs → custom-certificates-BzAOnEoT.mjs} +1 -1
- package/dist/custom-csrs-CgzG3pd3.mjs +3 -0
- package/dist/{custom-hostnames-BiOVGwnR.mjs → custom-hostnames-q_nsnlye.mjs} +4 -4
- package/dist/custom-nameservers-BUBmfhUe.mjs +3 -0
- package/dist/custom-pages-M7jA2Hit.mjs +3 -0
- package/dist/{d1-FmAh7T7l.mjs → d1-BFvMd6-S.mjs} +1 -1
- package/dist/{data-security-2fmzF_Me.mjs → data-security-Bji4Or_j.mjs} +2 -2
- package/dist/{dcv-delegation-Cmxxgi9V.mjs → dcv-delegation-BuoRQ1Yh.mjs} +1 -1
- package/dist/{deploy-BzFbjH6a.mjs → deploy-CZ7bgNDu.mjs} +1 -1
- package/dist/{deploy-input-BRMQehgs.mjs → deploy-input-CrvuoDGJ.mjs} +1 -1
- package/dist/{dev-CWaf-qW4.mjs → dev-V10MG-Bg.mjs} +1 -1
- package/dist/{diagnostics-Ca6r_972.mjs → diagnostics-BTH-8nJH.mjs} +2 -2
- package/dist/{directory-CGNWfVQc.mjs → directory-BlH6N6Qy.mjs} +1 -1
- package/dist/{dispatch-namespaces-CBo5kuf7.mjs → dispatch-namespaces-BCjH1JzB.mjs} +1 -1
- package/dist/{dist-COfwjT96.mjs → dist-CgrMkXFx.mjs} +1 -1
- package/dist/{dls-CobKlH4N.mjs → dls-BF5iN78p.mjs} +1 -1
- package/dist/{dns-OfJXNYkK.mjs → dns-CeCTNqRk.mjs} +11 -11
- package/dist/{dns-firewall-DZ2ij-nX.mjs → dns-firewall-B54MaLGm.mjs} +1 -1
- package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wIVDg_fl.mjs} +1 -1
- package/dist/{durable-objects-Cw_y37WB.mjs → durable-objects-D8FQORrL.mjs} +1 -1
- package/dist/{email-auth-DuJHdiwN.mjs → email-auth-DJK0Eb30.mjs} +1 -1
- package/dist/email-routing-NpmiKIrl.mjs +6 -0
- package/dist/{email-security-D-P8ln2L.mjs → email-security-BLZ7WZ9Z.mjs} +2 -2
- package/dist/email-sending-dn-353Nx.mjs +7 -0
- package/dist/fieldExtractors-ahysj57J.mjs +3 -0
- package/dist/firewall-CBPGJ43p.mjs +11 -0
- package/dist/{flagship-CPkQMist.mjs → flagship-BusjRNIb.mjs} +3 -3
- package/dist/{fraud-BhX0QNUl.mjs → fraud-BIhS8pLf.mjs} +1 -1
- package/dist/{google-tag-gateway-CDtRxao4.mjs → google-tag-gateway-TZZ3F1tV.mjs} +1 -1
- package/dist/{healthchecks-D2WwALvQ.mjs → healthchecks-FiXIk-KP.mjs} +2 -2
- package/dist/{hostnames-CGAFkYT1.mjs → hostnames-Bx0mykMR.mjs} +1 -1
- package/dist/{hyperdrive-zLFPWFQj.mjs → hyperdrive-C8qCabBF.mjs} +1 -1
- package/dist/{iam-Su_hpatD.mjs → iam-Cj63Kjc6.mjs} +1 -1
- package/dist/{images-D2ZflvBi.mjs → images-CBWXCDhy.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{intel-DPGzVovJ.mjs → intel-B-9Z_sJs.mjs} +2 -2
- package/dist/{interactive-CM2G03lr.mjs → interactive-DtsCYfrK.mjs} +1 -1
- package/dist/{ips-C5-NH1b0.mjs → ips-qs9eGJnI.mjs} +1 -1
- package/dist/{keyless-certificates-Xx-oAN3Z.mjs → keyless-certificates-THHvoXX3.mjs} +1 -1
- package/dist/{keys-B0FBtlOD.mjs → keys-D7N0j4-x.mjs} +1 -1
- package/dist/{kv-BbZ9st5o.mjs → kv-BFDUCnft.mjs} +1 -1
- package/dist/{leaked-credential-checks-Vonw4inx.mjs → leaked-credential-checks-DUlUCOoJ.mjs} +1 -1
- package/dist/load-balancers-D2zbQ8fT.mjs +6 -0
- package/dist/{local-eEF0NF51.mjs → local-D-aVNu6A.mjs} +1 -1
- package/dist/{local-runtime-BNCCOZ8s.mjs → local-runtime-Dh3keC5v.mjs} +1 -1
- package/dist/logexplorer-CUsfZ_bS.mjs +13 -0
- package/dist/{logo-matches-oHYc8Xaz.mjs → logo-matches-CJcthPHf.mjs} +1 -1
- package/dist/{logos-DS0krPAz.mjs → logos-BS65zN8q.mjs} +1 -1
- package/dist/logpush-BK34mMQs.mjs +4 -0
- package/dist/{logs-C07M9zn-.mjs → logs-CLAqX9h2.mjs} +1 -1
- package/dist/{magic-cloud-networking-ZPEK7O5I.mjs → magic-cloud-networking-h_ozrC5S.mjs} +1 -1
- package/dist/magic-network-monitoring-C7tAPNKP.mjs +4 -0
- package/dist/{magic-transit-CgPZ8iMn.mjs → magic-transit-BtsFePMx.mjs} +5 -5
- package/dist/{managed-transforms-2XyQ14s3.mjs → managed-transforms-Cm_KVCMB.mjs} +1 -1
- package/dist/{matches-CIaCrdrs.mjs → matches-InA1hwII.mjs} +1 -1
- package/dist/{mcp-D2afM8MD.mjs → mcp-mJ7bekNJ.mjs} +1 -1
- package/dist/mesh-BK4S1Ezy.mjs +4 -0
- package/dist/{moq-BBQVNGo1.mjs → moq-qmuVPAO0.mjs} +1 -1
- package/dist/{mtls-certificates-C5j0Gn65.mjs → mtls-certificates-CU4OAAXY.mjs} +1 -1
- package/dist/{network-CmuJqtFJ.mjs → network-D74cSy3t.mjs} +1 -1
- package/dist/{network-interconnects-BlajBQqs.mjs → network-interconnects-BJ0Nc48J.mjs} +1 -1
- package/dist/{oauth-BjHjJtnn.mjs → oauth-B0ETkNcX.mjs} +2 -2
- package/dist/{oauth-clients-BSthfZP-.mjs → oauth-clients-Br-smLxQ.mjs} +1 -1
- package/dist/{oauth-scopes-ByUp5bLU.mjs → oauth-scopes-D5bF11ju.mjs} +1 -1
- package/dist/observability-BWE0Gg3V.mjs +4 -0
- package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-R-qesf18.mjs} +1 -1
- package/dist/{organization-DQIfNVCT.mjs → organization-NX7yCZrq.mjs} +1 -1
- package/dist/{organizations-L_ycAy6r.mjs → organizations-DLhiRt8g.mjs} +1 -1
- package/dist/{origin-ca-certificates-opIcs3_Q.mjs → origin-ca-certificates-Ff4McZRQ.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-TSMXzoEL.mjs → origin-post-quantum-encryption-UuTr4_SW.mjs} +1 -1
- package/dist/{origin-tls-client-auth-5CtcPUR6.mjs → origin-tls-client-auth-DOJ1zlH3.mjs} +1 -1
- package/dist/{output-DgW1hQGX.mjs → output-DrpYYfnB.mjs} +1 -1
- package/dist/{page-rules-DPd1Y3IL.mjs → page-rules-BSz1gO-_.mjs} +1 -1
- package/dist/{pages-CskAn5mR.mjs → pages-DVDogxPs.mjs} +4 -4
- package/dist/{pay-per-crawl-BMa_V40s.mjs → pay-per-crawl-BrLXK7gT.mjs} +1 -1
- package/dist/{pipelines-BbJjj1ZQ.mjs → pipelines-BszRk4sM.mjs} +2 -2
- package/dist/{precursor-DgRWBN9_.mjs → precursor-BPNjQr76.mjs} +1 -1
- package/dist/progress-CsHIt3Tp.mjs +2 -0
- package/dist/{prompt-DM4z101s.mjs → prompt-DdegNPpg.mjs} +1 -1
- package/dist/{queries-DrqcK0ZX.mjs → queries-JL1H1Biz.mjs} +1 -1
- package/dist/{queues-CutvMZcc.mjs → queues-DpkYdRUE.mjs} +1 -1
- package/dist/{r2-sFI62vhq.mjs → r2-CKozthw_.mjs} +4 -4
- package/dist/{r2-data-catalog-3vzU6FE1.mjs → r2-data-catalog-Du7hN9jA.mjs} +1 -1
- package/dist/radar-C-92vggG.mjs +2 -0
- package/dist/{rate-limits-HRZ8zMSl.mjs → rate-limits-yBF3qoYD.mjs} +1 -1
- package/dist/{raw-fetch-25gXED6c.mjs → raw-fetch-CteyTOM2.mjs} +1 -1
- package/dist/realtimekit-CIP7lP-a.mjs +7 -0
- package/dist/{registrar-C0EsXf83.mjs → registrar-DKKN0M29.mjs} +3 -3
- package/dist/{registrar-sandbox-CR9Rr7jV.mjs → registrar-sandbox-DiXg8p_1.mjs} +3 -3
- package/dist/{registry-CJvn75Bq.mjs → registry-Bck_zFkz.mjs} +1 -1
- package/dist/{reporting-BB6sqe6r.mjs → reporting-fg_GKXe1.mjs} +1 -1
- package/dist/{request-tracers-BrsM3zXZ.mjs → request-tracers-CkMya96z.mjs} +1 -1
- package/dist/{resource-sharing-CusU3kiy.mjs → resource-sharing-D1pSDvtf.mjs} +1 -1
- package/dist/{resource-tagging-wXAcblmz.mjs → resource-tagging-z48JGHCq.mjs} +1 -1
- package/dist/{rules-C2BxykEe.mjs → rules-BTmNjDN-.mjs} +1 -1
- package/dist/rulesets-CsoSM-17.mjs +5 -0
- package/dist/{rum-Dyno5zj3.mjs → rum-DB4iO2q5.mjs} +1 -1
- package/dist/{schema-BeXPWeK9.mjs → schema-B34Q9tLF.mjs} +1 -1
- package/dist/{schema-flags-C1BRprT2.mjs → schema-flags-iGoOriJt.mjs} +1 -1
- package/dist/{scim-Bb2xHpIz.mjs → scim-CcSyfKCH.mjs} +1 -1
- package/dist/sdk-ZctLa5jW.mjs +3 -0
- package/dist/{secrets-store-BMhjbceW.mjs → secrets-store-DFmvtphu.mjs} +1 -1
- package/dist/security-center-DFKeHq5c.mjs +2 -0
- package/dist/{security-txt-Bh_2gymk.mjs → security-txt-DqnFpjMI.mjs} +1 -1
- package/dist/{session-Br-q_UIW.mjs → session-D6KHthHf.mjs} +1 -1
- package/dist/{share-DfTpOxhk.mjs → share-BuwYUzOL.mjs} +1 -1
- package/dist/{shared-BNjZc02w.mjs → shared-VppSAQf4.mjs} +1 -1
- package/dist/{smart-shield-rHn-Lckq.mjs → smart-shield-D6X8L7p8.mjs} +2 -2
- package/dist/{snippets-nSLwH8uJ.mjs → snippets-DIpc9pb_.mjs} +1 -1
- package/dist/{spawn-Bj8QRFJ5.mjs → spawn-O1RS01vr.mjs} +2 -2
- package/dist/{spectrum-DuhSUTZI.mjs → spectrum-b7N1ZRAm.mjs} +1 -1
- package/dist/{speed-Dgby_e1J.mjs → speed-cw31yFva.mjs} +1 -1
- package/dist/src-D_HETJNy.mjs +108 -0
- package/dist/{ssl-BsxTHasY.mjs → ssl-CsEhRVTO.mjs} +1 -1
- package/dist/{state-C1m9nwUm.mjs → state-Bb5Cbc_L.mjs} +1 -1
- package/dist/{stream-CkEOX5Ko.mjs → stream-DFOao6Gu.mjs} +3 -3
- package/dist/{submit-BjdywxTq.mjs → submit--xTzyNPy.mjs} +1 -1
- package/dist/{tags-CFAw_Sce.mjs → tags-efICDkah.mjs} +1 -1
- package/dist/{tenant-C66iOy5O.mjs → tenant-CerHuToJ.mjs} +1 -1
- package/dist/{tenant-custom-nameservers-CyJZ_AB0.mjs → tenant-custom-nameservers-C4otMBm2.mjs} +1 -1
- package/dist/{tools-D2Xxfkrc.mjs → tools-BHfBOZOU.mjs} +1 -1
- package/dist/{triggers-Dv22ZXM4.mjs → triggers-BEsiiKAf.mjs} +1 -1
- package/dist/{tunnel-BatkLdds.mjs → tunnel-DkMiNtVY.mjs} +1 -1
- package/dist/{tunnels-CstoXOoq.mjs → tunnels-D0J8lJoI.mjs} +1 -1
- package/dist/{turnstile-IoRtama4.mjs → turnstile-CFmtY5bn.mjs} +2 -2
- package/dist/{ui-DjQ4AQww.mjs → ui-DE8CNn6c.mjs} +1 -1
- package/dist/{url-info-Hjhwr2la.mjs → url-info-DBCeRWwb.mjs} +1 -1
- package/dist/{url-normalization-C2BP_Kl0.mjs → url-normalization-ClfFiruK.mjs} +1 -1
- package/dist/{url-scanner-DmYVTdAE.mjs → url-scanner-CNyvg65L.mjs} +1 -1
- package/dist/{user-CVHm-cnB.mjs → user-bifVEQq5.mjs} +2 -2
- package/dist/{values-Cmlw5wGZ.mjs → values-OxkdP1tV.mjs} +1 -1
- package/dist/{vectorize-BQtIqiNO.mjs → vectorize-CVKu7lEt.mjs} +1 -1
- package/dist/{versions-CU6Av1vh.mjs → versions-BVL-Ludh.mjs} +1 -1
- package/dist/waiting-rooms-CmRAl51T.mjs +11 -0
- package/dist/{web-assets-DmSKaxzf.mjs → web-assets-C2s9kzWf.mjs} +1 -1
- package/dist/{web3-DVv4jNul.mjs → web3-y_cY91V_.mjs} +1 -1
- package/dist/{workers-builds-DgrejrUc.mjs → workers-builds-B55-oXOa.mjs} +4 -4
- package/dist/{workers-D8czeT64.mjs → workers-jDcq14GH.mjs} +6 -6
- package/dist/{workflows-BOi5MTEN.mjs → workflows-B-kGHxFu.mjs} +2 -2
- package/dist/{zaraz-CGSSFJng.mjs → zaraz-27zwjLvv.mjs} +1 -1
- package/dist/zero-trust-DV3sIOvu.mjs +92 -0
- package/dist/{zone-Bx5ElO9U.mjs → zone-BJix2KQ9.mjs} +1 -1
- package/dist/{zones-_SnlZMiM.mjs → zones-Bkj5i92c.mjs} +1 -1
- package/package.json +2 -2
- package/dist/account-tags-CKRh1jra.mjs +0 -9
- package/dist/accounts-2pGhN4s8.mjs +0 -28
- package/dist/ai-search-2xP8FP_W.mjs +0 -7
- package/dist/analytics-UQrIx99t.mjs +0 -3
- package/dist/argo-Br60zF3y.mjs +0 -2
- package/dist/artifacts-D8HMRQmb.mjs +0 -4
- package/dist/browser-run-C5pYOwtf.mjs +0 -4
- package/dist/cloudforce-one-Cp4bQmrG.mjs +0 -30
- package/dist/connector-interrupts-BR47snkh.mjs +0 -2
- package/dist/custom-csrs-D0zBkQT5.mjs +0 -4
- package/dist/custom-nameservers-G2MWpRwY.mjs +0 -3
- package/dist/custom-pages-BINNZTds.mjs +0 -4
- package/dist/email-CGOC_evd.mjs +0 -2
- package/dist/email-routing-CRvIUSFm.mjs +0 -6
- package/dist/email-sending-BwRN8PMW.mjs +0 -7
- package/dist/filters-DczM8qpH.mjs +0 -4
- package/dist/firewall-BMiETRmM.mjs +0 -11
- package/dist/load-balancers-Ct5cyyF9.mjs +0 -7
- package/dist/logexplorer-BhsAWxCr.mjs +0 -24
- package/dist/logpush-CFQBi88z.mjs +0 -5
- package/dist/magic-network-monitoring-CY3CHSpX.mjs +0 -4
- package/dist/media-CnxgOViL.mjs +0 -2
- package/dist/mesh-DLNLi3UT.mjs +0 -4
- package/dist/observability-B5p3iwrq.mjs +0 -4
- package/dist/progress-C-oFUtvC.mjs +0 -2
- package/dist/radar-Cu9rsTw_.mjs +0 -2
- package/dist/realtimekit-msnGHBbf.mjs +0 -7
- package/dist/rulesets-BHvhAeG_.mjs +0 -8
- package/dist/sdk-m4xeaua4.mjs +0 -3
- package/dist/security-center-DRC4Mf3R.mjs +0 -2
- package/dist/src-CgAVPA4I.mjs +0 -108
- package/dist/waiting-rooms-ku9UsAr9.mjs +0 -11
- package/dist/zero-trust-BmA0VkgF.mjs +0 -102
- package/dist/zone-tags-izd3WWmy.mjs +0 -9
- /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
- /package/dist/{alerts-B85uj2Vx.mjs → alerts-CRmjqOZi.mjs} +0 -0
- /package/dist/{autorag-Do9l_LyY.mjs → autorag-BD7cu5NU.mjs} +0 -0
- /package/dist/{body-parser-CYD7PKFC.mjs → body-parser-C-c9gfH1.mjs} +0 -0
- /package/dist/{brands-DateHCdd.mjs → brands-BhALBkX2.mjs} +0 -0
- /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-B7bSMYLe.mjs} +0 -0
- /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
- /package/dist/{clear-CB2kgcEB.mjs → clear-BgF8No7D.mjs} +0 -0
- /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-BsTty22w.mjs} +0 -0
- /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C50W5GhA.mjs} +0 -0
- /package/dist/{health-buY5f5pp.mjs → health-BFNZqiAm.mjs} +0 -0
- /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-Bav2M9F-.mjs} +0 -0
- /package/dist/{internal-CwyoJUHh.mjs → internal-BTeSewwB.mjs} +0 -0
- /package/dist/{live-wEpA5V_n.mjs → live-Dkiyu30_.mjs} +0 -0
- /package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BwQqexwo-CNW_dPly.mjs} +0 -0
- /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-Dz-Wv1T0.mjs} +0 -0
- /package/dist/{ready-CBSCPiHE.mjs → ready-TKOkKeRg.mjs} +0 -0
- /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-3Asm6eIi.mjs} +0 -0
- /package/dist/{refute-u7ZPQJZy.mjs → refute-BVz9nMyd.mjs} +0 -0
- /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-CeBbH6Pq.mjs} +0 -0
- /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-ZteA-PUV.mjs} +0 -0
- /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-DWDSyzQ7.mjs} +0 -0
- /package/dist/{search-D9WDwnV4.mjs → search-DGNc37HK.mjs} +0 -0
- /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-B5Qpn2mn.mjs} +0 -0
- /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-FjUolE6A.mjs} +0 -0
- /package/dist/{theme-BePJemMn.mjs → theme-CeVf-5qG.mjs} +0 -0
- /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-NHJj1HGq.mjs} +0 -0
- /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CniKVHIp.mjs} +0 -0
- /package/dist/{verify-2yi0H93r.mjs → verify-DS1PWAJe.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{h as e}from"./oauth-
|
|
2
|
+
import{h as e}from"./oauth-B0ETkNcX.mjs";import{r as t}from"./auth-MQEamPN9.mjs";import{t as n}from"./output-DrpYYfnB.mjs";import{n as r,t as i}from"./progress-CsHIt3Tp.mjs";import{n as a,t as o}from"./body-parser-C-c9gfH1.mjs";import{n as s}from"./prompt-DdegNPpg.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:"Get the custom topic categories defined for the zone. While AI Security for Apps is enabled, it scores every incoming prompt against these topics and writes the scores to the `cf.llm.prompt.custom_topic_categories` field, keyed by topic label. Topics can be configured while the detection is disabled, but no prompt is scored until you enable it.",builder:c,handler:async a=>{if(a.dryRun){r({command:`cf ai-security custom-topics get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.aiSecurity.customTopics.get({zone_id:s})),{successLabel:`Loaded`})}};function u(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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`update`,describe:"Update the custom topic list of the zone, overwriting it entirely with the topics in the request, so include every topic you want to keep. Changes can take up to a minute to propagate. Each entry has a `label`, used to reference the topic in rule expressions and analytics, and a `topic` description, which the classifier scores prompts against while AI Security for Apps is enabled. The following rules apply: - A zone can hold at most 20 topics. - `label` must be 2–20 characters, using only lowercase letters (a–z), digits (0–9), and hyphens. - `topic` must be 2–50 printable ASCII characters. - Labels must be unique within the zone, and so must topic descriptions.",builder:u,handler:async o=>{if(o.dryRun){r({command:`cf ai-security custom-topics update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:o.body===void 0?void 0:a(o.body)});return}let c=await t(o),l=await e({zone:o.zone},c,{quiet:o.quiet});if(o.zoneId=l,!await s({force:!!o.force,message:`This operation overwrites the AI Security for Apps custom topics for a zone.`})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}if(o.body){let e=a(o.body);n(await i(`Deleting`,async()=>c.aiSecurity.customTopics.update({body:e,zone_id:l})),{successLabel:`Deleted`});return}if(o.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},f={command:`custom-topics`,describe:`Organization-specific topic categories used by AI Security for Apps content detection`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:"Get the current AI Security for Apps status for the zone. While enabled, Cloudflare scans prompts sent to endpoints labeled `cf-llm` for personally identifiable information, unsafe topics, and prompt injection attempts.",builder:p,handler:async a=>{if(a.dryRun){r({command:`cf ai-security get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/ai-security/settings`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.aiSecurity.get({zone_id:s})),{successLabel:`Loaded`})}};function h(e){return e.option(`enabled`,{type:`boolean`,description:`Whether AI Security for Apps is enabled on the zone.`}).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:`AI Security for Apps enablement status for a zone.`})}const g={command:`update`,describe:"Update the AI Security for Apps status for the zone, enabling or disabling the detection. The detection results are exposed as `cf.llm.prompt.*` fields for use in custom rules and rate limiting rules; changes can take up to a minute to propagate.",builder:h,handler:async c=>{if(c.dryRun){r({command:`cf ai-security update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/ai-security/settings`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({enabled:c.enabled}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,!await s({force:!!c.force,message:`This operation toggles AI Security for Apps for a zone.`})){process.stderr.write(`Aborted.
|
|
4
4
|
`);return}if(c.body){let e=a(c.body);n(await i(`Deleting`,async()=>l.aiSecurity.update({body:e,zone_id:u})),{successLabel:`Deleted`});return}let d=o({enabled:c.enabled});n(await i(`Deleting`,async()=>l.aiSecurity.update({body:d,zone_id:u})),{successLabel:`Deleted`})}},_={command:`ai-security`,describe:`Detect prompt injection, PII, and unsafe topics in traffic to your AI applications`,builder:e=>e.command(m).command(g).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{_ as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as e}from"./theme-
|
|
2
|
+
import{a as e}from"./theme-CeVf-5qG.mjs";import{n as t,t as n}from"./local-D-aVNu6A.mjs";import{f as r,g as i}from"./oauth-B0ETkNcX.mjs";import{a,o,r as s}from"./auth-MQEamPN9.mjs";import{t as c}from"./output-DrpYYfnB.mjs";import{n as l,t as u}from"./progress-CsHIt3Tp.mjs";import{n as d,t as f}from"./body-parser-C-c9gfH1.mjs";import{n as p,t as m}from"./input-validation-Bav2M9F-.mjs";import{a as h,i as g,n as _}from"./prompt-DdegNPpg.mjs";import{t as v}from"./cli-types-BsTty22w.mjs";import{n as y}from"./raw-fetch-CteyTOM2.mjs";import{a as b,c as x,d as S,i as C,l as ee,n as w,o as T,r as E,s as D,t as O,u as k}from"./schema-flags-iGoOriJt.mjs";const A=`ai-model-schema`;async function j(e,t,n,r){let i=k(A,[t,e]);if(i)return{ok:!0,schema:i};let a;try{let i=await n();if(r===void 0)a=await i.ai.getModelSchema({account_id:t,model:e});else{let n=r-Date.now();if(n<=0)return{ok:!1,reason:`the request timed out`};a=await i.ai.getModelSchema({account_id:t,model:e},{timeoutInSeconds:n/1e3,maxRetries:0})}}catch(e){return{ok:!1,reason:x(e)}}let o=ee(a,`input`);return o?(S(A,[t,e],o),{ok:!0,schema:o}):{ok:!1,reason:`the API returned no input schema`}}const M="Run `cf ai models list` to see the models you can run.",N=[`model-name`,`modelName`];let P;function F(e){return P=e,e.positional(`model-name`,{type:`string`,description:`Model ID, e.g. @cf/meta/llama-3.1-8b-instruct`}).option(`body`,{type:`string`,description:`Raw JSON request body, or @path to a JSON file`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).strictOptions(!1).help(!1).option(`help`,{type:`boolean`,alias:`h`,description:`Show help, including this model's input flags`}).epilogue(`Input flags depend on the model: run \`cf ai run <model> --help\`.\n${M}`)}async function I(n){n.local&&console.log(`${t}\n`),P?.showHelp(`log`);let r=n[`model-name`];if(!r||n.local)return;let i=Date.now()+D,a=await o(i);if(!a){console.log(`\n${e.muted(`Set \`CLOUDFLARE_ACCOUNT_ID\` or sign in with \`cf auth login\` to see the input flags for ${r}.`)}`);return}let c=await j(r,a,()=>s(n),i);console.log(c.ok?`\n${C(b(c.schema),`Input flags for ${r}`)}`:`\n${e.muted(`Could not load the input flags for ${r}: ${c.reason}.`)}`)}const L={command:`run [model-name]`,describe:"Run inference on a Workers AI model. Input flags are model-specific — see `cf ai run <model> --help`",builder:F,handler:async e=>{if(e.help){await I(e);return}if(e.local)throw Error(t);let n=e[`model-name`];if(!n)throw Error(`A model is required: cf ai run <model>. ${M}`);let o=e.dryRun?await i()??`<account-id>`:await r(),f=n.split(`/`).map(encodeURIComponent).join(`/`),p;if(e.body!==void 0){if(T(e,N).length>0)throw Error(`--body cannot be combined with model input flags. Pass one or the other.`);p=d(e.body)}else{let t=await j(n,o,()=>s(e));if(!t.ok)throw Error(`Could not load the input schema for ${n}: ${t.reason}.\nPass the request body directly instead: cf ai run ${n} --body '{…}'`);let r=b(t.schema),i=T(e,[...N,...w(r)]);if(i.length>0)throw Error(`${i.map(e=>`Unknown flag --${e}`).join(`
|
|
3
3
|
`)}\n\nRun \`cf ai run ${n} --help\` for this model's input flags.`);for(let t of E(r,e))t.choices?e[t.name]=await g(t.name,t.description??``,t.choices):t.type===`string`&&(e[t.name]=await h(t.name,t.description??``));let a=O(r,e,{reserved:N});if(a.errors.length>0)throw Error(`${a.errors.join(`
|
|
4
4
|
`)}\n\nRun \`cf ai run ${n} --help\` for this model's input flags.`);p=a.body}if(e.dryRun){l({command:`cf ai run`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${o}/ai/run/${f}`,pathParams:{"model-name":n},bodyKind:`json`,body:p});return}let m=await s(e);e.accountId=o;let _=await u(`Running`,async()=>a(m,`POST`,`/accounts/${o}/ai/run/${f}`,{body:p,preserveNonJsonBytes:!0}));if(Buffer.isBuffer(_)){y(_);return}c(_,{successLabel:`Ran`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`Searches Workers AI models by author or organization name.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf ai authors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/authors/search`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.authors.list({account_id:a})),{successLabel:`Loaded`})}},B={command:`authors`,describe:`Operations for authors`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.positional(`finetune-id`,{type:`string`,description:`Finetune ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Finetune asset file upload.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`file-name`,{type:`string`,description:`Name of the file (adapter_config.json or adapter_model.safetensors).`})}const H={command:`create <finetune-id>`,describe:`Uploads training data assets for a Workers AI fine-tuning job.`,builder:V,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes assets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/${e[`finetune-id`]==null?`<finetune-id>`:encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets`,pathParams:{"finetune-id":String(e[`finetune-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,"file-name":e[`file-name`]}});return}let t=await s(e),o=e.local?n:await r();if(e.accountId=o,e.file!==void 0||e.body!==void 0||e[`file-name`]!==void 0){let n=new FormData;if(e.file){let t=m(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);e[`file-name`]!==void 0&&n.append(`file_name`,String(p(e[`file-name`],`file-name`,`text`)??``)),c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/finetunes/${encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=p(e.body,`body`,`binary`);c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/finetunes/${encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets`,{body:n,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 U(e){return e.positional(`file-name`,{type:`string`,description:`File name`,demandOption:!0}).option(`finetune-id`,{type:`string`,description:`Finetune ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`download <file-name>`,describe:`Returns a pre-signed R2 URL for downloading a finetune asset file.`,builder:U,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes assets download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/${e[`finetune-id`]==null?`<finetune-id>`:encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets/${e[`file-name`]==null?`<file-name>`:encodeURIComponent(String(e[`file-name`]))}`,pathParams:{"finetune-id":String(e[`finetune-id`]??``),"file-name":String(e[`file-name`]??``)},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.finetunes.assets.download({account_id:a,finetune_id:e[`finetune-id`],file_name:e[`file-name`]})),{successLabel:`Loaded`})}},W={command:`assets`,describe:`Operations for finetunes.assets`,builder:e=>e.command(H).command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`model`,{type:`string`,description:`The model field`}).option(`name`,{type:`string`,description:`The name field`}).option(`public`,{type:`boolean`,description:`The public field`,default:!1}).option(`dry-run`,{type:`boolean`,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`,describe:`Creates a new fine-tuning job for a Workers AI model using custom training data.`,builder:G,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({description:p(e.description,`description`,`text`),model:p(e.model,`model`,`text`),name:p(e.name,`name`,`text`),public:e.public}):d(e.body)});return}let t=await s(e),a=e.local?n:await r();if(e.accountId=a,e.body){let n=d(e.body);c(await u(`Creating`,async()=>t.ai.finetunes.create({...n,account_id:a})),{successLabel:`Created`});return}e.model===void 0&&(e.model=await h(`model`,`The model field`)),e.name===void 0&&(e.name=await h(`name`,`The name field`));let o=f({description:p(e.description,`description`,`text`),model:p(e.model,`model`,`text`),name:p(e.name,`name`,`text`),public:e.public});c(await u(`Creating`,async()=>t.ai.finetunes.create({...o,account_id:a})),{successLabel:`Created`})}};function q(e){return e.positional(`finetune-id`,{type:`string`,description:`Finetune 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 J={command:`delete <finetune-id>`,describe:`Delete a finetune. Any in-flight requests referencing the lora will fail after the files are deleted.`,builder:q,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/${e[`finetune-id`]==null?`<finetune-id>`:encodeURIComponent(String(e[`finetune-id`]))}`,pathParams:{"finetune-id":String(e[`finetune-id`]??``)},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();if(e.accountId=a,!await _({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
5
|
`);return}c(await u(`Deleting`,async()=>t.ai.finetunes.delete({account_id:a,finetune_id:e[`finetune-id`]})),{successLabel:`Deleted`})}};function Y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Lists all fine-tuning jobs created by the account, including status and metrics.`,builder:Y,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.finetunes.list({account_id:a})),{successLabel:`Loaded`})}};function Z(e){return e.option(`limit`,{type:`number`,description:`Pagination Limit.`}).option(`offset`,{type:`number`,description:`Pagination Offset.`}).option(`order-by`,{type:`string`,description:`Order By Column Name.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`list`,describe:`Lists publicly available fine-tuned models that can be used with Workers AI.`,builder:Z,handler:async e=>{let t={limit:e.limit,offset:e.offset,orderBy:e[`order-by`]};if(e.dryRun){l({command:`cf ai finetunes public list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/public`,pathParams:{},query:t,bodyKind:`none`});return}let a=await s(e),o=e.local?n:await r();e.accountId=o,c(await u(`Loading`,async()=>a.ai.finetunes.public.list({account_id:o,...t})),{successLabel:`Loaded`})}},ne={command:`public`,describe:`Operations for finetunes.public`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},re={command:`finetunes`,describe:`Operations for finetunes`,builder:e=>e.command(K).command(J).command(X).command(W).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(e){return e.option(`model`,{type:`string`,description:`Model Name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`getModelSchema`,describe:`Retrieves the input and output JSON schema definition for a Workers AI model.`,builder:ie,handler:async e=>{let t={model:e.model};if(e.dryRun){l({command:`cf ai getModelSchema`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/models/schema`,pathParams:{},query:t,bodyKind:`none`});return}let a=await s(e),o=e.local?n:await r();e.accountId=o,c(await u(`Loading`,async()=>a.ai.getModelSchema({account_id:o,...t})),{successLabel:`Loaded`})}};function oe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`listMarkdownSupportedFormats`,describe:`Lists all file formats supported for conversion to Markdown.`,builder:oe,handler:async e=>{if(e.dryRun){l({command:`cf ai listMarkdownSupportedFormats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/tomarkdown/supported`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.listMarkdownSupportedFormats({account_id:a})),{successLabel:`Loaded`})}};function ce(e){return e.option(`per-page`,{type:`number`,description:`Per page`}).option(`page`,{type:`number`,description:`Page`}).option(`task`,{type:`string`,description:`Filter by Task Name.`}).option(`author`,{type:`string`,description:`Filter by Author.`}).option(`source`,{type:`number`,description:`Filter by Source Id.`}).option(`hide-experimental`,{type:`boolean`,description:`Filter to hide experimental models.`}).option(`search`,{type:`string`,description:`Search.`}).option(`include-deprecated`,{type:`boolean`,description:`If true, include models for up to three months after their deprecation date. Defaults to false.`}).option(`format`,{type:`string`,description:`If set, return models in the requested marketplace format instead of the default response.`,choices:[`openrouter`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`list`,describe:`Searches Workers AI models by name or description.`,builder:v(ce),handler:async e=>{let t={per_page:e[`per-page`],page:e.page,task:e.task,author:e.author,source:e.source,hide_experimental:e[`hide-experimental`],search:e.search,include_deprecated:e[`include-deprecated`],format:e.format};if(e.dryRun){l({command:`cf ai models list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/models/search`,pathParams:{},query:t,bodyKind:`none`});return}let a=await s(e),o=e.local?n:await r();e.accountId=o,c(await u(`Loading`,async()=>a.ai.models.list({account_id:o,...t})),{successLabel:`Loaded`})}},ue={command:`models`,describe:`Operations for models`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.positional(`model-name`,{type:`string`,description:`Model name`,demandOption:!0}).option(`text`,{type:`string`,description:`The text that you want to classify`}).option(`guidance`,{type:`number`,description:`Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt`}).option(`height`,{type:`number`,description:`The height of the generated image in pixels`}).option(`image`,{type:`string`,array:!0,description:`For use with img2img tasks. An array of integers that represent the image data constrained to 8-bit unsigned integer values`}).option(`image-b64`,{type:`string`,description:`For use with img2img tasks. A base64-encoded string of the input image`}).option(`mask`,{type:`string`,array:!0,description:`An array representing An array of integers that represent mask image data for inpainting constrained to 8-bit unsigned integer values`}).option(`negative-prompt`,{type:`string`,description:`Text describing elements to avoid in the generated image`}).option(`num-steps`,{type:`number`,description:`The number of diffusion steps; higher values can improve quality but take longer`}).option(`prompt`,{type:`string`,description:`A text description of the image you want to generate`}).option(`seed`,{type:`number`,description:`Random seed for reproducibility of the image generation`}).option(`strength`,{type:`number`,description:`A value between 0 and 1 indicating how strongly to apply the transformation during img2img tasks; lower values make the output closer to the input image`}).option(`width`,{type:`number`,description:`The width of the generated image in pixels`}).option(`lang`,{type:`string`,description:`The speech language (e.g., 'en' for English, 'fr' for French). Defaults to 'en' if not specified`}).option(`source-lang`,{type:`string`,description:`The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified`}).option(`target-lang`,{type:`string`,description:`The language code to translate the text into (e.g., 'es' for Spanish)`}).option(`input-text`,{type:`string`,description:`The text that you want the model to summarize`}).option(`max-length`,{type:`number`,description:`The maximum length of the generated summary in tokens`}).option(`dry-run`,{type:`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(`text`,[`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`input-text`,`max-length`]).conflicts(`guidance`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`height`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`image`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`,`prompt`]).conflicts(`image-b64`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`mask`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`negative-prompt`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`num-steps`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`prompt`,[`text`,`source-lang`,`target-lang`,`input-text`,`max-length`,`image`]).conflicts(`seed`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`strength`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`width`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`lang`,[`text`,`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`seed`,`strength`,`width`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`source-lang`,[`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`input-text`,`max-length`]).conflicts(`target-lang`,[`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`input-text`,`max-length`]).implies(`target-lang`,[`text`]).conflicts(`input-text`,[`text`,`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`source-lang`,`target-lang`]).conflicts(`max-length`,[`text`,`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`source-lang`,`target-lang`])}const fe={command:`runModel <model-name>`,describe:`This endpoint provides users with the capability to run specific AI models on-demand. By submitting the required input data, users can receive real-time predictions or results generated by the chosen AI model. The endpoint supports various AI model types, ensuring flexibility and adaptability for diverse use cases. Model specific inputs available in [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).`,builder:de,handler:async e=>{if(e.dryRun){l({command:`cf ai runModel`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/run/${e[`model-name`]==null?`<model-name>`:encodeURIComponent(String(e[`model-name`]))}`,pathParams:{"model-name":String(e[`model-name`]??``)},bodyKind:`json`,body:e.body===void 0?f({text:p(e.text,`text`,`text`),guidance:e.guidance,height:e.height,image:e.image,image_b64:p(e[`image-b64`],`image-b64`,`text`),mask:e.mask,negative_prompt:p(e[`negative-prompt`],`negative-prompt`,`text`),num_steps:e[`num-steps`],prompt:p(e.prompt,`prompt`,`text`),seed:e.seed,strength:e.strength,width:e.width,lang:p(e.lang,`lang`,`text`),source_lang:p(e[`source-lang`],`source-lang`,`text`),target_lang:p(e[`target-lang`],`target-lang`,`text`),input_text:p(e[`input-text`],`input-text`,`text`),max_length:e[`max-length`]}):d(e.body)});return}let t=await s(e),a=e.local?n:await r();if(e.accountId=a,e.body){let n=d(e.body);c(await u(`Creating`,async()=>t.ai.runModel({body:n,account_id:a,model_name:e[`model-name`]})),{successLabel:`Created`});return}let o=f({text:p(e.text,`text`,`text`),guidance:e.guidance,height:e.height,image:e.image,image_b64:p(e[`image-b64`],`image-b64`,`text`),mask:e.mask,negative_prompt:p(e[`negative-prompt`],`negative-prompt`,`text`),num_steps:e[`num-steps`],prompt:p(e.prompt,`prompt`,`text`),seed:e.seed,strength:e.strength,width:e.width,lang:p(e.lang,`lang`,`text`),source_lang:p(e[`source-lang`],`source-lang`,`text`),target_lang:p(e[`target-lang`],`target-lang`,`text`),input_text:p(e[`input-text`],`input-text`,`text`),max_length:e[`max-length`]});c(await u(`Creating`,async()=>t.ai.runModel({body:o,account_id:a,model_name:e[`model-name`]})),{successLabel:`Created`})}};function pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Searches Workers AI models by task type (e.g., text-generation, embeddings).`,builder:pe,handler:async e=>{if(e.dryRun){l({command:`cf ai tasks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/tasks/search`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.tasks.list({account_id:a})),{successLabel:`Loaded`})}},me={command:`tasks`,describe:`Operations for tasks`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`files`,{type:`string`,description:`The files`})}const ge={command:`toMarkdown`,describe:`Converts uploaded files into Markdown format using Workers AI.`,builder:he,handler:async e=>{if(e.dryRun){l({command:`cf ai toMarkdown`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/tomarkdown`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file,files:e.files}});return}let t=await s(e),o=e.local?n:await r();if(e.accountId=o,e.file!==void 0||e.body!==void 0||e.files!==void 0){let n=new FormData;if(e.file){let t=m(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);if(e.files!==void 0){let t=typeof e.files==`string`?p(e.files,`files`,`text`):e.files;n.append(`files`,typeof t==`string`?t:JSON.stringify(t))}c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/tomarkdown`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=p(e.body,`body`,`binary`);c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/tomarkdown`,{body:n,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.`)}},_e={command:`ai`,describe:`ai`,builder:e=>e.command(ae).command(se).command(L).command(fe).command(ge).command(B).command(re).command(ue).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{_e as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
3
|
-
`);return}i(await o(`Deleting`,async()=>c.alerting.destinations.pagerduty.delete({account_id:l})),{successLabel:`Deleted`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get a list of all configured PagerDuty services.`,builder:w,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.pagerduty.get({account_id:l})),{successLabel:`Loaded`})}};function E(e){return e.positional(`token-id`,{type:`string`,description:`The token integration key`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`link <token-id>`,describe:`Links PagerDuty with the account using the integration token.`,builder:E,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty link`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect/${s[`token-id`]==null?`<token-id>`:encodeURIComponent(String(s[`token-id`]))}`,pathParams:{"token-id":String(s[`token-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.pagerduty.link({account_id:l,token_id:s[`token-id`]})),{successLabel:`Loaded`})}},O={command:`pagerduty`,describe:`Operations for destinations.pagerduty`,builder:e=>e.command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const A={command:`create`,describe:`Creates a new webhook destination.`,builder:k,handler:async d=>{if(d.dryRun){a({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.alerting.destinations.webhooks.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),d.url===void 0&&(d.url=await u(`url`,`The POST endpoint to call when dispatching a notification.`));let m=c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)});i(await o(`Creating`,async()=>f.alerting.destinations.webhooks.create({...m,account_id:p})),{successLabel:`Created`})}};function j(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,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 M={command:`delete <webhook-id>`,describe:`Delete a configured webhook destination.`,builder:j,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}i(await o(`Deleting`,async()=>c.alerting.destinations.webhooks.delete({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Deleted`})}};function N(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <webhook-id>`,describe:`Get details for a single webhooks destination.`,builder:N,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.webhooks.get({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Loaded`})}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`Gets a list of all configured webhook destinations.`,builder:F,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.webhooks.list({account_id:l})),{successLabel:`Loaded`})}};function L(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`update <webhook-id>`,describe:`Update a webhook destination.`,builder:L,handler:async d=>{if(d.dryRun){a({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${d[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(d[`webhook-id`]))}`,pathParams:{"webhook-id":String(d[`webhook-id`]??``)},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Updating`,async()=>f.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:d[`webhook-id`]})),{successLabel:`Updated`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),d.url===void 0&&(d.url=await u(`url`,`The POST endpoint to call when dispatching a notification.`));let m=c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)});i(await o(`Updating`,async()=>f.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:d[`webhook-id`]})),{successLabel:`Updated`})}},z={command:`webhooks`,describe:`Operations for destinations.webhooks`,builder:e=>e.command(A).command(M).command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(y).command(O).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`before`,{type:`string`,description:`Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`since`,{type:`string`,description:`Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`list`,describe:"Gets a list of history records for notifications sent to an account. The records are displayed for last `x` number of days based on the zone plan (free = 30, pro = 30, biz = 30, ent = 90).",builder:V,handler:async s=>{let c={per_page:s[`per-page`],before:s.before,page:s.page,since:s.since};if(s.dryRun){a({command:`cf alerting history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.alerting.history.list({account_id:u,...c})),{successLabel:`Loaded`})}},U={command:`history`,describe:`Operations for history`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`,default:!0}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Creates a new Notification policy.`,builder:te,handler:async f=>{if(f.dryRun){a({command:`cf alerting policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`json`,body:f.body===void 0?c({alert_interval:l(f[`alert-interval`],`alert-interval`,`text`),alert_type:l(f[`alert-type`],`alert-type`,`text`),description:l(f.description,`description`,`text`),enabled:f.enabled,filters:{actions:f[`filters-actions`],affected_asns:f[`filters-affected-asns`],affected_components:f[`filters-affected-components`],affected_locations:f[`filters-affected-locations`],airport_code:f[`filters-airport-code`],alert_trigger_preferences:f[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:f[`filters-alert-trigger-preferences-value`],enabled:f[`filters-enabled`],environment:f[`filters-environment`],event:f[`filters-event`],event_source:f[`filters-event-source`],event_type:f[`filters-event-type`],group_by:f[`filters-group-by`],health_check_id:f[`filters-health-check-id`],incident_impact:f[`filters-incident-impact`],input_id:f[`filters-input-id`],insight_class:f[`filters-insight-class`],limit:f[`filters-limit`],logo_tag:f[`filters-logo-tag`],megabits_per_second:f[`filters-megabits-per-second`],new_health:f[`filters-new-health`],new_status:f[`filters-new-status`],packets_per_second:f[`filters-packets-per-second`],pool_id:f[`filters-pool-id`],pop_names:f[`filters-pop-names`],product:f[`filters-product`],project_id:f[`filters-project-id`],protocol:f[`filters-protocol`],query_tag:f[`filters-query-tag`],requests_per_second:f[`filters-requests-per-second`],selectors:f[`filters-selectors`],services:f[`filters-services`],slo:f[`filters-slo`],status:f[`filters-status`],target_hostname:f[`filters-target-hostname`],target_ip:f[`filters-target-ip`],target_zone_name:f[`filters-target-zone-name`],traffic_exclusions:f[`filters-traffic-exclusions`],tunnel_id:f[`filters-tunnel-id`],tunnel_name:f[`filters-tunnel-name`],type:f[`filters-type`],where:f[`filters-where`],zones:f[`filters-zones`]},name:l(f.name,`name`,`text`)}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Creating`,async()=>p.alerting.policies.create({...e,account_id:m})),{successLabel:`Created`});return}if(f[`alert-type`]===void 0&&(f[`alert-type`]=await d(`alert-type`,`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`))),f.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);f.name===void 0&&(f.name=await u(`name`,`Name of the policy.`));let h=c({alert_interval:l(f[`alert-interval`],`alert-interval`,`text`),alert_type:l(f[`alert-type`],`alert-type`,`text`),description:l(f.description,`description`,`text`),enabled:f.enabled,filters:{actions:f[`filters-actions`],affected_asns:f[`filters-affected-asns`],affected_components:f[`filters-affected-components`],affected_locations:f[`filters-affected-locations`],airport_code:f[`filters-airport-code`],alert_trigger_preferences:f[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:f[`filters-alert-trigger-preferences-value`],enabled:f[`filters-enabled`],environment:f[`filters-environment`],event:f[`filters-event`],event_source:f[`filters-event-source`],event_type:f[`filters-event-type`],group_by:f[`filters-group-by`],health_check_id:f[`filters-health-check-id`],incident_impact:f[`filters-incident-impact`],input_id:f[`filters-input-id`],insight_class:f[`filters-insight-class`],limit:f[`filters-limit`],logo_tag:f[`filters-logo-tag`],megabits_per_second:f[`filters-megabits-per-second`],new_health:f[`filters-new-health`],new_status:f[`filters-new-status`],packets_per_second:f[`filters-packets-per-second`],pool_id:f[`filters-pool-id`],pop_names:f[`filters-pop-names`],product:f[`filters-product`],project_id:f[`filters-project-id`],protocol:f[`filters-protocol`],query_tag:f[`filters-query-tag`],requests_per_second:f[`filters-requests-per-second`],selectors:f[`filters-selectors`],services:f[`filters-services`],slo:f[`filters-slo`],status:f[`filters-status`],target_hostname:f[`filters-target-hostname`],target_ip:f[`filters-target-ip`],target_zone_name:f[`filters-target-zone-name`],traffic_exclusions:f[`filters-traffic-exclusions`],tunnel_id:f[`filters-tunnel-id`],tunnel_name:f[`filters-tunnel-name`],type:f[`filters-type`],where:f[`filters-where`],zones:f[`filters-zones`]},name:l(f.name,`name`,`text`)});i(await o(`Creating`,async()=>p.alerting.policies.create({...h,account_id:m})),{successLabel:`Created`})}};function G(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <policy-id>`,describe:`Delete a Notification policy.`,builder:G,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}i(await o(`Deleting`,async()=>c.alerting.policies.delete({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Deleted`})}};function q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`email`,{type:`string`,description:`Email`,demandOption:!0}).option(`token`,{type:`string`,description:`Token`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`details <policy-id>`,describe:`Shows details for unsubscribing an email address from a notification policy.`,builder:q,handler:async i=>{let s={email:i.email,token:i.token};if(i.dryRun){a({command:`cf alerting policies email details`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${i[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe`,pathParams:{"policy-id":String(i[`policy-id`]??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();p((await o(`Loading`,async()=>m(`/accounts/${c}/alerting/v3/policies/${encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe${l?`?`+l:``}`,{method:`GET`,local:i.local===!0,persistTo:i.persistTo}))).toString(`utf-8`))}};function Y(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`email`,{type:`string`,description:`Email`,demandOption:!0}).option(`token`,{type:`string`,description:`Token`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`unsubscribe <policy-id>`,describe:`Unsubscribes an email address from a notification policy.`,builder:Y,handler:async i=>{let s={email:i.email,token:i.token};if(i.dryRun){a({command:`cf alerting policies email unsubscribe`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${i[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe`,pathParams:{"policy-id":String(i[`policy-id`]??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();p((await o(`Creating`,async()=>m(`/accounts/${c}/alerting/v3/policies/${encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe${l?`?`+l:``}`,{method:`POST`,local:i.local===!0,persistTo:i.persistTo}))).toString(`utf-8`))}},Z={command:`email`,describe:`Operations for policies.email`,builder:e=>e.command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`get <policy-id>`,describe:`Get details for a single policy.`,builder:Q,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.policies.get({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Loaded`})}};function re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`Get a list of all Notification policies.`,builder:re,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.policies.list({account_id:l})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`severity`,{type:`number`,description:`Severity level for the test alert. Defaults to INFO (1) if omitted.`}).option(`source`,{type:`string`,description:`Source identifier for the test alert.`}).option(`state-correlation-id`,{type:`string`,description:`Correlation ID for stateful test alerts. Required when state_event is set.`}).option(`state-event`,{type:`number`,description:`State event type for stateful test alerts. Use with state_correlation_id.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Optional configuration for the test notification. When omitted, a default INFO-severity test alert is sent.`})}const oe={command:`test <policy-id>`,describe:`Send a test notification for a policy to verify delivery mechanisms are working as expected.`,builder:ae,handler:async u=>{if(u.dryRun){a({command:`cf alerting policies test`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${u[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(u[`policy-id`]))}/test`,pathParams:{"policy-id":String(u[`policy-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({severity:u.severity,source:l(u.source,`source`,`text`),state_correlation_id:l(u[`state-correlation-id`],`state-correlation-id`,`text`),state_event:u[`state-event`]}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.alerting.policies.test({...e,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Created`});return}let p=c({severity:u.severity,source:l(u.source,`source`,`text`),state_correlation_id:l(u[`state-correlation-id`],`state-correlation-id`,`text`),state_event:u[`state-event`]});i(await o(`Creating`,async()=>d.alerting.policies.test({...p,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Created`})}};function se(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`update <policy-id>`,describe:`Update a Notification policy.`,builder:se,handler:async u=>{if(u.dryRun){a({command:`cf alerting policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${u[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(u[`policy-id`]))}`,pathParams:{"policy-id":String(u[`policy-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({alert_interval:l(u[`alert-interval`],`alert-interval`,`text`),alert_type:l(u[`alert-type`],`alert-type`,`text`),description:l(u.description,`description`,`text`),enabled:u.enabled,filters:{actions:u[`filters-actions`],affected_asns:u[`filters-affected-asns`],affected_components:u[`filters-affected-components`],affected_locations:u[`filters-affected-locations`],airport_code:u[`filters-airport-code`],alert_trigger_preferences:u[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:u[`filters-alert-trigger-preferences-value`],enabled:u[`filters-enabled`],environment:u[`filters-environment`],event:u[`filters-event`],event_source:u[`filters-event-source`],event_type:u[`filters-event-type`],group_by:u[`filters-group-by`],health_check_id:u[`filters-health-check-id`],incident_impact:u[`filters-incident-impact`],input_id:u[`filters-input-id`],insight_class:u[`filters-insight-class`],limit:u[`filters-limit`],logo_tag:u[`filters-logo-tag`],megabits_per_second:u[`filters-megabits-per-second`],new_health:u[`filters-new-health`],new_status:u[`filters-new-status`],packets_per_second:u[`filters-packets-per-second`],pool_id:u[`filters-pool-id`],pop_names:u[`filters-pop-names`],product:u[`filters-product`],project_id:u[`filters-project-id`],protocol:u[`filters-protocol`],query_tag:u[`filters-query-tag`],requests_per_second:u[`filters-requests-per-second`],selectors:u[`filters-selectors`],services:u[`filters-services`],slo:u[`filters-slo`],status:u[`filters-status`],target_hostname:u[`filters-target-hostname`],target_ip:u[`filters-target-ip`],target_zone_name:u[`filters-target-zone-name`],traffic_exclusions:u[`filters-traffic-exclusions`],tunnel_id:u[`filters-tunnel-id`],tunnel_name:u[`filters-tunnel-name`],type:u[`filters-type`],where:u[`filters-where`],zones:u[`filters-zones`]},name:l(u.name,`name`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.alerting.policies.update({...e,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Updated`});return}let p=c({alert_interval:l(u[`alert-interval`],`alert-interval`,`text`),alert_type:l(u[`alert-type`],`alert-type`,`text`),description:l(u.description,`description`,`text`),enabled:u.enabled,filters:{actions:u[`filters-actions`],affected_asns:u[`filters-affected-asns`],affected_components:u[`filters-affected-components`],affected_locations:u[`filters-affected-locations`],airport_code:u[`filters-airport-code`],alert_trigger_preferences:u[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:u[`filters-alert-trigger-preferences-value`],enabled:u[`filters-enabled`],environment:u[`filters-environment`],event:u[`filters-event`],event_source:u[`filters-event-source`],event_type:u[`filters-event-type`],group_by:u[`filters-group-by`],health_check_id:u[`filters-health-check-id`],incident_impact:u[`filters-incident-impact`],input_id:u[`filters-input-id`],insight_class:u[`filters-insight-class`],limit:u[`filters-limit`],logo_tag:u[`filters-logo-tag`],megabits_per_second:u[`filters-megabits-per-second`],new_health:u[`filters-new-health`],new_status:u[`filters-new-status`],packets_per_second:u[`filters-packets-per-second`],pool_id:u[`filters-pool-id`],pop_names:u[`filters-pop-names`],product:u[`filters-product`],project_id:u[`filters-project-id`],protocol:u[`filters-protocol`],query_tag:u[`filters-query-tag`],requests_per_second:u[`filters-requests-per-second`],selectors:u[`filters-selectors`],services:u[`filters-services`],slo:u[`filters-slo`],status:u[`filters-status`],target_hostname:u[`filters-target-hostname`],target_ip:u[`filters-target-ip`],target_zone_name:u[`filters-target-zone-name`],traffic_exclusions:u[`filters-traffic-exclusions`],tunnel_id:u[`filters-tunnel-id`],tunnel_name:u[`filters-tunnel-name`],type:u[`filters-type`],where:u[`filters-where`],zones:u[`filters-zones`]},name:l(u.name,`name`,`text`)});i(await o(`Updating`,async()=>d.alerting.policies.update({...p,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Updated`})}},le={command:`policies`,describe:`Operations for policies`,builder:e=>e.command(W).command(K).command(ne).command(ie).command(oe).command(ce).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ue(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const de={command:`create`,describe:`Creates a new silence for an account.`,builder:ue,handler:async c=>{if(c.dryRun){a({command:`cf alerting silences create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,c.body){let e=s(c.body);i(await o(`Creating`,async()=>l.alerting.silences.create({body:e,account_id:u})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function fe(e){return e.positional(`silence-id`,{type:`string`,description:`Silence 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 pe={command:`delete <silence-id>`,describe:`Deletes an existing silence for an account.`,builder:fe,handler:async s=>{if(s.dryRun){a({command:`cf alerting silences delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences/${s[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(s[`silence-id`]))}`,pathParams:{"silence-id":String(s[`silence-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
|
|
2
|
+
import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{r}from"./auth-MQEamPN9.mjs";import{t as i}from"./output-DrpYYfnB.mjs";import{n as a,t as o}from"./progress-CsHIt3Tp.mjs";import{n as s,t as c}from"./body-parser-C-c9gfH1.mjs";import{n as l}from"./input-validation-Bav2M9F-.mjs";import{a as u,i as d,n as f}from"./prompt-DdegNPpg.mjs";import{n as p,t as m}from"./raw-fetch-CteyTOM2.mjs";function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`Gets a list of all alert types for which an account is eligible.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.availableAlerts.list({account_id:l})),{successLabel:`Loaded`})}},g={command:`available-alerts`,describe:`Operations for available-alerts`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get a list of all delivery mechanism types for which an account is eligible.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations eligible get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/eligible`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.eligible.get({account_id:l})),{successLabel:`Loaded`})}},y={command:`eligible`,describe:`Operations for destinations.eligible`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`create`,describe:`Creates a new token for integrating with PagerDuty.`,builder:b,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.alerting.destinations.pagerduty.create({account_id:l})),{successLabel:`Created`})}};function S(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 C={command:`delete`,describe:`Deletes all the PagerDuty Services connected to the account.`,builder:S,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force,message:`This operation deletes all PagerDuty services connected to the account.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>c.alerting.destinations.pagerduty.delete({account_id:l})),{successLabel:`Deleted`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get a list of all configured PagerDuty services.`,builder:w,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.pagerduty.get({account_id:l})),{successLabel:`Loaded`})}};function E(e){return e.positional(`token-id`,{type:`string`,description:`The token integration key`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`link <token-id>`,describe:`Links PagerDuty with the account using the integration token.`,builder:E,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty link`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect/${s[`token-id`]==null?`<token-id>`:encodeURIComponent(String(s[`token-id`]))}`,pathParams:{"token-id":String(s[`token-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.pagerduty.link({account_id:l,token_id:s[`token-id`]})),{successLabel:`Loaded`})}},O={command:`pagerduty`,describe:`Operations for destinations.pagerduty`,builder:e=>e.command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const A={command:`create`,describe:`Creates a new webhook destination.`,builder:k,handler:async d=>{if(d.dryRun){a({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.alerting.destinations.webhooks.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),d.url===void 0&&(d.url=await u(`url`,`The POST endpoint to call when dispatching a notification.`));let m=c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)});i(await o(`Creating`,async()=>f.alerting.destinations.webhooks.create({...m,account_id:p})),{successLabel:`Created`})}};function j(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,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 M={command:`delete <webhook-id>`,describe:`Delete a configured webhook destination.`,builder:j,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force,message:`This operation deletes the webhook destination.`})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}i(await o(`Deleting`,async()=>c.alerting.destinations.webhooks.delete({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Deleted`})}};function N(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <webhook-id>`,describe:`Get details for a single webhooks destination.`,builder:N,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.webhooks.get({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Loaded`})}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`Gets a list of all configured webhook destinations.`,builder:F,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.webhooks.list({account_id:l})),{successLabel:`Loaded`})}};function L(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`update <webhook-id>`,describe:`Update a webhook destination.`,builder:L,handler:async d=>{if(d.dryRun){a({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${d[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(d[`webhook-id`]))}`,pathParams:{"webhook-id":String(d[`webhook-id`]??``)},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Updating`,async()=>f.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:d[`webhook-id`]})),{successLabel:`Updated`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),d.url===void 0&&(d.url=await u(`url`,`The POST endpoint to call when dispatching a notification.`));let m=c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)});i(await o(`Updating`,async()=>f.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:d[`webhook-id`]})),{successLabel:`Updated`})}},z={command:`webhooks`,describe:`Operations for destinations.webhooks`,builder:e=>e.command(A).command(M).command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(y).command(O).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`before`,{type:`string`,description:`Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`since`,{type:`string`,description:`Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`list`,describe:"Gets a list of history records for notifications sent to an account. The records are displayed for last `x` number of days based on the zone plan (free = 30, pro = 30, biz = 30, ent = 90).",builder:V,handler:async s=>{let c={per_page:s[`per-page`],before:s.before,page:s.page,since:s.since};if(s.dryRun){a({command:`cf alerting history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.alerting.history.list({account_id:u,...c})),{successLabel:`Loaded`})}},U={command:`history`,describe:`Operations for history`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`,default:!0}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Creates a new Notification policy.`,builder:te,handler:async f=>{if(f.dryRun){a({command:`cf alerting policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`json`,body:f.body===void 0?c({alert_interval:l(f[`alert-interval`],`alert-interval`,`text`),alert_type:l(f[`alert-type`],`alert-type`,`text`),description:l(f.description,`description`,`text`),enabled:f.enabled,filters:{actions:f[`filters-actions`],affected_asns:f[`filters-affected-asns`],affected_components:f[`filters-affected-components`],affected_locations:f[`filters-affected-locations`],airport_code:f[`filters-airport-code`],alert_trigger_preferences:f[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:f[`filters-alert-trigger-preferences-value`],enabled:f[`filters-enabled`],environment:f[`filters-environment`],event:f[`filters-event`],event_source:f[`filters-event-source`],event_type:f[`filters-event-type`],group_by:f[`filters-group-by`],health_check_id:f[`filters-health-check-id`],incident_impact:f[`filters-incident-impact`],input_id:f[`filters-input-id`],insight_class:f[`filters-insight-class`],limit:f[`filters-limit`],logo_tag:f[`filters-logo-tag`],megabits_per_second:f[`filters-megabits-per-second`],new_health:f[`filters-new-health`],new_status:f[`filters-new-status`],packets_per_second:f[`filters-packets-per-second`],pool_id:f[`filters-pool-id`],pop_names:f[`filters-pop-names`],product:f[`filters-product`],project_id:f[`filters-project-id`],protocol:f[`filters-protocol`],query_tag:f[`filters-query-tag`],requests_per_second:f[`filters-requests-per-second`],selectors:f[`filters-selectors`],services:f[`filters-services`],slo:f[`filters-slo`],status:f[`filters-status`],target_hostname:f[`filters-target-hostname`],target_ip:f[`filters-target-ip`],target_zone_name:f[`filters-target-zone-name`],traffic_exclusions:f[`filters-traffic-exclusions`],tunnel_id:f[`filters-tunnel-id`],tunnel_name:f[`filters-tunnel-name`],type:f[`filters-type`],where:f[`filters-where`],zones:f[`filters-zones`]},name:l(f.name,`name`,`text`)}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Creating`,async()=>p.alerting.policies.create({...e,account_id:m})),{successLabel:`Created`});return}if(f[`alert-type`]===void 0&&(f[`alert-type`]=await d(`alert-type`,`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`))),f.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);f.name===void 0&&(f.name=await u(`name`,`Name of the policy.`));let h=c({alert_interval:l(f[`alert-interval`],`alert-interval`,`text`),alert_type:l(f[`alert-type`],`alert-type`,`text`),description:l(f.description,`description`,`text`),enabled:f.enabled,filters:{actions:f[`filters-actions`],affected_asns:f[`filters-affected-asns`],affected_components:f[`filters-affected-components`],affected_locations:f[`filters-affected-locations`],airport_code:f[`filters-airport-code`],alert_trigger_preferences:f[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:f[`filters-alert-trigger-preferences-value`],enabled:f[`filters-enabled`],environment:f[`filters-environment`],event:f[`filters-event`],event_source:f[`filters-event-source`],event_type:f[`filters-event-type`],group_by:f[`filters-group-by`],health_check_id:f[`filters-health-check-id`],incident_impact:f[`filters-incident-impact`],input_id:f[`filters-input-id`],insight_class:f[`filters-insight-class`],limit:f[`filters-limit`],logo_tag:f[`filters-logo-tag`],megabits_per_second:f[`filters-megabits-per-second`],new_health:f[`filters-new-health`],new_status:f[`filters-new-status`],packets_per_second:f[`filters-packets-per-second`],pool_id:f[`filters-pool-id`],pop_names:f[`filters-pop-names`],product:f[`filters-product`],project_id:f[`filters-project-id`],protocol:f[`filters-protocol`],query_tag:f[`filters-query-tag`],requests_per_second:f[`filters-requests-per-second`],selectors:f[`filters-selectors`],services:f[`filters-services`],slo:f[`filters-slo`],status:f[`filters-status`],target_hostname:f[`filters-target-hostname`],target_ip:f[`filters-target-ip`],target_zone_name:f[`filters-target-zone-name`],traffic_exclusions:f[`filters-traffic-exclusions`],tunnel_id:f[`filters-tunnel-id`],tunnel_name:f[`filters-tunnel-name`],type:f[`filters-type`],where:f[`filters-where`],zones:f[`filters-zones`]},name:l(f.name,`name`,`text`)});i(await o(`Creating`,async()=>p.alerting.policies.create({...h,account_id:m})),{successLabel:`Created`})}};function G(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <policy-id>`,describe:`Delete a Notification policy.`,builder:G,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force,message:`This operation deletes the notification policy.`})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}i(await o(`Deleting`,async()=>c.alerting.policies.delete({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Deleted`})}};function q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`email`,{type:`string`,description:`Email`,demandOption:!0}).option(`token`,{type:`string`,description:`Token`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`details <policy-id>`,describe:`Shows details for unsubscribing an email address from a notification policy.`,builder:q,handler:async i=>{let s={email:i.email,token:i.token};if(i.dryRun){a({command:`cf alerting policies email details`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${i[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe`,pathParams:{"policy-id":String(i[`policy-id`]??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();p((await o(`Loading`,async()=>m(`/accounts/${c}/alerting/v3/policies/${encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe${l?`?`+l:``}`,{method:`GET`,local:i.local===!0,persistTo:i.persistTo}))).toString(`utf-8`))}};function Y(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`email`,{type:`string`,description:`Email`,demandOption:!0}).option(`token`,{type:`string`,description:`Token`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`unsubscribe <policy-id>`,describe:`Unsubscribes an email address from a notification policy.`,builder:Y,handler:async i=>{let s={email:i.email,token:i.token};if(i.dryRun){a({command:`cf alerting policies email unsubscribe`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${i[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe`,pathParams:{"policy-id":String(i[`policy-id`]??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();p((await o(`Creating`,async()=>m(`/accounts/${c}/alerting/v3/policies/${encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe${l?`?`+l:``}`,{method:`POST`,local:i.local===!0,persistTo:i.persistTo}))).toString(`utf-8`))}},Z={command:`email`,describe:`Operations for policies.email`,builder:e=>e.command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`get <policy-id>`,describe:`Get details for a single policy.`,builder:Q,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.policies.get({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Loaded`})}};function re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`Get a list of all Notification policies.`,builder:re,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.policies.list({account_id:l})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`severity`,{type:`number`,description:`Severity level for the test alert. Defaults to INFO (1) if omitted.`}).option(`source`,{type:`string`,description:`Source identifier for the test alert.`}).option(`state-correlation-id`,{type:`string`,description:`Correlation ID for stateful test alerts. Required when state_event is set.`}).option(`state-event`,{type:`number`,description:`State event type for stateful test alerts. Use with state_correlation_id.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Optional configuration for the test notification. When omitted, a default INFO-severity test alert is sent.`})}const oe={command:`test <policy-id>`,describe:`Send a test notification for a policy to verify delivery mechanisms are working as expected.`,builder:ae,handler:async u=>{if(u.dryRun){a({command:`cf alerting policies test`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${u[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(u[`policy-id`]))}/test`,pathParams:{"policy-id":String(u[`policy-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({severity:u.severity,source:l(u.source,`source`,`text`),state_correlation_id:l(u[`state-correlation-id`],`state-correlation-id`,`text`),state_event:u[`state-event`]}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.alerting.policies.test({...e,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Created`});return}let p=c({severity:u.severity,source:l(u.source,`source`,`text`),state_correlation_id:l(u[`state-correlation-id`],`state-correlation-id`,`text`),state_event:u[`state-event`]});i(await o(`Creating`,async()=>d.alerting.policies.test({...p,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Created`})}};function se(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`update <policy-id>`,describe:`Update a Notification policy.`,builder:se,handler:async u=>{if(u.dryRun){a({command:`cf alerting policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${u[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(u[`policy-id`]))}`,pathParams:{"policy-id":String(u[`policy-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({alert_interval:l(u[`alert-interval`],`alert-interval`,`text`),alert_type:l(u[`alert-type`],`alert-type`,`text`),description:l(u.description,`description`,`text`),enabled:u.enabled,filters:{actions:u[`filters-actions`],affected_asns:u[`filters-affected-asns`],affected_components:u[`filters-affected-components`],affected_locations:u[`filters-affected-locations`],airport_code:u[`filters-airport-code`],alert_trigger_preferences:u[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:u[`filters-alert-trigger-preferences-value`],enabled:u[`filters-enabled`],environment:u[`filters-environment`],event:u[`filters-event`],event_source:u[`filters-event-source`],event_type:u[`filters-event-type`],group_by:u[`filters-group-by`],health_check_id:u[`filters-health-check-id`],incident_impact:u[`filters-incident-impact`],input_id:u[`filters-input-id`],insight_class:u[`filters-insight-class`],limit:u[`filters-limit`],logo_tag:u[`filters-logo-tag`],megabits_per_second:u[`filters-megabits-per-second`],new_health:u[`filters-new-health`],new_status:u[`filters-new-status`],packets_per_second:u[`filters-packets-per-second`],pool_id:u[`filters-pool-id`],pop_names:u[`filters-pop-names`],product:u[`filters-product`],project_id:u[`filters-project-id`],protocol:u[`filters-protocol`],query_tag:u[`filters-query-tag`],requests_per_second:u[`filters-requests-per-second`],selectors:u[`filters-selectors`],services:u[`filters-services`],slo:u[`filters-slo`],status:u[`filters-status`],target_hostname:u[`filters-target-hostname`],target_ip:u[`filters-target-ip`],target_zone_name:u[`filters-target-zone-name`],traffic_exclusions:u[`filters-traffic-exclusions`],tunnel_id:u[`filters-tunnel-id`],tunnel_name:u[`filters-tunnel-name`],type:u[`filters-type`],where:u[`filters-where`],zones:u[`filters-zones`]},name:l(u.name,`name`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.alerting.policies.update({...e,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Updated`});return}let p=c({alert_interval:l(u[`alert-interval`],`alert-interval`,`text`),alert_type:l(u[`alert-type`],`alert-type`,`text`),description:l(u.description,`description`,`text`),enabled:u.enabled,filters:{actions:u[`filters-actions`],affected_asns:u[`filters-affected-asns`],affected_components:u[`filters-affected-components`],affected_locations:u[`filters-affected-locations`],airport_code:u[`filters-airport-code`],alert_trigger_preferences:u[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:u[`filters-alert-trigger-preferences-value`],enabled:u[`filters-enabled`],environment:u[`filters-environment`],event:u[`filters-event`],event_source:u[`filters-event-source`],event_type:u[`filters-event-type`],group_by:u[`filters-group-by`],health_check_id:u[`filters-health-check-id`],incident_impact:u[`filters-incident-impact`],input_id:u[`filters-input-id`],insight_class:u[`filters-insight-class`],limit:u[`filters-limit`],logo_tag:u[`filters-logo-tag`],megabits_per_second:u[`filters-megabits-per-second`],new_health:u[`filters-new-health`],new_status:u[`filters-new-status`],packets_per_second:u[`filters-packets-per-second`],pool_id:u[`filters-pool-id`],pop_names:u[`filters-pop-names`],product:u[`filters-product`],project_id:u[`filters-project-id`],protocol:u[`filters-protocol`],query_tag:u[`filters-query-tag`],requests_per_second:u[`filters-requests-per-second`],selectors:u[`filters-selectors`],services:u[`filters-services`],slo:u[`filters-slo`],status:u[`filters-status`],target_hostname:u[`filters-target-hostname`],target_ip:u[`filters-target-ip`],target_zone_name:u[`filters-target-zone-name`],traffic_exclusions:u[`filters-traffic-exclusions`],tunnel_id:u[`filters-tunnel-id`],tunnel_name:u[`filters-tunnel-name`],type:u[`filters-type`],where:u[`filters-where`],zones:u[`filters-zones`]},name:l(u.name,`name`,`text`)});i(await o(`Updating`,async()=>d.alerting.policies.update({...p,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Updated`})}},le={command:`policies`,describe:`Operations for policies`,builder:e=>e.command(W).command(K).command(ne).command(ie).command(oe).command(ce).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ue(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const de={command:`create`,describe:`Creates a new silence for an account.`,builder:ue,handler:async c=>{if(c.dryRun){a({command:`cf alerting silences create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,c.body){let e=s(c.body);i(await o(`Creating`,async()=>l.alerting.silences.create({body:e,account_id:u})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function fe(e){return e.positional(`silence-id`,{type:`string`,description:`Silence 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 pe={command:`delete <silence-id>`,describe:`Deletes an existing silence for an account.`,builder:fe,handler:async s=>{if(s.dryRun){a({command:`cf alerting silences delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences/${s[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(s[`silence-id`]))}`,pathParams:{"silence-id":String(s[`silence-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force,message:`This operation deletes the notification silence.`})){process.stderr.write(`Aborted.
|
|
6
6
|
`);return}i(await o(`Deleting`,async()=>c.alerting.silences.delete({account_id:l,silence_id:s[`silence-id`]})),{successLabel:`Deleted`})}};function $(e){return e.positional(`silence-id`,{type:`string`,description:`Silence ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`get <silence-id>`,describe:`Gets a specific silence for an account.`,builder:$,handler:async s=>{if(s.dryRun){a({command:`cf alerting silences get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences/${s[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(s[`silence-id`]))}`,pathParams:{"silence-id":String(s[`silence-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.silences.get({account_id:l,silence_id:s[`silence-id`]})),{successLabel:`Loaded`})}};function he(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`list`,describe:`Gets a list of silences for an account.`,builder:he,handler:async s=>{if(s.dryRun){a({command:`cf alerting silences list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.silences.list({account_id:l})),{successLabel:`Loaded`})}};function _e(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ve={command:`update`,describe:`Updates existing silences for an account.`,builder:_e,handler:async c=>{if(c.dryRun){a({command:`cf alerting silences update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,c.body){let e=s(c.body);i(await o(`Updating`,async()=>l.alerting.silences.update({body:e,account_id:u})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ye={command:`silences`,describe:`Operations for silences`,builder:e=>e.command(de).command(pe).command(me).command(ge).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},be={command:`alerting`,describe:`alerting`,builder:e=>e.command(g).command(B).command(U).command(le).command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{be as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n,h as r}from"./oauth-B0ETkNcX.mjs";import{r as i}from"./auth-MQEamPN9.mjs";import{t as a}from"./output-DrpYYfnB.mjs";import{n as o,t as s}from"./progress-CsHIt3Tp.mjs";import{n as c,t as l}from"./body-parser-C-c9gfH1.mjs";import{n as u}from"./input-validation-Bav2M9F-.mjs";import{a as d}from"./prompt-DdegNPpg.mjs";function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`,builder:f,handler:async e=>{if(e.dryRun){o({command:`cf analytics latency colos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency/colos`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.analytics.latency.colos.get({zone_id:n})),{successLabel:`Loaded`})}},m={command:`colos`,describe:`Operations for latency.colos`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`bins`,{type:`string`,description:`Bins`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieves aggregate Argo Smart Routing analytics for a zone, including latency improvements, bandwidth savings, and routing statistics.`,builder:h,handler:async e=>{let t={bins:e.bins};if(e.dryRun){o({command:`cf analytics latency get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>n.analytics.latency.get({zone_id:c,...t})),{successLabel:`Loaded`})}},_={command:`latency`,describe:`Operations for latency`,builder:e=>e.command(g).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`n`,{type:`number`,description:`Maximum number of integrations to return.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Returns the top N integrations for content findings.`})}const y={command:`topN`,describe:`Returns the top N integrations ranked by total content findings.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf analytics query data-security content-findings topN`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/data-security/content-findings/top-n`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),n:r.n,to:u(r.to,`to`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.analytics.query.dataSecurity.contentFindings.topN({...e,account_id:p})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.n===void 0)throw Error(`--n is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`End of the query time range (exclusive). RFC3339.`));let m=l({from:u(r.from,`from`,`text`),n:r.n,to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.dataSecurity.contentFindings.topN({...m,account_id:p})),{successLabel:`Created`})}},b={command:`content-findings`,describe:`Operations for query.data-security.content-findings`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for aggregate findings summary.`})}const S={command:`summary`,describe:`Returns aggregate current-period and previous-period totals for CASB findings.`,builder:x,handler:async r=>{if(r.dryRun){o({command:`cf analytics query data-security findings summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/data-security/findings/summary`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.analytics.query.dataSecurity.findings.summary({...e,account_id:p})),{successLabel:`Created`});return}r.from===void 0&&(r.from=await d(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.to===void 0&&(r.to=await d(`to`,`End of the query time range (exclusive). RFC3339.`));let m=l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.dataSecurity.findings.summary({...m,account_id:p})),{successLabel:`Created`})}};function C(e){return e.option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for findings timeseries.`})}const w={command:`timeseries`,describe:`Returns merged time-bucketed CASB findings.`,builder:C,handler:async r=>{if(r.dryRun){o({command:`cf analytics query data-security findings timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/data-security/findings/timeseries`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.analytics.query.dataSecurity.findings.timeseries({...e,account_id:p})),{successLabel:`Created`});return}r.from===void 0&&(r.from=await d(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.to===void 0&&(r.to=await d(`to`,`End of the query time range (exclusive). RFC3339.`));let m=l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.dataSecurity.findings.timeseries({...m,account_id:p})),{successLabel:`Created`})}},T={command:`findings`,describe:`Operations for query.data-security.findings`,builder:e=>e.command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},E={command:`data-security`,describe:`Operations for query.data-security`,builder:e=>e.command(b).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const O={command:`summary <dataset>`,describe:`Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison.`,builder:D,handler:async r=>{if(r.dryRun){o({command:`cf analytics query summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/summary`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.analytics.query.summary({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.summary({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}};function k(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`resolution`,{type:`string`,description:`Time bucket size for grouping results. Controls the granularity of the returned time slots.
|
|
3
|
+
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const A={command:`timeseries <dataset>`,describe:"Returns time-bucketed analytics data for a dataset. Includes time slots, each containing the requested stats, group-by dimensions, and resolution-controlled bucket size (e.g. `hour`, `day`).",builder:k,handler:async r=>{if(r.dryRun){o({command:`cf analytics query timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/timeseries`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),resolution:u(r.resolution,`resolution`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.analytics.query.timeseries({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),r.resolution===void 0&&(r.resolution=await d(`resolution`,`Time bucket size for grouping results. Controls the granularity of the returned time slots. `));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),resolution:u(r.resolution,`resolution`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.timeseries({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}};function j(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`n`,{type:`number`,description:`Maximum number of results to return.`}).option(`order-by`,{type:`string`,description:`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const M={command:`topN <dataset>`,describe:`Returns the top N results for a dataset by a specified stat. Includes an array of result rows, each containing the requested stats and group-by dimensions.`,builder:j,handler:async r=>{if(r.dryRun){o({command:`cf analytics query topN`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/top-n`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),n:r.n,orderBy:u(r[`order-by`],`order-by`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.analytics.query.topN({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);if(r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),r.n===void 0)throw Error(`--n is required (or pass --body with this field set).`);r[`order-by`]===void 0&&(r[`order-by`]=await d(`order-by`,`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),n:r.n,orderBy:u(r[`order-by`],`order-by`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.topN({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}},N={command:`query`,describe:`Operations for query`,builder:e=>e.command(O).command(A).command(M).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(_).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{a as r,r as i}from"./auth-MQEamPN9.mjs";import{t as a}from"./output-DrpYYfnB.mjs";import{n as o,t as s}from"./progress-CsHIt3Tp.mjs";import{n as c,t as l}from"./input-validation-Bav2M9F-.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const d={command:`query`,describe:`Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`,builder:u,handler:async u=>{if(u.dryRun){o({command:`cf analytics_engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await i(u),f=u.local?e:await t();if(u.accountId=f,u.file){let e=l(u.file);a(await s(`Loading`,async()=>r(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}if(u.body){let e=c(u.body,`body`,`binary`);a(await s(`Loading`,async()=>r(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}a(await s(`Loading`,async()=>d.analyticsEngine.sql.query({account_id:f})),{successLabel:`Loaded`})}},f={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`analytics_engine`,describe:`analytics_engine`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n,h as r}from"./oauth-B0ETkNcX.mjs";import{a as i,r as a}from"./auth-MQEamPN9.mjs";import{t as o}from"./output-DrpYYfnB.mjs";import{n as s,t as c}from"./progress-CsHIt3Tp.mjs";import{n as l,t as u}from"./body-parser-C-c9gfH1.mjs";import{n as d}from"./input-validation-Bav2M9F-.mjs";import{a as f,i as p,n as m}from"./prompt-DdegNPpg.mjs";import{t as h}from"./cli-types-BsTty22w.mjs";function ee(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema is enabled`}).option(`dry-run`,{type:`boolean`,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:`create`,describe:`Uploads an OpenAPI schema that defines expected request formats for API operations.`,builder:ee,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({kind:d(e.kind,`kind`,`text`),name:d(e.name,`name`,`text`),source:d(e.source,`source`,`text`),validation_enabled:e[`validation-enabled`]}):l(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);o(await c(`Creating`,async()=>t.apiSecurity.schemaValidation.schemas.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.kind===void 0&&(e.kind=await p(`kind`,`The kind of the schema`,[`openapi_v3`])),e.name===void 0&&(e.name=await f(`name`,`A human-readable name for the schema`)),e.source===void 0&&(e.source=await f(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),e[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let i=u({kind:d(e.kind,`kind`,`text`),name:d(e.name,`name`,`text`),source:d(e.source,`source`,`text`),validation_enabled:e[`validation-enabled`]});o(await c(`Creating`,async()=>t.apiSecurity.schemaValidation.schemas.create({...i,zone_id:n})),{successLabel:`Created`})}};function g(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,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 <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Security. Operations using this schema will lose their validation rules.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await m({force:!!e.force,message:`This operation permanently deletes the uploaded schema and removes its validation coverage.`})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}o(await c(`Deleting`,async()=>t.apiSecurity.schemaValidation.schemas.delete({zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <schema-id>`,describe:`Gets the contents and metadata of a specific OpenAPI schema uploaded to API Security.`,builder:v,handler:async e=>{let t={omit_source:e[`omit-source`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}};function b(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone.`,builder:b,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas hosts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/hosts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.hosts.list({zone_id:i,...t})),{successLabel:`Loaded`})}},S={command:`hosts`,describe:`Operations for schema-validation.schemas.hosts`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`validation-enabled`,{type:`boolean`,description:`Filter for enabled schemas`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Security.`,builder:C,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],omit_source:e[`omit-source`],validation_enabled:e[`validation-enabled`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function T(e){return e.option(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in Web Asset Management or not. `new` will just return operations from the schema that do not exist otherwise. `existing` will just return operations from the schema that already exist.",choices:[`new`,`existing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:h(T),handler:async e=>{let t={feature:e.feature,host:e.host,method:e.method,endpoint:e.endpoint,page:e.page,per_page:e[`per-page`],operation_status:e[`operation-status`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.operations.list({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}},D={command:`operations`,describe:`Operations for schema-validation.schemas.operations`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`validation-enabled`,{type:`boolean`,description:`Flag whether schema is enabled for validation.`}).option(`dry-run`,{type:`boolean`,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:`set-validation <schema-id>`,describe:`Enables or disables validation for an uploaded OpenAPI schema without changing the schema document.`,builder:O,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas set-validation`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({validation_enabled:e[`validation-enabled`]}):l(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);o(await c(`Updating`,async()=>t.apiSecurity.schemaValidation.schemas.setValidation({...r,zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Updated`});return}let i=u({validation_enabled:e[`validation-enabled`]});o(await c(`Updating`,async()=>t.apiSecurity.schemaValidation.schemas.setValidation({...i,zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Updated`})}},A={command:`schemas`,describe:`Operations for schema-validation.schemas`,builder:e=>e.command(te).command(_).command(y).command(w).command(k).command(S).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
|
|
4
4
|
Mitigation actions are as follows:
|
|
5
5
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{h as e}from"./oauth-B0ETkNcX.mjs";import{r as t}from"./auth-MQEamPN9.mjs";import{t as n}from"./output-DrpYYfnB.mjs";import{n as r,t as i}from"./progress-CsHIt3Tp.mjs";import{n as a,t as o}from"./body-parser-C-c9gfH1.mjs";import{n as s}from"./input-validation-Bav2M9F-.mjs";import{i as c}from"./prompt-DdegNPpg.mjs";function l(e){return e.option(`value`,{type:`string`,description:`Specifies the enablement value of Argo Smart Routing.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Configures the enablement of Argo Smart Routing.`})}const u={command:`edit`,describe:`Configures the value of the Argo Smart Routing enablement setting.`,builder:l,handler:async l=>{if(l.dryRun){r({command:`cf argo smart-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({value:s(l.value,`value`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.argo.smartRouting.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Specifies the enablement value of Argo Smart Routing.`,[`on`,`off`]));let f=o({value:s(l.value,`value`,`text`)});n(await i(`Updating`,async()=>u.argo.smartRouting.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves the value of Argo Smart Routing enablement setting.`,builder:d,handler:async a=>{if(a.dryRun){r({command:`cf argo smart-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.argo.smartRouting.get({zone_id:s})),{successLabel:`Loaded`})}},p={command:`smart-routing`,describe:`Route traffic through the fastest network paths to your origin using real-time latency data`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`value`,{type:`string`,description:`Enables Tiered Caching.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Tiered Caching.`})}const h={command:`edit`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:m,handler:async l=>{if(l.dryRun){r({command:`cf argo tiered-caching edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({value:s(l.value,`value`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.argo.tieredCaching.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Enables Tiered Caching.`,[`on`,`off`]));let f=o({value:s(l.value,`value`,`text`)});n(await i(`Updating`,async()=>u.argo.tieredCaching.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:g,handler:async a=>{if(a.dryRun){r({command:`cf argo tiered-caching get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.argo.tieredCaching.get({zone_id:s})),{successLabel:`Loaded`})}},v={command:`tiered-caching`,describe:`Operations for tiered-caching`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`argo`,describe:`Network optimization features that speed up and improve reliability of traffic to your origins`,builder:e=>e.command(p).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
function e(e=process.argv.slice(2)){let t=!1;for(let[n,r]of e.entries()){if(r===`--quiet=false`||r===`-q=false`||r===`--no-quiet`){t=!1;continue}if(r===`--quiet=true`||r===`-q=true`){t=!0;continue}(r===`--quiet`||r===`-q`)&&(t=e[n+1]!==`false`)}return t}export{e as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{r}from"./auth-MQEamPN9.mjs";import{t as i}from"./output-DrpYYfnB.mjs";import{n as a,t as o}from"./progress-CsHIt3Tp.mjs";import{n as s,t as c}from"./body-parser-C-c9gfH1.mjs";import{n as l}from"./input-validation-Bav2M9F-.mjs";import{a as u,n as d}from"./prompt-DdegNPpg.mjs";import{t as f}from"./cli-types-BsTty22w.mjs";import{n as p,t as m}from"./raw-fetch-CteyTOM2.mjs";function h(e){return e.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 g={command:`artifactsNamespacesList`,describe:`Lists Artifacts namespaces for an account.`,builder:h,handler:async s=>{let c={limit:s.limit,cursor:s.cursor};if(s.dryRun){a({command:`cf artifacts namespaces artifactsNamespacesList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsNamespacesList({account_id:u,...c})),{successLabel:`Loaded`})}};function _(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <namespace>`,describe:`Returns an Artifacts namespace summary.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf artifacts namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}`,pathParams:{namespace:String(s.namespace??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.get({account_id:l,namespace:s.namespace})),{successLabel:`Loaded`})}};function y(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const b={command:`get <hash>`,describe:`Returns raw bytes for an immutable Git blob object. Blob responses are cacheable forever by hash.`,builder:y,handler:async i=>{if(i.dryRun){a({command:`cf artifacts namespaces repos blobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${i.namespace==null?`<namespace>`:encodeURIComponent(String(i.namespace))}/repos/${i.name==null?`<name>`:encodeURIComponent(String(i.name))}/blob/${i.hash==null?`<hash>`:encodeURIComponent(String(i.hash))}`,pathParams:{namespace:String(i.namespace??``),name:String(i.name??``),hash:String(i.hash??``)},bodyKind:`none`});return}await r(i);let s=i.local?e:await t();i.accountId=s;let c=await o(`Loading`,async()=>m(`/accounts/${s}/artifacts/namespaces/${encodeURIComponent(String(i.namespace))}/repos/${encodeURIComponent(String(i.name))}/blob/${encodeURIComponent(String(i.hash))}`,{method:`GET`,local:i.local===!0,persistTo:i.persistTo}));p(i.text===!0?c.toString(`utf-8`):c)}},x={command:`blobs`,describe:`Operations for namespaces.repos.blobs`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <hash>`,describe:`Returns decoded metadata for an immutable Git commit object. Commit responses are cacheable forever by hash.`,builder:S,handler:async s=>{if(s.dryRun){a({command:`cf artifacts namespaces repos commits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/commit/${s.hash==null?`<hash>`:encodeURIComponent(String(s.hash))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``),hash:String(s.hash??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.repos.commits.get({account_id:l,namespace:s.namespace,name:s.name,hash:s.hash})),{successLabel:`Loaded`})}},w={command:`commits`,describe:`Operations for namespaces.repos.commits`,builder:e=>e.command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`default-branch`,{type:`string`,description:`Git branch name. Must match /^[a-zA-Z0-9][a-zA-Z0-9._/-]*$/, must not contain '..', and must not end with '/' or '.'.`}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`read-only`,{type:`boolean`,description:`The read_only 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 <namespace>`,describe:`Creates a Git-compatible Artifacts repository in a namespace.`,builder:T,handler:async d=>{if(d.dryRun){a({command:`cf artifacts namespaces repos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${d.namespace==null?`<namespace>`:encodeURIComponent(String(d.namespace))}/repos`,pathParams:{namespace:String(d.namespace??``)},bodyKind:`json`,body:d.body===void 0?c({default_branch:l(d[`default-branch`],`default-branch`,`text`),description:l(d.description,`description`,`text`),name:l(d.name,`name`,`text`),read_only:d[`read-only`]}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.artifacts.namespaces.repos.create({...e,account_id:p,namespace:d.namespace})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`The name field`));let m=c({default_branch:l(d[`default-branch`],`default-branch`,`text`),description:l(d.description,`description`,`text`),name:l(d.name,`name`,`text`),read_only:d[`read-only`]});i(await o(`Creating`,async()=>f.artifacts.namespaces.repos.create({...m,account_id:p,namespace:d.namespace})),{successLabel:`Created`})}};function D(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,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 O={command:`delete <name>`,describe:`Deletes a repository and schedules cleanup of its backing data.`,builder:D,handler:async s=>{if(s.dryRun){a({command:`cf artifacts namespaces repos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>c.artifacts.namespaces.repos.delete({account_id:l,namespace:s.namespace,name:s.name})),{successLabel:`Deleted`})}};function k(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or commit hash.`,demandOption:!0}).option(`path`,{type:`string`,description:`File path.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const A={command:`get <name>`,describe:`Returns raw bytes for a file resolved by ref and path.`,builder:k,handler:async i=>{let s={ref:i.ref,path:i.path};if(i.dryRun){a({command:`cf artifacts namespaces repos files get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${i.namespace==null?`<namespace>`:encodeURIComponent(String(i.namespace))}/repos/${i.name==null?`<name>`:encodeURIComponent(String(i.name))}/file`,pathParams:{namespace:String(i.namespace??``),name:String(i.name??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),u=await o(`Loading`,async()=>m(`/accounts/${c}/artifacts/namespaces/${encodeURIComponent(String(i.namespace))}/repos/${encodeURIComponent(String(i.name))}/file${l?`?`+l:``}`,{method:`GET`,local:i.local===!0,persistTo:i.persistTo}));p(i.text===!0?u.toString(`utf-8`):u)}},j={command:`files`,describe:`Operations for namespaces.repos.files`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`default-branch-only`,{type:`boolean`,description:`The default_branch_only field`}).option(`description`,{type:`string`,description:`The description field`}).option(`read-only`,{type:`boolean`,description:`The read_only field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`fork <name>`,describe:`Forks a source repository into a new repository.`,builder:M,handler:async u=>{if(u.dryRun){a({command:`cf artifacts namespaces repos fork`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${u.namespace==null?`<namespace>`:encodeURIComponent(String(u.namespace))}/repos/${u.name==null?`<name>`:encodeURIComponent(String(u.name))}/fork`,pathParams:{namespace:String(u.namespace??``),name:String(u.name??``)},bodyKind:`json`,body:u.body===void 0?c({default_branch_only:u[`default-branch-only`],description:l(u.description,`description`,`text`),read_only:u[`read-only`]}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.artifacts.namespaces.repos.fork({...e,account_id:f,namespace:u.namespace,name:u.name})),{successLabel:`Created`});return}let p=c({default_branch_only:u[`default-branch-only`],description:l(u.description,`description`,`text`),read_only:u[`read-only`]});i(await o(`Creating`,async()=>d.artifacts.namespaces.repos.fork({...p,account_id:f,namespace:u.namespace,name:u.name})),{successLabel:`Created`})}};function P(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get <name>`,describe:`Returns repository metadata.`,builder:P,handler:async s=>{if(s.dryRun){a({command:`cf artifacts namespaces repos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.repos.get({account_id:l,namespace:s.namespace,name:s.name})),{successLabel:`Loaded`})}};function ee(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`branch`,{type:`string`,description:`Git branch name. Must match /^[a-zA-Z0-9][a-zA-Z0-9._/-]*$/, must not contain '..', and must not end with '/' or '.'.`}).option(`depth`,{type:`number`,description:`The depth field`}).option(`read-only`,{type:`boolean`,description:`The read_only field`}).option(`url`,{type:`string`,description:`The url field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`import <name>`,describe:`Imports an HTTPS Git repository into an Artifacts repository.`,builder:ee,handler:async d=>{if(d.dryRun){a({command:`cf artifacts namespaces repos import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${d.namespace==null?`<namespace>`:encodeURIComponent(String(d.namespace))}/repos/${d.name==null?`<name>`:encodeURIComponent(String(d.name))}/import`,pathParams:{namespace:String(d.namespace??``),name:String(d.name??``)},bodyKind:`json`,body:d.body===void 0?c({branch:l(d.branch,`branch`,`text`),depth:d.depth,read_only:d[`read-only`],url:l(d.url,`url`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.artifacts.namespaces.repos.import({...e,account_id:p,namespace:d.namespace,name:d.name})),{successLabel:`Created`});return}d.url===void 0&&(d.url=await u(`url`,`The url field`));let m=c({branch:l(d.branch,`branch`,`text`),depth:d.depth,read_only:d[`read-only`],url:l(d.url,`url`,`text`)});i(await o(`Creating`,async()=>f.artifacts.namespaces.repos.import({...m,account_id:p,namespace:d.namespace,name:d.name})),{successLabel:`Created`})}};function L(e){return e.option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`search`,{type:`string`,description:`Search`}).option(`sort`,{type:`string`,description:`Sort`,choices:[`created_at`,`updated_at`,`last_push_at`,`name`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`Lists repositories in a namespace.`,builder:f(L),handler:async s=>{let c={limit:s.limit,cursor:s.cursor,search:s.search,sort:s.sort,direction:s.direction};if(s.dryRun){a({command:`cf artifacts namespaces repos list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos`,pathParams:{namespace:String(s.namespace??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.repos.list({account_id:u,namespace:s.namespace,...c})),{successLabel:`Loaded`})}};function z(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or commit hash. Defaults to HEAD.`}).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 B={command:`get <name>`,describe:`Returns commit metadata walking backwards from a ref, branch, tag, or HEAD.`,builder:z,handler:async s=>{let c={ref:s.ref,limit:s.limit,offset:s.offset};if(s.dryRun){a({command:`cf artifacts namespaces repos logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/log`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.repos.logs.get({account_id:u,namespace:s.namespace,name:s.name,...c})),{successLabel:`Loaded`})}},V={command:`logs`,describe:`Operations for namespaces.repos.logs`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.positional(`path`,{type:`string`,description:`File path. May contain slashes.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or 40-character commit hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const U={command:`get <path>`,describe:`Returns file bytes resolved by ref and path, with a sniffed content type and browser-safe response headers.`,builder:H,handler:async i=>{if(i.dryRun){a({command:`cf artifacts namespaces repos raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${i.namespace==null?`<namespace>`:encodeURIComponent(String(i.namespace))}/repos/${i.name==null?`<name>`:encodeURIComponent(String(i.name))}/raw/${i.ref==null?`<ref>`:encodeURIComponent(String(i.ref))}/${i.path==null?`<path>`:encodeURIComponent(String(i.path))}`,pathParams:{namespace:String(i.namespace??``),name:String(i.name??``),ref:String(i.ref??``),path:String(i.path??``)},bodyKind:`none`});return}await r(i);let s=i.local?e:await t();i.accountId=s;let c=await o(`Loading`,async()=>m(`/accounts/${s}/artifacts/namespaces/${encodeURIComponent(String(i.namespace))}/repos/${encodeURIComponent(String(i.name))}/raw/${encodeURIComponent(String(i.ref))}/${encodeURIComponent(String(i.path))}`,{method:`GET`,local:i.local===!0,persistTo:i.persistTo}));p(i.text===!0?c.toString(`utf-8`):c)}},W={command:`raw`,describe:`Operations for namespaces.repos.raw`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <hash>`,describe:`Returns decoded entries for an immutable Git tree object. Tree responses are cacheable forever by hash.`,builder:G,handler:async s=>{if(s.dryRun){a({command:`cf artifacts namespaces repos trees get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/tree/${s.hash==null?`<hash>`:encodeURIComponent(String(s.hash))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``),hash:String(s.hash??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.repos.trees.get({account_id:l,namespace:s.namespace,name:s.name,hash:s.hash})),{successLabel:`Loaded`})}},q={command:`trees`,describe:`Operations for namespaces.repos.trees`,builder:e=>e.command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`repos`,describe:`Operations for namespaces.repos`,builder:e=>e.command(E).command(O).command(N).command(F).command(I).command(R).command(x).command(w).command(j).command(V).command(W).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Y(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`repo`,{type:`string`,description:`The repo field`}).option(`scope`,{type:`string`,description:`The scope field`,choices:[`read`,`write`]}).option(`ttl`,{type:`number`,description:`The ttl 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 <namespace>`,describe:`Creates a scoped Git token for a repository.`,builder:Y,handler:async d=>{if(d.dryRun){a({command:`cf artifacts namespaces tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${d.namespace==null?`<namespace>`:encodeURIComponent(String(d.namespace))}/tokens`,pathParams:{namespace:String(d.namespace??``)},bodyKind:`json`,body:d.body===void 0?c({repo:l(d.repo,`repo`,`text`),scope:l(d.scope,`scope`,`text`),ttl:d.ttl}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.artifacts.namespaces.tokens.create({...e,account_id:p,namespace:d.namespace})),{successLabel:`Created`});return}d.repo===void 0&&(d.repo=await u(`repo`,`The repo field`));let m=c({repo:l(d.repo,`repo`,`text`),scope:l(d.scope,`scope`,`text`),ttl:d.ttl});i(await o(`Creating`,async()=>f.artifacts.namespaces.tokens.create({...m,account_id:p,namespace:d.namespace})),{successLabel:`Created`})}};function Z(e){return e.option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`state`,{type:`string`,description:`State`,choices:[`active`,`expired`,`revoked`,`all`]}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`list`,describe:`Lists tokens for a repository.`,builder:f(Z),handler:async s=>{let c={state:s.state,page:s.page,per_page:s[`per-page`]};if(s.dryRun){a({command:`cf artifacts namespaces tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/tokens`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.tokens.list({account_id:u,namespace:s.namespace,name:s.name,...c})),{successLabel:`Loaded`})}};function $(e){return e.positional(`id`,{type:`string`,description:`Token ID. Must match /^[0-9a-z]{16}$/.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,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 te={command:`revoke <id>`,describe:`Revokes an Artifacts repository token.`,builder:$,handler:async s=>{if(s.dryRun){a({command:`cf artifacts namespaces tokens revoke`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/tokens/${s.id==null?`<id>`:encodeURIComponent(String(s.id))}`,pathParams:{namespace:String(s.namespace??``),id:String(s.id??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}i(await o(`Deleting`,async()=>c.artifacts.namespaces.tokens.revoke({account_id:l,namespace:s.namespace,id:s.id})),{successLabel:`Deleted`})}},ne={command:`tokens`,describe:`Operations for namespaces.tokens`,builder:e=>e.command(X).command(Q).command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},re={command:`namespaces`,describe:`Operations for namespaces`,builder:e=>e.command(g).command(v).command(J).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ie={command:`artifacts`,describe:`artifacts`,builder:e=>e.command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ie as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{r}from"./auth-MQEamPN9.mjs";import{t as i}from"./output-DrpYYfnB.mjs";import{n as a,t as o}from"./progress-CsHIt3Tp.mjs";import{t as s}from"./cli-types-BsTty22w.mjs";function c(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:s(c),handler:async s=>{let c={id:s.id,export:s.export,"action.type":s[`action-type`],"actor.ip":s[`actor-ip`],"actor.email":s[`actor-email`],since:s.since,before:s.before,"zone.name":s[`zone-name`],direction:s.direction,per_page:s[`per-page`],page:s.page,hide_user_logs:s[`hide-user-logs`]};if(s.dryRun){a({command:`cf audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/audit_logs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.auditLogs.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`audit-logs`,describe:`audit-logs`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
|