cf 0.0.6 → 0.1.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 +2 -4
- package/bin/cf +11 -0
- package/dist/_meta/agent-context.json +7 -7
- package/dist/_meta/commands.json +9051 -1085
- package/dist/abuse-reports-ChV_yD7f.mjs +8 -0
- package/dist/accounts-BCYecXFh.mjs +21 -0
- package/dist/acm-DD8zSds2.mjs +3 -0
- package/dist/addressing-D4Eqw5Bi.mjs +13 -0
- package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
- package/dist/ai-DfXMOMx_.mjs +2 -0
- package/dist/ai-gateway-DdRFthMo.mjs +8 -0
- package/dist/ai-search-C_68CDj1.mjs +7 -0
- package/dist/alerting-DbhqhVCp.mjs +6 -0
- package/dist/analytics-BSBBc7ep.mjs +20 -0
- package/dist/api-gateway-CZ4swbkQ.mjs +33 -0
- package/dist/argo-tms9ZwHO.mjs +2 -0
- package/dist/audit-logs-24qyW8cl.mjs +2 -0
- package/dist/auth-BlSmtIKd.mjs +112 -0
- package/dist/auth-DQ8miey6.mjs +6 -0
- package/dist/autorag-kgNt06GD.mjs +2 -0
- package/dist/billing-lwBHNTXC.mjs +2 -0
- package/dist/body-parser-Br-BoYk-.mjs +2 -0
- package/dist/bot-management-LKf7BqUr.mjs +5 -0
- package/dist/botnet-feed-nQ-gErTS.mjs +3 -0
- package/dist/brand-protection-DOKv9GRr.mjs +3 -0
- package/dist/browser-rendering-CBExtgGt.mjs +4 -0
- package/dist/build-C_48VvoK.mjs +1056 -0
- package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
- package/dist/cache-BBiiNZHP.mjs +5 -0
- package/dist/calls-DA5Xzwev.mjs +4 -0
- package/dist/certificate-authorities-sXyR_yGp.mjs +2 -0
- package/dist/chunk-DH-VkVmc.mjs +2 -0
- package/dist/client-certificates-tV0aCLQJ.mjs +3 -0
- package/dist/cloud-connector-DZfHcSso.mjs +2 -0
- package/dist/cloudforce-one-y1PgQmI9.mjs +21 -0
- package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
- package/dist/config-BIfdEY0E.mjs +2 -0
- package/dist/connectivity-8SOqaFDn.mjs +3 -0
- package/dist/content-scanning-B9y6K_G5.mjs +4 -0
- package/dist/context-DTIbtQn5.mjs +2 -0
- package/dist/custom-certificates-sWksR8Ys.mjs +5 -0
- package/dist/custom-hostnames-91QZkdqN.mjs +5 -0
- package/dist/custom-nameservers-DajZaZvE.mjs +3 -0
- package/dist/custom-pages-Cu7gmwzT.mjs +4 -0
- package/dist/d1-H_VRsVmF.mjs +3 -0
- package/dist/dcv-delegation-C-qhEYEZ.mjs +2 -0
- package/dist/delegate.mjs +2 -0
- package/dist/deploy--9wYOkHg.mjs +2 -0
- package/dist/dev-BfKYB-R_.mjs +6 -0
- package/dist/diagnostics-D2B2LPZZ.mjs +3 -0
- package/dist/dispatch-namespaces-CyrXBU_w.mjs +7 -0
- package/dist/dist-C_bu5HwZ.mjs +82 -0
- package/dist/dist-DvKjT2TT.mjs +303 -0
- package/dist/dns-Bn9Uz_Nj.mjs +29 -0
- package/dist/dns-firewall-BslP4p-j.mjs +57 -0
- package/dist/durable-objects-BN1ZnHhm.mjs +2 -0
- package/dist/email-routing-n2TnTaRR.mjs +10 -0
- package/dist/email-security-C9SEx0kh.mjs +60 -0
- package/dist/email-sending-DayZ7u3I.mjs +3 -0
- package/dist/filters-CI_XTgfQ.mjs +4 -0
- package/dist/firewall-CcaayGig.mjs +11 -0
- package/dist/fraud-Cr7aPCV8.mjs +8 -0
- package/dist/google-tag-gateway-B3GpYgQ4.mjs +2 -0
- package/dist/healthchecks-CVTsR_OC.mjs +4 -0
- package/dist/hostnames-Bd_Wa5l6.mjs +3 -0
- package/dist/hyperdrive-BBJhEDZd.mjs +18 -0
- package/dist/iam-D_FN0pDF.mjs +6 -0
- package/dist/images-CAP2hAlZ.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/input-validation-zEO81MWN.mjs +2 -0
- package/dist/intel-CkxfzqmJ.mjs +3 -0
- package/dist/ips-B0cK7D0_.mjs +2 -0
- package/dist/keyless-certificates-LcLmHZsX.mjs +3 -0
- package/dist/kv-_TkUQ6fs.mjs +5 -0
- package/dist/leaked-credential-checks-Dhvaen22.mjs +3 -0
- package/dist/lib-Eu1wXxuh.mjs +68 -0
- package/dist/load-balancers-Ckr0UIpk.mjs +6 -0
- package/dist/local-VJaJ3BZ1.mjs +2 -0
- package/dist/logpush-Cj946hxT.mjs +4 -0
- package/dist/logs-DgC9hjvJ.mjs +3 -0
- package/dist/magic-cloud-networking-WbDvPzuG.mjs +5 -0
- package/dist/magic-network-monitoring-BcHShvGQ.mjs +4 -0
- package/dist/magic-transit-B8sCOkt_.mjs +89 -0
- package/dist/managed-transforms-BpOr-8HY.mjs +3 -0
- package/dist/mtls-certificates-fOul8D5g.mjs +3 -0
- package/dist/network-interconnects-BSW65xlh.mjs +36 -0
- package/dist/organizations-T4vKGFAb.mjs +41 -0
- package/dist/origin-ca-certificates-ChM0lZ64.mjs +3 -0
- package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +2 -0
- package/dist/origin-tls-client-auth-D32dpZk_.mjs +5 -0
- package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
- package/dist/page-rules-RFoj8CjN.mjs +18 -0
- package/dist/page-shield-VTktzKDN.mjs +37 -0
- package/dist/pages-L1ITjXDZ.mjs +10 -0
- package/dist/pipelines-BPO0Lnil.mjs +6 -0
- package/dist/progress-DZfTxbrx.mjs +2 -0
- package/dist/queues-B0C06L9r.mjs +6 -0
- package/dist/r2-DP020Tmq.mjs +21 -0
- package/dist/r2-data-catalog-Dmipvz5F.mjs +14 -0
- package/dist/radar-DR3VMknH.mjs +2 -0
- package/dist/rate-limits-DnHPBPgU.mjs +5 -0
- package/dist/raw-fetch-DlXYwVA8.mjs +2 -0
- package/dist/realtime-kit-C430aq2d.mjs +6 -0
- package/dist/registrar-7Qy50zbW.mjs +46 -0
- package/dist/request-tracers-sv99NDIl.mjs +2 -0
- package/dist/resolve-BuJRWSk0.mjs +2 -0
- package/dist/resource-sharing-uEjC7lnQ.mjs +5 -0
- package/dist/resource-tagging-CiODdP3N.mjs +16 -0
- package/dist/rules-FXAyTrwk.mjs +4 -0
- package/dist/rulesets-B6aUsFFB.mjs +8 -0
- package/dist/rum-CyyGJhp5.mjs +4 -0
- package/dist/{schema-qJlCfmo8.mjs → schema-D0_cbcDt.mjs} +1 -1
- package/dist/schema-validation-ByU49h--.mjs +4 -0
- package/dist/scim-DdTS65_C.mjs +3 -0
- package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
- package/dist/secrets-store-ClOUVhBJ.mjs +18 -0
- package/dist/security-center-4iSBqTrf.mjs +2 -0
- package/dist/security-txt-kGxdkDY6.mjs +3 -0
- package/dist/session-mW-s8ghP.mjs +2 -0
- package/dist/smart-shield-B-SQd2Qp.mjs +3 -0
- package/dist/snippets-Aq58ojqw.mjs +4 -0
- package/dist/spawn-D_cjG87Z.mjs +10 -0
- package/dist/spectrum-0gFvGI6y.mjs +59 -0
- package/dist/speed-DAZU8w3T.mjs +4 -0
- package/dist/src-C5qivNKH.mjs +108 -0
- package/dist/ssl-BRlXa-5w.mjs +15 -0
- package/dist/stream-BAxsVeBX.mjs +14 -0
- package/dist/tenants-Df6xDqoA.mjs +2 -0
- package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
- package/dist/token-validation-pO4dCjCy.mjs +4 -0
- package/dist/{tools-CawscCBu.mjs → tools-CtKbk6VS.mjs} +1 -1
- package/dist/turnstile-B1dmO8wE.mjs +23 -0
- package/dist/{ui-Dj3No2vN.mjs → ui-mP_arYIg.mjs} +1 -1
- package/dist/url-normalization-sUDVmrUt.mjs +3 -0
- package/dist/url-scanner-CwOKRkYo.mjs +2 -0
- package/dist/user-D_UrIdNq.mjs +10 -0
- package/dist/vectorize-BEbBn9G9.mjs +4 -0
- package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
- package/dist/waiting-rooms-BQC-urV4.mjs +11 -0
- package/dist/web3-CIH2iQeX.mjs +4 -0
- package/dist/workers-B9EvrpH3.mjs +16 -0
- package/dist/workers-builds-DzWSiRd2.mjs +7 -0
- package/dist/workflows-aD81gA4k.mjs +4 -0
- package/dist/zaraz-Cg1dsvrZ.mjs +2 -0
- package/dist/zero-trust-D-xQXWcy.mjs +119 -0
- package/dist/zones-DQzucJDd.mjs +28 -0
- package/package.json +13 -3
- package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
- package/dist/accounts-BjGtCB8T.mjs +0 -6
- package/dist/acm-h4YPDN7k.mjs +0 -3
- package/dist/addressing-BiEnQ1o1.mjs +0 -11
- package/dist/ai-BPln2Yka.mjs +0 -2
- package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
- package/dist/ai-search-EjrONI5a.mjs +0 -7
- package/dist/alerting-CPWMKr-m.mjs +0 -6
- package/dist/analytics-3dX9-scQ.mjs +0 -2
- package/dist/api-gateway-7FKFHdI-.mjs +0 -9
- package/dist/argo-Dxz9P37E.mjs +0 -2
- package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
- package/dist/auth-BHD_B2p9.mjs +0 -277
- package/dist/auth-caVo2j1K.mjs +0 -6
- package/dist/autorag-D7nMweNF.mjs +0 -2
- package/dist/billing-yaIBp1Xq.mjs +0 -2
- package/dist/body-parser-iA3vRFmh.mjs +0 -2
- package/dist/bot-management-C0H6U0t4.mjs +0 -2
- package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
- package/dist/brand-protection-CI0NQa_l.mjs +0 -3
- package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
- package/dist/cache-B6M_pm_D.mjs +0 -5
- package/dist/calls-C5XCC0i1.mjs +0 -4
- package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
- package/dist/client-certificates-CwpzEnCT.mjs +0 -3
- package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
- package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
- package/dist/config-BmTd_qeU.mjs +0 -2
- package/dist/connectivity-C4tXPkW_.mjs +0 -3
- package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
- package/dist/context-6lBIck1r.mjs +0 -2
- package/dist/custom-certificates-pllRyU2y.mjs +0 -3
- package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
- package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
- package/dist/custom-pages-XWwfn7hV.mjs +0 -4
- package/dist/d1-c_zhZGWf.mjs +0 -3
- package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
- package/dist/dev-Bu26u5Jm.mjs +0 -14
- package/dist/diagnostics-BU07Jnku.mjs +0 -3
- package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
- package/dist/dns-CrvIxztB.mjs +0 -11
- package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
- package/dist/dry-run-FV0pZwdg.mjs +0 -2
- package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
- package/dist/email-routing-CxU5JlXT.mjs +0 -10
- package/dist/email-security-CnpAHWpj.mjs +0 -8
- package/dist/email-sending-MeCKsktR.mjs +0 -3
- package/dist/filters-Sx2Po1UP.mjs +0 -4
- package/dist/firewall-B0_012XO.mjs +0 -9
- package/dist/fraud-CG0G_VG-.mjs +0 -2
- package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
- package/dist/healthchecks-C0LgExxa.mjs +0 -4
- package/dist/hostnames-D4K6s9EX.mjs +0 -3
- package/dist/hyperdrive-D7XvTRys.mjs +0 -3
- package/dist/iam-4LhJianW.mjs +0 -6
- package/dist/images-BqXyIycX.mjs +0 -5
- package/dist/input-validation-BpVQi9rR.mjs +0 -2
- package/dist/intel-CiO3Sy4x.mjs +0 -3
- package/dist/ips-DLuGN7Mr.mjs +0 -2
- package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
- package/dist/kv-CVYCrk7L.mjs +0 -5
- package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
- package/dist/load-balancers-cxodJuI2.mjs +0 -6
- package/dist/local-OqhVQbv0.mjs +0 -2
- package/dist/logpush-BX7z2xWz.mjs +0 -4
- package/dist/logs-C7vxr6Kp.mjs +0 -3
- package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
- package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
- package/dist/magic-transit-troGMFb9.mjs +0 -30
- package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
- package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
- package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
- package/dist/organizations-BtlEchi-.mjs +0 -4
- package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
- package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
- package/dist/page-rules-CcMmrvY4.mjs +0 -3
- package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
- package/dist/pages-F1vdzqgC.mjs +0 -6
- package/dist/pipelines-DsF1HHMY.mjs +0 -6
- package/dist/progress-5sHFvwez.mjs +0 -2
- package/dist/queues-BuvkxFPX.mjs +0 -6
- package/dist/r2-Du-fgHiT.mjs +0 -9
- package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
- package/dist/radar-C0eqNmWR.mjs +0 -2
- package/dist/rate-limits-CUv2cxXV.mjs +0 -3
- package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
- package/dist/realtime-kit-C-jix3I_.mjs +0 -6
- package/dist/registrar-B7V7i89n.mjs +0 -2
- package/dist/request-tracers-D2V7QUrC.mjs +0 -2
- package/dist/resolve-GtphSYWh.mjs +0 -2
- package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
- package/dist/resource-tagging-BOknFugv.mjs +0 -4
- package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
- package/dist/rules-DzJFHGW1.mjs +0 -4
- package/dist/rulesets-BzI1dUiq.mjs +0 -8
- package/dist/rum-CQ_rJ96u.mjs +0 -4
- package/dist/schema-validation-TmikfxS9.mjs +0 -4
- package/dist/scim-ByZ5kqXS.mjs +0 -3
- package/dist/secrets-store-D7HL4VXw.mjs +0 -8
- package/dist/security-center-OUrILUnx.mjs +0 -2
- package/dist/security-txt-Ca13oCJ8.mjs +0 -3
- package/dist/session-Dxi_LbAk.mjs +0 -2
- package/dist/smart-shield-foPT0J9L.mjs +0 -3
- package/dist/snippets-FDPiBMWc.mjs +0 -4
- package/dist/spectrum-DPoh_BPx.mjs +0 -3
- package/dist/speed-BuEappVX.mjs +0 -4
- package/dist/src-D8_cWUwt.mjs +0 -104
- package/dist/ssl-bJbzEoRv.mjs +0 -3
- package/dist/stream-DuYGiGk6.mjs +0 -13
- package/dist/tenants-BYqEutrr.mjs +0 -2
- package/dist/token-validation-DwmtbWUB.mjs +0 -4
- package/dist/turnstile-Dy91RVTn.mjs +0 -3
- package/dist/url-normalization-DoD9iHWH.mjs +0 -3
- package/dist/url-scanner-qwL64FIo.mjs +0 -2
- package/dist/user-Cduf3VRi.mjs +0 -7
- package/dist/vectorize-CMLobU9V.mjs +0 -4
- package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
- package/dist/web3-Bcx68Kq3.mjs +0 -4
- package/dist/workers-D5fOQsUA.mjs +0 -16
- package/dist/workers-builds-2kdzxjlN.mjs +0 -7
- package/dist/workflows-qFD80noW.mjs +0 -4
- package/dist/zaraz-C0iJimA4.mjs +0 -2
- package/dist/zero-trust-Btix6zOy.mjs +0 -73
- package/dist/zones-Nu3wMtds.mjs +0 -5
- /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
package/dist/stream-DuYGiGk6.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";import{n as p,t as m}from"./raw-fetch-CxFs4i0R.mjs";const h={command:`copy <identifier>`,describe:`Adds an additional audio track to a video using the provided audio track URL.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`url`,{type:`string`,description:"An audio track URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(o(r.identifier,`identifier`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/stream/${r.identifier??`<identifier>`}/audio/copy`,pathParams:{identifier:String(r.identifier??``)},bodyKind:`json`,body:{label:r.label,url:r.url,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating audio track`,async()=>p.post(`/accounts/${m}/stream/${r.identifier}/audio/copy`,{body:e})),{successLabel:`Created audio track`});return}r.label===void 0&&(r.label=await t(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let h={};r.label!==void 0&&s(h,[`label`],a(r.label,`label`,`text`)),r.url!==void 0&&s(h,[`url`],a(r.url,`url`,`text`)),l(await f(`Creating audio track`,async()=>p.post(`/accounts/${m}/stream/${r.identifier}/audio/copy`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created audio track`})}},ee={command:`delete <audioIdentifier>`,describe:`Deletes additional audio tracks on a video. Deleting a default audio track is not allowed. You must assign another audio track as default prior to deletion.`,builder:e=>e.positional(`audioIdentifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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}),handler:async t=>{if(o(t.audioIdentifier,`audioIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/audio/${t.audioIdentifier??`<audioIdentifier>`}`,pathParams:{identifier:String(t.identifier??``),audioIdentifier:String(t.audioIdentifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`audio track`,String(t.audioIdentifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await f(`Deleting audio track`,async()=>a.stream.audioTracks.delete(s,t.identifier,t.audioIdentifier)),{successLabel:`Deleted audio track`})}},g={command:`edit <audioIdentifier>`,describe:"Edits additional audio tracks on a video. Editing the default status of an audio track to `true` will mark all other audio tracks on the video default status to `false`.",builder:e=>e.positional(`audioIdentifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`default`,{type:`boolean`,description:`Denotes whether the audio track will be played by default in a player.`,default:!1}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.audioIdentifier,`audioIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/audio/${t.audioIdentifier??`<audioIdentifier>`}`,pathParams:{identifier:String(t.identifier??``),audioIdentifier:String(t.audioIdentifier??``)},bodyKind:`json`,body:{default:t.default,label:t.label,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating audio track`,async()=>r.patch(`/accounts/${p}/stream/${t.identifier}/audio/${t.audioIdentifier}`,{body:e})),{successLabel:`Updated audio track`});return}let m={};t.default!==void 0&&s(m,[`default`],t.default),t.label!==void 0&&s(m,[`label`],a(t.label,`label`,`text`)),l(await f(`Updating audio track`,async()=>r.patch(`/accounts/${p}/stream/${t.identifier}/audio/${t.audioIdentifier}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated audio track`})}},_={command:`get <identifier>`,describe:`Lists additional audio tracks on a video. Note this API will not return information for audio attached to the video upload.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.identifier,`identifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading audio track`,async()=>t.stream.audioTracks.get(r,e.identifier)),{successLabel:`Loaded audio track`})}},v={command:`audio-tracks`,describe:`Add, edit, or remove additional audio tracks on a video`,builder:e=>e.command(h).command(ee).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.identifier,`identifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading caption`,async()=>t.stream.captions.get(e.identifier,r)),{successLabel:`Loaded caption`})}},b={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:e=>e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.language,`language`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/captions/${t.language??`<language>`}/generate`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating language`,async()=>r.stream.captions.language.create(t.language,t.identifier,a)),{successLabel:`Created language`})}},x={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:e=>e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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}),handler:async t=>{if(o(t.language,`language`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/captions/${t.language??`<language>`}`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`language`,String(t.language??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}l(await f(`Deleting language`,async()=>a.stream.captions.language.delete(t.language,t.identifier,s)),{successLabel:`Deleted language`})}},S={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:e=>e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.language,`language`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading language`,async()=>t.stream.captions.language.get(e.language,e.identifier,r)),{successLabel:`Loaded language`})}},C={command:`update <language>`,describe:`Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed.`,builder:e=>e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}),handler:async t=>{if(o(t.language,`language`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/captions/${t.language??`<language>`}`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file},validation:`passed`});return}let r=await i(t),s=t.local?d:await n(r);if(t.accountId=s,t.file!==void 0||t.body!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);l(await f(`Updating language`,async()=>r.put(`/accounts/${s}/stream/${t.identifier}/captions/${t.language}`,{body:e})),{successLabel:`Updated language`});return}if(t.body){let e=a(t.body,`body`,`binary`);l(await f(`Updating language`,async()=>r.put(`/accounts/${s}/stream/${t.identifier}/captions/${t.language}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated language`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},w={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:e=>e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.language,`language`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,p((await f(`Loading vtt`,async()=>m(`/accounts/${r}/stream/${e.identifier}/captions/${e.language}/vtt`,`GET`,e.local?e.localEndpoint:void 0))).toString(`utf-8`))}},T={command:`vtt`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(w).demandCommand(1),handler:()=>{}},E={command:`language`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(b).command(x).command(S).command(C).command(T).demandCommand(1),handler:()=>{}},D={command:`captions`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(y).command(E).demandCommand(1),handler:()=>{}},O={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:e=>e.option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`clipped-from-video-uid`,{type:`string`,description:`The unique video identifier (UID).`}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`end-time-seconds`,{type:`number`,description:`Specifies the end time for the video clip in seconds.`}).option(`input`,{type:`string`,description:`A video's URL. Preferred over 'url'.`}).option(`name`,{type:`string`,description:`A name for the video.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`start-time-seconds`,{type:`number`,description:`Specifies the start time for the video clip in seconds.`}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:`A video's URL (legacy field, use 'input' instead).`}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:{allowedOrigins:r.allowedOrigins,clippedFromVideoUid:r.clippedFromVideoUid,creator:r.creator,endTimeSeconds:r.endTimeSeconds,input:r.input,name:r.name,requireSignedUrls:r.requireSignedUrls,scheduledDeletion:r.scheduledDeletion,startTimeSeconds:r.startTimeSeconds,thumbnailTimestampPct:r.thumbnailTimestampPct,url:r.url,watermarkUid:r.watermarkUid,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating clip`,async()=>p.post(`/accounts/${m}/stream/clip`,{body:e})),{successLabel:`Created clip`});return}if(r.clippedFromVideoUid===void 0&&(r.clippedFromVideoUid=await t(`clipped-from-video-uid`,`The unique video identifier (UID).`)),r.endTimeSeconds===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(r.startTimeSeconds===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let h={};r.allowedOrigins!==void 0&&s(h,[`allowedOrigins`],r.allowedOrigins),r.clippedFromVideoUid!==void 0&&s(h,[`clippedFromVideoUID`],a(r.clippedFromVideoUid,`clippedFromVideoUid`,`text`)),r.creator!==void 0&&s(h,[`creator`],a(r.creator,`creator`,`text`)),r.endTimeSeconds!==void 0&&s(h,[`endTimeSeconds`],r.endTimeSeconds),r.input!==void 0&&s(h,[`input`],a(r.input,`input`,`text`)),r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),r.requireSignedUrls!==void 0&&s(h,[`requireSignedURLs`],r.requireSignedUrls),r.scheduledDeletion!==void 0&&s(h,[`scheduledDeletion`],a(r.scheduledDeletion,`scheduledDeletion`,`text`)),r.startTimeSeconds!==void 0&&s(h,[`startTimeSeconds`],r.startTimeSeconds),r.thumbnailTimestampPct!==void 0&&s(h,[`thumbnailTimestampPct`],r.thumbnailTimestampPct),r.url!==void 0&&s(h,[`url`],a(r.url,`url`,`text`)),r.watermarkUid!==void 0&&s(h,[`watermark`,`uid`],a(r.watermarkUid,`watermarkUid`,`text`)),l(await f(`Creating clip`,async()=>p.post(`/accounts/${m}/stream/clip`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created clip`})}},k={command:`clip`,describe:`Create a new video clip from an existing video by specifying start and end times`,builder:e=>e.command(O).demandCommand(1),handler:()=>{}},A={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:e=>e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`input`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This is the preferred field over `url`."}).option(`name`,{type:`string`,description:`A video's name. Used for legacy compatibility.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This field is deprecated in favor of `input`."}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Copy upload request. Provide `input` (preferred) or `url` (deprecated)."}),handler:async t=>{let r={};if(t.uploadCreator!==void 0&&(r[`Upload-Creator`]=String(t.uploadCreator)),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:{allowedOrigins:t.allowedOrigins,creator:t.creator,input:t.input,name:t.name,requireSignedUrls:t.requireSignedUrls,scheduledDeletion:t.scheduledDeletion,thumbnailTimestampPct:t.thumbnailTimestampPct,url:t.url,watermarkUid:t.watermarkUid,body:t.body},validation:`passed`});return}let p=await i(t),m=t.local?d:await n(p);if(t.accountId=m,t.body){let e=c(t.body);l(await f(`Creating copy`,async()=>p.post(`/accounts/${m}/stream/copy`,{body:e,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created copy`});return}let h={};t.allowedOrigins!==void 0&&s(h,[`allowedOrigins`],t.allowedOrigins),t.creator!==void 0&&s(h,[`creator`],a(t.creator,`creator`,`text`)),t.input!==void 0&&s(h,[`input`],a(t.input,`input`,`text`)),t.name!==void 0&&s(h,[`name`],a(t.name,`name`,`text`)),t.requireSignedUrls!==void 0&&s(h,[`requireSignedURLs`],t.requireSignedUrls),t.scheduledDeletion!==void 0&&s(h,[`scheduledDeletion`],a(t.scheduledDeletion,`scheduledDeletion`,`text`)),t.thumbnailTimestampPct!==void 0&&s(h,[`thumbnailTimestampPct`],t.thumbnailTimestampPct),t.url!==void 0&&s(h,[`url`],a(t.url,`url`,`text`)),t.watermarkUid!==void 0&&s(h,[`watermark`,`uid`],a(t.watermarkUid,`watermarkUid`,`text`)),l(await f(`Creating copy`,async()=>p.post(`/accounts/${m}/stream/copy`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created copy`})}},j={command:`copy`,describe:`Import a video from a URL into Stream for processing and delivery`,builder:e=>e.command(A).demandCommand(1),handler:()=>{}},M={command:`create`,describe:"Initiates a video upload using the TUS protocol. On success, the server responds with a status code 201 (created) and includes a `location` header to indicate where the content should be uploaded. Refer to https://tus.io for protocol details.",builder:e=>e.option(`direct-user`,{type:`string`,description:`Provisions a URL to let your end users upload videos directly to Cloudflare Stream without exposing your API token to clients.`}).option(`tus-resumable`,{type:`string`,description:`Specifies the TUS protocol version. This value must be included in every upload request. Notes: The only supported version of TUS protocol is 1.0.0.`,demandOption:!0}).option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`upload-length`,{type:`string`,description:`Indicates the size of the entire upload in bytes. The value must be a non-negative integer.`,demandOption:!0}).option(`upload-metadata`,{type:`string`,description:"Comma-separated key-value pairs following the TUS protocol specification. Values are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`, `maxdurationseconds`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{let r={};t.directUser!==void 0&&(r.direct_user=t.directUser);let a={};if(t.tusResumable!==void 0&&(a[`Tus-Resumable`]=String(t.tusResumable)),t.uploadCreator!==void 0&&(a[`Upload-Creator`]=String(t.uploadCreator)),t.uploadLength!==void 0&&(a[`Upload-Length`]=String(t.uploadLength)),t.uploadMetadata!==void 0&&(a[`Upload-Metadata`]=String(t.uploadMetadata)),t.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/stream`,pathParams:{},bodyKind:`json`,body:{...r},validation:`passed`});return}let s=await i(t),c=t.local?d:await n(s);t.accountId=c,l(await f(`Creating stream`,async()=>s.post(`/accounts/${c}/stream`,{query:Object.keys(r).length>0?r:void 0,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Created stream`})}},N={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`stream`,String(t.identifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}l(await f(`Deleting stream`,async()=>a.stream.delete(t.identifier,s)),{successLabel:`Deleted stream`})}},P={command:`create`,describe:`Creates a direct upload that allows video uploads without an API key.`,builder:e=>e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`expiry`,{type:`string`,description:`The date and time after upload when videos will not be accepted.`,default:`Now + 30 minutes`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{let r={};if(t.uploadCreator!==void 0&&(r[`Upload-Creator`]=String(t.uploadCreator)),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream direct-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/direct_upload`,pathParams:{},bodyKind:`json`,body:{allowedOrigins:t.allowedOrigins,creator:t.creator,expiry:t.expiry,maxDurationSeconds:t.maxDurationSeconds,requireSignedUrls:t.requireSignedUrls,scheduledDeletion:t.scheduledDeletion,thumbnailTimestampPct:t.thumbnailTimestampPct,watermarkUid:t.watermarkUid,body:t.body},validation:`passed`});return}let p=await i(t),m=t.local?d:await n(p);if(t.accountId=m,t.body){let e=c(t.body);l(await f(`Creating direct upload`,async()=>p.post(`/accounts/${m}/stream/direct_upload`,{body:e,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created direct upload`});return}if(t.maxDurationSeconds===void 0)throw Error(`--max-duration-seconds is required (or pass --body with this field set).`);let h={};t.allowedOrigins!==void 0&&s(h,[`allowedOrigins`],t.allowedOrigins),t.creator!==void 0&&s(h,[`creator`],a(t.creator,`creator`,`text`)),t.expiry!==void 0&&s(h,[`expiry`],a(t.expiry,`expiry`,`text`)),t.maxDurationSeconds!==void 0&&s(h,[`maxDurationSeconds`],t.maxDurationSeconds),t.requireSignedUrls!==void 0&&s(h,[`requireSignedURLs`],t.requireSignedUrls),t.scheduledDeletion!==void 0&&s(h,[`scheduledDeletion`],a(t.scheduledDeletion,`scheduledDeletion`,`text`)),t.thumbnailTimestampPct!==void 0&&s(h,[`thumbnailTimestampPct`],t.thumbnailTimestampPct),t.watermarkUid!==void 0&&s(h,[`watermark`,`uid`],a(t.watermarkUid,`watermarkUid`,`text`)),l(await f(`Creating direct upload`,async()=>p.post(`/accounts/${m}/stream/direct_upload`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created direct upload`})}},F={command:`direct-upload`,describe:`Generate a tokenized URL that lets end-users upload video directly to Stream`,builder:e=>e.command(P).demandCommand(1),handler:()=>{}},I={command:`create <identifier>`,describe:"Creates a download for a video when a video is ready to view. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating download`,async()=>r.stream.downloads.create(t.identifier,a)),{successLabel:`Created download`})}},L={command:`delete <identifier>`,describe:"Delete the downloads for a video. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`download`,String(t.identifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}l(await f(`Deleting download`,async()=>a.stream.downloads.delete(t.identifier,s)),{successLabel:`Deleted download`})}},R={command:`get <identifier>`,describe:`Lists the downloads created for a video.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.identifier,`identifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading download`,async()=>t.stream.downloads.get(e.identifier,r)),{successLabel:`Loaded download`})}},z={command:`downloads`,describe:`Create downloadable MP4 renditions of a video for offline viewing`,builder:e=>e.command(I).command(L).command(R).demandCommand(1),handler:()=>{}},B={command:`edit <identifier>`,describe:`Edit details for a single video.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`public-details-channel-link`,{type:`string`,description:`The publicDetails.channel_link field`}).option(`public-details-logo`,{type:`string`,description:`The publicDetails.logo field`}).option(`public-details-share-link`,{type:`string`,description:`The publicDetails.share_link field`}).option(`public-details-title`,{type:`string`,description:`The publicDetails.title field`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`uid`,{type:`string`,description:`The unique identifier for the video. Can be used to verify the video being updated.`}).option(`upload-expiry`,{type:`string`,description:`The date and time when the video upload URL is no longer valid for direct user uploads.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:{allowedOrigins:t.allowedOrigins,creator:t.creator,maxDurationSeconds:t.maxDurationSeconds,publicDetailsChannelLink:t.publicDetailsChannelLink,publicDetailsLogo:t.publicDetailsLogo,publicDetailsShareLink:t.publicDetailsShareLink,publicDetailsTitle:t.publicDetailsTitle,requireSignedUrls:t.requireSignedUrls,scheduledDeletion:t.scheduledDeletion,thumbnailTimestampPct:t.thumbnailTimestampPct,uid:t.uid,uploadExpiry:t.uploadExpiry,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Creating stream`,async()=>r.post(`/accounts/${p}/stream/${t.identifier}`,{body:e})),{successLabel:`Created stream`});return}let m={};t.allowedOrigins!==void 0&&s(m,[`allowedOrigins`],t.allowedOrigins),t.creator!==void 0&&s(m,[`creator`],a(t.creator,`creator`,`text`)),t.maxDurationSeconds!==void 0&&s(m,[`maxDurationSeconds`],t.maxDurationSeconds),t.publicDetailsChannelLink!==void 0&&s(m,[`publicDetails`,`channel_link`],a(t.publicDetailsChannelLink,`publicDetailsChannelLink`,`text`)),t.publicDetailsLogo!==void 0&&s(m,[`publicDetails`,`logo`],a(t.publicDetailsLogo,`publicDetailsLogo`,`text`)),t.publicDetailsShareLink!==void 0&&s(m,[`publicDetails`,`share_link`],a(t.publicDetailsShareLink,`publicDetailsShareLink`,`text`)),t.publicDetailsTitle!==void 0&&s(m,[`publicDetails`,`title`],a(t.publicDetailsTitle,`publicDetailsTitle`,`text`)),t.requireSignedUrls!==void 0&&s(m,[`requireSignedURLs`],t.requireSignedUrls),t.scheduledDeletion!==void 0&&s(m,[`scheduledDeletion`],a(t.scheduledDeletion,`scheduledDeletion`,`text`)),t.thumbnailTimestampPct!==void 0&&s(m,[`thumbnailTimestampPct`],t.thumbnailTimestampPct),t.uid!==void 0&&s(m,[`uid`],a(t.uid,`uid`,`text`)),t.uploadExpiry!==void 0&&s(m,[`uploadExpiry`],a(t.uploadExpiry,`uploadExpiry`,`text`)),l(await f(`Creating stream`,async()=>r.post(`/accounts/${p}/stream/${t.identifier}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created stream`})}},V={command:`get <identifier>`,describe:`Fetches an HTML code snippet to embed a video in a web page delivered through Cloudflare. On success, returns an HTML fragment for use on web pages to display a video. On failure, returns a JSON response body.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.identifier,`identifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,p((await f(`Loading embed`,async()=>m(`/accounts/${r}/stream/${e.identifier}/embed`,`GET`,e.local?e.localEndpoint:void 0))).toString(`utf-8`))}},H={command:`embed`,describe:`Retrieve the HTML embed code snippet for a video`,builder:e=>e.command(V).demandCommand(1),handler:()=>{}},U={command:`get <identifier>`,describe:`Fetches details for a single video.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}),handler:async e=>{o(e.identifier,`identifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading stream`,async()=>t.stream.get(e.identifier,r)),{successLabel:`Loaded stream`})}},W={command:`create`,describe:`Creates an RSA private key in PEM and JWK formats. Key files are only displayed once after creation. Keys are created, used, and deleted independently of videos, and every key can sign any video.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream keys create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Creating key`,async()=>r.post(`/accounts/${a}/stream/keys`,{body:e})),{successLabel:`Created key`});return}l(await f(`Creating key`,async()=>r.stream.keys.create(a)),{successLabel:`Created key`})}},G={command:`delete <identifier>`,describe:`Deletes signing keys and revokes all signed URLs generated with the key.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Identifier.`,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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/keys/${t.identifier??`<identifier>`}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`key`,String(t.identifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}if(t.body){let e=c(t.body);l(await f(`Deleting key`,async()=>a.delete(`/accounts/${s}/stream/keys/${t.identifier}`,{body:e})),{successLabel:`Deleted key`});return}l(await f(`Deleting key`,async()=>a.stream.keys.delete(t.identifier,s)),{successLabel:`Deleted key`})}},K={command:`get`,describe:`Lists the video ID and creation date and time when a signing key was created.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading key`,async()=>t.stream.keys.get(r)),{successLabel:`Loaded key`})}},q={command:`keys`,describe:`Signing keys used to generate short-lived signed URLs for private video playback`,builder:e=>e.command(W).command(G).command(K).demandCommand(1),handler:()=>{}},J={command:`list`,describe:`Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.`,builder:e=>e.option(`status`,{type:`string`,description:`Specifies the processing status for all quality levels for a video.`,choices:[`pendingupload`,`downloading`,`queued`,`inprogress`,`ready`,`error`,`live-inprogress`]}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`type`,{type:`string`,description:"Specifies whether the video is `vod` or `live`."}).option(`asc`,{type:`string`,description:`Lists videos in ascending order of creation.`}).option(`video-name`,{type:`string`,description:"Provides a fast, exact string match on the `name` key in the `meta` field."}).option(`search`,{type:`string`,description:"Provides a partial word match of the `name` key in the `meta` field. Slow for medium to large video libraries. May be unavailable for very large libraries."}).option(`start`,{type:`string`,description:`Lists videos created after the specified date.`}).option(`end`,{type:`string`,description:`Lists videos created before the specified date.`}).option(`include-counts`,{type:`string`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`id`,{type:`string`,description:`Filter by video ID(s). Can be a single ID or a comma-separated list of IDs.`}).option(`name`,{type:`string`,description:`Filter by video name/UID(s). Can be a single name or a comma-separated list.`}).option(`live-input-id`,{type:`string`,description:`Filter by live input ID to find videos associated with a specific live stream.`}).option(`before`,{type:`string`,description:`Alias for 'end'. Returns videos created before this date/time (RFC 3339 format).`}).option(`after`,{type:`string`,description:`Alias for 'start'. Returns videos created after this date/time (RFC 3339 format).`}).option(`limit`,{type:`number`,description:`Maximum number of videos to return (default 1000, max 1000).`}),handler:async e=>{let t={};e.status!==void 0&&(t.status=e.status),e.creator!==void 0&&(t.creator=e.creator),e.type!==void 0&&(t.type=e.type),e.asc!==void 0&&(t.asc=e.asc),e.videoName!==void 0&&(t.video_name=e.videoName),e.search!==void 0&&(t.search=e.search),e.start!==void 0&&(t.start=e.start),e.end!==void 0&&(t.end=e.end),e.includeCounts!==void 0&&(t.include_counts=e.includeCounts),e.id!==void 0&&(t.id=e.id),e.name!==void 0&&(t.name=e.name),e.liveInputId!==void 0&&(t.live_input_id=e.liveInputId),e.before!==void 0&&(t.before=e.before),e.after!==void 0&&(t.after=e.after),e.limit!==void 0&&(t.limit=e.limit);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading stream`,async()=>r.stream.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded stream`})}},Y={command:`create`,describe:`Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream.`,builder:e=>e.option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`,default:!0}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`.",default:!1}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`],default:`off`}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input.",default:!1}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used.",default:0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs`,pathParams:{},bodyKind:`json`,body:{defaultCreator:t.defaultCreator,deleteRecordingAfterDays:t.deleteRecordingAfterDays,enabled:t.enabled,recordingAllowedOrigins:t.recordingAllowedOrigins,recordingHideLiveViewerCount:t.recordingHideLiveViewerCount,recordingMode:t.recordingMode,recordingRequireSignedUrls:t.recordingRequireSignedUrls,recordingTimeoutSeconds:t.recordingTimeoutSeconds,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Creating live input`,async()=>r.post(`/accounts/${p}/stream/live_inputs`,{body:e})),{successLabel:`Created live input`});return}let m={};t.defaultCreator!==void 0&&s(m,[`defaultCreator`],a(t.defaultCreator,`defaultCreator`,`text`)),t.deleteRecordingAfterDays!==void 0&&s(m,[`deleteRecordingAfterDays`],t.deleteRecordingAfterDays),t.enabled!==void 0&&s(m,[`enabled`],t.enabled),t.recordingAllowedOrigins!==void 0&&s(m,[`recording`,`allowedOrigins`],t.recordingAllowedOrigins),t.recordingHideLiveViewerCount!==void 0&&s(m,[`recording`,`hideLiveViewerCount`],t.recordingHideLiveViewerCount),t.recordingMode!==void 0&&s(m,[`recording`,`mode`],a(t.recordingMode,`recordingMode`,`text`)),t.recordingRequireSignedUrls!==void 0&&s(m,[`recording`,`requireSignedURLs`],t.recordingRequireSignedUrls),t.recordingTimeoutSeconds!==void 0&&s(m,[`recording`,`timeoutSeconds`],t.recordingTimeoutSeconds),l(await f(`Creating live input`,async()=>r.post(`/accounts/${p}/stream/live_inputs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created live input`})}},X={command:`delete <liveInputIdentifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls.`,builder:e=>e.positional(`liveInputIdentifier`,{type:`string`,description:`A unique identifier for a live input.`,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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.liveInputIdentifier,`liveInputIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs/${t.liveInputIdentifier??`<liveInputIdentifier>`}`,pathParams:{liveInputIdentifier:String(t.liveInputIdentifier??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`live input`,String(t.liveInputIdentifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}if(t.body){let e=c(t.body);l(await f(`Deleting live input`,async()=>a.delete(`/accounts/${s}/stream/live_inputs/${t.liveInputIdentifier}`,{body:e})),{successLabel:`Deleted live input`});return}l(await f(`Deleting live input`,async()=>a.stream.liveInputs.delete(t.liveInputIdentifier,s)),{successLabel:`Deleted live input`})}},Z={command:`create <liveInputIdentifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls until enabled.`,builder:e=>e.positional(`liveInputIdentifier`,{type:`string`,description:`A unique identifier for a live input.`,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}),handler:async t=>{if(o(t.liveInputIdentifier,`liveInputIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs disable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs/${t.liveInputIdentifier??`<liveInputIdentifier>`}/disable`,pathParams:{liveInputIdentifier:String(t.liveInputIdentifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`disable`,String(t.liveInputIdentifier??``),{force:!!t.force,message:`This operation disables a live input. Active streams to it are dropped.`})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}l(await f(`Deleting disable`,async()=>a.stream.liveInputs.disable.create(t.liveInputIdentifier,s)),{successLabel:`Deleted disable`})}},te={command:`disable`,describe:`Enable and disable live input streams`,builder:e=>e.command(Z).demandCommand(1),handler:()=>{}},Q={command:`create <liveInputIdentifier>`,describe:`Allows a live input to be streamed to and makes the live input accessible to any future API calls.`,builder:e=>e.positional(`liveInputIdentifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.liveInputIdentifier,`liveInputIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs enable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs/${t.liveInputIdentifier??`<liveInputIdentifier>`}/enable`,pathParams:{liveInputIdentifier:String(t.liveInputIdentifier??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating enable`,async()=>r.stream.liveInputs.enable.create(t.liveInputIdentifier,a)),{successLabel:`Created enable`})}},ne={command:`enable`,describe:`Enable and disable live input streams`,builder:e=>e.command(Q).demandCommand(1),handler:()=>{}},re={command:`get <liveInputIdentifier>`,describe:`Retrieves details of an existing live input.`,builder:e=>e.positional(`liveInputIdentifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}),handler:async e=>{o(e.liveInputIdentifier,`liveInputIdentifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading live input`,async()=>t.stream.liveInputs.get(e.liveInputIdentifier,r)),{successLabel:`Loaded live input`})}},ie={command:`list`,describe:`Lists the live inputs created for an account. To get the credentials needed to stream to a specific live input, request a single live input.`,builder:e=>e.option(`include-counts`,{type:`string`,description:`Includes the total number of videos associated with the submitted query parameters.`}),handler:async e=>{let t={};e.includeCounts!==void 0&&(t.include_counts=e.includeCounts);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading live inputs`,async()=>r.stream.liveInputs.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded live inputs`})}},ae={command:`create <liveInputIdentifier>`,describe:`Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live input — one live input can have many outputs.`,builder:e=>e.positional(`liveInputIdentifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`,default:!0}).option(`stream-key`,{type:`string`,description:`The streamKey used to authenticate against an output's target.`}).option(`url`,{type:`string`,description:`The URL an output uses to restream.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(o(r.liveInputIdentifier,`liveInputIdentifier`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf stream live-inputs outputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/stream/live_inputs/${r.liveInputIdentifier??`<liveInputIdentifier>`}/outputs`,pathParams:{liveInputIdentifier:String(r.liveInputIdentifier??``)},bodyKind:`json`,body:{enabled:r.enabled,streamKey:r.streamKey,url:r.url,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating output`,async()=>p.post(`/accounts/${m}/stream/live_inputs/${r.liveInputIdentifier}/outputs`,{body:e})),{successLabel:`Created output`});return}r.streamKey===void 0&&(r.streamKey=await t(`stream-key`,`The streamKey used to authenticate against an output's target.`,{kind:`secret`})),r.url===void 0&&(r.url=await t(`url`,`The URL an output uses to restream.`,{kind:`secret`}));let h={};r.enabled!==void 0&&s(h,[`enabled`],r.enabled),r.streamKey!==void 0&&s(h,[`streamKey`],a(r.streamKey,`streamKey`,`text`)),r.url!==void 0&&s(h,[`url`],a(r.url,`url`,`text`)),l(await f(`Creating output`,async()=>p.post(`/accounts/${m}/stream/live_inputs/${r.liveInputIdentifier}/outputs`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created output`})}},oe={command:`delete <outputIdentifier>`,describe:`Deletes an output and removes it from the associated live input.`,builder:e=>e.positional(`outputIdentifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.outputIdentifier,`outputIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs outputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs/${t.liveInputIdentifier??`<liveInputIdentifier>`}/outputs/${t.outputIdentifier??`<outputIdentifier>`}`,pathParams:{outputIdentifier:String(t.outputIdentifier??``),liveInputIdentifier:String(t.liveInputIdentifier??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`output`,String(t.outputIdentifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}if(t.body){let e=c(t.body);l(await f(`Deleting output`,async()=>a.delete(`/accounts/${s}/stream/live_inputs/${t.liveInputIdentifier}/outputs/${t.outputIdentifier}`,{body:e})),{successLabel:`Deleted output`});return}l(await f(`Deleting output`,async()=>a.stream.liveInputs.outputs.delete(t.outputIdentifier,t.liveInputIdentifier,s)),{successLabel:`Deleted output`})}},se={command:`list`,describe:`Retrieves all outputs associated with a specified live input.`,builder:e=>e.option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}),handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading outputs`,async()=>t.stream.liveInputs.outputs.list(e.liveInputIdentifier,r)),{successLabel:`Loaded outputs`})}},ce={command:`update <outputIdentifier>`,describe:`Updates the state of an output.`,builder:e=>e.positional(`outputIdentifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.outputIdentifier,`outputIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs outputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs/${t.liveInputIdentifier??`<liveInputIdentifier>`}/outputs/${t.outputIdentifier??`<outputIdentifier>`}`,pathParams:{outputIdentifier:String(t.outputIdentifier??``),liveInputIdentifier:String(t.liveInputIdentifier??``)},bodyKind:`json`,body:{enabled:t.enabled,body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Updating output`,async()=>r.put(`/accounts/${a}/stream/live_inputs/${t.liveInputIdentifier}/outputs/${t.outputIdentifier}`,{body:e})),{successLabel:`Updated output`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let p={};t.enabled!==void 0&&s(p,[`enabled`],t.enabled),l(await f(`Updating output`,async()=>r.put(`/accounts/${a}/stream/live_inputs/${t.liveInputIdentifier}/outputs/${t.outputIdentifier}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated output`})}},le={command:`outputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(ae).command(oe).command(se).command(ce).demandCommand(1),handler:()=>{}},ue={command:`update <liveInputIdentifier>`,describe:`Updates a specified live input.`,builder:e=>e.positional(`liveInputIdentifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`,default:!0}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`.",default:!1}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`],default:`off`}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input.",default:!1}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used.",default:0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.liveInputIdentifier,`liveInputIdentifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream live-inputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/live_inputs/${t.liveInputIdentifier??`<liveInputIdentifier>`}`,pathParams:{liveInputIdentifier:String(t.liveInputIdentifier??``)},bodyKind:`json`,body:{defaultCreator:t.defaultCreator,deleteRecordingAfterDays:t.deleteRecordingAfterDays,enabled:t.enabled,recordingAllowedOrigins:t.recordingAllowedOrigins,recordingHideLiveViewerCount:t.recordingHideLiveViewerCount,recordingMode:t.recordingMode,recordingRequireSignedUrls:t.recordingRequireSignedUrls,recordingTimeoutSeconds:t.recordingTimeoutSeconds,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating live input`,async()=>r.put(`/accounts/${p}/stream/live_inputs/${t.liveInputIdentifier}`,{body:e})),{successLabel:`Updated live input`});return}let m={};t.defaultCreator!==void 0&&s(m,[`defaultCreator`],a(t.defaultCreator,`defaultCreator`,`text`)),t.deleteRecordingAfterDays!==void 0&&s(m,[`deleteRecordingAfterDays`],t.deleteRecordingAfterDays),t.enabled!==void 0&&s(m,[`enabled`],t.enabled),t.recordingAllowedOrigins!==void 0&&s(m,[`recording`,`allowedOrigins`],t.recordingAllowedOrigins),t.recordingHideLiveViewerCount!==void 0&&s(m,[`recording`,`hideLiveViewerCount`],t.recordingHideLiveViewerCount),t.recordingMode!==void 0&&s(m,[`recording`,`mode`],a(t.recordingMode,`recordingMode`,`text`)),t.recordingRequireSignedUrls!==void 0&&s(m,[`recording`,`requireSignedURLs`],t.recordingRequireSignedUrls),t.recordingTimeoutSeconds!==void 0&&s(m,[`recording`,`timeoutSeconds`],t.recordingTimeoutSeconds),l(await f(`Updating live input`,async()=>r.put(`/accounts/${p}/stream/live_inputs/${t.liveInputIdentifier}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated live input`})}},de={command:`live-inputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Y).command(X).command(re).command(ie).command(ue).command(te).command(ne).command(le).demandCommand(1),handler:()=>{}},fe={command:`create <identifier>`,describe:`Creates a signed URL token for a video. If a body is not provided in the request, a token is created with default values.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`downloadable`,{type:`boolean`,description:`The optional boolean value that enables using signed tokens to access MP4 download links for a video.`,default:!1}).option(`exp`,{type:`number`,description:`The optional unix epoch timestamp that specficies the time after a token is not accepted. The maximum time specification is 24 hours from issuing time. If this field is not set, the default is one hour after issuing.`}).option(`flags-original`,{type:`boolean`,description:`Whether to return the original video without transformations.`,default:!1}).option(`id`,{type:`string`,description:"The optional ID of a Stream signing key. If present, the `pem` field is also required."}).option(`nbf`,{type:`number`,description:`The optional unix epoch timestamp that specifies the time before a the token is not accepted. If this field is not set, the default is one hour before issuing.`}).option(`pem`,{type:`string`,description:"The optional base64 encoded private key in PEM format associated with a Stream signing key. If present, the `id` field is also required."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/token`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:{downloadable:t.downloadable,exp:t.exp,flagsOriginal:t.flagsOriginal,id:t.id,nbf:t.nbf,pem:t.pem,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Creating token`,async()=>r.post(`/accounts/${p}/stream/${t.identifier}/token`,{body:e})),{successLabel:`Created token`});return}let m={};t.downloadable!==void 0&&s(m,[`downloadable`],t.downloadable),t.exp!==void 0&&s(m,[`exp`],t.exp),t.flagsOriginal!==void 0&&s(m,[`flags`,`original`],t.flagsOriginal),t.id!==void 0&&s(m,[`id`],a(t.id,`id`,`text`)),t.nbf!==void 0&&s(m,[`nbf`],t.nbf),t.pem!==void 0&&s(m,[`pem`],a(t.pem,`pem`,`text`)),l(await f(`Creating token`,async()=>r.post(`/accounts/${p}/stream/${t.identifier}/token`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created token`})}},pe={command:`token`,describe:`Generate short-lived signed URL tokens for secure private video playback`,builder:e=>e.command(fe).demandCommand(1),handler:()=>{}},me={command:`create <downloadType>`,describe:`Creates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.`,builder:e=>e.positional(`downloadType`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.downloadType,`downloadType`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream typed-downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/downloads/${t.downloadType??`<downloadType>`}`,pathParams:{identifier:String(t.identifier??``),downloadType:String(t.downloadType??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating typed download`,async()=>r.stream.typedDownloads.create(t.identifier,a,t.downloadType)),{successLabel:`Created typed download`})}},he={command:`delete <downloadType>`,describe:`Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.`,builder:e=>e.positional(`downloadType`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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}),handler:async t=>{if(o(t.downloadType,`downloadType`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream typed-downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/${t.identifier??`<identifier>`}/downloads/${t.downloadType??`<downloadType>`}`,pathParams:{identifier:String(t.identifier??``),downloadType:String(t.downloadType??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`typed download`,String(t.downloadType??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}l(await f(`Deleting typed download`,async()=>a.stream.typedDownloads.delete(t.identifier,s,t.downloadType)),{successLabel:`Deleted typed download`})}},ge={command:`typed-downloads`,describe:`Type-specific stream download creation and deletion`,builder:e=>e.command(me).command(he).demandCommand(1),handler:()=>{}},_e={command:`storage-usage`,describe:`Returns information about an account's storage use.`,builder:e=>e.option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}),handler:async e=>{let t={};e.creator!==void 0&&(t.creator=e.creator);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading video`,async()=>r.stream.videos.storageUsage(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded video`})}},ve={command:`videos`,describe:`Aggregate video storage usage statistics for the account`,builder:e=>e.command(_e).demandCommand(1),handler:()=>{}},ye={command:`create`,describe:"Creates watermark profiles using a single `HTTP POST multipart/form-data` request.",builder:e=>e.option(`name`,{type:`string`,description:`A short description of the watermark profile.`,default:``}).option(`opacity`,{type:`number`,description:"The translucency of the image. A value of `0.0` makes the image completely transparent, and `1.0` makes the image completely opaque. Note that if the image is already semi-transparent, setting this to `1.0` will not make the image completely opaque.",default:1}).option(`padding`,{type:`number`,description:"The whitespace between the adjacent edges (determined by position) of the video and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded video width or length, as determined by the algorithm.",default:.05}).option(`position`,{type:`string`,description:"The location of the image. Valid positions are: `upperRight`, `upperLeft`, `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the `padding` parameter.",default:`upperRight`}).option(`scale`,{type:`number`,description:"The size of the image relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. `0.0` indicates no scaling (use the size of the image as-is), and `1.0 `fills the entire video.",default:.15}).option(`url`,{type:`string`,description:`URL of the watermark image to copy.`}).option(`dry-run`,{type:`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`}),handler:async t=>{if(t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream watermarks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`multipart`,body:{name:t.name,opacity:t.opacity,padding:t.padding,position:t.position,scale:t.scale,url:t.url,body:t.body,file:t.file},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.file!==void 0||t.body!==void 0||t.name!==void 0||t.opacity!==void 0||t.padding!==void 0||t.position!==void 0||t.scale!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);t.name!==void 0&&e.append(`name`,String(a(t.name,`name`,`text`)??``)),t.opacity!==void 0&&e.append(`opacity`,String(t.opacity)),t.padding!==void 0&&e.append(`padding`,String(t.padding)),t.position!==void 0&&e.append(`position`,String(a(t.position,`position`,`text`)??``)),t.scale!==void 0&&e.append(`scale`,String(t.scale)),l(await f(`Creating watermark`,async()=>r.post(`/accounts/${p}/stream/watermarks`,{body:e})),{successLabel:`Created watermark`});return}if(t.body){let e=c(t.body);l(await f(`Creating watermark`,async()=>r.post(`/accounts/${p}/stream/watermarks`,{body:e})),{successLabel:`Created watermark`});return}let m={};t.name!==void 0&&s(m,[`name`],a(t.name,`name`,`text`)),t.opacity!==void 0&&s(m,[`opacity`],t.opacity),t.padding!==void 0&&s(m,[`padding`],t.padding),t.position!==void 0&&s(m,[`position`],a(t.position,`position`,`text`)),t.scale!==void 0&&s(m,[`scale`],t.scale),t.url!==void 0&&s(m,[`url`],a(t.url,`url`,`text`)),l(await f(`Creating watermark`,async()=>r.post(`/accounts/${p}/stream/watermarks`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created watermark`})}},be={command:`delete <identifier>`,describe:`Deletes a watermark profile.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,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}),handler:async t=>{if(o(t.identifier,`identifier`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream watermarks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/watermarks/${t.identifier??`<identifier>`}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`watermark`,String(t.identifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
12
|
-
`);return}l(await f(`Deleting watermark`,async()=>a.stream.watermarks.delete(t.identifier,s)),{successLabel:`Deleted watermark`})}},$={command:`get <identifier>`,describe:`Retrieves details for a single watermark profile.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}),handler:async e=>{o(e.identifier,`identifier`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading watermark`,async()=>t.stream.watermarks.get(e.identifier,r)),{successLabel:`Loaded watermark`})}},xe={command:`list`,describe:`Lists all watermark profiles for an account.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading watermarks`,async()=>t.stream.watermarks.list(r)),{successLabel:`Loaded watermarks`})}},Se={command:`watermarks`,describe:`Watermark profiles that overlay an image on every video in the account`,builder:e=>e.command(ye).command(be).command($).command(xe).demandCommand(1),handler:()=>{}},Ce={command:`delete`,describe:`Deletes a webhook.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf stream webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`webhook`,``,{force:!!t.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}l(await f(`Deleting webhook`,async()=>a.stream.webhooks.delete(s)),{successLabel:`Deleted webhook`})}},we={command:`get`,describe:`Retrieves a list of webhooks.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading webhook`,async()=>t.stream.webhooks.get(r)),{successLabel:`Loaded webhook`})}},Te={command:`update`,describe:`Creates a webhook notification.`,builder:e=>e.option(`notification-url`,{type:`string`,description:`The URL where webhooks will be sent.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf stream webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`json`,body:{notificationUrl:t.notificationUrl,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating webhook`,async()=>r.put(`/accounts/${p}/stream/webhook`,{body:e})),{successLabel:`Updated webhook`});return}let m={};t.notificationUrl!==void 0&&s(m,[`notificationUrl`],a(t.notificationUrl,`notificationUrl`,`text`)),l(await f(`Updating webhook`,async()=>r.put(`/accounts/${p}/stream/webhook`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated webhook`})}},Ee={command:`webhooks`,describe:`Webhook notifications for video lifecycle events (ready, error, etc.)`,builder:e=>e.command(Ce).command(we).command(Te).demandCommand(1),handler:()=>{}},De={command:`stream`,describe:`Video encoding, storage, and delivery — upload, live-stream, clip, caption, and embed video at scale`,builder:e=>e.command(M).command(N).command(B).command(U).command(J).command(v).command(D).command(k).command(j).command(F).command(z).command(H).command(q).command(de).command(pe).command(ge).command(ve).command(Se).command(Ee).demandCommand(1),handler:()=>{}};export{De as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./auth-BHD_B2p9.mjs";import{r as t}from"./input-validation-BpVQi9rR.mjs";import{t as n}from"./output-CqGQp2r6.mjs";import{t as r}from"./progress-5sHFvwez.mjs";const i={command:`get <tenantId>`,describe:`List of account types available for the Tenant to provision accounts.`,builder:e=>e.positional(`tenantId`,{type:`string`,description:`Tenant ID`,demandOption:!0}),handler:async i=>{t(i.tenantId,`tenantId`);let a=await e(i);n(await r(`Loading account type`,async()=>a.tenants.accountTypes.get(i.tenantId)),{successLabel:`Loaded account type`})}},a={command:`account-types`,describe:`Account Types operations`,builder:e=>e.command(i).demandCommand(1),handler:()=>{}},o={command:`list`,describe:`List of accounts for the Tenant.`,builder:e=>e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}),handler:async t=>{let i=await e(t);n(await r(`Loading accounts`,async()=>i.tenants.accounts.list(t.tenantId)),{successLabel:`Loaded accounts`})}},s={command:`accounts`,describe:`Accounts operations`,builder:e=>e.command(o).demandCommand(1),handler:()=>{}},c={command:`list`,describe:`List of innate entitlements available for the Tenant.`,builder:e=>e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}),handler:async t=>{let i=await e(t);n(await r(`Loading entitlements`,async()=>i.tenants.entitlements.list(t.tenantId)),{successLabel:`Loaded entitlements`})}},l={command:`entitlements`,describe:`Entitlements operations`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}},u={command:`get <tenantId>`,describe:`Retrieves a Tenant by Tenant ID.`,builder:e=>e.positional(`tenantId`,{type:`string`,description:`Tenant ID`,demandOption:!0}),handler:async i=>{t(i.tenantId,`tenantId`);let a=await e(i);n(await r(`Loading tenant`,async()=>a.tenants.get(i.tenantId)),{successLabel:`Loaded tenant`})}},d={command:`list`,describe:`List of active members (Cloudflare users) for the Tenant.`,builder:e=>e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}),handler:async t=>{let i=await e(t);n(await r(`Loading memberships`,async()=>i.tenants.memberships.list(t.tenantId)),{successLabel:`Loaded memberships`})}},f={command:`memberships`,describe:`Memberships operations`,builder:e=>e.command(d).demandCommand(1),handler:()=>{}},p={command:`tenants`,describe:`Multi-tenant account management — manage tenant accounts, entitlements, and memberships`,builder:e=>e.command(u).command(a).command(s).command(l).command(f).demandCommand(1),handler:()=>{}};export{p as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{t as i}from"./output-CqGQp2r6.mjs";import{t as a}from"./dry-run-FV0pZwdg.mjs";import{t as o}from"./progress-5sHFvwez.mjs";const s={command:`create`,describe:`Create a new Token Validation configuration`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/config`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Creating configuration`,async()=>s.post(`/zones/${e.zoneId}/token_validation/config`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created configuration`});return}i(await o(`Creating configuration`,async()=>s.tokenValidation.configuration.create(c)),{successLabel:`Created configuration`})}},c={command:`update`,describe:`Update Token Configuration credentials`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation configuration credentials update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/config/${e.configId??`<configId>`}/credentials`,pathParams:{zoneId:String(e.zoneId??``),configId:String(e.configId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating credential`,async()=>s.put(`/zones/${e.zoneId}/token_validation/config/${e.configId}/credentials`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated credential`});return}i(await o(`Updating credential`,async()=>s.tokenValidation.configuration.credentials.update(c,e.configId)),{successLabel:`Updated credential`})}},l={command:`credentials`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}},u={command:`delete`,describe:`Delete Token Configuration`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){a({command:`cf token-validation configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/token_validation/config/${r.configId??`<configId>`}`,pathParams:{zoneId:String(r.zoneId??``),configId:String(r.configId??``)},bodyKind:`none`,validation:`passed`});return}let s=await t(r),c=await n({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e(`configuration`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting configuration`,async()=>s.tokenValidation.configuration.delete(c,r.configId)),{successLabel:`Deleted configuration`})}},d={command:`edit`,describe:`Edit fields of an existing Token Configuration`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/config/${e.configId??`<configId>`}`,pathParams:{zoneId:String(e.zoneId??``),configId:String(e.configId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating configuration`,async()=>s.patch(`/zones/${e.zoneId}/token_validation/config/${e.configId}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated configuration`});return}i(await o(`Updating configuration`,async()=>s.tokenValidation.configuration.edit(c,e.configId)),{successLabel:`Updated configuration`})}},f={command:`get`,describe:`Get a single Token Configuration`,builder:e=>e,handler:async e=>{let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,i(await o(`Loading configuration`,async()=>r.tokenValidation.configuration.get(a,e.configId)),{successLabel:`Loaded configuration`})}},p={command:`list`,describe:`Lists all token validation configurations for this zone`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading configuration`,async()=>a.tokenValidation.configuration.list(s,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded configuration`})}},m={command:`configuration`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(s).command(u).command(d).command(f).command(p).command(l).demandCommand(1),handler:()=>{}},h={command:`bulk-create`,describe:`Create zone token validation rules. A request can create multiple Token Validation Rules.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/rules/bulk`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e);if(e.zoneId=await n({zone:e.zone},s,{quiet:e.quiet}),e.body){let t=r(e.body,`body`,`binary`);i(await o(`Creating rules`,async()=>s.post(`/zones/${e.zoneId}/token_validation/rules/bulk`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created rules`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`bulk-edit`,describe:"Edit token validation rules. A request can update multiple Token Validation Rules. Rules can be re-ordered using the `position` field. Returns all updated rules.",builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/rules/bulk`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e);if(e.zoneId=await n({zone:e.zone},s,{quiet:e.quiet}),e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating rules`,async()=>s.patch(`/zones/${e.zoneId}/token_validation/rules/bulk`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated rules`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},_={command:`create`,describe:`Create a token validation rule.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Creating rule`,async()=>s.post(`/zones/${e.zoneId}/token_validation/rules`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created rule`});return}i(await o(`Creating rule`,async()=>s.tokenValidation.rules.create(c)),{successLabel:`Created rule`})}},v={command:`delete`,describe:`Delete a zone token validation rule.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){a({command:`cf token-validation rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/token_validation/rules/${r.ruleId??`<ruleId>`}`,pathParams:{zoneId:String(r.zoneId??``),ruleId:String(r.ruleId??``)},bodyKind:`none`,validation:`passed`});return}let s=await t(r),c=await n({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e(`rule`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}i(await o(`Deleting rule`,async()=>s.tokenValidation.rules.delete(c,r.ruleId)),{successLabel:`Deleted rule`})}},y={command:`edit`,describe:`Edit a zone token validation rule.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){a({command:`cf token-validation rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/rules/${e.ruleId??`<ruleId>`}`,pathParams:{zoneId:String(e.zoneId??``),ruleId:String(e.ruleId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating rule`,async()=>s.patch(`/zones/${e.zoneId}/token_validation/rules/${e.ruleId}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated rule`});return}i(await o(`Updating rule`,async()=>s.tokenValidation.rules.edit(c,e.ruleId)),{successLabel:`Updated rule`})}},b={command:`get`,describe:`Get a zone token validation rule.`,builder:e=>e,handler:async e=>{let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,i(await o(`Loading rule`,async()=>r.tokenValidation.rules.get(a,e.ruleId)),{successLabel:`Loaded rule`})}},x={command:`list`,describe:`List token validation rules`,builder:e=>e.option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`token-configuration`,{type:`string`,description:`Select rules using any of these token configurations.`}).option(`action`,{type:`string`,description:"Action to take on requests that match operations included in `selector` and fail `expression`.",choices:[`log`,`block`]}).option(`enabled`,{type:`string`,description:`Toggle rule on or off.`}).option(`id`,{type:`string`,description:`Select rules with these IDs.`}).option(`rule-id`,{type:`string`,description:`Select rules with these IDs.`}).option(`host`,{type:`string`,description:"Select rules with this host in `include`."}).option(`hostname`,{type:`string`,description:"Select rules with this host in `include`."}),handler:async e=>{let r={};e.perPage!==void 0&&(r.per_page=e.perPage),e.page!==void 0&&(r.page=e.page),e.tokenConfiguration!==void 0&&(r.token_configuration=e.tokenConfiguration),e.action!==void 0&&(r.action=e.action),e.enabled!==void 0&&(r.enabled=e.enabled),e.id!==void 0&&(r.id=e.id),e.ruleId!==void 0&&(r.rule_id=e.ruleId),e.host!==void 0&&(r.host=e.host),e.hostname!==void 0&&(r.hostname=e.hostname);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading rules`,async()=>a.tokenValidation.rules.list(s,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded rules`})}},S={command:`create`,describe:"Preview operations covered by a Token Validation rule. The API will return all operations on a zone annotated with an additional `state` field. Operations with an `included` `state` will be covered by a Token Validation Rule.",builder:e=>e.option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`state`,{type:`string`,description:`State`}).option(`host`,{type:`string`,description:`Filter operations by host.`}).option(`hostname`,{type:`string`,description:`Filter operations by host.`}).option(`method`,{type:`string`,description:`Filter operations by method.`}).option(`endpoint`,{type:`string`,description:`Filter operations by endpoint. Allows substring matching.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Select operations covered by this rule. For details on selectors, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). `}),handler:async e=>{let s={};if(e.perPage!==void 0&&(s.per_page=e.perPage),e.page!==void 0&&(s.page=e.page),e.state!==void 0&&(s.state=e.state),e.host!==void 0&&(s.host=e.host),e.hostname!==void 0&&(s.hostname=e.hostname),e.method!==void 0&&(s.method=e.method),e.endpoint!==void 0&&(s.endpoint=e.endpoint),e.dryRun){a({command:`cf token-validation rules preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/token_validation/rules/preview`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{...s,body:e.body},validation:`passed`});return}let c=await t(e),l=await n({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=r(e.body,`body`,`binary`),n=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();i(await o(`Creating preview`,async()=>c.post(`/zones/${e.zoneId}/token_validation/rules/preview${n?`?`+n:``}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created preview`});return}i(await o(`Creating preview`,async()=>c.tokenValidation.rules.preview.create(l,Object.keys(s).length>0?s:void 0)),{successLabel:`Created preview`})}},C={command:`preview`,describe:`Preview token validation rule behavior before applying`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`rules`,describe:`Validation rules that enforce token requirements on specific API endpoints`,builder:e=>e.command(h).command(g).command(_).command(v).command(y).command(b).command(x).command(C).demandCommand(1),handler:()=>{}},T={command:`token-validation`,describe:`Validate JWT tokens at the edge — configure token sources, signing keys, and validation rules`,builder:e=>e.command(m).command(w).demandCommand(1),handler:()=>{}};export{T as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Lists challenge widgets.`,builder:e=>e.option(`bot-fight-mode`,{type:`boolean`,description:"If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive challenges in response to malicious bots (ENT only). "}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set `,choices:[`no_clearance`,`jschallenge`,`managed`,`interactive`]}).option(`domains`,{type:`string`,array:!0,description:`The domains field`}).option(`ephemeral-id`,{type:`boolean`,description:`Return the Ephemeral ID in /siteverify (ENT only). `}).option(`mode`,{type:`string`,description:`Widget Mode`,choices:[`non-interactive`,`invisible`,`managed`]}).option(`name`,{type:`string`,description:`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only). `}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation. `,choices:[`world`,`china`],default:`world`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf turnstile widgets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/challenges/widgets`,pathParams:{},bodyKind:`json`,body:{botFightMode:i.botFightMode,clearanceLevel:i.clearanceLevel,domains:i.domains,ephemeralId:i.ephemeralId,mode:i.mode,name:i.name,offlabel:i.offlabel,region:i.region,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating widget`,async()=>m.post(`/accounts/${h}/challenges/widgets`,{body:e})),{successLabel:`Created widget`});return}if(i.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);i.mode===void 0&&(i.mode=await n(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),i.name===void 0&&(i.name=await t(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let g={};i.botFightMode!==void 0&&c(g,[`bot_fight_mode`],i.botFightMode),i.clearanceLevel!==void 0&&c(g,[`clearance_level`],o(i.clearanceLevel,`clearanceLevel`,`text`)),i.domains!==void 0&&c(g,[`domains`],i.domains),i.ephemeralId!==void 0&&c(g,[`ephemeral_id`],i.ephemeralId),i.mode!==void 0&&c(g,[`mode`],o(i.mode,`mode`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.offlabel!==void 0&&c(g,[`offlabel`],i.offlabel),i.region!==void 0&&c(g,[`region`],o(i.region,`region`,`text`)),u(await p(`Creating widget`,async()=>m.post(`/accounts/${h}/challenges/widgets`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created widget`})}},h={command:`delete`,describe:`Destroy a Turnstile Widget.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf turnstile widgets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/challenges/widgets/${t.sitekey??`<sitekey>`}`,pathParams:{sitekey:String(t.sitekey??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`widget`,``,{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}u(await p(`Deleting widget`,async()=>n.turnstile.widgets.delete(o,t.sitekey)),{successLabel:`Deleted widget`})}},g={command:`get`,describe:`Show a single challenge widget configuration.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading widget`,async()=>t.turnstile.widgets.get(n,e.sitekey)),{successLabel:`Loaded widget`})}},_={command:`list`,describe:`Lists all turnstile widgets of an account.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading widgets`,async()=>t.turnstile.widgets.list(n)),{successLabel:`Loaded widgets`})}},v={command:`rotate-secret`,describe:"Generate a new secret key for this widget. If `invalidate_immediately` is set to `false`, the previous secret remains valid for 2 hours. Note that secrets cannot be rotated again during the grace period.",builder:e=>e.option(`invalidate-immediately`,{type:`boolean`,description:"If `invalidate_immediately` is set to `false`, the previous secret will remain valid for two hours. Otherwise, the secret is immediately invalidated, and requests using it will be rejected. ",default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf turnstile widgets rotate-secret`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/challenges/widgets/${t.sitekey??`<sitekey>`}/rotate_secret`,pathParams:{sitekey:String(t.sitekey??``)},bodyKind:`json`,body:{invalidateImmediately:t.invalidateImmediately,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating widget`,async()=>n.post(`/accounts/${i}/challenges/widgets/${t.sitekey}/rotate_secret`,{body:e})),{successLabel:`Created widget`});return}let o={};t.invalidateImmediately!==void 0&&c(o,[`invalidate_immediately`],t.invalidateImmediately),u(await p(`Creating widget`,async()=>n.post(`/accounts/${i}/challenges/widgets/${t.sitekey}/rotate_secret`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created widget`})}},y={command:`update`,describe:`Update the configuration of a widget.`,builder:e=>e.option(`bot-fight-mode`,{type:`boolean`,description:"If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive challenges in response to malicious bots (ENT only). "}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set `,choices:[`no_clearance`,`jschallenge`,`managed`,`interactive`]}).option(`domains`,{type:`string`,array:!0,description:`The domains field`}).option(`ephemeral-id`,{type:`boolean`,description:`Return the Ephemeral ID in /siteverify (ENT only). `}).option(`mode`,{type:`string`,description:`Widget Mode`,choices:[`non-interactive`,`invisible`,`managed`]}).option(`name`,{type:`string`,description:`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only). `}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation. `,choices:[`world`,`china`],default:`world`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf turnstile widgets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/challenges/widgets/${i.sitekey??`<sitekey>`}`,pathParams:{sitekey:String(i.sitekey??``)},bodyKind:`json`,body:{botFightMode:i.botFightMode,clearanceLevel:i.clearanceLevel,domains:i.domains,ephemeralId:i.ephemeralId,mode:i.mode,name:i.name,offlabel:i.offlabel,region:i.region,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating widget`,async()=>m.put(`/accounts/${h}/challenges/widgets/${i.sitekey}`,{body:e})),{successLabel:`Updated widget`});return}if(i.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);i.mode===void 0&&(i.mode=await n(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),i.name===void 0&&(i.name=await t(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let g={};i.botFightMode!==void 0&&c(g,[`bot_fight_mode`],i.botFightMode),i.clearanceLevel!==void 0&&c(g,[`clearance_level`],o(i.clearanceLevel,`clearanceLevel`,`text`)),i.domains!==void 0&&c(g,[`domains`],i.domains),i.ephemeralId!==void 0&&c(g,[`ephemeral_id`],i.ephemeralId),i.mode!==void 0&&c(g,[`mode`],o(i.mode,`mode`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.offlabel!==void 0&&c(g,[`offlabel`],i.offlabel),i.region!==void 0&&c(g,[`region`],o(i.region,`region`,`text`)),u(await p(`Updating widget`,async()=>m.put(`/accounts/${h}/challenges/widgets/${i.sitekey}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated widget`})}},b={command:`widgets`,describe:`Turnstile widget configurations — site keys, secret rotation, and challenge mode settings`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).command(y).demandCommand(1),handler:()=>{}},x={command:`turnstile`,describe:`CAPTCHA-free bot verification widgets that protect forms and APIs without degrading user experience`,builder:e=>e.command(b).demandCommand(1),handler:()=>{}};export{x as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{t as i}from"./output-CqGQp2r6.mjs";import{t as a}from"./dry-run-FV0pZwdg.mjs";import{t as o}from"./progress-5sHFvwez.mjs";const s={command:`delete`,describe:`Deletes the URL Normalization settings.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){a({command:`cf url-normalization delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/url_normalization`,pathParams:{zoneId:String(r.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let s=await t(r),c=await n({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e(`url normalization`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting url normalization`,async()=>s.urlNormalization.delete(c)),{successLabel:`Deleted url normalization`})}},c={command:`get`,describe:`Fetches the current URL Normalization settings.`,builder:e=>e,handler:async e=>{let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,i(await o(`Loading url normalization`,async()=>r.urlNormalization.get(a)),{successLabel:`Loaded url normalization`})}},l={command:`update`,describe:`Updates the URL Normalization settings.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A URL Normalization object.`}),handler:async e=>{if(e.dryRun){a({command:`cf url-normalization update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/url_normalization`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating url normalization`,async()=>s.put(`/zones/${e.zoneId}/url_normalization`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated url normalization`});return}i(await o(`Updating url normalization`,async()=>s.urlNormalization.update(c)),{successLabel:`Updated url normalization`})}},u={command:`url-normalization`,describe:`Normalize incoming request URLs to a consistent format before rule evaluation and caching`,builder:e=>e.command(s).command(c).command(l).demandCommand(1),handler:()=>{}};export{u as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";import{n as f,t as p}from"./raw-fetch-CxFs4i0R.mjs";const m={command:`get <responseId>`,describe:"Returns the raw response of the network request. Find the `response_id` in the `data.requests.response.hash`.",builder:e=>e.positional(`responseId`,{type:`string`,description:`Response hash.`,demandOption:!0}),handler:async e=>{a(e.responseId,`responseId`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,f((await d(`Loading response`,async()=>p(`/accounts/${i}/urlscanner/v2/responses/${e.responseId}`,`GET`,e.local?e.localEndpoint:void 0))).toString(`utf-8`))}},h={command:`responses`,describe:`Raw HTTP response data captured during URL scans`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`bulk-create`,describe:`Submit URLs to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/ and take into account scans submitted in bulk have lower priority and may take longer to finish.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`List of urls to scan (up to a 100).`}),handler:async t=>{if(t.dryRun){let n=e();n&&a(n,`accountId`),l({command:`cf url-scanner scans bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/urlscanner/v2/bulk`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let i=await r(t),o=t.local?u:await n(i);if(t.accountId=o,t.body){let e=s(t.body);c(await d(`Creating scans`,async()=>i.post(`/accounts/${o}/urlscanner/v2/bulk`,{body:e})),{successLabel:`Created scans`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},_={command:`create`,describe:`Submit a URL to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/.`,builder:e=>e.option(`agent-readiness`,{type:`boolean`,description:`Enable agent readiness checks.`}).option(`country`,{type:`string`,description:`Country to geo egress from`,choices:`AF.AL.DZ.AD.AO.AG.AR.AM.AU.AT.AZ.BH.BD.BB.BY.BE.BZ.BJ.BM.BT.BO.BA.BW.BR.BN.BG.BF.BI.KH.CM.CA.CV.KY.CF.TD.CL.CN.CO.KM.CG.CR.CI.HR.CU.CY.CZ.CD.DK.DJ.DM.DO.EC.EG.SV.GQ.ER.EE.SZ.ET.FJ.FI.FR.GA.GE.DE.GH.GR.GL.GD.GT.GN.GW.GY.HT.HN.HU.IS.IN.ID.IR.IQ.IE.IL.IT.JM.JP.JO.KZ.KE.KI.KW.KG.LA.LV.LB.LS.LR.LY.LI.LT.LU.MO.MG.MW.MY.MV.ML.MR.MU.MX.FM.MD.MC.MN.MS.MA.MZ.MM.NA.NR.NP.NL.NZ.NI.NE.NG.KP.MK.NO.OM.PK.PS.PA.PG.PY.PE.PH.PL.PT.QA.RO.RU.RW.SH.KN.LC.VC.WS.SM.ST.SA.SN.RS.SC.SL.SK.SI.SB.SO.ZA.KR.SS.ES.LK.SD.SR.SE.CH.SY.TW.TJ.TZ.TH.BS.GM.TL.TG.TO.TT.TN.TR.TM.UG.UA.AE.GB.US.UY.UZ.VU.VE.VN.YE.ZM.ZW`.split(`.`)}).option(`customagent`,{type:`string`,description:`The customagent field`}).option(`referer`,{type:`string`,description:`The referer field`}).option(`screenshots-resolutions`,{type:`string`,array:!0,description:`Take multiple screenshots targeting different device types.`}).option(`url`,{type:`string`,description:`The url field`}).option(`visibility`,{type:`string`,description:"The option `Public` means it will be included in listings like recent scans and search results. `Unlisted` means it will not be included in the aforementioned listings, users will need to have the scan's ID to access it. A a scan will be automatically marked as unlisted if it fails, if it contains potential PII or other sensitive material.",choices:[`Public`,`Unlisted`],default:`Public`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async f=>{if(f.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf url-scanner scans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/urlscanner/v2/scan`,pathParams:{},bodyKind:`json`,body:{agentReadiness:f.agentReadiness,country:f.country,customagent:f.customagent,referer:f.referer,screenshotsResolutions:f.screenshotsResolutions,url:f.url,visibility:f.visibility,body:f.body},validation:`passed`});return}let p=await r(f),m=f.local?u:await n(p);if(f.accountId=m,f.body){let e=s(f.body);c(await d(`Creating scan`,async()=>p.post(`/accounts/${m}/urlscanner/v2/scan`,{body:e})),{successLabel:`Created scan`});return}f.url===void 0&&(f.url=await t(`url`,``));let h={};f.agentReadiness!==void 0&&o(h,[`agentReadiness`],f.agentReadiness),f.country!==void 0&&o(h,[`country`],i(f.country,`country`,`text`)),f.customagent!==void 0&&o(h,[`customagent`],i(f.customagent,`customagent`,`text`)),f.referer!==void 0&&o(h,[`referer`],i(f.referer,`referer`,`text`)),f.screenshotsResolutions!==void 0&&o(h,[`screenshotsResolutions`],f.screenshotsResolutions),f.url!==void 0&&o(h,[`url`],i(f.url,`url`,`text`)),f.visibility!==void 0&&o(h,[`visibility`],i(f.visibility,`visibility`,`text`)),c(await d(`Creating scan`,async()=>p.post(`/accounts/${m}/urlscanner/v2/scan`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created scan`})}},v={command:`dom <scanId>`,describe:`Returns a plain text response, with the scan's DOM content as rendered by Chrome.`,builder:e=>e.positional(`scanId`,{type:`string`,description:`Scan UUID.`,demandOption:!0}),handler:async e=>{a(e.scanId,`scanId`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,f((await d(`Loading scan`,async()=>p(`/accounts/${i}/urlscanner/v2/dom/${e.scanId}`,`GET`,e.local?e.localEndpoint:void 0))).toString(`utf-8`))}},y={command:`get <scanId>`,describe:`Get URL scan by uuid`,builder:e=>e.positional(`scanId`,{type:`string`,description:`Scan UUID.`,demandOption:!0}),handler:async e=>{a(e.scanId,`scanId`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,c(await d(`Loading scan`,async()=>t.urlScanner.scans.get(e.scanId,i)),{successLabel:`Loaded scan`})}},b={command:`har <scanId>`,describe:`Get a URL scan's HAR file. See HAR spec at http://www.softwareishard.com/blog/har-12-spec/.`,builder:e=>e.positional(`scanId`,{type:`string`,description:`Scan UUID.`,demandOption:!0}),handler:async e=>{a(e.scanId,`scanId`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,c(await d(`Loading scan`,async()=>t.urlScanner.scans.har(e.scanId,i)),{successLabel:`Loaded scan`})}},x={command:`list`,describe:`Use a subset of ElasticSearch Query syntax to filter scans. Some example queries:<br/> <br/>- 'path:"/bundles/jquery.js"': Searches for scans who requested resources with the given path.<br/>- 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940 where a resource with the given hash was downloaded.<br/>- 'page.domain:microsoft* AND verdicts.malicious:true AND NOT page.domain:microsoft.com': malicious scans whose hostname starts with "microsoft".<br/>- 'apikey:me AND date:[2025-01 TO 2025-02]': my scans from 2025 January to 2025 February.`,builder:e=>e.option(`size`,{type:`number`,description:`Limit the number of objects in the response.`}).option(`q`,{type:`string`,description:`Filter scans`}),handler:async e=>{let t={};e.size!==void 0&&(t.size=e.size),e.q!==void 0&&(t.q=e.q);let i=await r(e),a=e.local?u:await n(i);e.accountId=a,c(await d(`Loading scans`,async()=>i.urlScanner.scans.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded scans`})}},S={command:`screenshot <scanId>`,describe:`Get scan's screenshot by resolution (desktop/mobile/tablet).`,builder:e=>e.positional(`scanId`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`resolution`,{type:`string`,description:`Target device type.`,choices:[`desktop`,`mobile`,`tablet`]}),handler:async e=>{a(e.scanId,`scanId`);let t={};e.resolution!==void 0&&(t.resolution=e.resolution);let i=await r(e),o=e.local?u:await n(i);e.accountId=o,c(await d(`Loading scan`,async()=>i.urlScanner.scans.screenshot(e.scanId,o,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded scan`})}},C={command:`scans`,describe:`URL scan requests and results — submit URLs for analysis and retrieve threat verdicts`,builder:e=>e.command(g).command(_).command(v).command(y).command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`url-scanner`,describe:`Scan URLs for phishing, malware, and other threats — submit scans and retrieve detailed results`,builder:e=>e.command(h).command(C).demandCommand(1),handler:()=>{}};export{w as default};
|
package/dist/user-Cduf3VRi.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,m as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`list`,describe:`Gets a list of audit logs for a user account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:e=>e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`,default:!1}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:`Since`}).option(`before`,{type:`string`,description:`Before`}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`,default:!1}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id),e.export!==void 0&&(t.export=e.export),e.actionType!==void 0&&(t.actionType=e.actionType),e.actorIp!==void 0&&(t.actorIp=e.actorIp),e.actorEmail!==void 0&&(t.actorEmail=e.actorEmail),e.since!==void 0&&(t.since=e.since),e.before!==void 0&&(t.before=e.before),e.zoneName!==void 0&&(t.zoneName=e.zoneName),e.direction!==void 0&&(t.direction=e.direction),e.perPage!==void 0&&(t.per_page=e.perPage),e.page!==void 0&&(t.page=e.page),e.hideUserLogs!==void 0&&(t.hide_user_logs=e.hideUserLogs);let n=await r(e);c(await u(`Loading audit logs`,async()=>n.user.auditLogs.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded audit logs`})}},ee={command:`audit-logs`,describe:`Review a chronological record of actions performed by or on behalf of your user`,builder:e=>e.command(d).demandCommand(1),handler:()=>{}},f={command:`list`,describe:`Accesses your billing history object.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order billing history by.`,choices:[`type`,`occurred_at`,`action`]}).option(`occurred-at`,{type:`string`,description:`When the billing item was created.`}).option(`type`,{type:`string`,description:`The billing item type.`}).option(`action`,{type:`string`,description:`The billing item action.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.occurredAt!==void 0&&(t.occurred_at=e.occurredAt),e.type!==void 0&&(t.type=e.type),e.action!==void 0&&(t.action=e.action);let n=await r(e);c(await u(`Loading history`,async()=>n.user.billing.history.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded history`})}},p={command:`history`,describe:`View billing history and payment profile for your user (deprecated — prefer account-level billing)`,builder:e=>e.command(f).demandCommand(1),handler:()=>{}},m={command:`get`,describe:`Accesses your billing profile object.`,builder:e=>e,handler:async e=>{let t=await r(e);c(await u(`Loading profile`,async()=>t.user.billing.profile.get()),{successLabel:`Loaded profile`})}},h={command:`profile`,describe:`View billing history and payment profile for your user (deprecated — prefer account-level billing)`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`billing`,describe:`Operations for billing`,builder:e=>e.command(p).command(h).demandCommand(1),handler:()=>{}},_={command:`edit`,describe:`Edit part of your user details.`,builder:e=>e.option(`country`,{type:`string`,description:`The country in which the user lives.`}).option(`first-name`,{type:`string`,description:`User's first name`}).option(`last-name`,{type:`string`,description:`User's last name`}).option(`telephone`,{type:`string`,description:`User's telephone number`}).option(`zipcode`,{type:`string`,description:`The zipcode or postal code where the user lives.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf user edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user`,pathParams:{},bodyKind:`json`,body:{country:e.country,firstName:e.firstName,lastName:e.lastName,telephone:e.telephone,zipcode:e.zipcode,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating user`,async()=>t.patch(`/user`,{body:n})),{successLabel:`Updated user`});return}let n={};e.country!==void 0&&o(n,[`country`],i(e.country,`country`,`text`)),e.firstName!==void 0&&o(n,[`first_name`],i(e.firstName,`firstName`,`text`)),e.lastName!==void 0&&o(n,[`last_name`],i(e.lastName,`lastName`,`text`)),e.telephone!==void 0&&o(n,[`telephone`],i(e.telephone,`telephone`,`text`)),e.zipcode!==void 0&&o(n,[`zipcode`],i(e.zipcode,`zipcode`,`text`)),c(await u(`Updating user`,async()=>t.patch(`/user`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated user`})}},v={command:`create`,describe:`Creates a new IP Access rule for all zones owned by the current user. Note: To create an IP Access rule that applies to a specific zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:e=>e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf user firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:{configurationTarget:e.configurationTarget,configurationValue:e.configurationValue,mode:e.mode,body:e.body},validation:`passed`});return}let n=await r(e);if(e.body){let t=s(e.body);c(await u(`Creating access rule`,async()=>n.post(`/user/firewall/access_rules/rules`,{body:t})),{successLabel:`Created access rule`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a={};e.configurationTarget!==void 0&&o(a,[`configuration`,`target`],i(e.configurationTarget,`configurationTarget`,`text`)),e.configurationValue!==void 0&&o(a,[`configuration`,`value`],i(e.configurationValue,`configurationValue`,`text`)),e.mode!==void 0&&o(a,[`mode`],i(e.mode,`mode`,`text`)),c(await u(`Creating access rule`,async()=>n.post(`/user/firewall/access_rules/rules`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created access rule`})}},y={command:`delete <ruleId>`,describe:`Deletes an IP Access rule at the user level. Note: Deleting a user-level rule will affect all zones owned by the user.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.ruleId,`ruleId`),e.dryRun){l({command:`cf user firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`access rule`,String(e.ruleId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let n=s(e.body);c(await u(`Deleting access rule`,async()=>t.delete(`/user/firewall/access_rules/rules/${e.ruleId}`,{body:n})),{successLabel:`Deleted access rule`});return}c(await u(`Deleting access rule`,async()=>t.user.firewall.accessRules.delete(e.ruleId)),{successLabel:`Deleted access rule`})}},b={command:`edit <ruleId>`,describe:"Updates an IP Access rule defined at the user level. You can only update the rule action (`mode` parameter) and notes.",builder:e=>e.positional(`ruleId`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.ruleId,`ruleId`),e.dryRun){l({command:`cf user firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``)},bodyKind:`json`,body:{mode:e.mode,notes:e.notes,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating access rule`,async()=>t.patch(`/user/firewall/access_rules/rules/${e.ruleId}`,{body:n})),{successLabel:`Updated access rule`});return}let n={};e.mode!==void 0&&o(n,[`mode`],i(e.mode,`mode`,`text`)),e.notes!==void 0&&o(n,[`notes`],i(e.notes,`notes`,`text`)),c(await u(`Updating access rule`,async()=>t.patch(`/user/firewall/access_rules/rules/${e.ruleId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated access rule`})}},x={command:`list`,describe:`Fetches IP Access rules of the user. You can filter the results using several optional parameters.`,builder:e=>e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.mode!==void 0&&(t.mode=e.mode),e.configurationTarget!==void 0&&(t.configurationTarget=e.configurationTarget),e.configurationValue!==void 0&&(t.configurationValue=e.configurationValue),e.notes!==void 0&&(t.notes=e.notes),e.match!==void 0&&(t.match=e.match),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let n=await r(e);c(await u(`Loading access rules`,async()=>n.user.firewall.accessRules.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded access rules`})}},S={command:`access-rules`,describe:`Firewall operations`,builder:e=>e.command(v).command(y).command(b).command(x).demandCommand(1),handler:()=>{}},C={command:`firewall`,describe:`Operations for firewall`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`get`,describe:`Get current user details`,builder:e=>e,handler:async e=>{let t=await r(e);c(await u(`Loading user`,async()=>t.user.get()),{successLabel:`Loaded user`})}},T={command:`create`,describe:`Create a configured monitor.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){l({command:`cf user load-balancers monitors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors`,pathParams:{},bodyKind:`json`,body:{allowInsecure:e.allowInsecure,consecutiveDown:e.consecutiveDown,consecutiveUp:e.consecutiveUp,description:e.description,expectedBody:e.expectedBody,expectedCodes:e.expectedCodes,followRedirects:e.followRedirects,interval:e.interval,method:e.method,path:e.path,port:e.port,probeZone:e.probeZone,retries:e.retries,timeout:e.timeout,type:e.type,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Creating monitor`,async()=>t.post(`/user/load_balancers/monitors`,{body:n})),{successLabel:`Created monitor`});return}let n={};e.allowInsecure!==void 0&&o(n,[`allow_insecure`],e.allowInsecure),e.consecutiveDown!==void 0&&o(n,[`consecutive_down`],e.consecutiveDown),e.consecutiveUp!==void 0&&o(n,[`consecutive_up`],e.consecutiveUp),e.description!==void 0&&o(n,[`description`],i(e.description,`description`,`text`)),e.expectedBody!==void 0&&o(n,[`expected_body`],i(e.expectedBody,`expectedBody`,`text`)),e.expectedCodes!==void 0&&o(n,[`expected_codes`],i(e.expectedCodes,`expectedCodes`,`text`)),e.followRedirects!==void 0&&o(n,[`follow_redirects`],e.followRedirects),e.interval!==void 0&&o(n,[`interval`],e.interval),e.method!==void 0&&o(n,[`method`],i(e.method,`method`,`text`)),e.path!==void 0&&o(n,[`path`],i(e.path,`path`,`text`)),e.port!==void 0&&o(n,[`port`],e.port),e.probeZone!==void 0&&o(n,[`probe_zone`],i(e.probeZone,`probeZone`,`text`)),e.retries!==void 0&&o(n,[`retries`],e.retries),e.timeout!==void 0&&o(n,[`timeout`],e.timeout),e.type!==void 0&&o(n,[`type`],i(e.type,`type`,`text`)),c(await u(`Creating monitor`,async()=>t.post(`/user/load_balancers/monitors`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created monitor`})}},E={command:`delete <monitorId>`,describe:`Delete a configured monitor.`,builder:e=>e.positional(`monitorId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.monitorId,`monitorId`),e.dryRun){l({command:`cf user load-balancers monitors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e.monitorId??`<monitorId>`}`,pathParams:{monitorId:String(e.monitorId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`monitor`,String(e.monitorId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(e.body){let n=s(e.body);c(await u(`Deleting monitor`,async()=>t.delete(`/user/load_balancers/monitors/${e.monitorId}`,{body:n})),{successLabel:`Deleted monitor`});return}c(await u(`Deleting monitor`,async()=>t.user.loadBalancers.monitors.delete(e.monitorId)),{successLabel:`Deleted monitor`})}},D={command:`edit <monitorId>`,describe:`Apply changes to an existing monitor, overwriting the supplied properties.`,builder:e=>e.positional(`monitorId`,{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)`}),handler:async e=>{if(a(e.monitorId,`monitorId`),e.dryRun){l({command:`cf user load-balancers monitors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e.monitorId??`<monitorId>`}`,pathParams:{monitorId:String(e.monitorId??``)},bodyKind:`json`,body:{allowInsecure:e.allowInsecure,consecutiveDown:e.consecutiveDown,consecutiveUp:e.consecutiveUp,description:e.description,expectedBody:e.expectedBody,expectedCodes:e.expectedCodes,followRedirects:e.followRedirects,interval:e.interval,method:e.method,path:e.path,port:e.port,probeZone:e.probeZone,retries:e.retries,timeout:e.timeout,type:e.type,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating monitor`,async()=>t.patch(`/user/load_balancers/monitors/${e.monitorId}`,{body:n})),{successLabel:`Updated monitor`});return}let n={};e.allowInsecure!==void 0&&o(n,[`allow_insecure`],e.allowInsecure),e.consecutiveDown!==void 0&&o(n,[`consecutive_down`],e.consecutiveDown),e.consecutiveUp!==void 0&&o(n,[`consecutive_up`],e.consecutiveUp),e.description!==void 0&&o(n,[`description`],i(e.description,`description`,`text`)),e.expectedBody!==void 0&&o(n,[`expected_body`],i(e.expectedBody,`expectedBody`,`text`)),e.expectedCodes!==void 0&&o(n,[`expected_codes`],i(e.expectedCodes,`expectedCodes`,`text`)),e.followRedirects!==void 0&&o(n,[`follow_redirects`],e.followRedirects),e.interval!==void 0&&o(n,[`interval`],e.interval),e.method!==void 0&&o(n,[`method`],i(e.method,`method`,`text`)),e.path!==void 0&&o(n,[`path`],i(e.path,`path`,`text`)),e.port!==void 0&&o(n,[`port`],e.port),e.probeZone!==void 0&&o(n,[`probe_zone`],i(e.probeZone,`probeZone`,`text`)),e.retries!==void 0&&o(n,[`retries`],e.retries),e.timeout!==void 0&&o(n,[`timeout`],e.timeout),e.type!==void 0&&o(n,[`type`],i(e.type,`type`,`text`)),c(await u(`Updating monitor`,async()=>t.patch(`/user/load_balancers/monitors/${e.monitorId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated monitor`})}},O={command:`get <monitorId>`,describe:`List a single configured monitor for a user.`,builder:e=>e.positional(`monitorId`,{type:`string`,description:`Monitor ID`,demandOption:!0}),handler:async e=>{a(e.monitorId,`monitorId`);let t=await r(e);c(await u(`Loading monitor`,async()=>t.user.loadBalancers.monitors.get(e.monitorId)),{successLabel:`Loaded monitor`})}},k={command:`list`,describe:`List configured monitors for a user.`,builder:e=>e,handler:async e=>{let t=await r(e);c(await u(`Loading monitors`,async()=>t.user.loadBalancers.monitors.list()),{successLabel:`Loaded monitors`})}},A={command:`create <monitorId>`,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:e=>e.positional(`monitorId`,{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)`}),handler:async e=>{if(a(e.monitorId,`monitorId`),e.dryRun){l({command:`cf user load-balancers monitors preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e.monitorId??`<monitorId>`}/preview`,pathParams:{monitorId:String(e.monitorId??``)},bodyKind:`json`,body:{allowInsecure:e.allowInsecure,consecutiveDown:e.consecutiveDown,consecutiveUp:e.consecutiveUp,description:e.description,expectedBody:e.expectedBody,expectedCodes:e.expectedCodes,followRedirects:e.followRedirects,interval:e.interval,method:e.method,path:e.path,port:e.port,probeZone:e.probeZone,retries:e.retries,timeout:e.timeout,type:e.type,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Creating preview`,async()=>t.post(`/user/load_balancers/monitors/${e.monitorId}/preview`,{body:n})),{successLabel:`Created preview`});return}let n={};e.allowInsecure!==void 0&&o(n,[`allow_insecure`],e.allowInsecure),e.consecutiveDown!==void 0&&o(n,[`consecutive_down`],e.consecutiveDown),e.consecutiveUp!==void 0&&o(n,[`consecutive_up`],e.consecutiveUp),e.description!==void 0&&o(n,[`description`],i(e.description,`description`,`text`)),e.expectedBody!==void 0&&o(n,[`expected_body`],i(e.expectedBody,`expectedBody`,`text`)),e.expectedCodes!==void 0&&o(n,[`expected_codes`],i(e.expectedCodes,`expectedCodes`,`text`)),e.followRedirects!==void 0&&o(n,[`follow_redirects`],e.followRedirects),e.interval!==void 0&&o(n,[`interval`],e.interval),e.method!==void 0&&o(n,[`method`],i(e.method,`method`,`text`)),e.path!==void 0&&o(n,[`path`],i(e.path,`path`,`text`)),e.port!==void 0&&o(n,[`port`],e.port),e.probeZone!==void 0&&o(n,[`probe_zone`],i(e.probeZone,`probeZone`,`text`)),e.retries!==void 0&&o(n,[`retries`],e.retries),e.timeout!==void 0&&o(n,[`timeout`],e.timeout),e.type!==void 0&&o(n,[`type`],i(e.type,`type`,`text`)),c(await u(`Creating preview`,async()=>t.post(`/user/load_balancers/monitors/${e.monitorId}/preview`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created preview`})}},j={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(A).demandCommand(1),handler:()=>{}},M={command:`list`,describe:`Get the list of resources that reference the provided monitor.`,builder:e=>e.option(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}),handler:async e=>{let t=await r(e);c(await u(`Loading references`,async()=>t.user.loadBalancers.monitors.references.list(e.monitorId)),{successLabel:`Loaded references`})}},N={command:`references`,describe:`Load Balancers operations`,builder:e=>e.command(M).demandCommand(1),handler:()=>{}},P={command:`update <monitorId>`,describe:`Modify a configured monitor.`,builder:e=>e.positional(`monitorId`,{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)`}),handler:async e=>{if(a(e.monitorId,`monitorId`),e.dryRun){l({command:`cf user load-balancers monitors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e.monitorId??`<monitorId>`}`,pathParams:{monitorId:String(e.monitorId??``)},bodyKind:`json`,body:{allowInsecure:e.allowInsecure,consecutiveDown:e.consecutiveDown,consecutiveUp:e.consecutiveUp,description:e.description,expectedBody:e.expectedBody,expectedCodes:e.expectedCodes,followRedirects:e.followRedirects,interval:e.interval,method:e.method,path:e.path,port:e.port,probeZone:e.probeZone,retries:e.retries,timeout:e.timeout,type:e.type,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating monitor`,async()=>t.put(`/user/load_balancers/monitors/${e.monitorId}`,{body:n})),{successLabel:`Updated monitor`});return}let n={};e.allowInsecure!==void 0&&o(n,[`allow_insecure`],e.allowInsecure),e.consecutiveDown!==void 0&&o(n,[`consecutive_down`],e.consecutiveDown),e.consecutiveUp!==void 0&&o(n,[`consecutive_up`],e.consecutiveUp),e.description!==void 0&&o(n,[`description`],i(e.description,`description`,`text`)),e.expectedBody!==void 0&&o(n,[`expected_body`],i(e.expectedBody,`expectedBody`,`text`)),e.expectedCodes!==void 0&&o(n,[`expected_codes`],i(e.expectedCodes,`expectedCodes`,`text`)),e.followRedirects!==void 0&&o(n,[`follow_redirects`],e.followRedirects),e.interval!==void 0&&o(n,[`interval`],e.interval),e.method!==void 0&&o(n,[`method`],i(e.method,`method`,`text`)),e.path!==void 0&&o(n,[`path`],i(e.path,`path`,`text`)),e.port!==void 0&&o(n,[`port`],e.port),e.probeZone!==void 0&&o(n,[`probe_zone`],i(e.probeZone,`probeZone`,`text`)),e.retries!==void 0&&o(n,[`retries`],e.retries),e.timeout!==void 0&&o(n,[`timeout`],e.timeout),e.type!==void 0&&o(n,[`type`],i(e.type,`type`,`text`)),c(await u(`Updating monitor`,async()=>t.put(`/user/load_balancers/monitors/${e.monitorId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated monitor`})}},F={command:`monitors`,describe:`Load Balancers operations`,builder:e=>e.command(T).command(E).command(D).command(O).command(k).command(P).command(j).command(N).demandCommand(1),handler:()=>{}},I={command:`create`,describe:`Create a new pool.`,builder:e=>e.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.`,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.`,default:0}).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`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`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(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).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).`,default:!1}).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).`,default:!1}).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. - `"random"`: Select an origin randomly. - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address. - `"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. - `"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`],default:`random`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf user load-balancers pools create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:{checkRegions:t.checkRegions,description:t.description,enabled:t.enabled,latitude:t.latitude,loadSheddingDefaultPercent:t.loadSheddingDefaultPercent,loadSheddingDefaultPolicy:t.loadSheddingDefaultPolicy,loadSheddingSessionPercent:t.loadSheddingSessionPercent,loadSheddingSessionPolicy:t.loadSheddingSessionPolicy,longitude:t.longitude,minimumOrigins:t.minimumOrigins,monitor:t.monitor,monitorGroup:t.monitorGroup,name:t.name,networks:t.networks,notificationEmail:t.notificationEmail,notificationFilterOriginDisable:t.notificationFilterOriginDisable,notificationFilterOriginHealthy:t.notificationFilterOriginHealthy,notificationFilterPoolDisable:t.notificationFilterPoolDisable,notificationFilterPoolHealthy:t.notificationFilterPoolHealthy,originSteeringPolicy:t.originSteeringPolicy,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await u(`Creating pool`,async()=>n.post(`/user/load_balancers/pools`,{body:e})),{successLabel:`Created pool`});return}t.name===void 0&&(t.name=await e(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let a={};t.checkRegions!==void 0&&o(a,[`check_regions`],t.checkRegions),t.description!==void 0&&o(a,[`description`],i(t.description,`description`,`text`)),t.enabled!==void 0&&o(a,[`enabled`],t.enabled),t.latitude!==void 0&&o(a,[`latitude`],t.latitude),t.loadSheddingDefaultPercent!==void 0&&o(a,[`load_shedding`,`default_percent`],t.loadSheddingDefaultPercent),t.loadSheddingDefaultPolicy!==void 0&&o(a,[`load_shedding`,`default_policy`],i(t.loadSheddingDefaultPolicy,`loadSheddingDefaultPolicy`,`text`)),t.loadSheddingSessionPercent!==void 0&&o(a,[`load_shedding`,`session_percent`],t.loadSheddingSessionPercent),t.loadSheddingSessionPolicy!==void 0&&o(a,[`load_shedding`,`session_policy`],i(t.loadSheddingSessionPolicy,`loadSheddingSessionPolicy`,`text`)),t.longitude!==void 0&&o(a,[`longitude`],t.longitude),t.minimumOrigins!==void 0&&o(a,[`minimum_origins`],t.minimumOrigins),t.monitor!==void 0&&o(a,[`monitor`],i(t.monitor,`monitor`,`text`)),t.monitorGroup!==void 0&&o(a,[`monitor_group`],i(t.monitorGroup,`monitorGroup`,`text`)),t.name!==void 0&&o(a,[`name`],i(t.name,`name`,`text`)),t.networks!==void 0&&o(a,[`networks`],t.networks),t.notificationEmail!==void 0&&o(a,[`notification_email`],i(t.notificationEmail,`notificationEmail`,`text`)),t.notificationFilterOriginDisable!==void 0&&o(a,[`notification_filter`,`origin`,`disable`],t.notificationFilterOriginDisable),t.notificationFilterOriginHealthy!==void 0&&o(a,[`notification_filter`,`origin`,`healthy`],t.notificationFilterOriginHealthy),t.notificationFilterPoolDisable!==void 0&&o(a,[`notification_filter`,`pool`,`disable`],t.notificationFilterPoolDisable),t.notificationFilterPoolHealthy!==void 0&&o(a,[`notification_filter`,`pool`,`healthy`],t.notificationFilterPoolHealthy),t.originSteeringPolicy!==void 0&&o(a,[`origin_steering`,`policy`],i(t.originSteeringPolicy,`originSteeringPolicy`,`text`)),c(await u(`Creating pool`,async()=>n.post(`/user/load_balancers/pools`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created pool`})}},L={command:`delete <poolId>`,describe:`Delete a configured pool.`,builder:e=>e.positional(`poolId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.poolId,`poolId`),e.dryRun){l({command:`cf user load-balancers pools delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e.poolId??`<poolId>`}`,pathParams:{poolId:String(e.poolId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`pool`,String(e.poolId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}if(e.body){let n=s(e.body);c(await u(`Deleting pool`,async()=>t.delete(`/user/load_balancers/pools/${e.poolId}`,{body:n})),{successLabel:`Deleted pool`});return}c(await u(`Deleting pool`,async()=>t.user.loadBalancers.pools.delete(e.poolId)),{successLabel:`Deleted pool`})}},R={command:`pool <poolId>`,describe:`Apply changes to an existing pool, overwriting the supplied properties.`,builder:e=>e.positional(`poolId`,{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.`,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.`,default:0}).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`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`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).`,default:!1}).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).`,default:!1}).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. - `"random"`: Select an origin randomly. - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address. - `"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. - `"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`],default:`random`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.poolId,`poolId`),e.dryRun){l({command:`cf user load-balancers pools edit pools pool`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e.poolId??`<poolId>`}`,pathParams:{poolId:String(e.poolId??``)},bodyKind:`json`,body:{checkRegions:e.checkRegions,description:e.description,enabled:e.enabled,latitude:e.latitude,loadSheddingDefaultPercent:e.loadSheddingDefaultPercent,loadSheddingDefaultPolicy:e.loadSheddingDefaultPolicy,loadSheddingSessionPercent:e.loadSheddingSessionPercent,loadSheddingSessionPolicy:e.loadSheddingSessionPolicy,longitude:e.longitude,minimumOrigins:e.minimumOrigins,monitor:e.monitor,monitorGroup:e.monitorGroup,name:e.name,notificationEmail:e.notificationEmail,notificationFilterOriginDisable:e.notificationFilterOriginDisable,notificationFilterOriginHealthy:e.notificationFilterOriginHealthy,notificationFilterPoolDisable:e.notificationFilterPoolDisable,notificationFilterPoolHealthy:e.notificationFilterPoolHealthy,originSteeringPolicy:e.originSteeringPolicy,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating pool`,async()=>t.patch(`/user/load_balancers/pools/${e.poolId}`,{body:n})),{successLabel:`Updated pool`});return}let n={};e.checkRegions!==void 0&&o(n,[`check_regions`],e.checkRegions),e.description!==void 0&&o(n,[`description`],i(e.description,`description`,`text`)),e.enabled!==void 0&&o(n,[`enabled`],e.enabled),e.latitude!==void 0&&o(n,[`latitude`],e.latitude),e.loadSheddingDefaultPercent!==void 0&&o(n,[`load_shedding`,`default_percent`],e.loadSheddingDefaultPercent),e.loadSheddingDefaultPolicy!==void 0&&o(n,[`load_shedding`,`default_policy`],i(e.loadSheddingDefaultPolicy,`loadSheddingDefaultPolicy`,`text`)),e.loadSheddingSessionPercent!==void 0&&o(n,[`load_shedding`,`session_percent`],e.loadSheddingSessionPercent),e.loadSheddingSessionPolicy!==void 0&&o(n,[`load_shedding`,`session_policy`],i(e.loadSheddingSessionPolicy,`loadSheddingSessionPolicy`,`text`)),e.longitude!==void 0&&o(n,[`longitude`],e.longitude),e.minimumOrigins!==void 0&&o(n,[`minimum_origins`],e.minimumOrigins),e.monitor!==void 0&&o(n,[`monitor`],i(e.monitor,`monitor`,`text`)),e.monitorGroup!==void 0&&o(n,[`monitor_group`],i(e.monitorGroup,`monitorGroup`,`text`)),e.name!==void 0&&o(n,[`name`],i(e.name,`name`,`text`)),e.notificationEmail!==void 0&&o(n,[`notification_email`],i(e.notificationEmail,`notificationEmail`,`text`)),e.notificationFilterOriginDisable!==void 0&&o(n,[`notification_filter`,`origin`,`disable`],e.notificationFilterOriginDisable),e.notificationFilterOriginHealthy!==void 0&&o(n,[`notification_filter`,`origin`,`healthy`],e.notificationFilterOriginHealthy),e.notificationFilterPoolDisable!==void 0&&o(n,[`notification_filter`,`pool`,`disable`],e.notificationFilterPoolDisable),e.notificationFilterPoolHealthy!==void 0&&o(n,[`notification_filter`,`pool`,`healthy`],e.notificationFilterPoolHealthy),e.originSteeringPolicy!==void 0&&o(n,[`origin_steering`,`policy`],i(e.originSteeringPolicy,`originSteeringPolicy`,`text`)),c(await u(`Updating pool`,async()=>t.patch(`/user/load_balancers/pools/${e.poolId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated pool`})}},z={command:`pools`,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:e=>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)`}),handler:async e=>{if(e.dryRun){l({command:`cf user load-balancers pools edit pools pools`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:{notificationEmail:e.notificationEmail,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating pool`,async()=>t.patch(`/user/load_balancers/pools`,{body:n})),{successLabel:`Updated pool`});return}let n={};e.notificationEmail!==void 0&&o(n,[`notification_email`],i(e.notificationEmail,`notificationEmail`,`text`)),c(await u(`Updating pool`,async()=>t.patch(`/user/load_balancers/pools`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated pool`})}},B={command:`pools`,describe:`Load Balancers operations`,builder:e=>e.command(R).command(z).demandCommand(1),handler:()=>{}},V={command:`edit`,describe:`Operations for load-balancers.pools.edit`,builder:e=>e.command(B).demandCommand(1),handler:()=>{}},H={command:`get <poolId>`,describe:`Fetch a single configured pool.`,builder:e=>e.positional(`poolId`,{type:`string`,description:`Pool ID`,demandOption:!0}),handler:async e=>{a(e.poolId,`poolId`);let t=await r(e);c(await u(`Loading pool`,async()=>t.user.loadBalancers.pools.get(e.poolId)),{successLabel:`Loaded pool`})}},U={command:`get <poolId>`,describe:`Fetch the latest pool health status for a single pool.`,builder:e=>e.positional(`poolId`,{type:`string`,description:`Pool ID`,demandOption:!0}),handler:async e=>{a(e.poolId,`poolId`);let t=await r(e);c(await u(`Loading health`,async()=>t.user.loadBalancers.pools.health.get(e.poolId)),{successLabel:`Loaded health`})}},W={command:`health`,describe:`Load Balancers operations`,builder:e=>e.command(U).demandCommand(1),handler:()=>{}},G={command:`list`,describe:`List configured pools.`,builder:e=>e.option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}),handler:async e=>{let t={};e.monitor!==void 0&&(t.monitor=e.monitor);let n=await r(e);c(await u(`Loading pools`,async()=>n.user.loadBalancers.pools.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded pools`})}},K={command:`create <poolId>`,describe:`Preview pool health using provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:e=>e.positional(`poolId`,{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)`}),handler:async e=>{if(a(e.poolId,`poolId`),e.dryRun){l({command:`cf user load-balancers pools preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e.poolId??`<poolId>`}/preview`,pathParams:{poolId:String(e.poolId??``)},bodyKind:`json`,body:{allowInsecure:e.allowInsecure,consecutiveDown:e.consecutiveDown,consecutiveUp:e.consecutiveUp,description:e.description,expectedBody:e.expectedBody,expectedCodes:e.expectedCodes,followRedirects:e.followRedirects,interval:e.interval,method:e.method,path:e.path,port:e.port,probeZone:e.probeZone,retries:e.retries,timeout:e.timeout,type:e.type,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Creating preview`,async()=>t.post(`/user/load_balancers/pools/${e.poolId}/preview`,{body:n})),{successLabel:`Created preview`});return}let n={};e.allowInsecure!==void 0&&o(n,[`allow_insecure`],e.allowInsecure),e.consecutiveDown!==void 0&&o(n,[`consecutive_down`],e.consecutiveDown),e.consecutiveUp!==void 0&&o(n,[`consecutive_up`],e.consecutiveUp),e.description!==void 0&&o(n,[`description`],i(e.description,`description`,`text`)),e.expectedBody!==void 0&&o(n,[`expected_body`],i(e.expectedBody,`expectedBody`,`text`)),e.expectedCodes!==void 0&&o(n,[`expected_codes`],i(e.expectedCodes,`expectedCodes`,`text`)),e.followRedirects!==void 0&&o(n,[`follow_redirects`],e.followRedirects),e.interval!==void 0&&o(n,[`interval`],e.interval),e.method!==void 0&&o(n,[`method`],i(e.method,`method`,`text`)),e.path!==void 0&&o(n,[`path`],i(e.path,`path`,`text`)),e.port!==void 0&&o(n,[`port`],e.port),e.probeZone!==void 0&&o(n,[`probe_zone`],i(e.probeZone,`probeZone`,`text`)),e.retries!==void 0&&o(n,[`retries`],e.retries),e.timeout!==void 0&&o(n,[`timeout`],e.timeout),e.type!==void 0&&o(n,[`type`],i(e.type,`type`,`text`)),c(await u(`Creating preview`,async()=>t.post(`/user/load_balancers/pools/${e.poolId}/preview`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created preview`})}},q={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(K).demandCommand(1),handler:()=>{}},te={command:`list`,describe:`Get the list of resources that reference the provided pool.`,builder:e=>e.option(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}),handler:async e=>{let t=await r(e);c(await u(`Loading references`,async()=>t.user.loadBalancers.pools.references.list(e.poolId)),{successLabel:`Loaded references`})}},J={command:`references`,describe:`Load Balancers operations`,builder:e=>e.command(te).demandCommand(1),handler:()=>{}},Y={command:`update <poolId>`,describe:`Modify a configured pool.`,builder:e=>e.positional(`poolId`,{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.`,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.`,default:0}).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`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`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(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).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).`,default:!1}).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).`,default:!1}).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. - `"random"`: Select an origin randomly. - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address. - `"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. - `"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`],default:`random`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(a(t.poolId,`poolId`),t.dryRun){l({command:`cf user load-balancers pools update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${t.poolId??`<poolId>`}`,pathParams:{poolId:String(t.poolId??``)},bodyKind:`json`,body:{checkRegions:t.checkRegions,description:t.description,enabled:t.enabled,latitude:t.latitude,loadSheddingDefaultPercent:t.loadSheddingDefaultPercent,loadSheddingDefaultPolicy:t.loadSheddingDefaultPolicy,loadSheddingSessionPercent:t.loadSheddingSessionPercent,loadSheddingSessionPolicy:t.loadSheddingSessionPolicy,longitude:t.longitude,minimumOrigins:t.minimumOrigins,monitor:t.monitor,monitorGroup:t.monitorGroup,name:t.name,networks:t.networks,notificationEmail:t.notificationEmail,notificationFilterOriginDisable:t.notificationFilterOriginDisable,notificationFilterOriginHealthy:t.notificationFilterOriginHealthy,notificationFilterPoolDisable:t.notificationFilterPoolDisable,notificationFilterPoolHealthy:t.notificationFilterPoolHealthy,originSteeringPolicy:t.originSteeringPolicy,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await u(`Updating pool`,async()=>n.put(`/user/load_balancers/pools/${t.poolId}`,{body:e})),{successLabel:`Updated pool`});return}t.name===void 0&&(t.name=await e(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let d={};t.checkRegions!==void 0&&o(d,[`check_regions`],t.checkRegions),t.description!==void 0&&o(d,[`description`],i(t.description,`description`,`text`)),t.enabled!==void 0&&o(d,[`enabled`],t.enabled),t.latitude!==void 0&&o(d,[`latitude`],t.latitude),t.loadSheddingDefaultPercent!==void 0&&o(d,[`load_shedding`,`default_percent`],t.loadSheddingDefaultPercent),t.loadSheddingDefaultPolicy!==void 0&&o(d,[`load_shedding`,`default_policy`],i(t.loadSheddingDefaultPolicy,`loadSheddingDefaultPolicy`,`text`)),t.loadSheddingSessionPercent!==void 0&&o(d,[`load_shedding`,`session_percent`],t.loadSheddingSessionPercent),t.loadSheddingSessionPolicy!==void 0&&o(d,[`load_shedding`,`session_policy`],i(t.loadSheddingSessionPolicy,`loadSheddingSessionPolicy`,`text`)),t.longitude!==void 0&&o(d,[`longitude`],t.longitude),t.minimumOrigins!==void 0&&o(d,[`minimum_origins`],t.minimumOrigins),t.monitor!==void 0&&o(d,[`monitor`],i(t.monitor,`monitor`,`text`)),t.monitorGroup!==void 0&&o(d,[`monitor_group`],i(t.monitorGroup,`monitorGroup`,`text`)),t.name!==void 0&&o(d,[`name`],i(t.name,`name`,`text`)),t.networks!==void 0&&o(d,[`networks`],t.networks),t.notificationEmail!==void 0&&o(d,[`notification_email`],i(t.notificationEmail,`notificationEmail`,`text`)),t.notificationFilterOriginDisable!==void 0&&o(d,[`notification_filter`,`origin`,`disable`],t.notificationFilterOriginDisable),t.notificationFilterOriginHealthy!==void 0&&o(d,[`notification_filter`,`origin`,`healthy`],t.notificationFilterOriginHealthy),t.notificationFilterPoolDisable!==void 0&&o(d,[`notification_filter`,`pool`,`disable`],t.notificationFilterPoolDisable),t.notificationFilterPoolHealthy!==void 0&&o(d,[`notification_filter`,`pool`,`healthy`],t.notificationFilterPoolHealthy),t.originSteeringPolicy!==void 0&&o(d,[`origin_steering`,`policy`],i(t.originSteeringPolicy,`originSteeringPolicy`,`text`)),c(await u(`Updating pool`,async()=>n.put(`/user/load_balancers/pools/${t.poolId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated pool`})}},X={command:`pools`,describe:`Load Balancers operations`,builder:e=>e.command(I).command(L).command(H).command(G).command(Y).command(V).command(W).command(q).command(J).demandCommand(1),handler:()=>{}},Z={command:`get <previewId>`,describe:`Get the result of a previous preview operation using the provided preview_id.`,builder:e=>e.positional(`previewId`,{type:`string`,description:`Preview ID`,demandOption:!0}),handler:async e=>{a(e.previewId,`previewId`);let t=await r(e);c(await u(`Loading preview`,async()=>t.user.loadBalancers.preview.get(e.previewId)),{successLabel:`Loaded preview`})}},Q={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(Z).demandCommand(1),handler:()=>{}},ne={command:`load-balancers`,describe:`Operations for load-balancers`,builder:e=>e.command(F).command(X).command(Q).demandCommand(1),handler:()=>{}},re={command:`list`,describe:`List origin health changes.`,builder:e=>e.option(`until`,{type:`string`,description:`End date and time of requesting data period in the ISO8601 format.`}).option(`pool-name`,{type:`string`,description:`The name for the pool to filter.`}).option(`origin-healthy`,{type:`string`,description:`If true, filter events where the origin status is healthy. If false, filter events where the origin status is unhealthy.`}).option(`pool-id`,{type:`string`,description:`Pool ID`}).option(`since`,{type:`string`,description:`Start date and time of requesting data period in the ISO8601 format.`}).option(`origin-name`,{type:`string`,description:`The name for the origin to filter.`}).option(`pool-healthy`,{type:`boolean`,description:`If true, filter events where the pool status is healthy. If false, filter events where the pool status is unhealthy.`,default:!1}),handler:async e=>{let t={};e.until!==void 0&&(t.until=e.until),e.poolName!==void 0&&(t.pool_name=e.poolName),e.originHealthy!==void 0&&(t.origin_healthy=e.originHealthy),e.poolId!==void 0&&(t.pool_id=e.poolId),e.since!==void 0&&(t.since=e.since),e.originName!==void 0&&(t.origin_name=e.originName),e.poolHealthy!==void 0&&(t.pool_healthy=e.poolHealthy);let n=await r(e);c(await u(`Loading events`,async()=>n.user.loadBalancingAnalytics.events.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded events`})}},ie={command:`events`,describe:`Load Balancing Analytics operations`,builder:e=>e.command(re).demandCommand(1),handler:()=>{}},ae={command:`load-balancing-analytics`,describe:`Operations for load-balancing-analytics`,builder:e=>e.command(ie).demandCommand(1),handler:()=>{}},oe={command:`delete <identifier>`,describe:`Deletes a user's subscription.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Subscription identifier tag.`,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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.identifier,`identifier`),e.dryRun){l({command:`cf user subscriptions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/subscriptions/${e.identifier??`<identifier>`}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`subscription`,String(e.identifier??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}if(e.body){let n=s(e.body);c(await u(`Deleting subscription`,async()=>t.delete(`/user/subscriptions/${e.identifier}`,{body:n})),{successLabel:`Deleted subscription`});return}c(await u(`Deleting subscription`,async()=>t.user.subscriptions.delete(e.identifier)),{successLabel:`Deleted subscription`})}},se={command:`get`,describe:`Lists all of a user's subscriptions.`,builder:e=>e,handler:async e=>{let t=await r(e);c(await u(`Loading subscription`,async()=>t.user.subscriptions.get()),{successLabel:`Loaded subscription`})}},ce={command:`update <identifier>`,describe:`Updates a user's subscriptions.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`app-install-id`,{type:`string`,description:`app install id.`}).option(`frequency`,{type:`string`,description:`How often the subscription is renewed automatically.`,choices:[`weekly`,`monthly`,`quarterly`,`yearly`]}).option(`rate-plan-currency`,{type:`string`,description:`The currency applied to the rate plan subscription.`}).option(`rate-plan-externally-managed`,{type:`boolean`,description:`Whether this rate plan is managed externally from Cloudflare.`}).option(`rate-plan-id`,{type:`string`,description:`The ID of the rate plan.`}).option(`rate-plan-is-contract`,{type:`boolean`,description:`Whether a rate plan is enterprise-based (or newly adopted term contract).`}).option(`rate-plan-public-name`,{type:`string`,description:`The full name of the rate plan.`}).option(`rate-plan-scope`,{type:`string`,description:`The scope that this rate plan applies to.`}).option(`rate-plan-sets`,{type:`string`,array:!0,description:`The list of sets this rate plan applies to. Returns array of strings.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.identifier,`identifier`),e.dryRun){l({command:`cf user subscriptions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/subscriptions/${e.identifier??`<identifier>`}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{appInstallId:e.appInstallId,frequency:e.frequency,ratePlanCurrency:e.ratePlanCurrency,ratePlanExternallyManaged:e.ratePlanExternallyManaged,ratePlanId:e.ratePlanId,ratePlanIsContract:e.ratePlanIsContract,ratePlanPublicName:e.ratePlanPublicName,ratePlanScope:e.ratePlanScope,ratePlanSets:e.ratePlanSets,body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating subscription`,async()=>t.put(`/user/subscriptions/${e.identifier}`,{body:n})),{successLabel:`Updated subscription`});return}let n={};e.appInstallId!==void 0&&o(n,[`app`,`install_id`],i(e.appInstallId,`appInstallId`,`text`)),e.frequency!==void 0&&o(n,[`frequency`],i(e.frequency,`frequency`,`text`)),e.ratePlanCurrency!==void 0&&o(n,[`rate_plan`,`currency`],i(e.ratePlanCurrency,`ratePlanCurrency`,`text`)),e.ratePlanExternallyManaged!==void 0&&o(n,[`rate_plan`,`externally_managed`],e.ratePlanExternallyManaged),e.ratePlanId!==void 0&&o(n,[`rate_plan`,`id`],i(e.ratePlanId,`ratePlanId`,`text`)),e.ratePlanIsContract!==void 0&&o(n,[`rate_plan`,`is_contract`],e.ratePlanIsContract),e.ratePlanPublicName!==void 0&&o(n,[`rate_plan`,`public_name`],i(e.ratePlanPublicName,`ratePlanPublicName`,`text`)),e.ratePlanScope!==void 0&&o(n,[`rate_plan`,`scope`],i(e.ratePlanScope,`ratePlanScope`,`text`)),e.ratePlanSets!==void 0&&o(n,[`rate_plan`,`sets`],e.ratePlanSets),c(await u(`Updating subscription`,async()=>t.put(`/user/subscriptions/${e.identifier}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated subscription`})}},le={command:`subscriptions`,describe:`View and manage zone-level plan subscriptions owned by your user`,builder:e=>e.command(oe).command(se).command(ce).demandCommand(1),handler:()=>{}},ue={command:`list`,describe:`Retrieves list of tenants the authenticated user / method has access to.`,builder:e=>e,handler:async e=>{let t=await r(e);c(await u(`Loading tenants`,async()=>t.user.tenants.list()),{successLabel:`Loaded tenants`})}},de={command:`tenants`,describe:`Tenants operations`,builder:e=>e.command(ue).demandCommand(1),handler:()=>{}},fe={command:`create`,describe:`Create a new access token.`,builder:e=>e.option(`condition-request-ip-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`condition-request-ip-not-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`expires-on`,{type:`string`,description:`The expiration time on or after which the JWT MUST NOT be accepted for processing.`}).option(`name`,{type:`string`,description:`Token name.`}).option(`not-before`,{type:`string`,description:`The time before which the token MUST NOT be accepted for processing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf user tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/tokens`,pathParams:{},bodyKind:`json`,body:{conditionRequestIpIn:t.conditionRequestIpIn,conditionRequestIpNotIn:t.conditionRequestIpNotIn,expiresOn:t.expiresOn,name:t.name,notBefore:t.notBefore,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await u(`Creating token`,async()=>n.post(`/user/tokens`,{body:e})),{successLabel:`Created token`});return}t.name===void 0&&(t.name=await e(`name`,`Token name.`));let a={};t.conditionRequestIpIn!==void 0&&o(a,[`condition`,`request_ip`,`in`],t.conditionRequestIpIn),t.conditionRequestIpNotIn!==void 0&&o(a,[`condition`,`request_ip`,`not_in`],t.conditionRequestIpNotIn),t.expiresOn!==void 0&&o(a,[`expires_on`],i(t.expiresOn,`expiresOn`,`text`)),t.name!==void 0&&o(a,[`name`],i(t.name,`name`,`text`)),t.notBefore!==void 0&&o(a,[`not_before`],i(t.notBefore,`notBefore`,`text`)),c(await u(`Creating token`,async()=>n.post(`/user/tokens`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created token`})}},pe={command:`delete <tokenId>`,describe:`Destroy a token.`,builder:e=>e.positional(`tokenId`,{type:`string`,description:`Token identifier tag.`,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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.tokenId,`tokenId`),e.dryRun){l({command:`cf user tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/tokens/${e.tokenId??`<tokenId>`}`,pathParams:{tokenId:String(e.tokenId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`token`,String(e.tokenId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}if(e.body){let n=s(e.body);c(await u(`Deleting token`,async()=>t.delete(`/user/tokens/${e.tokenId}`,{body:n})),{successLabel:`Deleted token`});return}c(await u(`Deleting token`,async()=>t.user.tokens.delete(e.tokenId)),{successLabel:`Deleted token`})}},$={command:`get <tokenId>`,describe:`Get information about a specific token.`,builder:e=>e.positional(`tokenId`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}),handler:async e=>{a(e.tokenId,`tokenId`);let t=await r(e);c(await u(`Loading token`,async()=>t.user.tokens.get(e.tokenId)),{successLabel:`Loaded token`})}},me={command:`list`,describe:`List all access tokens you created.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.direction!==void 0&&(t.direction=e.direction);let n=await r(e);c(await u(`Loading tokens`,async()=>n.user.tokens.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded tokens`})}},he={command:`list`,describe:`Find all available permission groups for API Tokens.`,builder:e=>e.option(`name`,{type:`string`,description:`Filter by the name of the permission group. The value must be URL-encoded.`}).option(`scope`,{type:`string`,description:`Filter by the scope of the permission group. The value must be URL-encoded.`}),handler:async e=>{let t={};e.name!==void 0&&(t.name=e.name),e.scope!==void 0&&(t.scope=e.scope);let n=await r(e);c(await u(`Loading permission groups`,async()=>n.user.tokens.permissionGroups.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded permission groups`})}},ge={command:`permission-groups`,describe:`Create and manage personal API tokens scoped to your user for programmatic API access`,builder:e=>e.command(he).demandCommand(1),handler:()=>{}},_e={command:`update <tokenId>`,describe:`Update an existing token.`,builder:e=>e.positional(`tokenId`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`condition-request-ip-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`condition-request-ip-not-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`expires-on`,{type:`string`,description:`The expiration time on or after which the JWT MUST NOT be accepted for processing.`}).option(`name`,{type:`string`,description:`Token name.`}).option(`not-before`,{type:`string`,description:`The time before which the token MUST NOT be accepted for processing.`}).option(`status`,{type:`string`,description:`Status of the token.`,choices:[`active`,`disabled`,`expired`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(a(t.tokenId,`tokenId`),t.dryRun){l({command:`cf user tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/tokens/${t.tokenId??`<tokenId>`}`,pathParams:{tokenId:String(t.tokenId??``)},bodyKind:`json`,body:{conditionRequestIpIn:t.conditionRequestIpIn,conditionRequestIpNotIn:t.conditionRequestIpNotIn,expiresOn:t.expiresOn,name:t.name,notBefore:t.notBefore,status:t.status,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await u(`Updating token`,async()=>n.put(`/user/tokens/${t.tokenId}`,{body:e})),{successLabel:`Updated token`});return}t.name===void 0&&(t.name=await e(`name`,`Token name.`));let d={};t.conditionRequestIpIn!==void 0&&o(d,[`condition`,`request_ip`,`in`],t.conditionRequestIpIn),t.conditionRequestIpNotIn!==void 0&&o(d,[`condition`,`request_ip`,`not_in`],t.conditionRequestIpNotIn),t.expiresOn!==void 0&&o(d,[`expires_on`],i(t.expiresOn,`expiresOn`,`text`)),t.name!==void 0&&o(d,[`name`],i(t.name,`name`,`text`)),t.notBefore!==void 0&&o(d,[`not_before`],i(t.notBefore,`notBefore`,`text`)),t.status!==void 0&&o(d,[`status`],i(t.status,`status`,`text`)),c(await u(`Updating token`,async()=>n.put(`/user/tokens/${t.tokenId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated token`})}},ve={command:`update <tokenId>`,describe:`Roll the token secret.`,builder:e=>e.positional(`tokenId`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.tokenId,`tokenId`),e.dryRun){l({command:`cf user tokens value update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/tokens/${e.tokenId??`<tokenId>`}/value`,pathParams:{tokenId:String(e.tokenId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await u(`Updating value`,async()=>t.put(`/user/tokens/${e.tokenId}/value`,{body:n})),{successLabel:`Updated value`});return}c(await u(`Updating value`,async()=>t.user.tokens.value.update(e.tokenId)),{successLabel:`Updated value`})}},ye={command:`value`,describe:`Create and manage personal API tokens scoped to your user for programmatic API access`,builder:e=>e.command(ve).demandCommand(1),handler:()=>{}},be={command:`verify`,describe:`Test whether a token works.`,builder:e=>e,handler:async e=>{let t=await r(e);c(await u(`Loading token`,async()=>t.user.tokens.verify()),{successLabel:`Loaded token`})}},xe={command:`tokens`,describe:`Create and manage personal API tokens scoped to your user for programmatic API access`,builder:e=>e.command(fe).command(pe).command($).command(me).command(_e).command(be).command(ge).command(ye).demandCommand(1),handler:()=>{}},Se={command:`user`,describe:`Your Cloudflare user profile, invitations, organizations, billing, and personal API tokens`,builder:e=>e.command(_).command(w).command(ee).command(g).command(C).command(ne).command(ae).command(le).command(de).command(xe).demandCommand(1),handler:()=>{}};export{Se as default};
|