cf 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -5
- package/dist/_meta/agent-context.json +12 -4
- package/dist/_meta/commands.json +2249 -262
- package/dist/_meta/hand-written-commands.json +784 -0
- package/dist/_meta/schemas.json +1882 -155
- package/dist/{abuse-reports-CGF4zcKf.mjs → abuse-reports-sDBTV0qZ.mjs} +2 -2
- package/dist/{access-lhLJo1v2.mjs → access-DcNzuCue.mjs} +1 -1
- package/dist/account-BX90zXn5.mjs +2 -0
- package/dist/{account-tags-B88TotoH.mjs → account-tags-Bz3JG5hI.mjs} +4 -4
- package/dist/{accounts-BSIAT_iP.mjs → accounts-DCuW3xyZ.mjs} +12 -12
- package/dist/{acm-VULm1djv.mjs → acm-zjfShZLS.mjs} +1 -1
- package/dist/{addressing-BHPBIkRY.mjs → addressing-DORQ64Ux.mjs} +11 -11
- package/dist/{agent-context-KBy48G1b.mjs → agent-context-BgPR_aQr.mjs} +1 -1
- package/dist/agent-memory-C0hAUMeC.mjs +6 -0
- package/dist/ai-BpEBGMT2.mjs +5 -0
- package/dist/ai-audit-DnU3vn3E.mjs +2 -0
- package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
- package/dist/ai-search-DKbN9Tyd.mjs +7 -0
- package/dist/ai-security-C_I5lo58.mjs +4 -0
- package/dist/{alerting-Bl8OqViR.mjs → alerting-4T8gmZs-.mjs} +1 -1
- package/dist/analytics-Bxh4TCP7.mjs +3 -0
- package/dist/analytics_engine-fV56bjVN.mjs +2 -0
- package/dist/{api-security-4FVrD4n8.mjs → api-security-COk_i184.mjs} +20 -20
- package/dist/argo-DIRfvxvv.mjs +2 -0
- package/dist/{artifacts-CVDGnr2V.mjs → artifacts-BBfXNfUg.mjs} +1 -1
- package/dist/audit-logs-BlOrlAWe.mjs +2 -0
- package/dist/{auth-MQEamPN9.mjs → auth-D3X9HYhD.mjs} +3 -3
- package/dist/auth-DPhNN3Ly.mjs +5 -0
- package/dist/billing-B9e4PnvN.mjs +3 -0
- package/dist/body-parser-BshbixEq.mjs +2 -0
- package/dist/bot-management-D2JVeS-V.mjs +5 -0
- package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
- package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
- package/dist/{browser-extension-BtpCbh-2.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
- package/dist/browser-run-CHGOCTdG.mjs +4 -0
- package/dist/build-D0FhOj40.mjs +8 -0
- package/dist/{cache-VyWK1SjY.mjs → cache-C6V7PbQM.mjs} +1 -1
- package/dist/{calls-BxoRYxs4.mjs → calls-Bye8Tyy-.mjs} +1 -1
- package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
- package/dist/cf-Ds4JFovl.mjs +18 -0
- package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
- package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
- package/dist/{client-certificates-DDUv8K0a.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
- package/dist/{client-side-security-D4ysjwWT.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
- package/dist/cloud-connector-CL1jPQud.mjs +2 -0
- package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
- package/dist/command-C9VP3xaA.mjs +2 -0
- package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
- package/dist/config.d.mts +1460 -1348
- package/dist/config.mjs +1 -1
- package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
- package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
- package/dist/{connectors-BqxYMMtQ.mjs → connectors-BQwyBJ4_.mjs} +1 -1
- package/dist/{containers-CKW081JA.mjs → containers-BrQtGiNp.mjs} +12 -8
- package/dist/{content-scan-Dgd7A8KF.mjs → content-scan-DNzhXYkY.mjs} +1 -1
- package/dist/{csamScanner-DYL37wLc.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
- package/dist/{ct-alerting-CkhSbfAs.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
- package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
- package/dist/custom-csrs-bhClr2SU.mjs +3 -0
- package/dist/{custom-hostnames-q_nsnlye.mjs → custom-hostnames-C0eiGvG9.mjs} +1 -1
- package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
- package/dist/custom-pages-DTINMR30.mjs +3 -0
- package/dist/d1-sKdExJYF.mjs +20 -0
- package/dist/data-security-mV3a6UfW.mjs +7 -0
- package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-CZ7bgNDu.mjs → deploy-BL59O1O1.mjs} +1 -1
- package/dist/deploy-input-Dz6q-__n.mjs +2 -0
- package/dist/{dev-V10MG-Bg.mjs → dev-BDaavgH1.mjs} +2 -2
- package/dist/{diagnostics-BTH-8nJH.mjs → diagnostics-CJV6qWUA.mjs} +1 -1
- package/dist/{directory-BlH6N6Qy.mjs → directory-B5zCMusW.mjs} +1 -1
- package/dist/{dispatch-namespaces-BCjH1JzB.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
- package/dist/dist-BHi7UhXO.mjs +72 -0
- package/dist/dist-BWpErtDM.mjs +384 -0
- package/dist/{dls-BF5iN78p.mjs → dls-t0hnIe_P.mjs} +1 -1
- package/dist/{dns-CeCTNqRk.mjs → dns-C8FC2hbh.mjs} +13 -13
- package/dist/{dns-firewall-B54MaLGm.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
- package/dist/{dot-prop-6SRZBKHT-wIVDg_fl.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
- package/dist/dry-run-DL2V6yFm.mjs +2 -0
- package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
- package/dist/email-auth-BmYrl0pO.mjs +2 -0
- package/dist/email-routing-CF3_Z957.mjs +6 -0
- package/dist/email-security-F7OYcMkZ.mjs +18 -0
- package/dist/email-sending-EyU3WvGQ.mjs +7 -0
- package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
- package/dist/{firewall-CBPGJ43p.mjs → firewall-8YWWy4iB.mjs} +9 -9
- package/dist/flagship-C4x0l-8J.mjs +4 -0
- package/dist/{fraud-BIhS8pLf.mjs → fraud-HR_SdUx3.mjs} +1 -1
- package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
- package/dist/{healthchecks-FiXIk-KP.mjs → healthchecks-4qOvjrTN.mjs} +1 -1
- package/dist/{hostnames-Bx0mykMR.mjs → hostnames-DehdYOMz.mjs} +1 -1
- package/dist/{hyperdrive-C8qCabBF.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
- package/dist/iam-DR72hmii.mjs +6 -0
- package/dist/images-CeKc5JPh.mjs +8 -0
- package/dist/index.mjs +1 -1
- package/dist/{intel-B-9Z_sJs.mjs → intel-DtFix9WL.mjs} +1 -1
- package/dist/{interactive-DtsCYfrK.mjs → interactive-C7M55Wxx.mjs} +1 -1
- package/dist/ips-CtWCjXAN.mjs +2 -0
- package/dist/{keyless-certificates-THHvoXX3.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
- package/dist/keys-BmhG6Kn1.mjs +2 -0
- package/dist/{kv-BFDUCnft.mjs → kv-BuVPAuZP.mjs} +1 -1
- package/dist/{leaked-credential-checks-DUlUCOoJ.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
- package/dist/load-balancers-CylN-l7n.mjs +6 -0
- package/dist/{local-D-aVNu6A.mjs → local-Be3lg_9E.mjs} +1 -1
- package/dist/{local-runtime-Dh3keC5v.mjs → local-runtime-Ce7k598H.mjs} +1 -1
- package/dist/logexplorer-CvRPoKbj.mjs +17 -0
- package/dist/logo-matches-Heuft3yF.mjs +2 -0
- package/dist/logos-DRYjGBDq.mjs +3 -0
- package/dist/{logpush-BK34mMQs.mjs → logpush-Dve9jOMp.mjs} +1 -1
- package/dist/{logs-CLAqX9h2.mjs → logs-SC86FE89.mjs} +1 -1
- package/dist/{magic-cloud-networking-h_ozrC5S.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
- package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
- package/dist/magic-transit-BK_3asH2.mjs +111 -0
- package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
- package/dist/matches-Iss9Fo4R.mjs +2 -0
- package/dist/mcp-8wxXT6JU.mjs +4 -0
- package/dist/mesh-Bf9UAS4J.mjs +4 -0
- package/dist/{moq-qmuVPAO0.mjs → moq-ZKMFOeVz.mjs} +1 -1
- package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
- package/dist/{network-D74cSy3t.mjs → network-B1lBARU9.mjs} +1 -1
- package/dist/{network-interconnects-BJ0Nc48J.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
- package/dist/oauth-DuEONNgC.mjs +14 -0
- package/dist/{oauth-clients-Br-smLxQ.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
- package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
- package/dist/observability-Jya7-zkl.mjs +4 -0
- package/dist/{open-PBXRGS4R-R-qesf18.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
- package/dist/{organization-NX7yCZrq.mjs → organization-CYxYV4e0.mjs} +6 -6
- package/dist/organizations-SacGUW44.mjs +2 -0
- package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
- package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
- package/dist/{output-DrpYYfnB.mjs → output-Ccqw2WOb.mjs} +1 -1
- package/dist/page-rules-BqEyFR2c.mjs +27 -0
- package/dist/pages-CQ7ZVWk1.mjs +14 -0
- package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
- package/dist/pipelines-6De2Pe2C.mjs +6 -0
- package/dist/precursor-iwK-1P_d.mjs +4 -0
- package/dist/progress-BqQcF5QH.mjs +2 -0
- package/dist/project-settings-C_1-JI6Y.mjs +3 -0
- package/dist/prompt-B0sWIs9c.mjs +3 -0
- package/dist/{public-BwQqexwo-CNW_dPly.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
- package/dist/queries-c7zvnfEQ.mjs +3 -0
- package/dist/queues-BU6y16qS.mjs +6 -0
- package/dist/r2-Jo3QMahK.mjs +24 -0
- package/dist/{r2-data-catalog-Du7hN9jA.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
- package/dist/radar-DIYAMEof.mjs +2 -0
- package/dist/{rate-limits-yBF3qoYD.mjs → rate-limits-DewOcznT.mjs} +1 -1
- package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
- package/dist/{realtimekit-CIP7lP-a.mjs → realtimekit-cnZEVNDn.mjs} +1 -1
- package/dist/registrar-BsWr_aPM.mjs +23 -0
- package/dist/{registrar-sandbox-DiXg8p_1.mjs → registrar-sandbox-BlcpUyIH.mjs} +4 -4
- package/dist/{registry-Bck_zFkz.mjs → registry-jifR3_Y6.mjs} +1 -1
- package/dist/reporting--1AyTV7k.mjs +2 -0
- package/dist/request-tracers-C_VX7X6-.mjs +2 -0
- package/dist/{resource-sharing-D1pSDvtf.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
- package/dist/resource-tagging-C33U6T74.mjs +2 -0
- package/dist/rules-BfjzALMi.mjs +4 -0
- package/dist/rulesets-3i_1Vwt-.mjs +5 -0
- package/dist/rum-CjmIckiR.mjs +4 -0
- package/dist/{schema-B34Q9tLF.mjs → schema-1mwmslUV.mjs} +1 -1
- package/dist/schema-flags-llLJuFFw.mjs +5 -0
- package/dist/{scim-CcSyfKCH.mjs → scim-pApmzA5B.mjs} +1 -1
- package/dist/{secrets-store-DFmvtphu.mjs → secrets-store-DBC9WJau.mjs} +1 -1
- package/dist/security-center-Djm06dq-.mjs +2 -0
- package/dist/{security-txt-DqnFpjMI.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
- package/dist/{share-BuwYUzOL.mjs → share-Dj-MNXrw.mjs} +4 -4
- package/dist/shared-BJvq4DkR.mjs +290 -0
- package/dist/smart-shield--8EpJjrF.mjs +4 -0
- package/dist/snippets-Dyz0PH60.mjs +4 -0
- package/dist/{spawn-O1RS01vr.mjs → spawn-C5Z7oWdp.mjs} +108 -112
- package/dist/{spectrum-b7N1ZRAm.mjs → spectrum-rAHWz8rH.mjs} +1 -1
- package/dist/{speed-cw31yFva.mjs → speed-BKepWBXj.mjs} +1 -1
- package/dist/src-gJma71Ec.mjs +108 -0
- package/dist/{ssl-CsEhRVTO.mjs → ssl-KdFiY3ev.mjs} +1 -1
- package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
- package/dist/{state-Bb5Cbc_L.mjs → state-Cu3cItUg.mjs} +1 -1
- package/dist/{stream-DFOao6Gu.mjs → stream-CKJ6Tb0M.mjs} +13 -13
- package/dist/submit-BxbKKhBn.mjs +2 -0
- package/dist/tags-DA8dq9fx.mjs +2 -0
- package/dist/tenant-DLXw48hS.mjs +2 -0
- package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
- package/dist/{tools-BHfBOZOU.mjs → tools-x8bj9E6b.mjs} +1 -1
- package/dist/{tunnel-DkMiNtVY.mjs → tunnel-CNQA5Flp.mjs} +1 -1
- package/dist/tunnels-CC10EOsU.mjs +2 -0
- package/dist/turnstile-CH58hnf4.mjs +23 -0
- package/dist/{ui-DE8CNn6c.mjs → ui-CmnnBm_O.mjs} +1 -1
- package/dist/url-info-BpCgdUtL.mjs +2 -0
- package/dist/{url-normalization-ClfFiruK.mjs → url-normalization-BzuynEy1.mjs} +1 -1
- package/dist/url-scanner-APIZbhB7.mjs +2 -0
- package/dist/user-2-NGebfI.mjs +12 -0
- package/dist/values-S_bNv819.mjs +2 -0
- package/dist/{vectorize-CVKu7lEt.mjs → vectorize-Bv7feLBC.mjs} +1 -1
- package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
- package/dist/{web-assets-C2s9kzWf.mjs → web-assets-C1UmOyzD.mjs} +1 -1
- package/dist/web3-GnUocVYH.mjs +4 -0
- package/dist/workers-J1-PLwdl.mjs +28 -0
- package/dist/{workers-builds-B55-oXOa.mjs → workers-builds-DCHmWOMS.mjs} +1 -1
- package/dist/{workflows-B-kGHxFu.mjs → workflows-CArfEI2c.mjs} +1 -1
- package/dist/zaraz-mg2YlR3_.mjs +2 -0
- package/dist/{zero-trust-DV3sIOvu.mjs → zero-trust-DVdUPtj1.mjs} +67 -66
- package/dist/zone-DMAfrDJX.mjs +2 -0
- package/dist/zones-CNwxUi7I.mjs +21 -0
- package/package.json +10 -7
- package/dist/account-CYRm3yoN.mjs +0 -2
- package/dist/agent-memory-DDv_Gxr7.mjs +0 -6
- package/dist/ai-audit-BWZGvbca.mjs +0 -2
- package/dist/ai-gateway-jeB-sAgP.mjs +0 -13
- package/dist/ai-search-BmdskMjR.mjs +0 -7
- package/dist/ai-security-CsmfcaUx.mjs +0 -4
- package/dist/ai-viHB1tgI.mjs +0 -5
- package/dist/analytics-vOxw8Hy0.mjs +0 -3
- package/dist/analytics_engine-DO4-C0wD.mjs +0 -2
- package/dist/argo-CQfCgazW.mjs +0 -2
- package/dist/audit-logs-CzpwvQ6A.mjs +0 -2
- package/dist/auth-D0xZxAEa.mjs +0 -5
- package/dist/billing-aJgapeRm.mjs +0 -3
- package/dist/body-parser-C-c9gfH1.mjs +0 -2
- package/dist/bot-management-Y2q5d-pi.mjs +0 -5
- package/dist/botnet-feed-DANJqfmE.mjs +0 -3
- package/dist/brand-protection-CjpZWBjp.mjs +0 -3
- package/dist/browser-run-BFn9h2Tz.mjs +0 -4
- package/dist/build-DcflwvqN.mjs +0 -2
- package/dist/certificate-authorities-D7OAFxF_.mjs +0 -2
- package/dist/cf-C7DU4819.mjs +0 -18
- package/dist/chunk-LQW53VED-DLrXV-hE.mjs +0 -499
- package/dist/cloud-connector-Bhec6z2P.mjs +0 -2
- package/dist/cloudforce-one-J_hn9ss9.mjs +0 -36
- package/dist/connector-interrupts-Dycx8zFx.mjs +0 -2
- package/dist/connector-telemetry-events-BmxOSNtN.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CdcqfKnH.mjs +0 -2
- package/dist/custom-certificates-BzAOnEoT.mjs +0 -5
- package/dist/custom-csrs-CgzG3pd3.mjs +0 -3
- package/dist/custom-nameservers-BUBmfhUe.mjs +0 -3
- package/dist/custom-pages-M7jA2Hit.mjs +0 -3
- package/dist/d1-BFvMd6-S.mjs +0 -20
- package/dist/data-security-Bji4Or_j.mjs +0 -7
- package/dist/dcv-delegation-BuoRQ1Yh.mjs +0 -2
- package/dist/deploy-input-CrvuoDGJ.mjs +0 -242
- package/dist/dist-CgrMkXFx.mjs +0 -72
- package/dist/durable-objects-D8FQORrL.mjs +0 -2
- package/dist/email-auth-DJK0Eb30.mjs +0 -2
- package/dist/email-routing-NpmiKIrl.mjs +0 -6
- package/dist/email-security-BLZ7WZ9Z.mjs +0 -18
- package/dist/email-sending-dn-353Nx.mjs +0 -7
- package/dist/fieldExtractors-ahysj57J.mjs +0 -3
- package/dist/flagship-BusjRNIb.mjs +0 -4
- package/dist/google-tag-gateway-TZZ3F1tV.mjs +0 -2
- package/dist/iam-Cj63Kjc6.mjs +0 -6
- package/dist/images-CBWXCDhy.mjs +0 -8
- package/dist/ips-qs9eGJnI.mjs +0 -2
- package/dist/keys-D7N0j4-x.mjs +0 -2
- package/dist/load-balancers-D2zbQ8fT.mjs +0 -6
- package/dist/logexplorer-CUsfZ_bS.mjs +0 -13
- package/dist/logo-matches-CJcthPHf.mjs +0 -2
- package/dist/logos-BS65zN8q.mjs +0 -3
- package/dist/magic-network-monitoring-C7tAPNKP.mjs +0 -4
- package/dist/magic-transit-BtsFePMx.mjs +0 -111
- package/dist/managed-transforms-Cm_KVCMB.mjs +0 -3
- package/dist/matches-InA1hwII.mjs +0 -2
- package/dist/mcp-mJ7bekNJ.mjs +0 -4
- package/dist/mesh-BK4S1Ezy.mjs +0 -4
- package/dist/mtls-certificates-CU4OAAXY.mjs +0 -3
- package/dist/oauth-B0ETkNcX.mjs +0 -15
- package/dist/oauth-scopes-D5bF11ju.mjs +0 -2
- package/dist/observability-BWE0Gg3V.mjs +0 -4
- package/dist/organizations-DLhiRt8g.mjs +0 -2
- package/dist/origin-ca-certificates-Ff4McZRQ.mjs +0 -3
- package/dist/origin-post-quantum-encryption-UuTr4_SW.mjs +0 -2
- package/dist/origin-tls-client-auth-DOJ1zlH3.mjs +0 -4
- package/dist/page-rules-BSz1gO-_.mjs +0 -18
- package/dist/pages-DVDogxPs.mjs +0 -14
- package/dist/pay-per-crawl-BrLXK7gT.mjs +0 -4
- package/dist/pipelines-BszRk4sM.mjs +0 -6
- package/dist/precursor-BPNjQr76.mjs +0 -4
- package/dist/progress-CsHIt3Tp.mjs +0 -2
- package/dist/prompt-DdegNPpg.mjs +0 -3
- package/dist/queries-JL1H1Biz.mjs +0 -3
- package/dist/queues-DpkYdRUE.mjs +0 -6
- package/dist/r2-CKozthw_.mjs +0 -24
- package/dist/radar-C-92vggG.mjs +0 -2
- package/dist/raw-fetch-CteyTOM2.mjs +0 -2
- package/dist/registrar-DKKN0M29.mjs +0 -21
- package/dist/reporting-fg_GKXe1.mjs +0 -2
- package/dist/request-tracers-CkMya96z.mjs +0 -2
- package/dist/resource-tagging-z48JGHCq.mjs +0 -2
- package/dist/rules-BTmNjDN-.mjs +0 -4
- package/dist/rulesets-CsoSM-17.mjs +0 -5
- package/dist/rum-DB4iO2q5.mjs +0 -4
- package/dist/schema-flags-iGoOriJt.mjs +0 -5
- package/dist/security-center-DFKeHq5c.mjs +0 -2
- package/dist/session-D6KHthHf.mjs +0 -2
- package/dist/shared-VppSAQf4.mjs +0 -2
- package/dist/smart-shield-D6X8L7p8.mjs +0 -4
- package/dist/snippets-DIpc9pb_.mjs +0 -4
- package/dist/src-D_HETJNy.mjs +0 -108
- package/dist/submit--xTzyNPy.mjs +0 -2
- package/dist/tags-efICDkah.mjs +0 -2
- package/dist/tenant-CerHuToJ.mjs +0 -2
- package/dist/tenant-custom-nameservers-C4otMBm2.mjs +0 -3
- package/dist/triggers-BEsiiKAf.mjs +0 -2
- package/dist/tunnels-D0J8lJoI.mjs +0 -2
- package/dist/turnstile-CFmtY5bn.mjs +0 -23
- package/dist/url-info-DBCeRWwb.mjs +0 -2
- package/dist/url-scanner-CNyvg65L.mjs +0 -2
- package/dist/user-bifVEQq5.mjs +0 -12
- package/dist/values-OxkdP1tV.mjs +0 -2
- package/dist/versions-BVL-Ludh.mjs +0 -2
- package/dist/waiting-rooms-CmRAl51T.mjs +0 -11
- package/dist/web3-y_cY91V_.mjs +0 -4
- package/dist/workers-jDcq14GH.mjs +0 -24
- package/dist/zaraz-27zwjLvv.mjs +0 -2
- package/dist/zone-BJix2KQ9.mjs +0 -2
- package/dist/zones-Bkj5i92c.mjs +0 -21
- /package/dist/{alerts-CRmjqOZi.mjs → alerts-15-IW4jE.mjs} +0 -0
- /package/dist/{autorag-BD7cu5NU.mjs → autorag-CFwRkEKw.mjs} +0 -0
- /package/dist/{brands-BhALBkX2.mjs → brands-BgT1vu9B.mjs} +0 -0
- /package/dist/{chunk-6EUZQHAF-B7bSMYLe.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
- /package/dist/{clear-BgF8No7D.mjs → clear-BlCK85Me.mjs} +0 -0
- /package/dist/{cli-types-BsTty22w.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
- /package/dist/{connector-telemetry-events-latest-BY2556uL.mjs → connector-telemetry-events-latest-BbpcII3_.mjs} +0 -0
- /package/dist/{connector-telemetry-snapshots-latest-BHYdxUEF.mjs → connector-telemetry-snapshots-latest-DuCiimXl.mjs} +0 -0
- /package/dist/{domain-info-C50W5GhA.mjs → domain-info-C7LBxPBt.mjs} +0 -0
- /package/dist/{health-BFNZqiAm.mjs → health-DZFfafkX.mjs} +0 -0
- /package/dist/{input-validation-Bav2M9F-.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
- /package/dist/{internal-BTeSewwB.mjs → internal-BKHC2D1Y.mjs} +0 -0
- /package/dist/{live-Dkiyu30_.mjs → live-DwCvDmaH.mjs} +0 -0
- /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
- /package/dist/{rate-limit-analytics-Dz-Wv1T0.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
- /package/dist/{ready-TKOkKeRg.mjs → ready-D9H2zHHI.mjs} +0 -0
- /package/dist/{recent-submissions-3Asm6eIi.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
- /package/dist/{refute-BVz9nMyd.mjs → refute-2W8NLCN4.mjs} +0 -0
- /package/dist/{resolve-CeBbH6Pq.mjs → resolve-B8CyM1mi.mjs} +0 -0
- /package/dist/{scan-logo-ZteA-PUV.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
- /package/dist/{scan-page-DWDSyzQ7.mjs → scan-page-CWhta3x7.mjs} +0 -0
- /package/dist/{search-DGNc37HK.mjs → search-DZmBQJL9.mjs} +0 -0
- /package/dist/{signed-url-B5Qpn2mn.mjs → signed-url-CQrmWgz5.mjs} +0 -0
- /package/dist/{submission-info-FjUolE6A.mjs → submission-info-C98A0bqq.mjs} +0 -0
- /package/dist/{theme-CeVf-5qG.mjs → theme-CrIBazAF.mjs} +0 -0
- /package/dist/{total-queries-NHJj1HGq.mjs → total-queries-BZoaFoDE.mjs} +0 -0
- /package/dist/{tracked-domains-CniKVHIp.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
- /package/dist/{verify-DS1PWAJe.mjs → verify-4e4L9IRk.mjs} +0 -0
package/dist/{leaked-credential-checks-DUlUCOoJ.mjs → leaked-credential-checks-XcZmt1I-.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{h as e}from"./oauth-
|
|
2
|
+
import{h as e}from"./oauth-DuEONNgC.mjs";import{r as t}from"./auth-D3X9HYhD.mjs";import{t as n}from"./output-Ccqw2WOb.mjs";import{t as r}from"./dry-run-DL2V6yFm.mjs";import{t as i}from"./progress-BqQcF5QH.mjs";import{n as a,t as o}from"./body-parser-BshbixEq.mjs";import{n as s}from"./input-validation-QDIYu7Vb.mjs";import{n as c}from"./prompt-B0sWIs9c.mjs";function l(e){return e.option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`})}const u={command:`create`,describe:'Create a detection location for credentials that the default scan locations do not cover, using Rules language expressions such as `lookup_json_string(http.request.body.raw, "user")`. Only the username expression is required, and Leaked Credential Checks must be enabled on the zone.',builder:l,handler:async c=>{if(c.dryRun){r({command:`cf leaked-credential-checks detections create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({password:s(c.password,`password`,`text`),username:s(c.username,`username`,`text`)}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Creating`,async()=>l.leakedCredentialChecks.detections.create({body:e,zone_id:u})),{successLabel:`Created`});return}let d=o({password:s(c.password,`password`,`text`),username:s(c.username,`username`,`text`)});n(await i(`Creating`,async()=>l.leakedCredentialChecks.detections.create({body:d,zone_id:u})),{successLabel:`Created`})}};function d(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,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 f={command:`delete <detection-id>`,describe:`Delete a user-defined detection location, identified by its detection ID. Incoming requests are then scanned using only the default scan locations and the detection locations that remain.`,builder:d,handler:async a=>{if(a.dryRun){r({command:`cf leaked-credential-checks detections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/leaked-credential-checks/detections/${a[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(a[`detection-id`]))}`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``),"detection-id":String(a[`detection-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await c({force:!!a.force,message:`This operation deletes a Leaked Credential Checks custom detection location.`})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}n(await i(`Deleting`,async()=>o.leakedCredentialChecks.detections.delete({zone_id:s,detection_id:a[`detection-id`]})),{successLabel:`Deleted`})}};function p(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <detection-id>`,describe:`Get the username and password expressions of a single user-defined detection location, identified by its detection ID.`,builder:p,handler:async a=>{if(a.dryRun){r({command:`cf leaked-credential-checks detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/leaked-credential-checks/detections/${a[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(a[`detection-id`]))}`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``),"detection-id":String(a[`detection-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.leakedCredentialChecks.detections.get({zone_id:s,detection_id:a[`detection-id`]})),{successLabel:`Loaded`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List the user-defined detection locations configured for Leaked Credential Checks, each with its own identifier. A custom detection location tells the WAF where to find the username and password in requests to your application.`,builder:h,handler:async a=>{if(a.dryRun){r({command:`cf leaked-credential-checks detections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/leaked-credential-checks/detections`,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.leakedCredentialChecks.detections.list({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`})}const v={command:`update <detection-id>`,describe:`Update the username and password expressions of an existing detection location, identified by its detection ID. Both expressions are overwritten, so omitting the password expression clears it.`,builder:_,handler:async c=>{if(c.dryRun){r({command:`cf leaked-credential-checks detections update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/leaked-credential-checks/detections/${c[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(c[`detection-id`]))}`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``),"detection-id":String(c[`detection-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({password:s(c.password,`password`,`text`),username:s(c.username,`username`,`text`)}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.leakedCredentialChecks.detections.update({body:e,zone_id:u,detection_id:c[`detection-id`]})),{successLabel:`Updated`});return}let d=o({password:s(c.password,`password`,`text`),username:s(c.username,`username`,`text`)});n(await i(`Updating`,async()=>l.leakedCredentialChecks.detections.update({body:d,zone_id:u,detection_id:c[`detection-id`]})),{successLabel:`Updated`})}},y={command:`detections`,describe:`Custom detection locations that tell the WAF where to find usernames and passwords in requests`,builder:e=>e.command(u).command(f).command(m).command(g).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:`get`,describe:`Get the current Leaked Credential Checks status for the zone. While enabled, Cloudflare scans incoming requests for usernames and passwords that were exposed in known data breaches.`,builder:b,handler:async a=>{if(a.dryRun){r({command:`cf leaked-credential-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/leaked-credential-checks`,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.leakedCredentialChecks.get({zone_id:s})),{successLabel:`Loaded`})}};function S(e){return e.option(`enabled`,{type:`boolean`,description:`Determines whether or not Leaked Credential Checks are enabled.`}).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:`Defines the overall status for Leaked Credential Checks.`})}const C={command:`update`,describe:"Update the Leaked Credential Checks status for the zone, enabling or disabling the detection. While enabled, the detection populates the `cf.waf.credential_check.*` fields, which you can reference in custom rules and rate limiting rules to challenge or block requests carrying compromised credentials.",builder:S,handler:async s=>{if(s.dryRun){r({command:`cf leaked-credential-checks update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?o({enabled:s.enabled}):a(s.body)});return}let l=await t(s),u=await e({zone:s.zone},l,{quiet:s.quiet});if(s.zoneId=u,!await c({force:!!s.force,message:`This operation toggles Leaked Credential Checks for a zone.`})){process.stderr.write(`Aborted.
|
|
4
4
|
`);return}if(s.body){let e=a(s.body);n(await i(`Deleting`,async()=>l.leakedCredentialChecks.update({body:e,zone_id:u})),{successLabel:`Deleted`});return}let d=o({enabled:s.enabled});n(await i(`Deleting`,async()=>l.leakedCredentialChecks.update({body:d,zone_id:u})),{successLabel:`Deleted`})}},w={command:`leaked-credential-checks`,describe:`Detect compromised credentials in login requests by checking against known breach databases`,builder:e=>e.command(x).command(C).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n,h as r}from"./oauth-DuEONNgC.mjs";import{r as i}from"./auth-D3X9HYhD.mjs";import{t as a}from"./output-Ccqw2WOb.mjs";import{t as o}from"./dry-run-DL2V6yFm.mjs";import{t as s}from"./progress-BqQcF5QH.mjs";import{n as c,r as l,t as u}from"./body-parser-BshbixEq.mjs";import{n as d}from"./input-validation-QDIYu7Vb.mjs";import{a as f,n as p}from"./prompt-B0sWIs9c.mjs";import{t as m}from"./cli-types-DAYeL_Mj.mjs";function h(e){return e.option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`,default:!0}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`,default:!1}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`rules`,{type:`string`,description:`BETA Field Not General Access: A list of rules for this load balancer to execute. Provide as a JSON array of objects or @path/to/file.json.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`],default:`none`}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`],default:``}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`create`,describe:`Create a new account or zone-scoped load balancer.`,builder:h,handler:async p=>{if(p.dryRun){let e=p.zone===void 0?await n():void 0,t=p.zone===void 0?`accounts`:`zones`,r=p.zone??e??`<account-id>`;o({command:`cf load-balancers account create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/load_balancers`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:p.body===void 0?u({adaptive_routing:{failover_across_pools:p[`adaptive-routing-failover-across-pools`]},default_pools:p[`default-pools`],description:d(p.description,`description`,`text`),enabled:p.enabled,fallback_pool:d(p[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(p[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(p[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(p.name,`name`,`text`),networks:p.networks,proxied:p.proxied,random_steering:{default_weight:p[`random-steering-default-weight`]},rules:l(p.rules,`rules`),session_affinity:d(p[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:p[`session-affinity-attributes-drain-duration`],headers:p[`session-affinity-attributes-headers`],require_all_headers:p[`session-affinity-attributes-require-all-headers`],samesite:d(p[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(p[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(p[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:p[`session-affinity-ttl`],steering_policy:d(p[`steering-policy`],`steering-policy`,`text`),ttl:p.ttl}):c(p.body)});return}let m=await i(p),h=p.zone===void 0?`accounts`:`zones`,g=h===`zones`?await r({zone:p.zone},m,{quiet:p.quiet}):p.local?e:await t();if(h===`zones`?p.zoneId=g:p.accountId=g,p.body){let e=c(p.body);a(await s(`Creating`,async()=>m.loadBalancers.account.create({...e,account_or_zone:h,account_or_zone_id:g})),{successLabel:`Created`});return}if(p[`default-pools`]===void 0)throw Error(`--default-pools is required (or pass --body with this field set).`);p[`fallback-pool`]===void 0&&(p[`fallback-pool`]=await f(`fallback-pool`,`The pool ID to use when all other pools are detected as unhealthy.`)),p.name===void 0&&(p.name=await f(`name`,`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`));let _=u({adaptive_routing:{failover_across_pools:p[`adaptive-routing-failover-across-pools`]},default_pools:p[`default-pools`],description:d(p.description,`description`,`text`),enabled:p.enabled,fallback_pool:d(p[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(p[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(p[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(p.name,`name`,`text`),networks:p.networks,proxied:p.proxied,random_steering:{default_weight:p[`random-steering-default-weight`]},rules:l(p.rules,`rules`),session_affinity:d(p[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:p[`session-affinity-attributes-drain-duration`],headers:p[`session-affinity-attributes-headers`],require_all_headers:p[`session-affinity-attributes-require-all-headers`],samesite:d(p[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(p[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(p[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:p[`session-affinity-ttl`],steering_policy:d(p[`steering-policy`],`steering-policy`,`text`),ttl:p.ttl});a(await s(`Creating`,async()=>m.loadBalancers.account.create({..._,account_or_zone:h,account_or_zone_id:g})),{successLabel:`Created`})}};function _(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer 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 ee={command:`delete <load-balancer-id>`,describe:`Delete a configured account or zone-scoped load balancer.`,builder:_,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf load-balancers account delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/load_balancers/${c[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(c[`load-balancer-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"load-balancer-id":String(c[`load-balancer-id`]??``)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();if(u===`zones`?c.zoneId=d:c.accountId=d,!await p({force:!!c.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>l.loadBalancers.account.delete({account_or_zone:u,account_or_zone_id:d,load_balancer_id:c[`load-balancer-id`]})),{successLabel:`Deleted`})}};function te(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`rules`,{type:`string`,description:`BETA Field Not General Access: A list of rules for this load balancer to execute. Provide as a JSON array of objects or @path/to/file.json.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`]}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`]}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"The editable properties shared by load balancer create, update, and patch requests. Operations layer their own `required` constraints on top via `allOf`."})}const v={command:`edit <load-balancer-id>`,describe:`Apply changes to an existing account or zone-scoped load balancer, overwriting the supplied properties.`,builder:te,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf load-balancers account edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/load_balancers/${f[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(f[`load-balancer-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"load-balancer-id":String(f[`load-balancer-id`]??``)},bodyKind:`json`,body:f.body===void 0?u({adaptive_routing:{failover_across_pools:f[`adaptive-routing-failover-across-pools`]},default_pools:f[`default-pools`],description:d(f.description,`description`,`text`),enabled:f.enabled,fallback_pool:d(f[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(f[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(f[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(f.name,`name`,`text`),networks:f.networks,proxied:f.proxied,random_steering:{default_weight:f[`random-steering-default-weight`]},rules:l(f.rules,`rules`),session_affinity:d(f[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:f[`session-affinity-attributes-drain-duration`],headers:f[`session-affinity-attributes-headers`],require_all_headers:f[`session-affinity-attributes-require-all-headers`],samesite:d(f[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(f[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(f[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:f[`session-affinity-ttl`],steering_policy:d(f[`steering-policy`],`steering-policy`,`text`),ttl:f.ttl}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Updating`,async()=>p.loadBalancers.account.edit({body:e,account_or_zone:m,account_or_zone_id:h,load_balancer_id:f[`load-balancer-id`]})),{successLabel:`Updated`});return}let g=u({adaptive_routing:{failover_across_pools:f[`adaptive-routing-failover-across-pools`]},default_pools:f[`default-pools`],description:d(f.description,`description`,`text`),enabled:f.enabled,fallback_pool:d(f[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(f[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(f[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(f.name,`name`,`text`),networks:f.networks,proxied:f.proxied,random_steering:{default_weight:f[`random-steering-default-weight`]},rules:l(f.rules,`rules`),session_affinity:d(f[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:f[`session-affinity-attributes-drain-duration`],headers:f[`session-affinity-attributes-headers`],require_all_headers:f[`session-affinity-attributes-require-all-headers`],samesite:d(f[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(f[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(f[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:f[`session-affinity-ttl`],steering_policy:d(f[`steering-policy`],`steering-policy`,`text`),ttl:f.ttl});a(await s(`Updating`,async()=>p.loadBalancers.account.edit({body:g,account_or_zone:m,account_or_zone_id:h,load_balancer_id:f[`load-balancer-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <load-balancer-id>`,describe:`Fetch a single configured account or zone-scoped load balancer.`,builder:y,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf load-balancers account get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/load_balancers/${c[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(c[`load-balancer-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"load-balancer-id":String(c[`load-balancer-id`]??``)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.loadBalancers.account.get({account_or_zone:u,account_or_zone_id:d,load_balancer_id:c[`load-balancer-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`List configured account or zone-scoped load balancers.`,builder:x,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf load-balancers account list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/load_balancers`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.loadBalancers.account.list({account_or_zone:u,account_or_zone_id:d})),{successLabel:`Loaded`})}};function C(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`rules`,{type:`string`,description:`BETA Field Not General Access: A list of rules for this load balancer to execute. Provide as a JSON array of objects or @path/to/file.json.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`]}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`]}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).option(`dry-run`,{type:`boolean`,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:`update <load-balancer-id>`,describe:`Update a configured account or zone-scoped load balancer.`,builder:C,handler:async p=>{if(p.dryRun){let e=p.zone===void 0?await n():void 0,t=p.zone===void 0?`accounts`:`zones`,r=p.zone??e??`<account-id>`;o({command:`cf load-balancers account update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/load_balancers/${p[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(p[`load-balancer-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"load-balancer-id":String(p[`load-balancer-id`]??``)},bodyKind:`json`,body:p.body===void 0?u({adaptive_routing:{failover_across_pools:p[`adaptive-routing-failover-across-pools`]},default_pools:p[`default-pools`],description:d(p.description,`description`,`text`),enabled:p.enabled,fallback_pool:d(p[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(p[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(p[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(p.name,`name`,`text`),networks:p.networks,proxied:p.proxied,random_steering:{default_weight:p[`random-steering-default-weight`]},rules:l(p.rules,`rules`),session_affinity:d(p[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:p[`session-affinity-attributes-drain-duration`],headers:p[`session-affinity-attributes-headers`],require_all_headers:p[`session-affinity-attributes-require-all-headers`],samesite:d(p[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(p[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(p[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:p[`session-affinity-ttl`],steering_policy:d(p[`steering-policy`],`steering-policy`,`text`),ttl:p.ttl}):c(p.body)});return}let m=await i(p),h=p.zone===void 0?`accounts`:`zones`,g=h===`zones`?await r({zone:p.zone},m,{quiet:p.quiet}):p.local?e:await t();if(h===`zones`?p.zoneId=g:p.accountId=g,p.body){let e=c(p.body);a(await s(`Updating`,async()=>m.loadBalancers.account.update({...e,account_or_zone:h,account_or_zone_id:g,load_balancer_id:p[`load-balancer-id`]})),{successLabel:`Updated`});return}if(p[`default-pools`]===void 0)throw Error(`--default-pools is required (or pass --body with this field set).`);p[`fallback-pool`]===void 0&&(p[`fallback-pool`]=await f(`fallback-pool`,`The pool ID to use when all other pools are detected as unhealthy.`)),p.name===void 0&&(p.name=await f(`name`,`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`));let _=u({adaptive_routing:{failover_across_pools:p[`adaptive-routing-failover-across-pools`]},default_pools:p[`default-pools`],description:d(p.description,`description`,`text`),enabled:p.enabled,fallback_pool:d(p[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(p[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(p[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(p.name,`name`,`text`),networks:p.networks,proxied:p.proxied,random_steering:{default_weight:p[`random-steering-default-weight`]},rules:l(p.rules,`rules`),session_affinity:d(p[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:p[`session-affinity-attributes-drain-duration`],headers:p[`session-affinity-attributes-headers`],require_all_headers:p[`session-affinity-attributes-require-all-headers`],samesite:d(p[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(p[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(p[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:p[`session-affinity-ttl`],steering_policy:d(p[`steering-policy`],`steering-policy`,`text`),ttl:p.ttl});a(await s(`Updating`,async()=>m.loadBalancers.account.update({..._,account_or_zone:h,account_or_zone_id:g,load_balancer_id:p[`load-balancer-id`]})),{successLabel:`Updated`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Get current load balancer resource usage counts for an account.`,builder:T,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers account usage list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/usage`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.account.usage.list({account_id:l})),{successLabel:`Loaded`})}},D={command:`usage`,describe:`Operations for account.usage`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},O={command:`account`,describe:`Operations for account`,builder:e=>e.command(g).command(ee).command(v).command(b).command(S).command(w).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`members`,{type:`string`,description:`List of monitors in this group. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const A={command:`create`,describe:`Create a new monitor group.`,builder:k,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),members:l(r.members,`members`)}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Creating`,async()=>p.loadBalancers.monitorGroups.create({body:e,account_id:m})),{successLabel:`Created`});return}if(r.description===void 0&&(r.description=await f(`description`,`A short description of the monitor group`)),r.members===void 0)throw Error(`--members is required (or pass --body with this field set).`);let h=u({description:d(r.description,`description`,`text`),members:l(r.members,`members`)});a(await s(`Creating`,async()=>p.loadBalancers.monitorGroups.create({body:h,account_id:m})),{successLabel:`Created`})}};function j(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const M={command:`delete <monitor-group-id>`,describe:`Delete a configured monitor group.`,builder:j,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}a(await s(`Deleting`,async()=>c.loadBalancers.monitorGroups.delete({account_id:l,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Deleted`})}};function N(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`members`,{type:`string`,description:`List of monitors in this group. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`edit <monitor-group-id>`,describe:`Apply changes to an existing monitor group, overwriting the supplied properties.`,builder:N,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),members:l(r.members,`members`)}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Updating`,async()=>p.loadBalancers.monitorGroups.edit({body:e,account_id:m,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`});return}if(r.description===void 0&&(r.description=await f(`description`,`A short description of the monitor group`)),r.members===void 0)throw Error(`--members is required (or pass --body with this field set).`);let h=u({description:d(r.description,`description`,`text`),members:l(r.members,`members`)});a(await s(`Updating`,async()=>p.loadBalancers.monitorGroups.edit({body:h,account_id:m,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`})}};function F(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <monitor-group-id>`,describe:`Fetch a single configured monitor group.`,builder:F,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.monitorGroups.get({account_id:l,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Loaded`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`List configured monitor groups.`,builder:L,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.monitorGroups.list({account_id:l})),{successLabel:`Loaded`})}};function z(e){return e.option(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:`Get the list of resources that reference the provided monitor group.`,builder:z,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups references list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}/references`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.monitorGroups.references.list({account_id:l,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Loaded`})}},V={command:`references`,describe:`List references to monitor groups used by load balancer pools`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`members`,{type:`string`,description:`List of monitors in this group. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`update <monitor-group-id>`,describe:`Modify a configured monitor group.`,builder:H,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitor-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),members:l(r.members,`members`)}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Updating`,async()=>p.loadBalancers.monitorGroups.update({body:e,account_id:m,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`});return}if(r.description===void 0&&(r.description=await f(`description`,`A short description of the monitor group`)),r.members===void 0)throw Error(`--members is required (or pass --body with this field set).`);let h=u({description:d(r.description,`description`,`text`),members:l(r.members,`members`)});a(await s(`Updating`,async()=>p.loadBalancers.monitorGroups.update({body:h,account_id:m,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`})}},W={command:`monitor-groups`,describe:`Group monitors together for shared configuration and bulk management`,builder:e=>e.command(A).command(M).command(P).command(I).command(R).command(U).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,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:`Create a configured monitor.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.loadBalancers.monitors.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.loadBalancers.monitors.create({body:p,account_id:f})),{successLabel:`Created`})}};function q(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor 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 <monitor-id>`,describe:`Delete a configured monitor.`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors/${r[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(r[`monitor-id`]))}`,pathParams:{"monitor-id":String(r[`monitor-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}a(await s(`Deleting`,async()=>c.loadBalancers.monitors.delete({account_id:l,monitor_id:r[`monitor-id`]})),{successLabel:`Deleted`})}};function Y(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,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:`edit <monitor-id>`,describe:`Apply changes to an existing monitor, overwriting the supplied properties.`,builder:Y,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors/${r[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(r[`monitor-id`]))}`,pathParams:{"monitor-id":String(r[`monitor-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.loadBalancers.monitors.edit({body:e,account_id:f,monitor_id:r[`monitor-id`]})),{successLabel:`Updated`});return}let p=u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)});a(await s(`Updating`,async()=>l.loadBalancers.monitors.edit({body:p,account_id:f,monitor_id:r[`monitor-id`]})),{successLabel:`Updated`})}};function Z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <monitor-id>`,describe:`List a single configured monitor for an account.`,builder:Z,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors/${r[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(r[`monitor-id`]))}`,pathParams:{"monitor-id":String(r[`monitor-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.monitors.get({account_id:l,monitor_id:r[`monitor-id`]})),{successLabel:`Loaded`})}};function ne(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`List configured monitors for an account.`,builder:ne,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.monitors.list({account_id:l})),{successLabel:`Loaded`})}};function ie(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ae={command:`create <monitor-id>`,describe:`Preview pools using the specified monitor with provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:ie,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors/${r[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(r[`monitor-id`]))}/preview`,pathParams:{"monitor-id":String(r[`monitor-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.loadBalancers.monitors.previews.create({body:e,account_id:f,monitor_id:r[`monitor-id`]})),{successLabel:`Created`});return}let p=u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.loadBalancers.monitors.previews.create({body:p,account_id:f,monitor_id:r[`monitor-id`]})),{successLabel:`Created`})}},oe={command:`previews`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function se(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <monitor-id>`,describe:`Get the list of resources that reference the provided monitor.`,builder:se,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors references get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors/${r[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(r[`monitor-id`]))}/references`,pathParams:{"monitor-id":String(r[`monitor-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.monitors.references.get({account_id:l,monitor_id:r[`monitor-id`]})),{successLabel:`Loaded`})}},le={command:`references`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ue(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,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:`update <monitor-id>`,describe:`Modify a configured monitor.`,builder:ue,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers monitors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/monitors/${r[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(r[`monitor-id`]))}`,pathParams:{"monitor-id":String(r[`monitor-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.loadBalancers.monitors.update({body:e,account_id:f,monitor_id:r[`monitor-id`]})),{successLabel:`Updated`});return}let p=u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)});a(await s(`Updating`,async()=>l.loadBalancers.monitors.update({body:p,account_id:f,monitor_id:r[`monitor-id`]})),{successLabel:`Updated`})}},fe={command:`monitors`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(K).command(J).command(X).command(Q).command(re).command(de).command(oe).command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.option(`notification-email`,{type:`string`,description:'The email address to send health status notifications to. This field is now deprecated in favor of Cloudflare Notifications for Load Balancing, so only resetting this field with an empty string `""` is accepted.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`bulk-edit`,describe:"Apply changes to a number of existing pools, overwriting the supplied properties. Pools are ordered by ascending `name`. Returns the list of affected pools. Supports the standard pagination query parameters, either `limit`/`offset` or `per_page`/`page`.",builder:pe,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({notification_email:d(r[`notification-email`],`notification-email`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.loadBalancers.pools.bulkEdit({body:e,account_id:f})),{successLabel:`Updated`});return}let p=u({notification_email:d(r[`notification-email`],`notification-email`,`text`)});a(await s(`Updating`,async()=>l.loadBalancers.pools.bulkEdit({body:p,account_id:f})),{successLabel:`Updated`})}};function he(e){return e.option(`description`,{type:`string`,description:`A human-readable description of the pool.`,default:``}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`,default:!0}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`,default:1}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`,default:``}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).option(`origins`,{type:`string`,description:`The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ge={command:`create`,describe:`Create a new pool.`,builder:he,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),enabled:r.enabled,latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)},origins:l(r.origins,`origins`)}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Creating`,async()=>p.loadBalancers.pools.create({...e,account_id:m})),{successLabel:`Created`});return}if(r.name===void 0&&(r.name=await f(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`)),r.origins===void 0)throw Error(`--origins is required (or pass --body with this field set).`);let h=u({description:d(r.description,`description`,`text`),enabled:r.enabled,latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)},origins:l(r.origins,`origins`)});a(await s(`Creating`,async()=>p.loadBalancers.pools.create({...h,account_id:m})),{successLabel:`Created`})}};function _e(e){return e.positional(`pool-id`,{type:`string`,description:`Pool 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 ve={command:`delete <pool-id>`,describe:`Delete a configured pool.`,builder:_e,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}a(await s(`Deleting`,async()=>c.loadBalancers.pools.delete({account_id:l,pool_id:r[`pool-id`]})),{successLabel:`Deleted`})}};function ye(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`health-sources`,{type:`string`,array:!0,description:`A list of health sources, ordered from highest to lowest priority, used to evaluate individual origin health and overall pool health. The load balancer uses the first source that has data and falls back to the next. Currently accepted values are null or the exact array ["regional", "global"]; any other combination is rejected. Null (the default) behaves like ["local", "global"]. ["regional", "global"] makes each region steer on its own health, falling back to the global decision when a region has no fresh data. Setting regional requires at least one region in check_regions.`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).option(`origins`,{type:`string`,description:`The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`edit <pool-id>`,describe:`Apply changes to an existing pool, overwriting the supplied properties.`,builder:ye,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({check_regions:r[`check-regions`],description:d(r.description,`description`,`text`),enabled:r.enabled,health_sources:r[`health-sources`],latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)},origins:l(r.origins,`origins`)}):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(`Updating`,async()=>f.loadBalancers.pools.edit({...e,account_id:p,pool_id:r[`pool-id`]})),{successLabel:`Updated`});return}let m=u({check_regions:r[`check-regions`],description:d(r.description,`description`,`text`),enabled:r.enabled,health_sources:r[`health-sources`],latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)},origins:l(r.origins,`origins`)});a(await s(`Updating`,async()=>f.loadBalancers.pools.edit({...m,account_id:p,pool_id:r[`pool-id`]})),{successLabel:`Updated`})}};function xe(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`get <pool-id>`,describe:`Fetch a single configured pool.`,builder:xe,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.pools.get({account_id:l,pool_id:r[`pool-id`]})),{successLabel:`Loaded`})}};function Ce(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const we={command:`create <pool-id>`,describe:`Preview pool health using provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:Ce,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools health create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}/preview`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.loadBalancers.pools.health.create({body:e,account_id:f,pool_id:r[`pool-id`]})),{successLabel:`Created`});return}let p=u({allow_insecure:r[`allow-insecure`],consecutive_down:r[`consecutive-down`],consecutive_up:r[`consecutive-up`],description:d(r.description,`description`,`text`),expected_body:d(r[`expected-body`],`expected-body`,`text`),expected_codes:d(r[`expected-codes`],`expected-codes`,`text`),follow_redirects:r[`follow-redirects`],interval:r.interval,method:d(r.method,`method`,`text`),path:d(r.path,`path`,`text`),port:r.port,probe_zone:d(r[`probe-zone`],`probe-zone`,`text`),retries:r.retries,timeout:r.timeout,type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.loadBalancers.pools.health.create({body:p,account_id:f,pool_id:r[`pool-id`]})),{successLabel:`Created`})}};function Te(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <pool-id>`,describe:`Fetch the latest pool health status for a single pool.`,builder:Te,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools health get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}/health`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.pools.health.get({account_id:l,pool_id:r[`pool-id`]})),{successLabel:`Loaded`})}},De={command:`health`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(we).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oe(e){return e.option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ke={command:`list`,describe:`List configured pools.`,builder:Oe,handler:async r=>{let c={monitor:r.monitor};if(r.dryRun){o({command:`cf load-balancers pools list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.loadBalancers.pools.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ae(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const je={command:`get <pool-id>`,describe:`Get the list of resources that reference the provided pool.`,builder:Ae,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools references get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}/references`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.pools.references.get({account_id:l,pool_id:r[`pool-id`]})),{successLabel:`Loaded`})}},Me={command:`references`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ne(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`health-sources`,{type:`string`,array:!0,description:`A list of health sources, ordered from highest to lowest priority, used to evaluate individual origin health and overall pool health. The load balancer uses the first source that has data and falls back to the next. Currently accepted values are null or the exact array ["regional", "global"]; any other combination is rejected. Null (the default) behaves like ["local", "global"]. ["regional", "global"] makes each region steer on its own health, falling back to the global decision when a region has no fresh data. Setting regional requires at least one region in check_regions.`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).option(`origins`,{type:`string`,description:`The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pe={command:`update <pool-id>`,describe:`Modify a configured pool.`,builder:Ne,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers pools update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({check_regions:r[`check-regions`],description:d(r.description,`description`,`text`),enabled:r.enabled,health_sources:r[`health-sources`],latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)},origins:l(r.origins,`origins`)}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Updating`,async()=>p.loadBalancers.pools.update({...e,account_id:m,pool_id:r[`pool-id`]})),{successLabel:`Updated`});return}if(r.name===void 0&&(r.name=await f(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`)),r.origins===void 0)throw Error(`--origins is required (or pass --body with this field set).`);let h=u({check_regions:r[`check-regions`],description:d(r.description,`description`,`text`),enabled:r.enabled,health_sources:r[`health-sources`],latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)},origins:l(r.origins,`origins`)});a(await s(`Updating`,async()=>p.loadBalancers.pools.update({...h,account_id:m,pool_id:r[`pool-id`]})),{successLabel:`Updated`})}},$={command:`pools`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(me).command(ge).command(ve).command(be).command(Se).command(ke).command(Pe).command(De).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(e){return e.positional(`preview-id`,{type:`string`,description:`Preview ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`get <preview-id>`,describe:`Get the result of a previous preview operation using the provided preview_id.`,builder:Fe,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/preview/${r[`preview-id`]==null?`<preview-id>`:encodeURIComponent(String(r[`preview-id`]))}`,pathParams:{"preview-id":String(r[`preview-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.previews.get({account_id:l,preview_id:r[`preview-id`]})),{successLabel:`Loaded`})}},Le={command:`previews`,describe:`Preview the result of a health check monitor configuration before applying it`,builder:e=>e.command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Re(e){return e.positional(`region-id`,{type:`string`,description:`A list of Cloudflare regions. WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: Southern Asia, SEAS: South East Asia, NEAS: North East Asia).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <region-id>`,describe:`Get a single region mapping.`,builder:Re,handler:async r=>{if(r.dryRun){o({command:`cf load-balancers regions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/regions/${r[`region-id`]==null?`<region-id>`:encodeURIComponent(String(r[`region-id`]))}`,pathParams:{"region-id":String(r[`region-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.loadBalancers.regions.get({account_id:l,region_id:r[`region-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`subdivision-code`,{type:`string`,description:`Two-letter subdivision code followed in ISO 3166-2.`}).option(`subdivision-code-a2`,{type:`string`,description:`Two-letter subdivision code followed in ISO 3166-2.`}).option(`country-code-a2`,{type:`string`,description:`Two-letter alpha-2 country code followed in ISO 3166-1.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`List all region mappings.`,builder:Be,handler:async r=>{let c={subdivision_code:r[`subdivision-code`],subdivision_code_a2:r[`subdivision-code-a2`],country_code_a2:r[`country-code-a2`]};if(r.dryRun){o({command:`cf load-balancers regions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/regions`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.loadBalancers.regions.list({account_id:u,...c})),{successLabel:`Loaded`})}},He={command:`regions`,describe:`Geographic regions used for regional pool steering and traffic policies`,builder:e=>e.command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ue(e){return e.option(`query`,{type:`string`,description:`Search query term.`}).option(`references`,{type:`string`,description:`The type of references to include. "*" to include both referral and referrer references. "" to not include any reference information.`,choices:[``,`*`,`referral`,`referrer`]}).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 We={command:`list`,describe:`Search for Load Balancing resources.`,builder:m(Ue),handler:async r=>{let c={query:r.query,references:r.references,page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf load-balancers searches list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/load_balancers/search`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.loadBalancers.searches.list({account_id:u,...c})),{successLabel:`Loaded`})}},Ge={command:`searches`,describe:`Search across all load balancer resources (pools, monitors, load balancers) by name or reference`,builder:e=>e.command(We).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ke={command:`load-balancers`,describe:`Distribute traffic across origin pools with health monitoring, geo-steering, and failover`,builder:e=>e.command(O).command(W).command(fe).command($).command(Le).command(He).command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ke as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e}from"./chunk-vbHwaUoU.mjs";var t=e({LOCAL_ACCOUNT_ID:()=>o,NO_LOCAL_EQUIVALENT:()=>n,createLocalFetch:()=>a,disposeLocalRuntime:()=>i});const n=`This command has no local equivalent. Re-run without --local to use the Cloudflare API.`;let r;async function i(){let e=r;r=void 0,await e?.()}function a(e={}){return async function(t,n){let{dispatchLocal:i,disposeLocalSession:a}=await import(`./local-runtime-
|
|
2
|
+
import{n as e}from"./chunk-vbHwaUoU.mjs";var t=e({LOCAL_ACCOUNT_ID:()=>o,NO_LOCAL_EQUIVALENT:()=>n,createLocalFetch:()=>a,disposeLocalRuntime:()=>i});const n=`This command has no local equivalent. Re-run without --local to use the Cloudflare API.`;let r;async function i(){let e=r;r=void 0,await e?.()}function a(e={}){return async function(t,n){let{dispatchLocal:i,disposeLocalSession:a}=await import(`./local-runtime-Ce7k598H.mjs`);return r=a,i(new Request(t,n),e.persistTo,e.apiBaseUrl)}}const o=`local`;export{t as a,i,n,a as r,o as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e}from"./local-
|
|
2
|
+
import{n as e}from"./local-Be3lg_9E.mjs";import{i as t}from"./cf-Ds4JFovl.mjs";import{n}from"./registry-jifR3_Y6.mjs";import{mkdtempSync as r,rmSync as i,statSync as a}from"node:fs";import{join as o,resolve as s}from"node:path";import{tmpdir as c}from"node:os";import{randomUUID as l}from"node:crypto";import{Miniflare as u}from"miniflare";const d=/^\/accounts\/[^/]+/;function f(e){let n=e!==void 0&&e!==``?o(s(process.cwd(),e),`v3`):o(t(),`state`,`v3`);try{if(!a(n).isDirectory())throw Error(`Local persistence path must be a directory: ${n}`)}catch(e){let t=e.code;if(t===`ENOENT`)return n;throw t===`ENOTDIR`?Error(`Local persistence path must be a directory: ${n}`):e}return n}let p;function m(e){let t=n(),a=r(o(c(),`cf-local-isolated-${process.pid}-`));try{return{mf:new u({unsafeLocalExplorer:!0,cf:!1,resourcePersistencePath:e,unsafeEnableSharedStorage:!0,isolatedResourcePersistencePath:a,unsafeDevRegistryPath:t,workers:[{config:{name:`cf-local-${l()}`,type:`worker`,compatibilityDate:`2026-08-15`,manifest:{mainModule:`cf-local.mjs`,modules:{"cf-local.mjs":{type:`esm`,contents:`export default { fetch() { return new Response(null, { status: 404 }); } };`}}}}}]}),isolatedPersistRoot:a}}catch(e){throw i(a,{recursive:!0,force:!0}),e}}async function h(t,n,r){let i=new URL(t.url),a=new URL(r??`https://api.cloudflare.com/client/v4`).pathname.replace(/\/+$/,``),o=`http://localhost/cdn-cgi/local/explorer/api${i.pathname.slice(a.length).replace(d,``)||`/`}${i.search}`,s=new Headers(t.headers);s.delete(`Authorization`),s.set(`Host`,`localhost`);let c;try{c=p??=m(f(n))}catch(e){return g(500,`Could not start the local runtime: ${_(e)}`)}let l;try{let e={method:t.method,headers:[...s],redirect:`manual`,signal:t.signal};t.body!==null&&(e.body=t.body,e.duplex=`half`),l=await c.mf.dispatchFetch(o,e)}catch(e){return g(500,`The local runtime failed to answer: ${_(e)}`)}if(l.status===404&&l.headers.get(`content-type`)?.includes(`json`)!==!0){await l.body?.cancel();let n=new URL(o).pathname.replace(/^.*\/explorer\/api/,``);return g(404,`${e} The local explorer API does not implement ${t.method} ${n}.`)}return l}function g(e,t){return new Response(JSON.stringify({success:!1,errors:[{message:t}],messages:[],result:null}),{status:e,headers:{"content-type":`application/json`}})}function _(e){return e instanceof Error?e.message:String(e)}async function v(){let e=p;if(p=void 0,e!==void 0)try{let{mf:t,isolatedPersistRoot:n}=e;await t.dispose().finally(()=>i(n,{recursive:!0,force:!0}))}catch{}}export{h as dispatchLocal,v as disposeLocalSession};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n,h as r}from"./oauth-DuEONNgC.mjs";import{a as i,r as a}from"./auth-D3X9HYhD.mjs";import{t as o}from"./output-Ccqw2WOb.mjs";import{t as s}from"./dry-run-DL2V6yFm.mjs";import{t as c}from"./progress-BqQcF5QH.mjs";import{n as l,r as u,t as d}from"./body-parser-BshbixEq.mjs";import{n as f,t as p}from"./input-validation-QDIYu7Vb.mjs";import{a as m,n as h}from"./prompt-B0sWIs9c.mjs";function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`available`,describe:`Returns all dataset types that this account or zone can create. Each entry includes the dataset schema and timestamp field. The schema shows all possible fields for a dataset. However, not all fields may be available for your account or zone. When creating or updating a dataset, only fields available to your account or zone can be enabled. If you request a field that is not available, you will receive an error.`,builder:g,handler:async i=>{if(i.dryRun){let e=i.zone===void 0?await n():void 0,t=i.zone===void 0?`accounts`:`zones`,r=i.zone??e??`<account-id>`;s({command:`cf logexplorer account datasets available`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/datasets/available`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await a(i),u=i.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:i.zone},l,{quiet:i.quiet}):i.local?e:await t();u===`zones`?i.zoneId=d:i.accountId=d,o(await c(`Loading`,async()=>l.logexplorer.account.datasets.available({account_or_zone:u,account_or_zone_id:d})),{successLabel:`Loaded`})}};function v(e){return e.option(`dataset`,{type:`string`,description:"Dataset type name to create (e.g. `http_requests`)."}).option(`fields`,{type:`string`,description:`Controls which fields the API ingests. Defaults to all available
|
|
3
|
+
fields when absent.
|
|
4
|
+
. Provide as a JSON array of objects or @path/to/file.json.`}).option(`filter`,{type:`string`,description:`Optional Logpush filter predicate to restrict which events are ingested.
|
|
5
|
+
If provided, replaces the dataset's default filter entirely.
|
|
6
|
+
See [Logpush filters](https://developers.cloudflare.com/logs/reference/filters/)
|
|
7
|
+
for syntax and examples.
|
|
8
|
+
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`create`,describe:"Create a new Log Explorer dataset for the account or zone. List available account or zone datasets to see the dataset types and fields you can use. The `fields` property is optional. If not specified, all available fields will be enabled. For dataset field definitions, see: https://developers.cloudflare.com/logs/logpush/logpush-job/datasets/",builder:v,handler:async i=>{if(i.dryRun){let e=i.zone===void 0?await n():void 0,t=i.zone===void 0?`accounts`:`zones`,r=i.zone??e??`<account-id>`;s({command:`cf logexplorer account datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/datasets`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:i.body===void 0?d({dataset:f(i.dataset,`dataset`,`text`),fields:u(i.fields,`fields`),filter:f(i.filter,`filter`,`text`)}):l(i.body)});return}let p=await a(i),h=i.zone===void 0?`accounts`:`zones`,g=h===`zones`?await r({zone:i.zone},p,{quiet:i.quiet}):i.local?e:await t();if(h===`zones`?i.zoneId=g:i.accountId=g,i.body){let e=l(i.body);o(await c(`Creating`,async()=>p.logexplorer.account.datasets.create({...e,account_or_zone:h,account_or_zone_id:g})),{successLabel:`Created`});return}i.dataset===void 0&&(i.dataset=await m(`dataset`,"Dataset type name to create (e.g. `http_requests`)."));let _=d({dataset:f(i.dataset,`dataset`,`text`),fields:u(i.fields,`fields`),filter:f(i.filter,`filter`,`text`)});o(await c(`Creating`,async()=>p.logexplorer.account.datasets.create({..._,account_or_zone:h,account_or_zone_id:g})),{successLabel:`Created`})}};function b(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <dataset-id>`,describe:`Deletes a Log Explorer dataset for the account or zone. Dataset deletion must not be protected.`,builder:b,handler:async i=>{if(i.dryRun){let e=i.zone===void 0?await n():void 0,t=i.zone===void 0?`accounts`:`zones`,r=i.zone??e??`<account-id>`;s({command:`cf logexplorer account datasets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/datasets/${i[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(i[`dataset-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"dataset-id":String(i[`dataset-id`]??``)},bodyKind:`none`});return}let l=await a(i),u=i.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:i.zone},l,{quiet:i.quiet}):i.local?e:await t();if(u===`zones`?i.zoneId=d:i.accountId=d,!await h({force:!!i.force,message:`This operation deletes a Log Explorer dataset for the account.`})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}o(await c(`Deleting`,async()=>l.logexplorer.account.datasets.delete({account_or_zone:u,account_or_zone_id:d,dataset_id:i[`dataset-id`]})),{successLabel:`Deleted`})}};function S(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <dataset-id>`,describe:`Retrieve a single Log Explorer dataset by ID for the account or zone.`,builder:S,handler:async i=>{if(i.dryRun){let e=i.zone===void 0?await n():void 0,t=i.zone===void 0?`accounts`:`zones`,r=i.zone??e??`<account-id>`;s({command:`cf logexplorer account datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/datasets/${i[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(i[`dataset-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"dataset-id":String(i[`dataset-id`]??``)},bodyKind:`none`});return}let l=await a(i),u=i.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:i.zone},l,{quiet:i.quiet}):i.local?e:await t();u===`zones`?i.zoneId=d:i.accountId=d,o(await c(`Loading`,async()=>l.logexplorer.account.datasets.get({account_or_zone:u,account_or_zone_id:d,dataset_id:i[`dataset-id`]})),{successLabel:`Loaded`})}};function w(e){return e.option(`include-zones`,{type:`boolean`,description:`Set to true to include zone-scoped datasets belonging to this account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:"Returns all Log Explorer datasets configured for the account or zone. Pass `include_zones=true` to also include zone-level datasets that belong to this account or zone. List responses omit the `fields` property; use the single-dataset endpoint to retrieve field configuration.",builder:w,handler:async i=>{let l={include_zones:i[`include-zones`]};if(i.dryRun){let e=i.zone===void 0?await n():void 0,t=i.zone===void 0?`accounts`:`zones`,r=i.zone??e??`<account-id>`;s({command:`cf logexplorer account datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/datasets`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},query:l,bodyKind:`none`});return}let u=await a(i),d=i.zone===void 0?`accounts`:`zones`,f=d===`zones`?await r({zone:i.zone},u,{quiet:i.quiet}):i.local?e:await t();d===`zones`?i.zoneId=f:i.accountId=f,o(await c(`Loading`,async()=>u.logexplorer.account.datasets.list({account_or_zone:d,account_or_zone_id:f,...l})),{successLabel:`Loaded`})}};function E(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`deletion-protection`,{type:`boolean`,description:"Set to `false` to allow deletion of this dataset."}).option(`enabled`,{type:`boolean`,description:`Whether to enable or disable log ingest for this dataset.`}).option(`fields`,{type:`string`,description:`Controls which fields the API ingests after the update. Defaults
|
|
10
|
+
to all available fields when absent.
|
|
11
|
+
. Provide as a JSON array of objects or @path/to/file.json.`}).option(`filter`,{type:`string`,description:`Optional Logpush filter predicate to restrict which events are
|
|
12
|
+
ingested. If omitted, the existing filter is left unchanged. Set
|
|
13
|
+
to an empty string (\`""\`) to clear the filter. Otherwise,
|
|
14
|
+
replaces the dataset's filter entirely.
|
|
15
|
+
See [Logpush filters](https://developers.cloudflare.com/logs/reference/filters/)
|
|
16
|
+
for syntax and examples.
|
|
17
|
+
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`update <dataset-id>`,describe:`Updates the enabled state and/or field configuration of an account or zone dataset.`,builder:E,handler:async i=>{if(i.dryRun){let e=i.zone===void 0?await n():void 0,t=i.zone===void 0?`accounts`:`zones`,r=i.zone??e??`<account-id>`;s({command:`cf logexplorer account datasets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/datasets/${i[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(i[`dataset-id`]))}`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r),"dataset-id":String(i[`dataset-id`]??``)},bodyKind:`json`,body:i.body===void 0?d({deletion_protection:i[`deletion-protection`],enabled:i.enabled,fields:u(i.fields,`fields`),filter:f(i.filter,`filter`,`text`)}):l(i.body)});return}let p=await a(i),m=i.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:i.zone},p,{quiet:i.quiet}):i.local?e:await t();if(m===`zones`?i.zoneId=h:i.accountId=h,i.body){let e=l(i.body);o(await c(`Updating`,async()=>p.logexplorer.account.datasets.update({...e,account_or_zone:m,account_or_zone_id:h,dataset_id:i[`dataset-id`]})),{successLabel:`Updated`});return}if(i.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let g=d({deletion_protection:i[`deletion-protection`],enabled:i.enabled,fields:u(i.fields,`fields`),filter:f(i.filter,`filter`,`text`)});o(await c(`Updating`,async()=>p.logexplorer.account.datasets.update({...g,account_or_zone:m,account_or_zone_id:h,dataset_id:i[`dataset-id`]})),{successLabel:`Updated`})}},O={command:`datasets`,describe:`Operations for account.datasets`,builder:e=>e.command(_).command(y).command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(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 A={command:`query`,describe:`Run a SQL query against account or zone-level datasets. Timestamp fields are RFC3339 strings. Filter with: WHERE {timestamp_field} >= now() - INTERVAL '30' DAY WHERE {timestamp_field} >= '2026-04-01T00:00:00Z' WHERE {timestamp_field} BETWEEN '2026-04-01T00:00:00Z' AND '2026-04-30T23:59:59Z' List configured account or zone datasets to see enabled account or zone-level datasets. Zone-level datasets will not appear here. List available account or zone datasets to inspect their schemas and timestamp fields. For more information about the datasets, and the meaning of each field, check out https://developers.cloudflare.com/logs/logpush/logpush-job/datasets/`,builder:k,handler:async l=>{if(l.dryRun){let e=l.zone===void 0?await n():void 0,t=l.zone===void 0?`accounts`:`zones`,r=l.zone??e??`<account-id>`;s({command:`cf logexplorer account query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logs/explorer/query/sql`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`octet-stream`,body:l.body});return}let u=await a(l),d=l.zone===void 0?`accounts`:`zones`,m=d===`zones`?await r({zone:l.zone},u,{quiet:l.quiet}):l.local?e:await t();if(d===`zones`?l.zoneId=m:l.accountId=m,l.file){let e=p(l.file);o(await c(`Loading`,async()=>i(u,`POST`,`/${d}/${m}/logs/explorer/query/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}if(l.body){let e=f(l.body,`body`,`binary`);o(await c(`Loading`,async()=>i(u,`POST`,`/${d}/${m}/logs/explorer/query/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}o(await c(`Loading`,async()=>u.logexplorer.account.query({account_or_zone:d,account_or_zone_id:m})),{successLabel:`Loaded`})}},j={command:`account`,describe:`Operations for account`,builder:e=>e.command(A).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`logexplorer`,describe:`logexplorer`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n}from"./oauth-DuEONNgC.mjs";import{r}from"./auth-D3X9HYhD.mjs";import{t as i}from"./output-Ccqw2WOb.mjs";import{t as a}from"./dry-run-DL2V6yFm.mjs";import{t as o}from"./progress-BqQcF5QH.mjs";function s(e){return e.option(`logo-id`,{type:`string`,description:`Logo ID`}).option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`get`,describe:`Return matches as CSV for logo queries based on ID`,builder:s,handler:async s=>{let c={logo_id:s[`logo-id`],offset:s.offset,limit:s.limit};if(s.dryRun){a({command:`cf logo-matches download get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/brand-protection/logo-matches/download`,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.logoMatches.download.get({account_id:u,...c})),{successLabel:`Loaded`})}},l={command:`download`,describe:`Operations for download`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`logo-id`,{type:`string`,description:`Logo ID`}).option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`get`,describe:`Return matches for logo queries based on ID`,builder:u,handler:async s=>{let c={logo_id:s[`logo-id`],offset:s.offset,limit:s.limit};if(s.dryRun){a({command:`cf logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/brand-protection/logo-matches`,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.logoMatches.get({account_id:u,...c})),{successLabel:`Loaded`})}},f={command:`logo-matches`,describe:`logo-matches`,builder:e=>e.command(d).command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n}from"./oauth-DuEONNgC.mjs";import{a as r,r as i}from"./auth-D3X9HYhD.mjs";import{t as a}from"./output-Ccqw2WOb.mjs";import{t as o}from"./dry-run-DL2V6yFm.mjs";import{t as s}from"./progress-BqQcF5QH.mjs";import{n as c,t as l}from"./input-validation-QDIYu7Vb.mjs";import{n as u}from"./prompt-B0sWIs9c.mjs";function d(e){return e.option(`tag`,{type:`string`,description:`Tag`}).option(`match-type`,{type:`string`,description:`Match type`}).option(`threshold`,{type:`number`,description:`Threshold`}).option(`dry-run`,{type:`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 f={command:`create`,describe:`Return new saved logo queries created from image files`,builder:d,handler:async u=>{let d={tag:u.tag,match_type:u[`match-type`],threshold:u.threshold};if(u.dryRun){o({command:`cf logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/brand-protection/logos`,pathParams:{},query:d,bodyKind:`octet-stream`,body:u.body});return}let f=await i(u),p=u.local?e:await t();if(u.accountId=p,u.file){let e=l(u.file);a(await s(`Creating`,async()=>r(f,`POST`,`/accounts/${p}/brand-protection/logos`,{body:e,headers:{"Content-Type":`application/x-www-form-urlencoded`}})),{successLabel:`Created`});return}if(u.body){let e=c(u.body,`body`,`binary`),t=new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();a(await s(`Creating`,async()=>r(f,`POST`,`/accounts/${p}/brand-protection/logos${t?`?`+t:``}`,{body:e,headers:{"Content-Type":`application/x-www-form-urlencoded`}})),{successLabel:`Created`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function p(e){return e.positional(`logo-id`,{type:`string`,description:`Logo 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 m={command:`delete <logo-id>`,describe:`Return a success message after deleting saved logo queries by ID`,builder:p,handler:async r=>{if(r.dryRun){o({command:`cf logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/brand-protection/logos/${r[`logo-id`]==null?`<logo-id>`:encodeURIComponent(String(r[`logo-id`]))}`,pathParams:{"logo-id":String(r[`logo-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await u({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>c.logos.delete({account_id:l,logo_id:r[`logo-id`]})),{successLabel:`Deleted`})}},h={command:`logos`,describe:`logos`,builder:e=>e.command(f).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{h as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
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,n as f}from"./prompt-DdegNPpg.mjs";function p(e){return e.positional(`dataset-id`,{type:`string`,description:`Name of the dataset. A list of supported datasets can be found on the [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <dataset-id>`,describe:`Lists all fields available for a dataset. The response result is. an object with key-value pairs, where keys are field names, and values are descriptions.`,builder:p,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-datasets fields get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/datasets/${c[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(c[`dataset-id`]))}/fields`,pathParams:{"account-or-zone":String(t),"dataset-id":String(c[`dataset-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.logpush.accountDatasets.fields.get({account_or_zone:u,account_or_zone_id:d,dataset_id:c[`dataset-id`]})),{successLabel:`Loaded`})}},h={command:`fields`,describe:`Operations for account-datasets.fields`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.positional(`dataset-id`,{type:`string`,description:`Name of the dataset. A list of supported datasets can be found on the [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <dataset-id>`,describe:`Lists Logpush jobs for an account or zone for a dataset.`,builder:g,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-datasets jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/datasets/${c[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(c[`dataset-id`]))}/jobs`,pathParams:{"account-or-zone":String(t),"dataset-id":String(c[`dataset-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.logpush.accountDatasets.jobs.get({account_or_zone:u,account_or_zone_id:d,dataset_id:c[`dataset-id`]})),{successLabel:`Loaded`})}},_={command:`jobs`,describe:`Operations for account-datasets.jobs`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`account-datasets`,describe:`Operations for account-datasets`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dataset`,{type:`string`,description:`Name of the dataset. A list of supported datasets can be found on the [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).`,choices:`access_requests.account_abuse_protection_events.audit_logs.audit_logs_v2.biso_user_actions.casb_findings.device_posture_results.dex_application_tests.dex_device_state_events.dlp_forensic_copies.dns_firewall_logs.dns_logs.email_security_alerts.email_security_post_delivery_events.firewall_events.gateway_dns.gateway_http.gateway_network.http_requests.ipsec_logs.magic_bgp_logs.magic_ids_detections.mcp_portal_logs.mnm_flow_logs.nel_reports.network_analytics_logs.page_shield_events.sinkhole_http_logs.spectrum_events.ssh_logs.turnstile_events.warp_config_changes.warp_toggle_changes.websocket_analytics.workers_trace_events.zaraz_events.zero_trust_network_sessions`.split(`.`),default:`http_requests`}).option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`enabled`,{type:`boolean`,description:`Flag that indicates if the job is enabled.`,default:!1}).option(`filter`,{type:`string`,description:`The filters to select the events to include and/or remove from your logs. For more information, refer to [Filters](https://developers.cloudflare.com/logs/reference/filters/).`}).option(`frequency`,{type:`string`,description:"This field is deprecated. Please use `max_upload_*` parameters instead. . The frequency at which Cloudflare sends batches of logs to your destination. Setting frequency to high sends your logs in larger quantities of smaller files. Setting frequency to low sends logs in smaller quantities of larger files.",choices:[`high`,`low`],default:`high`}).option(`kind`,{type:`string`,description:`The kind parameter (optional) is used to differentiate between Logpush and Edge Log Delivery jobs (when supported by the dataset).`,choices:[`edge`],default:``}).option(`logpull-options`,{type:`string`,description:"This field is deprecated. Use `output_options` instead. Configuration string. It specifies things like requested fields and timestamp formats. If migrating from the logpull api, copy the url (full url or just the query string) of your call here, and logpush will keep on making this call for you, setting start and end times appropriately."}).option(`name`,{type:`string`,description:`Optional human readable job name. Not unique. Cloudflare suggests. that you set this to a meaningful string, like the domain name, to make it easier to identify your job.`}).option(`output-options-cve-2021-44228`,{type:`boolean`,description:"If set to true, will cause all occurrences of `${` in the generated files to be replaced with `x{`."}).option(`output-options-batch-prefix`,{type:`string`,description:`String to be prepended before each batch.`}).option(`output-options-batch-suffix`,{type:`string`,description:`String to be appended after each batch.`}).option(`output-options-field-delimiter`,{type:`string`,description:"String to join fields. This field be ignored when `record_template` is set."}).option(`output-options-field-names`,{type:`string`,array:!0,description:`List of field names to be included in the Logpush output. For the moment, there is no option to add all fields at once, so you must specify all the fields names you are interested in.`}).option(`output-options-merge-subrequests`,{type:`boolean`,description:"If set to true, subrequests will be merged into the parent request. Only supported for the `http_requests` dataset."}).option(`output-options-output-type`,{type:`string`,description:"Specifies the output type, such as `ndjson` or `csv`. This sets default values for the rest of the settings, depending on the chosen output type. Some formatting rules, like string quoting, are different between output types.",choices:[`ndjson`,`csv`]}).option(`output-options-record-delimiter`,{type:`string`,description:`String to be inserted in-between the records as separator.`}).option(`output-options-record-prefix`,{type:`string`,description:`String to be prepended before each record.`}).option(`output-options-record-suffix`,{type:`string`,description:`String to be appended after each record.`}).option(`output-options-record-template`,{type:`string`,description:"String to use as template for each record instead of the default json key value mapping. All fields used in the template must be present in `field_names` as well, otherwise they will end up as null. Format as a Go `text/template` without any standard functions, like conditionals, loops, sub-templates, etc."}).option(`output-options-sample-rate`,{type:`number`,description:"Specifies the sampling rate as a floating number greater than 0 and at most 1. Sampling is applied on top of filtering, and regardless of the current `sample_interval` of the data."}).option(`output-options-timestamp-format`,{type:`string`,description:"String to specify the format for timestamps, such as `unixnano`, `unix`, `rfc3339`, `rfc3339ms` or `rfc3339ns`.",choices:[`unixnano`,`unix`,`rfc3339`,`rfc3339ms`,`rfc3339ns`]}).option(`ownership-challenge`,{type:`string`,description:`Ownership challenge token to prove destination ownership.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create`,describe:`Creates a new Logpush job for an account or zone.`,builder:y,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({dataset:u(f.dataset,`dataset`,`text`),destination_conf:u(f[`destination-conf`],`destination-conf`,`text`),enabled:f.enabled,filter:u(f.filter,`filter`,`text`),frequency:u(f.frequency,`frequency`,`text`),kind:u(f.kind,`kind`,`text`),logpull_options:u(f[`logpull-options`],`logpull-options`,`text`),name:u(f.name,`name`,`text`),output_options:{"CVE-2021-44228":f[`output-options-cve-2021-44228`],batch_prefix:u(f[`output-options-batch-prefix`],`output-options-batch-prefix`,`text`),batch_suffix:u(f[`output-options-batch-suffix`],`output-options-batch-suffix`,`text`),field_delimiter:u(f[`output-options-field-delimiter`],`output-options-field-delimiter`,`text`),field_names:f[`output-options-field-names`],merge_subrequests:f[`output-options-merge-subrequests`],output_type:u(f[`output-options-output-type`],`output-options-output-type`,`text`),record_delimiter:u(f[`output-options-record-delimiter`],`output-options-record-delimiter`,`text`),record_prefix:u(f[`output-options-record-prefix`],`output-options-record-prefix`,`text`),record_suffix:u(f[`output-options-record-suffix`],`output-options-record-suffix`,`text`),record_template:u(f[`output-options-record-template`],`output-options-record-template`,`text`),sample_rate:f[`output-options-sample-rate`],timestamp_format:u(f[`output-options-timestamp-format`],`output-options-timestamp-format`,`text`)},ownership_challenge:u(f[`ownership-challenge`],`ownership-challenge`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountJobs.create({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`destination-conf`]===void 0&&(f[`destination-conf`]=await d(`destination-conf`,`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`,{kind:`secret`}));let g=l({dataset:u(f.dataset,`dataset`,`text`),destination_conf:u(f[`destination-conf`],`destination-conf`,`text`),enabled:f.enabled,filter:u(f.filter,`filter`,`text`),frequency:u(f.frequency,`frequency`,`text`),kind:u(f.kind,`kind`,`text`),logpull_options:u(f[`logpull-options`],`logpull-options`,`text`),name:u(f.name,`name`,`text`),output_options:{"CVE-2021-44228":f[`output-options-cve-2021-44228`],batch_prefix:u(f[`output-options-batch-prefix`],`output-options-batch-prefix`,`text`),batch_suffix:u(f[`output-options-batch-suffix`],`output-options-batch-suffix`,`text`),field_delimiter:u(f[`output-options-field-delimiter`],`output-options-field-delimiter`,`text`),field_names:f[`output-options-field-names`],merge_subrequests:f[`output-options-merge-subrequests`],output_type:u(f[`output-options-output-type`],`output-options-output-type`,`text`),record_delimiter:u(f[`output-options-record-delimiter`],`output-options-record-delimiter`,`text`),record_prefix:u(f[`output-options-record-prefix`],`output-options-record-prefix`,`text`),record_suffix:u(f[`output-options-record-suffix`],`output-options-record-suffix`,`text`),record_template:u(f[`output-options-record-template`],`output-options-record-template`,`text`),sample_rate:f[`output-options-sample-rate`],timestamp_format:u(f[`output-options-timestamp-format`],`output-options-timestamp-format`,`text`)},ownership_challenge:u(f[`ownership-challenge`],`ownership-challenge`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountJobs.create({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}};function x(e){return e.positional(`job-id`,{type:`string`,description:`Unique id of the job.`,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 S={command:`delete <job-id>`,describe:`Deletes a Logpush job.`,builder:x,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-jobs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs/${c[`job-id`]==null?`<job-id>`:encodeURIComponent(String(c[`job-id`]))}`,pathParams:{"account-or-zone":String(t),"job-id":String(c[`job-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();if(u===`zones`?c.zoneId=d:c.accountId=d,!await f({force:!!c.force,message:`This operation deletes the Logpush job.`})){process.stderr.write(`Aborted.
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n,h as r}from"./oauth-DuEONNgC.mjs";import{r as i}from"./auth-D3X9HYhD.mjs";import{t as a}from"./output-Ccqw2WOb.mjs";import{t as o}from"./dry-run-DL2V6yFm.mjs";import{t as s}from"./progress-BqQcF5QH.mjs";import{n as c,t as l}from"./body-parser-BshbixEq.mjs";import{n as u}from"./input-validation-QDIYu7Vb.mjs";import{a as d,n as f}from"./prompt-B0sWIs9c.mjs";function p(e){return e.positional(`dataset-id`,{type:`string`,description:`Name of the dataset. A list of supported datasets can be found on the [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <dataset-id>`,describe:`Lists all fields available for a dataset. The response result is. an object with key-value pairs, where keys are field names, and values are descriptions.`,builder:p,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-datasets fields get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/datasets/${c[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(c[`dataset-id`]))}/fields`,pathParams:{"account-or-zone":String(t),"dataset-id":String(c[`dataset-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.logpush.accountDatasets.fields.get({account_or_zone:u,account_or_zone_id:d,dataset_id:c[`dataset-id`]})),{successLabel:`Loaded`})}},h={command:`fields`,describe:`Operations for account-datasets.fields`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.positional(`dataset-id`,{type:`string`,description:`Name of the dataset. A list of supported datasets can be found on the [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <dataset-id>`,describe:`Lists Logpush jobs for an account or zone for a dataset.`,builder:g,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-datasets jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/datasets/${c[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(c[`dataset-id`]))}/jobs`,pathParams:{"account-or-zone":String(t),"dataset-id":String(c[`dataset-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.logpush.accountDatasets.jobs.get({account_or_zone:u,account_or_zone_id:d,dataset_id:c[`dataset-id`]})),{successLabel:`Loaded`})}},_={command:`jobs`,describe:`Operations for account-datasets.jobs`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`account-datasets`,describe:`Operations for account-datasets`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dataset`,{type:`string`,description:`Name of the dataset. A list of supported datasets can be found on the [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).`,choices:`access_requests.account_abuse_protection_events.audit_logs.audit_logs_v2.biso_user_actions.casb_findings.device_posture_results.dex_application_tests.dex_device_state_events.dlp_forensic_copies.dns_firewall_logs.dns_logs.email_security_alerts.email_security_post_delivery_events.firewall_events.gateway_dns.gateway_http.gateway_network.http_requests.ipsec_logs.magic_bgp_logs.magic_ids_detections.mcp_portal_logs.mnm_flow_logs.nel_reports.network_analytics_logs.page_shield_events.sinkhole_http_logs.spectrum_events.ssh_logs.turnstile_events.warp_config_changes.warp_toggle_changes.websocket_analytics.workers_trace_events.zaraz_events.zero_trust_network_sessions`.split(`.`),default:`http_requests`}).option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`enabled`,{type:`boolean`,description:`Flag that indicates if the job is enabled.`,default:!1}).option(`filter`,{type:`string`,description:`The filters to select the events to include and/or remove from your logs. For more information, refer to [Filters](https://developers.cloudflare.com/logs/reference/filters/).`}).option(`frequency`,{type:`string`,description:"This field is deprecated. Please use `max_upload_*` parameters instead. . The frequency at which Cloudflare sends batches of logs to your destination. Setting frequency to high sends your logs in larger quantities of smaller files. Setting frequency to low sends logs in smaller quantities of larger files.",choices:[`high`,`low`],default:`high`}).option(`kind`,{type:`string`,description:`The kind parameter (optional) is used to differentiate between Logpush and Edge Log Delivery jobs (when supported by the dataset).`,choices:[`edge`],default:``}).option(`logpull-options`,{type:`string`,description:"This field is deprecated. Use `output_options` instead. Configuration string. It specifies things like requested fields and timestamp formats. If migrating from the logpull api, copy the url (full url or just the query string) of your call here, and logpush will keep on making this call for you, setting start and end times appropriately."}).option(`name`,{type:`string`,description:`Optional human readable job name. Not unique. Cloudflare suggests. that you set this to a meaningful string, like the domain name, to make it easier to identify your job.`}).option(`output-options-cve-2021-44228`,{type:`boolean`,description:"If set to true, will cause all occurrences of `${` in the generated files to be replaced with `x{`."}).option(`output-options-batch-prefix`,{type:`string`,description:`String to be prepended before each batch.`}).option(`output-options-batch-suffix`,{type:`string`,description:`String to be appended after each batch.`}).option(`output-options-field-delimiter`,{type:`string`,description:"String to join fields. This field be ignored when `record_template` is set."}).option(`output-options-field-names`,{type:`string`,array:!0,description:`List of field names to be included in the Logpush output. For the moment, there is no option to add all fields at once, so you must specify all the fields names you are interested in.`}).option(`output-options-merge-subrequests`,{type:`boolean`,description:"If set to true, subrequests will be merged into the parent request. Only supported for the `http_requests` dataset."}).option(`output-options-output-type`,{type:`string`,description:"Specifies the output type, such as `ndjson` or `csv`. This sets default values for the rest of the settings, depending on the chosen output type. Some formatting rules, like string quoting, are different between output types.",choices:[`ndjson`,`csv`]}).option(`output-options-record-delimiter`,{type:`string`,description:`String to be inserted in-between the records as separator.`}).option(`output-options-record-prefix`,{type:`string`,description:`String to be prepended before each record.`}).option(`output-options-record-suffix`,{type:`string`,description:`String to be appended after each record.`}).option(`output-options-record-template`,{type:`string`,description:"String to use as template for each record instead of the default json key value mapping. All fields used in the template must be present in `field_names` as well, otherwise they will end up as null. Format as a Go `text/template` without any standard functions, like conditionals, loops, sub-templates, etc."}).option(`output-options-sample-rate`,{type:`number`,description:"Specifies the sampling rate as a floating number greater than 0 and at most 1. Sampling is applied on top of filtering, and regardless of the current `sample_interval` of the data."}).option(`output-options-timestamp-format`,{type:`string`,description:"String to specify the format for timestamps, such as `unixnano`, `unix`, `rfc3339`, `rfc3339ms` or `rfc3339ns`.",choices:[`unixnano`,`unix`,`rfc3339`,`rfc3339ms`,`rfc3339ns`]}).option(`ownership-challenge`,{type:`string`,description:`Ownership challenge token to prove destination ownership.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create`,describe:`Creates a new Logpush job for an account or zone.`,builder:y,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({dataset:u(f.dataset,`dataset`,`text`),destination_conf:u(f[`destination-conf`],`destination-conf`,`text`),enabled:f.enabled,filter:u(f.filter,`filter`,`text`),frequency:u(f.frequency,`frequency`,`text`),kind:u(f.kind,`kind`,`text`),logpull_options:u(f[`logpull-options`],`logpull-options`,`text`),name:u(f.name,`name`,`text`),output_options:{"CVE-2021-44228":f[`output-options-cve-2021-44228`],batch_prefix:u(f[`output-options-batch-prefix`],`output-options-batch-prefix`,`text`),batch_suffix:u(f[`output-options-batch-suffix`],`output-options-batch-suffix`,`text`),field_delimiter:u(f[`output-options-field-delimiter`],`output-options-field-delimiter`,`text`),field_names:f[`output-options-field-names`],merge_subrequests:f[`output-options-merge-subrequests`],output_type:u(f[`output-options-output-type`],`output-options-output-type`,`text`),record_delimiter:u(f[`output-options-record-delimiter`],`output-options-record-delimiter`,`text`),record_prefix:u(f[`output-options-record-prefix`],`output-options-record-prefix`,`text`),record_suffix:u(f[`output-options-record-suffix`],`output-options-record-suffix`,`text`),record_template:u(f[`output-options-record-template`],`output-options-record-template`,`text`),sample_rate:f[`output-options-sample-rate`],timestamp_format:u(f[`output-options-timestamp-format`],`output-options-timestamp-format`,`text`)},ownership_challenge:u(f[`ownership-challenge`],`ownership-challenge`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountJobs.create({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`destination-conf`]===void 0&&(f[`destination-conf`]=await d(`destination-conf`,`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`,{kind:`secret`}));let g=l({dataset:u(f.dataset,`dataset`,`text`),destination_conf:u(f[`destination-conf`],`destination-conf`,`text`),enabled:f.enabled,filter:u(f.filter,`filter`,`text`),frequency:u(f.frequency,`frequency`,`text`),kind:u(f.kind,`kind`,`text`),logpull_options:u(f[`logpull-options`],`logpull-options`,`text`),name:u(f.name,`name`,`text`),output_options:{"CVE-2021-44228":f[`output-options-cve-2021-44228`],batch_prefix:u(f[`output-options-batch-prefix`],`output-options-batch-prefix`,`text`),batch_suffix:u(f[`output-options-batch-suffix`],`output-options-batch-suffix`,`text`),field_delimiter:u(f[`output-options-field-delimiter`],`output-options-field-delimiter`,`text`),field_names:f[`output-options-field-names`],merge_subrequests:f[`output-options-merge-subrequests`],output_type:u(f[`output-options-output-type`],`output-options-output-type`,`text`),record_delimiter:u(f[`output-options-record-delimiter`],`output-options-record-delimiter`,`text`),record_prefix:u(f[`output-options-record-prefix`],`output-options-record-prefix`,`text`),record_suffix:u(f[`output-options-record-suffix`],`output-options-record-suffix`,`text`),record_template:u(f[`output-options-record-template`],`output-options-record-template`,`text`),sample_rate:f[`output-options-sample-rate`],timestamp_format:u(f[`output-options-timestamp-format`],`output-options-timestamp-format`,`text`)},ownership_challenge:u(f[`ownership-challenge`],`ownership-challenge`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountJobs.create({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}};function x(e){return e.positional(`job-id`,{type:`string`,description:`Unique id of the job.`,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 S={command:`delete <job-id>`,describe:`Deletes a Logpush job.`,builder:x,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-jobs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs/${c[`job-id`]==null?`<job-id>`:encodeURIComponent(String(c[`job-id`]))}`,pathParams:{"account-or-zone":String(t),"job-id":String(c[`job-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();if(u===`zones`?c.zoneId=d:c.accountId=d,!await f({force:!!c.force,message:`This operation deletes the Logpush job.`})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}a(await s(`Deleting`,async()=>l.logpush.accountJobs.delete({account_or_zone:u,account_or_zone_id:d,job_id:c[`job-id`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`job-id`,{type:`string`,description:`Unique id of the job.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <job-id>`,describe:`Gets the details of a Logpush job.`,builder:C,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs/${c[`job-id`]==null?`<job-id>`:encodeURIComponent(String(c[`job-id`]))}`,pathParams:{"account-or-zone":String(t),"job-id":String(c[`job-id`]??``),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.logpush.accountJobs.get({account_or_zone:u,account_or_zone_id:d,job_id:c[`job-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Lists Logpush jobs for an account or zone.`,builder:T,handler:async c=>{if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf logpush account-jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`none`});return}let l=await i(c),u=c.zone===void 0?`accounts`:`zones`,d=u===`zones`?await r({zone:c.zone},l,{quiet:c.quiet}):c.local?e:await t();u===`zones`?c.zoneId=d:c.accountId=d,a(await s(`Loading`,async()=>l.logpush.accountJobs.list({account_or_zone:u,account_or_zone_id:d})),{successLabel:`Loaded`})}};function D(e){return e.positional(`job-id`,{type:`string`,description:`Unique id of the job.`,demandOption:!0}).option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`enabled`,{type:`boolean`,description:`Flag that indicates if the job is enabled.`}).option(`filter`,{type:`string`,description:`The filters to select the events to include and/or remove from your logs. For more information, refer to [Filters](https://developers.cloudflare.com/logs/reference/filters/).`}).option(`frequency`,{type:`string`,description:"This field is deprecated. Please use `max_upload_*` parameters instead. . The frequency at which Cloudflare sends batches of logs to your destination. Setting frequency to high sends your logs in larger quantities of smaller files. Setting frequency to low sends logs in smaller quantities of larger files.",choices:[`high`,`low`]}).option(`kind`,{type:`string`,description:`The kind parameter (optional) is used to differentiate between Logpush and Edge Log Delivery jobs (when supported by the dataset).`,choices:[`edge`]}).option(`logpull-options`,{type:`string`,description:"This field is deprecated. Use `output_options` instead. Configuration string. It specifies things like requested fields and timestamp formats. If migrating from the logpull api, copy the url (full url or just the query string) of your call here, and logpush will keep on making this call for you, setting start and end times appropriately."}).option(`name`,{type:`string`,description:`Optional human readable job name. Not unique. Cloudflare suggests. that you set this to a meaningful string, like the domain name, to make it easier to identify your job.`}).option(`output-options-cve-2021-44228`,{type:`boolean`,description:"If set to true, will cause all occurrences of `${` in the generated files to be replaced with `x{`."}).option(`output-options-batch-prefix`,{type:`string`,description:`String to be prepended before each batch.`}).option(`output-options-batch-suffix`,{type:`string`,description:`String to be appended after each batch.`}).option(`output-options-field-delimiter`,{type:`string`,description:"String to join fields. This field be ignored when `record_template` is set."}).option(`output-options-field-names`,{type:`string`,array:!0,description:`List of field names to be included in the Logpush output. For the moment, there is no option to add all fields at once, so you must specify all the fields names you are interested in.`}).option(`output-options-merge-subrequests`,{type:`boolean`,description:"If set to true, subrequests will be merged into the parent request. Only supported for the `http_requests` dataset."}).option(`output-options-output-type`,{type:`string`,description:"Specifies the output type, such as `ndjson` or `csv`. This sets default values for the rest of the settings, depending on the chosen output type. Some formatting rules, like string quoting, are different between output types.",choices:[`ndjson`,`csv`]}).option(`output-options-record-delimiter`,{type:`string`,description:`String to be inserted in-between the records as separator.`}).option(`output-options-record-prefix`,{type:`string`,description:`String to be prepended before each record.`}).option(`output-options-record-suffix`,{type:`string`,description:`String to be appended after each record.`}).option(`output-options-record-template`,{type:`string`,description:"String to use as template for each record instead of the default json key value mapping. All fields used in the template must be present in `field_names` as well, otherwise they will end up as null. Format as a Go `text/template` without any standard functions, like conditionals, loops, sub-templates, etc."}).option(`output-options-sample-rate`,{type:`number`,description:"Specifies the sampling rate as a floating number greater than 0 and at most 1. Sampling is applied on top of filtering, and regardless of the current `sample_interval` of the data."}).option(`output-options-timestamp-format`,{type:`string`,description:"String to specify the format for timestamps, such as `unixnano`, `unix`, `rfc3339`, `rfc3339ms` or `rfc3339ns`.",choices:[`unixnano`,`unix`,`rfc3339`,`rfc3339ms`,`rfc3339ns`]}).option(`ownership-challenge`,{type:`string`,description:`Ownership challenge token to prove destination ownership.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <job-id>`,describe:`Updates a Logpush job.`,builder:D,handler:async d=>{if(d.dryRun){let e=d.zone===void 0?await n():void 0,t=d.zone===void 0?`accounts`:`zones`,r=d.zone??e??`<account-id>`;o({command:`cf logpush account-jobs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/jobs/${d[`job-id`]==null?`<job-id>`:encodeURIComponent(String(d[`job-id`]))}`,pathParams:{"account-or-zone":String(t),"job-id":String(d[`job-id`]??``),"account-or-zone-id":String(r)},bodyKind:`json`,body:d.body===void 0?l({destination_conf:u(d[`destination-conf`],`destination-conf`,`text`),enabled:d.enabled,filter:u(d.filter,`filter`,`text`),frequency:u(d.frequency,`frequency`,`text`),kind:u(d.kind,`kind`,`text`),logpull_options:u(d[`logpull-options`],`logpull-options`,`text`),name:u(d.name,`name`,`text`),output_options:{"CVE-2021-44228":d[`output-options-cve-2021-44228`],batch_prefix:u(d[`output-options-batch-prefix`],`output-options-batch-prefix`,`text`),batch_suffix:u(d[`output-options-batch-suffix`],`output-options-batch-suffix`,`text`),field_delimiter:u(d[`output-options-field-delimiter`],`output-options-field-delimiter`,`text`),field_names:d[`output-options-field-names`],merge_subrequests:d[`output-options-merge-subrequests`],output_type:u(d[`output-options-output-type`],`output-options-output-type`,`text`),record_delimiter:u(d[`output-options-record-delimiter`],`output-options-record-delimiter`,`text`),record_prefix:u(d[`output-options-record-prefix`],`output-options-record-prefix`,`text`),record_suffix:u(d[`output-options-record-suffix`],`output-options-record-suffix`,`text`),record_template:u(d[`output-options-record-template`],`output-options-record-template`,`text`),sample_rate:d[`output-options-sample-rate`],timestamp_format:u(d[`output-options-timestamp-format`],`output-options-timestamp-format`,`text`)},ownership_challenge:u(d[`ownership-challenge`],`ownership-challenge`,`text`)}):c(d.body)});return}let f=await i(d),p=d.zone===void 0?`accounts`:`zones`,m=p===`zones`?await r({zone:d.zone},f,{quiet:d.quiet}):d.local?e:await t();if(p===`zones`?d.zoneId=m:d.accountId=m,d.body){let e=c(d.body);a(await s(`Updating`,async()=>f.logpush.accountJobs.update({...e,account_or_zone:p,account_or_zone_id:m,job_id:d[`job-id`]})),{successLabel:`Updated`});return}let h=l({destination_conf:u(d[`destination-conf`],`destination-conf`,`text`),enabled:d.enabled,filter:u(d.filter,`filter`,`text`),frequency:u(d.frequency,`frequency`,`text`),kind:u(d.kind,`kind`,`text`),logpull_options:u(d[`logpull-options`],`logpull-options`,`text`),name:u(d.name,`name`,`text`),output_options:{"CVE-2021-44228":d[`output-options-cve-2021-44228`],batch_prefix:u(d[`output-options-batch-prefix`],`output-options-batch-prefix`,`text`),batch_suffix:u(d[`output-options-batch-suffix`],`output-options-batch-suffix`,`text`),field_delimiter:u(d[`output-options-field-delimiter`],`output-options-field-delimiter`,`text`),field_names:d[`output-options-field-names`],merge_subrequests:d[`output-options-merge-subrequests`],output_type:u(d[`output-options-output-type`],`output-options-output-type`,`text`),record_delimiter:u(d[`output-options-record-delimiter`],`output-options-record-delimiter`,`text`),record_prefix:u(d[`output-options-record-prefix`],`output-options-record-prefix`,`text`),record_suffix:u(d[`output-options-record-suffix`],`output-options-record-suffix`,`text`),record_template:u(d[`output-options-record-template`],`output-options-record-template`,`text`),sample_rate:d[`output-options-sample-rate`],timestamp_format:u(d[`output-options-timestamp-format`],`output-options-timestamp-format`,`text`)},ownership_challenge:u(d[`ownership-challenge`],`ownership-challenge`,`text`)});a(await s(`Updating`,async()=>f.logpush.accountJobs.update({...h,account_or_zone:p,account_or_zone_id:m,job_id:d[`job-id`]})),{successLabel:`Updated`})}},k={command:`account-jobs`,describe:`Operations for account-jobs`,builder:e=>e.command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`create`,describe:`Gets a new ownership challenge sent to your destination.`,builder:A,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-ownership create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/ownership`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountOwnership.create({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`destination-conf`]===void 0&&(f[`destination-conf`]=await d(`destination-conf`,`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`,{kind:`secret`}));let g=l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountOwnership.create({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}};function M(e){return e.option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`ownership-challenge`,{type:`string`,description:`Ownership challenge token to prove destination ownership.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`create`,describe:`Validates ownership challenge of the destination.`,builder:M,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-ownership validate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/ownership/validate`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`),ownership_challenge:u(f[`ownership-challenge`],`ownership-challenge`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountOwnership.validate.create({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`destination-conf`]===void 0&&(f[`destination-conf`]=await d(`destination-conf`,`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`,{kind:`secret`})),f[`ownership-challenge`]===void 0&&(f[`ownership-challenge`]=await d(`ownership-challenge`,`Ownership challenge token to prove destination ownership.`,{kind:`secret`}));let g=l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`),ownership_challenge:u(f[`ownership-challenge`],`ownership-challenge`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountOwnership.validate.create({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}},P={command:`validate`,describe:`Operations for account-ownership.validate`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`account-ownership`,describe:`Operations for account-ownership`,builder:e=>e.command(j).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`destination-exists-delete`,describe:`Checks if there is an existing job with a destination.`,builder:I,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-validate destination-exists-delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/validate/destination/exists`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountValidate.destinationExistsDelete({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`destination-conf`]===void 0&&(f[`destination-conf`]=await d(`destination-conf`,`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`,{kind:`secret`}));let g=l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountValidate.destinationExistsDelete({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}};function R(e){return e.option(`destination-conf`,{type:`string`,description:`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`delete`,describe:`Validates destination.`,builder:R,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-validate destination delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/validate/destination`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountValidate.destination.delete({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`destination-conf`]===void 0&&(f[`destination-conf`]=await d(`destination-conf`,`Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.`,{kind:`secret`}));let g=l({destination_conf:u(f[`destination-conf`],`destination-conf`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountValidate.destination.delete({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}},B={command:`destination`,describe:`Operations for account-validate.destination`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.option(`logpull-options`,{type:`string`,description:"This field is deprecated. Use `output_options` instead. Configuration string. It specifies things like requested fields and timestamp formats. If migrating from the logpull api, copy the url (full url or just the query string) of your call here, and logpush will keep on making this call for you, setting start and end times appropriately."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`create`,describe:`Validates logpull origin with logpull_options.`,builder:te,handler:async f=>{if(f.dryRun){let e=f.zone===void 0?await n():void 0,t=f.zone===void 0?`accounts`:`zones`,r=f.zone??e??`<account-id>`;o({command:`cf logpush account-validate origin create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/logpush/validate/origin`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},bodyKind:`json`,body:f.body===void 0?l({logpull_options:u(f[`logpull-options`],`logpull-options`,`text`)}):c(f.body)});return}let p=await i(f),m=f.zone===void 0?`accounts`:`zones`,h=m===`zones`?await r({zone:f.zone},p,{quiet:f.quiet}):f.local?e:await t();if(m===`zones`?f.zoneId=h:f.accountId=h,f.body){let e=c(f.body);a(await s(`Creating`,async()=>p.logpush.accountValidate.origin.create({...e,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`});return}f[`logpull-options`]===void 0&&(f[`logpull-options`]=await d(`logpull-options`,"This field is deprecated. Use `output_options` instead. Configuration string. It specifies things like requested fields and timestamp formats. If migrating from the logpull api, copy the url (full url or just the query string) of your call here, and logpush will keep on making this call for you, setting start and end times appropriately."));let g=l({logpull_options:u(f[`logpull-options`],`logpull-options`,`text`)});a(await s(`Creating`,async()=>p.logpush.accountValidate.origin.create({...g,account_or_zone:m,account_or_zone_id:h})),{successLabel:`Created`})}},H={command:`origin`,describe:`Operations for account-validate.origin`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`account-validate`,describe:`Operations for account-validate`,builder:e=>e.command(L).command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`fields`,{type:`string`,description:`Comma-separated list of fields.`}).option(`filter`,{type:`string`,description:`Filters to drill down into specific events.`}).option(`sample`,{type:`number`,description:`The sample parameter is the sample rate of the records set by the client: "sample": 1 is 100% of records "sample": 10 is 10% and so on.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const G={command:`create`,describe:`Creates a new Instant Logs job for a zone.`,builder:W,handler:async e=>{if(e.dryRun){o({command:`cf logpush edge create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logpush/edge/jobs`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({fields:u(e.fields,`fields`,`text`),filter:u(e.filter,`filter`,`text`),sample:e.sample}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Creating`,async()=>t.logpush.edge.create({...r,zone_id:n})),{successLabel:`Created`});return}let d=l({fields:u(e.fields,`fields`,`text`),filter:u(e.filter,`filter`,`text`),sample:e.sample});a(await s(`Creating`,async()=>t.logpush.edge.create({...d,zone_id:n})),{successLabel:`Created`})}};function K(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`get`,describe:`Lists Instant Logs jobs for a zone.`,builder:K,handler:async e=>{if(e.dryRun){o({command:`cf logpush edge get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logpush/edge/jobs`,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.logpush.edge.get({zone_id:n})),{successLabel:`Loaded`})}},J={command:`edge`,describe:`Operations for edge`,builder:e=>e.command(G).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Y(e){return e.positional(`transformer-id`,{type:`string`,description:`The transformer ID.`,demandOption:!0}).option(`version-id`,{type:`number`,description:`Specific version ID to retrieve. When omitted, the latest version is returned.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`get <transformer-id>`,describe:"Returns the SQL query content for a transformer. Without query params, returns the latest version. With `version_id`, returns the specified version.",builder:Y,handler:async r=>{let c={version_id:r[`version-id`]};if(r.dryRun){o({command:`cf logpush transformers content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers/${r[`transformer-id`]==null?`<transformer-id>`:encodeURIComponent(String(r[`transformer-id`]))}/content`,pathParams:{"transformer-id":String(r[`transformer-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.logpush.transformers.content.get({account_id:u,transformer_id:r[`transformer-id`],...c})),{successLabel:`Loaded`})}},Z={command:`content`,describe:`Operations for transformers.content`,builder:e=>e.command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.option(`code`,{type:`string`,description:`The SQL transformer query. Maximum 32 KB. The query must contain a FROM clause referencing a valid logpush dataset.`}).option(`description`,{type:`string`,description:`Optional customer-provided description.`}).option(`name`,{type:`string`,description:`Customer-provided name for identification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`create`,describe:`Creates a new custom log transformer for an account.`,builder:Q,handler:async r=>{if(r.dryRun){o({command:`cf logpush transformers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({code:u(r.code,`code`,`text`),description:u(r.description,`description`,`text`),name:u(r.name,`name`,`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.logpush.transformers.create({...e,account_id:p})),{successLabel:`Created`});return}r.code===void 0&&(r.code=await d(`code`,`The SQL transformer query. Maximum 32 KB. The query must contain a FROM clause referencing a valid logpush dataset.`)),r.name===void 0&&(r.name=await d(`name`,`Customer-provided name for identification.`));let m=l({code:u(r.code,`code`,`text`),description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`)});a(await s(`Creating`,async()=>f.logpush.transformers.create({...m,account_id:p})),{successLabel:`Created`})}};function re(e){return e.positional(`transformer-id`,{type:`string`,description:`The transformer ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ie={command:`delete <transformer-id>`,describe:`Deletes a custom log transformer. Returns 409 Conflict if any active logpush jobs reference the transformer.`,builder:re,handler:async r=>{if(r.dryRun){o({command:`cf logpush transformers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers/${r[`transformer-id`]==null?`<transformer-id>`:encodeURIComponent(String(r[`transformer-id`]))}`,pathParams:{"transformer-id":String(r[`transformer-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
4
|
`);return}a(await s(`Deleting`,async()=>c.logpush.transformers.delete({account_id:l,transformer_id:r[`transformer-id`]})),{successLabel:`Deleted`})}};function ae(e){return e.positional(`transformer-id`,{type:`string`,description:`The transformer ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get <transformer-id>`,describe:`Gets a single custom log transformer by ID.`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf logpush transformers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers/${r[`transformer-id`]==null?`<transformer-id>`:encodeURIComponent(String(r[`transformer-id`]))}`,pathParams:{"transformer-id":String(r[`transformer-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.logpush.transformers.get({account_id:l,transformer_id:r[`transformer-id`]})),{successLabel:`Loaded`})}};function $(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`list`,describe:`Lists all custom log transformers for an account.`,builder:$,handler:async r=>{if(r.dryRun){o({command:`cf logpush transformers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.logpush.transformers.list({account_id:l})),{successLabel:`Loaded`})}};function ce(e){return e.option(`sql`,{type:`string`,description:`The SQL transformer query. Maximum 32 KB. The query must contain a FROM clause referencing a valid logpush dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`preview`,describe:`Executes a SQL transformer against a single input record and returns the transformed output. This is a stateless endpoint — nothing is persisted.`,builder:ce,handler:async r=>{if(r.dryRun){o({command:`cf logpush transformers preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers/preview`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({sql:u(r.sql,`sql`,`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(`Loading`,async()=>f.logpush.transformers.preview({...e,account_id:p})),{successLabel:`Loaded`});return}r.sql===void 0&&(r.sql=await d(`sql`,`The SQL transformer query. Maximum 32 KB. The query must contain a FROM clause referencing a valid logpush dataset.`));let m=l({sql:u(r.sql,`sql`,`text`)});a(await s(`Loading`,async()=>f.logpush.transformers.preview({...m,account_id:p})),{successLabel:`Loaded`})}};function ue(e){return e.positional(`transformer-id`,{type:`string`,description:`The transformer ID.`,demandOption:!0}).option(`code`,{type:`string`,description:`The SQL transformer query. Maximum 32 KB. The query must contain a FROM clause referencing a valid logpush dataset.`}).option(`description`,{type:`string`,description:`Optional customer-provided description.`}).option(`name`,{type:`string`,description:`Customer-provided name for identification.`}).option(`dry-run`,{type:`boolean`,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:`update <transformer-id>`,describe:"Updates an existing custom log transformer. When `code` is provided, the SQL query is validated and a new version is created. When `code` is omitted, only the name and description are updated. Omitting `description` clears the existing description.",builder:ue,handler:async r=>{if(r.dryRun){o({command:`cf logpush transformers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers/${r[`transformer-id`]==null?`<transformer-id>`:encodeURIComponent(String(r[`transformer-id`]))}`,pathParams:{"transformer-id":String(r[`transformer-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({code:u(r.code,`code`,`text`),description:u(r.description,`description`,`text`),name:u(r.name,`name`,`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(`Updating`,async()=>f.logpush.transformers.update({...e,account_id:p,transformer_id:r[`transformer-id`]})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await d(`name`,`Customer-provided name for identification.`));let m=l({code:u(r.code,`code`,`text`),description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`)});a(await s(`Updating`,async()=>f.logpush.transformers.update({...m,account_id:p,transformer_id:r[`transformer-id`]})),{successLabel:`Updated`})}};function fe(e){return e.option(`transformer-id`,{type:`string`,description:`The transformer ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Maximum number of versions to return.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`list`,describe:`Returns version metadata for a transformer, newest first. Each version corresponds to a SQL query update.`,builder:fe,handler:async r=>{let c={limit:r.limit};if(r.dryRun){o({command:`cf logpush transformers versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logpush/transformers/${r[`transformer-id`]==null?`<transformer-id>`:encodeURIComponent(String(r[`transformer-id`]))}/versions`,pathParams:{"transformer-id":String(r[`transformer-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.logpush.transformers.versions.list({account_id:u,transformer_id:r[`transformer-id`],...c})),{successLabel:`Loaded`})}},me={command:`versions`,describe:`Operations for transformers.versions`,builder:e=>e.command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},he={command:`transformers`,describe:`Operations for transformers`,builder:e=>e.command(ne).command(ie).command(oe).command(se).command(le).command(de).command(Z).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ge={command:`logpush`,describe:`logpush`,builder:e=>e.command(v).command(k).command(F).command(U).command(J).command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ge as default};
|