cf 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_meta/agent-context.json +88 -88
- package/dist/_meta/commands.json +5268 -5350
- package/dist/_meta/schemas.json +33572 -1148
- package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
- package/dist/accounts-BopMfODC.mjs +21 -0
- package/dist/acm-BT4vlnEJ.mjs +3 -0
- package/dist/addressing-B3uFxHst.mjs +13 -0
- package/dist/ai-DWHqwMap.mjs +2 -0
- package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
- package/dist/ai-search-VnOQ5n--.mjs +7 -0
- package/dist/alerting-BmmgIlIO.mjs +6 -0
- package/dist/analytics-isY03taL.mjs +20 -0
- package/dist/api-gateway-DXurEbA-.mjs +33 -0
- package/dist/argo-B02BL_hp.mjs +2 -0
- package/dist/audit-logs-DcgR9xUc.mjs +2 -0
- package/dist/auth-CQcAgnOy.mjs +135 -0
- package/dist/{auth-DQ8miey6.mjs → auth-DenWm_X0.mjs} +3 -3
- package/dist/autorag-CmrwnGVj.mjs +2 -0
- package/dist/{billing-lwBHNTXC.mjs → billing-CaW1ZAB1.mjs} +1 -1
- package/dist/bot-management-CeBsFx68.mjs +5 -0
- package/dist/botnet-feed-B396vQeQ.mjs +3 -0
- package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
- package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
- package/dist/build-5jmmOZhm.mjs +1054 -0
- package/dist/cache-DmXizSMi.mjs +5 -0
- package/dist/calls-x4KQpTB4.mjs +4 -0
- package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
- package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
- package/dist/cloud-connector-BClQpEzI.mjs +2 -0
- package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
- package/dist/{config-BIfdEY0E.mjs → config-DYzlVxcB.mjs} +1 -1
- package/dist/connectivity-G0NP6LtW.mjs +3 -0
- package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
- package/dist/context-CC0Rhkhy.mjs +2 -0
- package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
- package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
- package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
- package/dist/custom-pages-D-oErw57.mjs +4 -0
- package/dist/d1-C95ckPKI.mjs +3 -0
- package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
- package/dist/delegate.mjs +1 -1
- package/dist/deploy-DbkiIzUr.mjs +2 -0
- package/dist/{dev-BfKYB-R_.mjs → dev-C6iSuQZm.mjs} +1 -1
- package/dist/diagnostics-DEEhPnXj.mjs +3 -0
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
- package/dist/{dist-C_bu5HwZ.mjs → dist-CnSubA1Z.mjs} +1 -1
- package/dist/dist-DNBSHor6.mjs +301 -0
- package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
- package/dist/dns-qW-3TZOT.mjs +29 -0
- package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
- package/dist/email-routing-tdNJaCpJ.mjs +10 -0
- package/dist/email-security-DTVHNr2h.mjs +60 -0
- package/dist/email-sending-DsFTvE31.mjs +3 -0
- package/dist/filters-DO1Is_tI.mjs +4 -0
- package/dist/firewall-DbUhVTCg.mjs +11 -0
- package/dist/fraud-Bzr4njYb.mjs +8 -0
- package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
- package/dist/healthchecks-BBAs-lS_.mjs +4 -0
- package/dist/hostnames-Dz9PEUKS.mjs +3 -0
- package/dist/hyperdrive-B1iUJddG.mjs +18 -0
- package/dist/iam-CJM8gHpG.mjs +6 -0
- package/dist/images-DEoBmtFS.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-BM6xkZ0C.mjs +3 -0
- package/dist/{ips-B0cK7D0_.mjs → ips-B8fwxKZD.mjs} +1 -1
- package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
- package/dist/kv-BTceLtWZ.mjs +5 -0
- package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
- package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
- package/dist/logpush-CSYhgevA.mjs +4 -0
- package/dist/logs-DlIwmMpt.mjs +3 -0
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
- package/dist/magic-transit-qQmA-981.mjs +89 -0
- package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
- package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
- package/dist/network-interconnects-CxG2deY0.mjs +36 -0
- package/dist/organizations-DyEAiGiR.mjs +41 -0
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
- package/dist/page-rules-DP-w6TAm.mjs +18 -0
- package/dist/page-shield-Bf7kFp8c.mjs +37 -0
- package/dist/pages-D0Y_XRqW.mjs +10 -0
- package/dist/pipelines-C-SPESAk.mjs +6 -0
- package/dist/{progress-DZfTxbrx.mjs → progress-CjcQ6ato.mjs} +1 -1
- package/dist/queues-wv6CZsi8.mjs +6 -0
- package/dist/r2-DuXjp9n5.mjs +21 -0
- package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
- package/dist/radar-BW_ZHP8X.mjs +2 -0
- package/dist/rate-limits-DLTkIvwr.mjs +5 -0
- package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
- package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
- package/dist/{registrar-7Qy50zbW.mjs → registrar-DIIv6fWd.mjs} +6 -6
- package/dist/request-tracers-DMej0Drs.mjs +2 -0
- package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
- package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
- package/dist/rules-DLJpOYbC.mjs +4 -0
- package/dist/rulesets-D9nqEJT5.mjs +8 -0
- package/dist/rum-DBVmdPkp.mjs +4 -0
- package/dist/schema-validation-MCd3xdtX.mjs +4 -0
- package/dist/scim-DZA3VXog.mjs +3 -0
- package/dist/secrets-store-BrvcZSOM.mjs +21 -0
- package/dist/security-center-BU6f3Cm1.mjs +2 -0
- package/dist/security-txt-BPIbP3dG.mjs +3 -0
- package/dist/{session-mW-s8ghP.mjs → session-H7IV2BrM.mjs} +1 -1
- package/dist/shared-DEzmTsEC.mjs +2 -0
- package/dist/smart-shield-e8XFBkiF.mjs +3 -0
- package/dist/snippets-B4M3MMb8.mjs +4 -0
- package/dist/{spawn-D_cjG87Z.mjs → spawn-13QQ0IwO.mjs} +1 -1
- package/dist/spectrum-B0adfSRI.mjs +59 -0
- package/dist/speed-BVcUtkAz.mjs +4 -0
- package/dist/{src-C5qivNKH.mjs → src-B9cKsgsg.mjs} +8 -8
- package/dist/ssl-BAa91gsc.mjs +15 -0
- package/dist/stream-D53sxKb3.mjs +14 -0
- package/dist/tenants-bH5pt3dJ.mjs +2 -0
- package/dist/token-validation-M61Vx_Tw.mjs +4 -0
- package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
- package/dist/{ui-mP_arYIg.mjs → ui-BXjU1dX1.mjs} +1 -1
- package/dist/url-normalization-DZrWDgB5.mjs +3 -0
- package/dist/url-scanner-Zo49edNp.mjs +2 -0
- package/dist/user-DbXlVReB.mjs +10 -0
- package/dist/vectorize-CUnTM0DT.mjs +4 -0
- package/dist/versions-DzyrlUAi.mjs +2 -0
- package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
- package/dist/web3-DueyOQtx.mjs +4 -0
- package/dist/workers-builds-BM_aoeUR.mjs +7 -0
- package/dist/workers-nV_vBCfV.mjs +16 -0
- package/dist/workflows-CQITmo-s.mjs +4 -0
- package/dist/zaraz-DIbpF5Op.mjs +2 -0
- package/dist/zero-trust-CKp8j512.mjs +119 -0
- package/dist/zones-BZ5tZDbH.mjs +28 -0
- package/package.json +4 -4
- package/dist/abuse-reports-ChV_yD7f.mjs +0 -8
- package/dist/accounts-BCYecXFh.mjs +0 -21
- package/dist/acm-DD8zSds2.mjs +0 -3
- package/dist/addressing-D4Eqw5Bi.mjs +0 -13
- package/dist/ai-DfXMOMx_.mjs +0 -2
- package/dist/ai-gateway-DdRFthMo.mjs +0 -8
- package/dist/ai-search-C_68CDj1.mjs +0 -7
- package/dist/alerting-DbhqhVCp.mjs +0 -6
- package/dist/analytics-BSBBc7ep.mjs +0 -20
- package/dist/api-gateway-CZ4swbkQ.mjs +0 -33
- package/dist/argo-tms9ZwHO.mjs +0 -2
- package/dist/audit-logs-24qyW8cl.mjs +0 -2
- package/dist/auth-BlSmtIKd.mjs +0 -112
- package/dist/autorag-kgNt06GD.mjs +0 -2
- package/dist/bot-management-LKf7BqUr.mjs +0 -5
- package/dist/botnet-feed-nQ-gErTS.mjs +0 -3
- package/dist/brand-protection-DOKv9GRr.mjs +0 -3
- package/dist/browser-rendering-CBExtgGt.mjs +0 -4
- package/dist/build-C_48VvoK.mjs +0 -1056
- package/dist/cache-BBiiNZHP.mjs +0 -5
- package/dist/calls-DA5Xzwev.mjs +0 -4
- package/dist/certificate-authorities-sXyR_yGp.mjs +0 -2
- package/dist/client-certificates-tV0aCLQJ.mjs +0 -3
- package/dist/cloud-connector-DZfHcSso.mjs +0 -2
- package/dist/cloudforce-one-y1PgQmI9.mjs +0 -21
- package/dist/connectivity-8SOqaFDn.mjs +0 -3
- package/dist/content-scanning-B9y6K_G5.mjs +0 -4
- package/dist/context-DTIbtQn5.mjs +0 -2
- package/dist/custom-certificates-sWksR8Ys.mjs +0 -5
- package/dist/custom-hostnames-91QZkdqN.mjs +0 -5
- package/dist/custom-nameservers-DajZaZvE.mjs +0 -3
- package/dist/custom-pages-Cu7gmwzT.mjs +0 -4
- package/dist/d1-H_VRsVmF.mjs +0 -3
- package/dist/dcv-delegation-C-qhEYEZ.mjs +0 -2
- package/dist/deploy--9wYOkHg.mjs +0 -2
- package/dist/diagnostics-D2B2LPZZ.mjs +0 -3
- package/dist/dispatch-namespaces-CyrXBU_w.mjs +0 -7
- package/dist/dist-DvKjT2TT.mjs +0 -303
- package/dist/dns-Bn9Uz_Nj.mjs +0 -29
- package/dist/dns-firewall-BslP4p-j.mjs +0 -57
- package/dist/durable-objects-BN1ZnHhm.mjs +0 -2
- package/dist/email-routing-n2TnTaRR.mjs +0 -10
- package/dist/email-security-C9SEx0kh.mjs +0 -60
- package/dist/email-sending-DayZ7u3I.mjs +0 -3
- package/dist/filters-CI_XTgfQ.mjs +0 -4
- package/dist/firewall-CcaayGig.mjs +0 -11
- package/dist/fraud-Cr7aPCV8.mjs +0 -8
- package/dist/google-tag-gateway-B3GpYgQ4.mjs +0 -2
- package/dist/healthchecks-CVTsR_OC.mjs +0 -4
- package/dist/hostnames-Bd_Wa5l6.mjs +0 -3
- package/dist/hyperdrive-BBJhEDZd.mjs +0 -18
- package/dist/iam-D_FN0pDF.mjs +0 -6
- package/dist/images-CAP2hAlZ.mjs +0 -5
- package/dist/intel-CkxfzqmJ.mjs +0 -3
- package/dist/keyless-certificates-LcLmHZsX.mjs +0 -3
- package/dist/kv-_TkUQ6fs.mjs +0 -5
- package/dist/leaked-credential-checks-Dhvaen22.mjs +0 -3
- package/dist/load-balancers-Ckr0UIpk.mjs +0 -6
- package/dist/logpush-Cj946hxT.mjs +0 -4
- package/dist/logs-DgC9hjvJ.mjs +0 -3
- package/dist/magic-cloud-networking-WbDvPzuG.mjs +0 -5
- package/dist/magic-network-monitoring-BcHShvGQ.mjs +0 -4
- package/dist/magic-transit-B8sCOkt_.mjs +0 -89
- package/dist/managed-transforms-BpOr-8HY.mjs +0 -3
- package/dist/mtls-certificates-fOul8D5g.mjs +0 -3
- package/dist/network-interconnects-BSW65xlh.mjs +0 -36
- package/dist/organizations-T4vKGFAb.mjs +0 -41
- package/dist/origin-ca-certificates-ChM0lZ64.mjs +0 -3
- package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +0 -2
- package/dist/origin-tls-client-auth-D32dpZk_.mjs +0 -5
- package/dist/page-rules-RFoj8CjN.mjs +0 -18
- package/dist/page-shield-VTktzKDN.mjs +0 -37
- package/dist/pages-L1ITjXDZ.mjs +0 -10
- package/dist/pipelines-BPO0Lnil.mjs +0 -6
- package/dist/queues-B0C06L9r.mjs +0 -6
- package/dist/r2-DP020Tmq.mjs +0 -21
- package/dist/r2-data-catalog-Dmipvz5F.mjs +0 -14
- package/dist/radar-DR3VMknH.mjs +0 -2
- package/dist/rate-limits-DnHPBPgU.mjs +0 -5
- package/dist/raw-fetch-DlXYwVA8.mjs +0 -2
- package/dist/realtime-kit-C430aq2d.mjs +0 -6
- package/dist/request-tracers-sv99NDIl.mjs +0 -2
- package/dist/resource-sharing-uEjC7lnQ.mjs +0 -5
- package/dist/resource-tagging-CiODdP3N.mjs +0 -16
- package/dist/rules-FXAyTrwk.mjs +0 -4
- package/dist/rulesets-B6aUsFFB.mjs +0 -8
- package/dist/rum-CyyGJhp5.mjs +0 -4
- package/dist/schema-validation-ByU49h--.mjs +0 -4
- package/dist/scim-DdTS65_C.mjs +0 -3
- package/dist/secrets-store-ClOUVhBJ.mjs +0 -18
- package/dist/security-center-4iSBqTrf.mjs +0 -2
- package/dist/security-txt-kGxdkDY6.mjs +0 -3
- package/dist/smart-shield-B-SQd2Qp.mjs +0 -3
- package/dist/snippets-Aq58ojqw.mjs +0 -4
- package/dist/spectrum-0gFvGI6y.mjs +0 -59
- package/dist/speed-DAZU8w3T.mjs +0 -4
- package/dist/ssl-BRlXa-5w.mjs +0 -15
- package/dist/stream-BAxsVeBX.mjs +0 -14
- package/dist/tenants-Df6xDqoA.mjs +0 -2
- package/dist/token-validation-pO4dCjCy.mjs +0 -4
- package/dist/turnstile-B1dmO8wE.mjs +0 -23
- package/dist/url-normalization-sUDVmrUt.mjs +0 -3
- package/dist/url-scanner-CwOKRkYo.mjs +0 -2
- package/dist/user-D_UrIdNq.mjs +0 -10
- package/dist/vectorize-BEbBn9G9.mjs +0 -4
- package/dist/waiting-rooms-BQC-urV4.mjs +0 -11
- package/dist/web3-CIH2iQeX.mjs +0 -4
- package/dist/workers-B9EvrpH3.mjs +0 -16
- package/dist/workers-builds-DzWSiRd2.mjs +0 -7
- package/dist/workflows-aD81gA4k.mjs +0 -4
- package/dist/zaraz-Cg1dsvrZ.mjs +0 -2
- package/dist/zero-trust-D-xQXWcy.mjs +0 -119
- package/dist/zones-DQzucJDd.mjs +0 -28
- /package/dist/{schema-D0_cbcDt.mjs → schema-CHBfkARI.mjs} +0 -0
- /package/dist/{tools-CtKbk6VS.mjs → tools-B7QiNu-d.mjs} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,h as n,t as r,x as i}from"./auth-CQcAgnOy.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-CjcQ6ato.mjs";import{n as u,t as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{n as p,t as m}from"./raw-fetch-hRv-6P3D.mjs";function ee(e){return 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)`})}const te={command:`copy <identifier>`,describe:`Adds an additional audio track to a video using the provided audio track URL.`,builder:ee,handler:async e=>{if(e.dryRun){c({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/audio/copy`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{label:e.label,url:e.url,body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/${encodeURIComponent(String(e.identifier))}/audio/copy`,{body:t})),{successLabel:`Created`});return}e.label===void 0&&(e.label=await t(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let m={};e.label!==void 0&&a(m,[`label`],u(e.label,`label`,`text`)),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/${encodeURIComponent(String(e.identifier))}/audio/copy`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function h(e){return e.positional(`audio-identifier`,{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})}const g={command:`delete <audio-identifier>`,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:h,handler:async t=>{if(t.dryRun){c({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/audio/${t[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(t[`audio-identifier`]))}`,pathParams:{identifier:String(t.identifier??``),"audio-identifier":String(t[`audio-identifier`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.audioTracks.delete(o,t.identifier,t[`audio-identifier`])),{successLabel:`Deleted`})}};function _(e){return e.positional(`audio-identifier`,{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.`}).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)`})}const v={command:`edit <audio-identifier>`,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:_,handler:async e=>{if(e.dryRun){c({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/audio/${e[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(e[`audio-identifier`]))}`,pathParams:{identifier:String(e.identifier??``),"audio-identifier":String(e[`audio-identifier`]??``)},bodyKind:`json`,body:{default:e.default,label:e.label,body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.patch(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/audio/${encodeURIComponent(String(e[`audio-identifier`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.default!==void 0&&a(p,[`default`],e.default),e.label!==void 0&&a(p,[`label`],u(e.label,`label`,`text`)),s(await l(`Updating`,async()=>t.patch(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/audio/${encodeURIComponent(String(e[`audio-identifier`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function y(e){return 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})}const b={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:y,handler:async e=>{if(e.dryRun){c({command:`cf stream audio-tracks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/audio`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.audioTracks.get(a,e.identifier)),{successLabel:`Loaded`})}},x={command:`audio-tracks`,describe:`Add, edit, or remove additional audio tracks on a video`,builder:e=>e.command(te).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return 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})}const C={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:S,handler:async e=>{if(e.dryRun){c({command:`cf stream captions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.captions.get(e.identifier,a)),{successLabel:`Loaded`})}};function w(e){return 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})}const T={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:w,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}/generate`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.captions.language.create(e.language,e.identifier,a)),{successLabel:`Created`})}};function E(e){return 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})}const D={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:E,handler:async t=>{if(t.dryRun){c({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/captions/${t.language==null?`<language>`:encodeURIComponent(String(t.language))}`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.captions.language.delete(t.language,t.identifier,o)),{successLabel:`Deleted`})}};function O(e){return 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})}const k={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.captions.language.get(e.language,e.identifier,a)),{successLabel:`Loaded`})}};function A(e){return 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`})}const j={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:A,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file}});return}let t=await r(e),a=e.local?f:await n(t);if(e.accountId=a,e.file!==void 0||e.body!==void 0){let n=new FormData;if(e.file){let t=d(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/captions/${encodeURIComponent(String(e.language))}`,{body:n})),{successLabel:`Updated`});return}if(e.body){let n=u(e.body,`body`,`binary`);s(await l(`Updating`,async()=>t.put(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/captions/${encodeURIComponent(String(e.language))}`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function M(e){return 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})}const N={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language vtt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}/vtt`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,p((await l(`Loading`,async()=>m(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/captions/${encodeURIComponent(String(e.language))}/vtt`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}},P={command:`vtt`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`language`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(T).command(D).command(k).command(j).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},I={command:`captions`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(C).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return 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)`})}const R={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],"clipped-from-video-uid":e[`clipped-from-video-uid`],creator:e.creator,"end-time-seconds":e[`end-time-seconds`],input:e.input,name:e.name,"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"start-time-seconds":e[`start-time-seconds`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],url:e.url,"watermark-uid":e[`watermark-uid`],body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/clip`,{body:t})),{successLabel:`Created`});return}if(e[`clipped-from-video-uid`]===void 0&&(e[`clipped-from-video-uid`]=await t(`clipped-from-video-uid`,`The unique video identifier (UID).`)),e[`end-time-seconds`]===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(e[`start-time-seconds`]===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let m={};e[`allowed-origins`]!==void 0&&a(m,[`allowedOrigins`],e[`allowed-origins`]),e[`clipped-from-video-uid`]!==void 0&&a(m,[`clippedFromVideoUID`],u(e[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`)),e.creator!==void 0&&a(m,[`creator`],u(e.creator,`creator`,`text`)),e[`end-time-seconds`]!==void 0&&a(m,[`endTimeSeconds`],e[`end-time-seconds`]),e.input!==void 0&&a(m,[`input`],u(e.input,`input`,`text`)),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),e[`require-signed-urls`]!==void 0&&a(m,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(m,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`start-time-seconds`]!==void 0&&a(m,[`startTimeSeconds`],e[`start-time-seconds`]),e[`thumbnail-timestamp-pct`]!==void 0&&a(m,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),e[`watermark-uid`]!==void 0&&a(m,[`watermark`,`uid`],u(e[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/clip`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},z={command:`clip`,describe:`Create a new video clip from an existing video by specifying start and end times`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return 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)."})}const V={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:B,handler:async e=>{let t={};if(e[`upload-creator`]!==void 0&&(t[`Upload-Creator`]=String(e[`upload-creator`])),e.dryRun){c({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],creator:e.creator,input:e.input,name:e.name,"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],url:e.url,"watermark-uid":e[`watermark-uid`],body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let n=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/copy`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`});return}let m={};e[`allowed-origins`]!==void 0&&a(m,[`allowedOrigins`],e[`allowed-origins`]),e.creator!==void 0&&a(m,[`creator`],u(e.creator,`creator`,`text`)),e.input!==void 0&&a(m,[`input`],u(e.input,`input`,`text`)),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),e[`require-signed-urls`]!==void 0&&a(m,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(m,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`thumbnail-timestamp-pct`]!==void 0&&a(m,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),e[`watermark-uid`]!==void 0&&a(m,[`watermark`,`uid`],u(e[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/copy`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`})}},H={command:`copy`,describe:`Import a video from a URL into Stream for processing and delivery`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return 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.
|
|
5
|
+
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.\nSupported keys: `name`, `requiresignedurls`, `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`, `maxdurationseconds`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={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:U,handler:async e=>{let t={direct_user:e[`direct-user`]},a={};if(e[`tus-resumable`]!==void 0&&(a[`Tus-Resumable`]=String(e[`tus-resumable`])),e[`upload-creator`]!==void 0&&(a[`Upload-Creator`]=String(e[`upload-creator`])),e[`upload-length`]!==void 0&&(a[`Upload-Length`]=String(e[`upload-length`])),e[`upload-metadata`]!==void 0&&(a[`Upload-Metadata`]=String(e[`upload-metadata`])),e.dryRun){c({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream`,pathParams:{},query:t,bodyKind:`none`});return}let o=await r(e),u=e.local?f:await n(o);e.accountId=u,s(await l(`Creating`,async()=>o.post(`/accounts/${u}/stream`,{query:t,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Created`})}};function G(e){return 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})}const K={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:G,handler:async t=>{if(t.dryRun){c({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.delete(t.identifier,o)),{successLabel:`Deleted`})}};function q(e){return 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)`})}const J={command:`create`,describe:`Creates a direct upload that allows video uploads without an API key.`,builder:q,handler:async e=>{let t={};if(e[`upload-creator`]!==void 0&&(t[`Upload-Creator`]=String(e[`upload-creator`])),e.dryRun){c({command:`cf stream direct-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/direct_upload`,pathParams:{},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],creator:e.creator,expiry:e.expiry,"max-duration-seconds":e[`max-duration-seconds`],"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],"watermark-uid":e[`watermark-uid`],body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let n=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/direct_upload`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`});return}if(e[`max-duration-seconds`]===void 0)throw Error(`--max-duration-seconds is required (or pass --body with this field set).`);let m={};e[`allowed-origins`]!==void 0&&a(m,[`allowedOrigins`],e[`allowed-origins`]),e.creator!==void 0&&a(m,[`creator`],u(e.creator,`creator`,`text`)),e.expiry!==void 0&&a(m,[`expiry`],u(e.expiry,`expiry`,`text`)),e[`max-duration-seconds`]!==void 0&&a(m,[`maxDurationSeconds`],e[`max-duration-seconds`]),e[`require-signed-urls`]!==void 0&&a(m,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(m,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`thumbnail-timestamp-pct`]!==void 0&&a(m,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e[`watermark-uid`]!==void 0&&a(m,[`watermark`,`uid`],u(e[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/direct_upload`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`})}},Y={command:`direct-upload`,describe:`Generate a tokenized URL that lets end-users upload video directly to Stream`,builder:e=>e.command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return 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})}const Z={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:X,handler:async e=>{if(e.dryRun){c({command:`cf stream downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/downloads`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.downloads.create(e.identifier,a)),{successLabel:`Created`})}};function Q(e){return 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})}const ne={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:Q,handler:async t=>{if(t.dryRun){c({command:`cf stream downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.downloads.delete(t.identifier,o)),{successLabel:`Deleted`})}};function re(e){return 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})}const ie={command:`get <identifier>`,describe:`Lists the downloads created for a video.`,builder:re,handler:async e=>{if(e.dryRun){c({command:`cf stream downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/downloads`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.downloads.get(e.identifier,a)),{successLabel:`Loaded`})}},ae={command:`downloads`,describe:`Create downloadable MP4 renditions of a video for offline viewing`,builder:e=>e.command(Z).command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return 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)`})}const se={command:`edit <identifier>`,describe:`Edit details for a single video.`,builder:oe,handler:async e=>{if(e.dryRun){c({command:`cf stream edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],creator:e.creator,"max-duration-seconds":e[`max-duration-seconds`],"public-details-channel-link":e[`public-details-channel-link`],"public-details-logo":e[`public-details-logo`],"public-details-share-link":e[`public-details-share-link`],"public-details-title":e[`public-details-title`],"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],uid:e.uid,"upload-expiry":e[`upload-expiry`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}`,{body:n})),{successLabel:`Created`});return}let p={};e[`allowed-origins`]!==void 0&&a(p,[`allowedOrigins`],e[`allowed-origins`]),e.creator!==void 0&&a(p,[`creator`],u(e.creator,`creator`,`text`)),e[`max-duration-seconds`]!==void 0&&a(p,[`maxDurationSeconds`],e[`max-duration-seconds`]),e[`public-details-channel-link`]!==void 0&&a(p,[`publicDetails`,`channel_link`],u(e[`public-details-channel-link`],`public-details-channel-link`,`text`)),e[`public-details-logo`]!==void 0&&a(p,[`publicDetails`,`logo`],u(e[`public-details-logo`],`public-details-logo`,`text`)),e[`public-details-share-link`]!==void 0&&a(p,[`publicDetails`,`share_link`],u(e[`public-details-share-link`],`public-details-share-link`,`text`)),e[`public-details-title`]!==void 0&&a(p,[`publicDetails`,`title`],u(e[`public-details-title`],`public-details-title`,`text`)),e[`require-signed-urls`]!==void 0&&a(p,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(p,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`thumbnail-timestamp-pct`]!==void 0&&a(p,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e.uid!==void 0&&a(p,[`uid`],u(e.uid,`uid`,`text`)),e[`upload-expiry`]!==void 0&&a(p,[`uploadExpiry`],u(e[`upload-expiry`],`upload-expiry`,`text`)),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function ce(e){return 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})}const le={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:ce,handler:async e=>{if(e.dryRun){c({command:`cf stream embed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/embed`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,p((await l(`Loading`,async()=>m(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/embed`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}},ue={command:`embed`,describe:`Retrieve the HTML embed code snippet for a video`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return 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})}const fe={command:`get <identifier>`,describe:`Fetches details for a single video.`,builder:de,handler:async e=>{if(e.dryRun){c({command:`cf stream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.get(e.identifier,a)),{successLabel:`Loaded`})}};function pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={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:pe,handler:async e=>{if(e.dryRun){c({command:`cf stream keys create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),a=e.local?f:await n(t);if(e.accountId=a,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${a}/stream/keys`,{body:n})),{successLabel:`Created`});return}s(await l(`Creating`,async()=>t.stream.keys.create(a)),{successLabel:`Created`})}};function he(e){return 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)`})}const ge={command:`delete <identifier>`,describe:`Deletes signing keys and revokes all signed URLs generated with the key.`,builder:he,handler:async t=>{if(t.dryRun){c({command:`cf stream keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/keys/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/stream/keys/${encodeURIComponent(String(t.identifier))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.stream.keys.delete(t.identifier,u)),{successLabel:`Deleted`})}};function _e(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`get`,describe:`Lists the video ID and creation date and time when a signing key was created.`,builder:_e,handler:async e=>{if(e.dryRun){c({command:`cf stream keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.keys.get(a)),{successLabel:`Loaded`})}},ye={command:`keys`,describe:`Signing keys used to generate short-lived signed URLs for private video playback`,builder:e=>e.command(me).command(ge).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return 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).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.`,builder:be,handler:async e=>{let t={status:e.status,creator:e.creator,type:e.type,asc:e.asc,video_name:e[`video-name`],search:e.search,start:e.start,end:e.end,include_counts:e[`include-counts`],id:e.id,name:e.name,live_input_id:e[`live-input-id`],before:e.before,after:e.after,limit:e.limit};if(e.dryRun){c({command:`cf stream list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.stream.list(o,t)),{successLabel:`Loaded`})}};function Se(e){return 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)`})}const Ce={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:Se,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs`,pathParams:{},bodyKind:`json`,body:{"default-creator":e[`default-creator`],"delete-recording-after-days":e[`delete-recording-after-days`],enabled:e.enabled,"recording-allowed-origins":e[`recording-allowed-origins`],"recording-hide-live-viewer-count":e[`recording-hide-live-viewer-count`],"recording-mode":e[`recording-mode`],"recording-require-signed-urls":e[`recording-require-signed-urls`],"recording-timeout-seconds":e[`recording-timeout-seconds`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/live_inputs`,{body:n})),{successLabel:`Created`});return}let p={};e[`default-creator`]!==void 0&&a(p,[`defaultCreator`],u(e[`default-creator`],`default-creator`,`text`)),e[`delete-recording-after-days`]!==void 0&&a(p,[`deleteRecordingAfterDays`],e[`delete-recording-after-days`]),e.enabled!==void 0&&a(p,[`enabled`],e.enabled),e[`recording-allowed-origins`]!==void 0&&a(p,[`recording`,`allowedOrigins`],e[`recording-allowed-origins`]),e[`recording-hide-live-viewer-count`]!==void 0&&a(p,[`recording`,`hideLiveViewerCount`],e[`recording-hide-live-viewer-count`]),e[`recording-mode`]!==void 0&&a(p,[`recording`,`mode`],u(e[`recording-mode`],`recording-mode`,`text`)),e[`recording-require-signed-urls`]!==void 0&&a(p,[`recording`,`requireSignedURLs`],e[`recording-require-signed-urls`]),e[`recording-timeout-seconds`]!==void 0&&a(p,[`recording`,`timeoutSeconds`],e[`recording-timeout-seconds`]),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/live_inputs`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function we(e){return e.positional(`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)`})}const Te={command:`delete <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls.`,builder:we,handler:async t=>{if(t.dryRun){c({command:`cf stream live-inputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(t[`live-input-identifier`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.stream.liveInputs.delete(t[`live-input-identifier`],u)),{successLabel:`Deleted`})}};function Ee(e){return e.positional(`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})}const De={command:`create <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls until enabled.`,builder:Ee,handler:async t=>{if(t.dryRun){c({command:`cf stream live-inputs disable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/disable`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force,message:`This operation disables a live input. Active streams to it are dropped.`})){process.stderr.write(`Aborted.
|
|
10
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.liveInputs.disable.create(t[`live-input-identifier`],o)),{successLabel:`Deleted`})}},Oe={command:`disable`,describe:`Enable and disable live input streams`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`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})}const Ae={command:`create <live-input-identifier>`,describe:`Allows a live input to be streamed to and makes the live input accessible to any future API calls.`,builder:ke,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs enable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/enable`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.liveInputs.enable.create(e[`live-input-identifier`],a)),{successLabel:`Created`})}},je={command:`enable`,describe:`Enable and disable live input streams`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.positional(`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})}const Ne={command:`get <live-input-identifier>`,describe:`Retrieves details of an existing live input.`,builder:Me,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.liveInputs.get(e[`live-input-identifier`],a)),{successLabel:`Loaded`})}};function Pe(e){return e.option(`include-counts`,{type:`string`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={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:Pe,handler:async e=>{let t={include_counts:e[`include-counts`]};if(e.dryRun){c({command:`cf stream live-inputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.stream.liveInputs.list(o,t)),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`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(`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)`})}const Le={command:`create <live-input-identifier>`,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:Ie,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs outputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`json`,body:{enabled:e.enabled,"stream-key":e[`stream-key`],url:e.url,body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,{body:t})),{successLabel:`Created`});return}e[`stream-key`]===void 0&&(e[`stream-key`]=await t(`stream-key`,`The streamKey used to authenticate against an output's target.`,{kind:`secret`})),e.url===void 0&&(e.url=await t(`url`,`The URL an output uses to restream.`,{kind:`secret`}));let m={};e.enabled!==void 0&&a(m,[`enabled`],e.enabled),e[`stream-key`]!==void 0&&a(m,[`streamKey`],u(e[`stream-key`],`stream-key`,`text`)),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Re(e){return e.positional(`output-identifier`,{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)`})}const ze={command:`delete <output-identifier>`,describe:`Deletes an output and removes it from the associated live input.`,builder:Re,handler:async t=>{if(t.dryRun){c({command:`cf stream live-inputs outputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/outputs/${t[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(t[`output-identifier`]))}`,pathParams:{"output-identifier":String(t[`output-identifier`]??``),"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
11
|
+
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(t[`live-input-identifier`]))}/outputs/${encodeURIComponent(String(t[`output-identifier`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.stream.liveInputs.outputs.delete(t[`output-identifier`],t[`live-input-identifier`],u)),{successLabel:`Deleted`})}};function Be(e){return e.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})}const Ve={command:`list`,describe:`Retrieves all outputs associated with a specified live input.`,builder:Be,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs outputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.liveInputs.outputs.list(e[`live-input-identifier`],a)),{successLabel:`Loaded`})}};function He(e){return e.positional(`output-identifier`,{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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ue={command:`update <output-identifier>`,describe:`Updates the state of an output.`,builder:He,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs outputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/outputs/${e[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(e[`output-identifier`]))}`,pathParams:{"output-identifier":String(e[`output-identifier`]??``),"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body}});return}let t=await r(e),u=e.local?f:await n(t);if(e.accountId=u,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs/${encodeURIComponent(String(e[`output-identifier`]))}`,{body:n})),{successLabel:`Updated`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let d={};e.enabled!==void 0&&a(d,[`enabled`],e.enabled),s(await l(`Updating`,async()=>t.put(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs/${encodeURIComponent(String(e[`output-identifier`]))}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},We={command:`outputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Le).command(ze).command(Ve).command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ge(e){return e.positional(`live-input-identifier`,{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.`}).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`."}).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`]}).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."}).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."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`update <live-input-identifier>`,describe:`Updates a specified live input.`,builder:Ge,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`json`,body:{"default-creator":e[`default-creator`],"delete-recording-after-days":e[`delete-recording-after-days`],enabled:e.enabled,"recording-allowed-origins":e[`recording-allowed-origins`],"recording-hide-live-viewer-count":e[`recording-hide-live-viewer-count`],"recording-mode":e[`recording-mode`],"recording-require-signed-urls":e[`recording-require-signed-urls`],"recording-timeout-seconds":e[`recording-timeout-seconds`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e[`default-creator`]!==void 0&&a(p,[`defaultCreator`],u(e[`default-creator`],`default-creator`,`text`)),e[`delete-recording-after-days`]!==void 0&&a(p,[`deleteRecordingAfterDays`],e[`delete-recording-after-days`]),e.enabled!==void 0&&a(p,[`enabled`],e.enabled),e[`recording-allowed-origins`]!==void 0&&a(p,[`recording`,`allowedOrigins`],e[`recording-allowed-origins`]),e[`recording-hide-live-viewer-count`]!==void 0&&a(p,[`recording`,`hideLiveViewerCount`],e[`recording-hide-live-viewer-count`]),e[`recording-mode`]!==void 0&&a(p,[`recording`,`mode`],u(e[`recording-mode`],`recording-mode`,`text`)),e[`recording-require-signed-urls`]!==void 0&&a(p,[`recording`,`requireSignedURLs`],e[`recording-require-signed-urls`]),e[`recording-timeout-seconds`]!==void 0&&a(p,[`recording`,`timeoutSeconds`],e[`recording-timeout-seconds`]),s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},qe={command:`live-inputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Ce).command(Te).command(Ne).command(Fe).command(Ke).command(Oe).command(je).command(We).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return 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)`})}const Ye={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:Je,handler:async e=>{if(e.dryRun){c({command:`cf stream token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/token`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{downloadable:e.downloadable,exp:e.exp,"flags-original":e[`flags-original`],id:e.id,nbf:e.nbf,pem:e.pem,body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/token`,{body:n})),{successLabel:`Created`});return}let p={};e.downloadable!==void 0&&a(p,[`downloadable`],e.downloadable),e.exp!==void 0&&a(p,[`exp`],e.exp),e[`flags-original`]!==void 0&&a(p,[`flags`,`original`],e[`flags-original`]),e.id!==void 0&&a(p,[`id`],u(e.id,`id`,`text`)),e.nbf!==void 0&&a(p,[`nbf`],e.nbf),e.pem!==void 0&&a(p,[`pem`],u(e.pem,`pem`,`text`)),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/token`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},Xe={command:`token`,describe:`Generate short-lived signed URL tokens for secure private video playback`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(e){return e.positional(`download-type`,{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})}const Qe={command:`create <download-type>`,describe:`Creates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.`,builder:Ze,handler:async e=>{if(e.dryRun){c({command:`cf stream typed-downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/downloads/${e[`download-type`]==null?`<download-type>`:encodeURIComponent(String(e[`download-type`]))}`,pathParams:{identifier:String(e.identifier??``),"download-type":String(e[`download-type`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.typedDownloads.create(e.identifier,a,e[`download-type`])),{successLabel:`Created`})}};function $e(e){return e.positional(`download-type`,{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})}const et={command:`delete <download-type>`,describe:`Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.`,builder:$e,handler:async t=>{if(t.dryRun){c({command:`cf stream typed-downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads/${t[`download-type`]==null?`<download-type>`:encodeURIComponent(String(t[`download-type`]))}`,pathParams:{identifier:String(t.identifier??``),"download-type":String(t[`download-type`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
12
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.typedDownloads.delete(t.identifier,o,t[`download-type`])),{successLabel:`Deleted`})}},tt={command:`typed-downloads`,describe:`Type-specific stream download creation and deletion`,builder:e=>e.command(Qe).command(et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nt(e){return e.option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rt={command:`storage-usage`,describe:`Returns information about an account's storage use.`,builder:nt,handler:async e=>{let t={creator:e.creator};if(e.dryRun){c({command:`cf stream videos storage-usage`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/storage-usage`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.stream.videos.storageUsage(o,t)),{successLabel:`Loaded`})}},it={command:`videos`,describe:`Aggregate video storage usage statistics for the account`,builder:e=>e.command(rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function at(e){return 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`})}const ot={command:`create`,describe:"Creates watermark profiles using a single `HTTP POST multipart/form-data` request.",builder:at,handler:async e=>{if(e.dryRun){c({command:`cf stream watermarks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`multipart`,body:{name:e.name,opacity:e.opacity,padding:e.padding,position:e.position,scale:e.scale,url:e.url,body:e.body,file:e.file}});return}let t=await r(e),p=e.local?f:await n(t);if(e.accountId=p,e.file!==void 0||e.body!==void 0||e.name!==void 0||e.opacity!==void 0||e.padding!==void 0||e.position!==void 0||e.scale!==void 0){let n=new FormData;if(e.file){let t=d(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);e.name!==void 0&&n.append(`name`,String(u(e.name,`name`,`text`)??``)),e.opacity!==void 0&&n.append(`opacity`,String(e.opacity)),e.padding!==void 0&&n.append(`padding`,String(e.padding)),e.position!==void 0&&n.append(`position`,String(u(e.position,`position`,`text`)??``)),e.scale!==void 0&&n.append(`scale`,String(e.scale)),s(await l(`Creating`,async()=>t.post(`/accounts/${p}/stream/watermarks`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${p}/stream/watermarks`,{body:n})),{successLabel:`Created`});return}let m={};e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),e.opacity!==void 0&&a(m,[`opacity`],e.opacity),e.padding!==void 0&&a(m,[`padding`],e.padding),e.position!==void 0&&a(m,[`position`],u(e.position,`position`,`text`)),e.scale!==void 0&&a(m,[`scale`],e.scale),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),s(await l(`Creating`,async()=>t.post(`/accounts/${p}/stream/watermarks`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function st(e){return 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})}const ct={command:`delete <identifier>`,describe:`Deletes a watermark profile.`,builder:st,handler:async t=>{if(t.dryRun){c({command:`cf stream watermarks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
13
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.watermarks.delete(t.identifier,o)),{successLabel:`Deleted`})}};function lt(e){return 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})}const ut={command:`get <identifier>`,describe:`Retrieves details for a single watermark profile.`,builder:lt,handler:async e=>{if(e.dryRun){c({command:`cf stream watermarks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.watermarks.get(e.identifier,a)),{successLabel:`Loaded`})}};function dt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ft={command:`list`,describe:`Lists all watermark profiles for an account.`,builder:dt,handler:async e=>{if(e.dryRun){c({command:`cf stream watermarks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.watermarks.list(a)),{successLabel:`Loaded`})}},$={command:`watermarks`,describe:`Watermark profiles that overlay an image on every video in the account`,builder:e=>e.command(ot).command(ct).command(ut).command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const mt={command:`delete`,describe:`Deletes a webhook.`,builder:pt,handler:async t=>{if(t.dryRun){c({command:`cf stream webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
14
|
+
`);return}s(await l(`Deleting`,async()=>a.stream.webhooks.delete(o)),{successLabel:`Deleted`})}};function ht(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gt={command:`get`,describe:`Retrieves a list of webhooks.`,builder:ht,handler:async e=>{if(e.dryRun){c({command:`cf stream webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.webhooks.get(a)),{successLabel:`Loaded`})}};function _t(e){return 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)`})}const vt={command:`update`,describe:`Creates a webhook notification.`,builder:_t,handler:async e=>{if(e.dryRun){c({command:`cf stream webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`json`,body:{"notification-url":e[`notification-url`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/webhook`,{body:n})),{successLabel:`Updated`});return}let p={};e[`notification-url`]!==void 0&&a(p,[`notificationUrl`],u(e[`notification-url`],`notification-url`,`text`)),s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/webhook`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},yt={command:`webhooks`,describe:`Webhook notifications for video lifecycle events (ready, error, etc.)`,builder:e=>e.command(mt).command(gt).command(vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bt={command:`stream`,describe:`Video encoding, storage, and delivery — upload, live-stream, clip, caption, and embed video at scale`,builder:e=>e.command(W).command(K).command(se).command(fe).command(xe).command(x).command(I).command(z).command(H).command(Y).command(ae).command(ue).command(ye).command(qe).command(Xe).command(tt).command(it).command($).command(yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{bt as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./auth-CQcAgnOy.mjs";import{t}from"./output-D7_yAFVR.mjs";import{n,t as r}from"./progress-CjcQ6ato.mjs";function i(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={command:`get <tenant-id>`,describe:`List of account types available for the Tenant to provision accounts.`,builder:i,handler:async i=>{if(i.dryRun){n({command:`cf tenants account-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/account_types`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.accountTypes.get(i[`tenant-id`])),{successLabel:`Loaded`})}},o={command:`account-types`,describe:`Account Types operations`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function s(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`list`,describe:`List of accounts for the Tenant.`,builder:s,handler:async i=>{if(i.dryRun){n({command:`cf tenants accounts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/accounts`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.accounts.list(i[`tenant-id`])),{successLabel:`Loaded`})}},l={command:`accounts`,describe:`Accounts operations`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`List of innate entitlements available for the Tenant.`,builder:u,handler:async i=>{if(i.dryRun){n({command:`cf tenants entitlements list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/entitlements`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.entitlements.list(i[`tenant-id`])),{successLabel:`Loaded`})}},f={command:`entitlements`,describe:`Entitlements operations`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <tenant-id>`,describe:`Retrieves a Tenant by Tenant ID.`,builder:p,handler:async i=>{if(i.dryRun){n({command:`cf tenants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.get(i[`tenant-id`])),{successLabel:`Loaded`})}};function h(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List of active members (Cloudflare users) for the Tenant.`,builder:h,handler:async i=>{if(i.dryRun){n({command:`cf tenants memberships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/memberships`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.memberships.list(i[`tenant-id`])),{successLabel:`Loaded`})}},_={command:`memberships`,describe:`Memberships operations`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`tenants`,describe:`Multi-tenant account management — manage tenant accounts, entitlements, and memberships`,builder:e=>e.command(m).command(o).command(l).command(f).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{t as r}from"./output-D7_yAFVR.mjs";import{n as i,t as a}from"./progress-CjcQ6ato.mjs";import{n as o}from"./input-validation-zEO81MWN.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const c={command:`create`,describe:`Create a new Token Validation configuration`,builder:s,handler:async e=>{if(e.dryRun){i({command:`cf token-validation configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Creating`,async()=>s.post(`/zones/${e.zoneId}/token_validation/config`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}r(await a(`Creating`,async()=>s.tokenValidation.configuration.create(c)),{successLabel:`Created`})}};function l(e){return e.positional(`config-id`,{type:`string`,description:`Config ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const u={command:`update <config-id>`,describe:`Update Token Configuration credentials`,builder:l,handler:async e=>{if(e.dryRun){i({command:`cf token-validation configuration credentials update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}/credentials`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.put(`/zones/${e.zoneId}/token_validation/config/${encodeURIComponent(String(e[`config-id`]))}/credentials`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}r(await a(`Updating`,async()=>s.tokenValidation.configuration.credentials.update(c,e[`config-id`])),{successLabel:`Updated`})}},d={command:`credentials`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`config-id`,{type:`string`,description:`Config ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <config-id>`,describe:`Delete Token Configuration`,builder:f,handler:async o=>{if(o.dryRun){i({command:`cf token-validation configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/token_validation/config/${o[`config-id`]==null?`<config-id>`:encodeURIComponent(String(o[`config-id`]))}`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``),"config-id":String(o[`config-id`]??``)},bodyKind:`none`});return}let s=await n(o),c=await t({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,!await e({force:!!o.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}r(await a(`Deleting`,async()=>s.tokenValidation.configuration.delete(c,o[`config-id`])),{successLabel:`Deleted`})}};function m(e){return e.positional(`config-id`,{type:`string`,description:`Config ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <config-id>`,describe:`Edit fields of an existing Token Configuration`,builder:m,handler:async e=>{if(e.dryRun){i({command:`cf token-validation configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.patch(`/zones/${e.zoneId}/token_validation/config/${encodeURIComponent(String(e[`config-id`]))}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}r(await a(`Updating`,async()=>s.tokenValidation.configuration.edit(c,e[`config-id`])),{successLabel:`Updated`})}};function g(e){return e.positional(`config-id`,{type:`string`,description:`Config ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <config-id>`,describe:`Get a single Token Configuration`,builder:g,handler:async e=>{if(e.dryRun){i({command:`cf token-validation configuration get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`none`});return}let o=await n(e),s=await t({zone:e.zone},o,{quiet:e.quiet});e.zoneId=s,r(await a(`Loading`,async()=>o.tokenValidation.configuration.get(s,e[`config-id`])),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`Lists all token validation configurations for this zone`,builder:v,handler:async e=>{let o={page:e.page,per_page:e[`per-page`]};if(e.dryRun){i({command:`cf token-validation configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,r(await a(`Loading`,async()=>s.tokenValidation.configuration.list(c,o)),{successLabel:`Loaded`})}},b={command:`configuration`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(c).command(p).command(h).command(_).command(y).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`bulk-create`,describe:`Create zone token validation rules. A request can create multiple Token Validation Rules.`,builder:x,handler:async e=>{if(e.dryRun){i({command:`cf token-validation rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/bulk`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e);if(e.zoneId=await t({zone:e.zone},s,{quiet:e.quiet}),e.body){let t=o(e.body,`body`,`binary`);r(await a(`Creating`,async()=>s.post(`/zones/${e.zoneId}/token_validation/rules/bulk`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={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:C,handler:async e=>{if(e.dryRun){i({command:`cf token-validation rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/bulk`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e);if(e.zoneId=await t({zone:e.zone},s,{quiet:e.quiet}),e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.patch(`/zones/${e.zoneId}/token_validation/rules/bulk`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const E={command:`create`,describe:`Create a token validation rule.`,builder:T,handler:async e=>{if(e.dryRun){i({command:`cf token-validation rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Creating`,async()=>s.post(`/zones/${e.zoneId}/token_validation/rules`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}r(await a(`Creating`,async()=>s.tokenValidation.rules.create(c)),{successLabel:`Created`})}};function D(e){return e.positional(`rule-id`,{type:`string`,description:`Rule ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const O={command:`delete <rule-id>`,describe:`Delete a zone token validation rule.`,builder:D,handler:async o=>{if(o.dryRun){i({command:`cf token-validation rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/token_validation/rules/${o[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(o[`rule-id`]))}`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``),"rule-id":String(o[`rule-id`]??``)},bodyKind:`none`});return}let s=await n(o),c=await t({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,!await e({force:!!o.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}r(await a(`Deleting`,async()=>s.tokenValidation.rules.delete(c,o[`rule-id`])),{successLabel:`Deleted`})}};function k(e){return e.positional(`rule-id`,{type:`string`,description:`Rule ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const A={command:`edit <rule-id>`,describe:`Edit a zone token validation rule.`,builder:k,handler:async e=>{if(e.dryRun){i({command:`cf token-validation rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.patch(`/zones/${e.zoneId}/token_validation/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}r(await a(`Updating`,async()=>s.tokenValidation.rules.edit(c,e[`rule-id`])),{successLabel:`Updated`})}};function j(e){return e.positional(`rule-id`,{type:`string`,description:`Rule ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <rule-id>`,describe:`Get a zone token validation rule.`,builder:j,handler:async e=>{if(e.dryRun){i({command:`cf token-validation rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let o=await n(e),s=await t({zone:e.zone},o,{quiet:e.quiet});e.zoneId=s,r(await a(`Loading`,async()=>o.tokenValidation.rules.get(s,e[`rule-id`])),{successLabel:`Loaded`})}};function N(e){return 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`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list`,describe:`List token validation rules`,builder:N,handler:async e=>{let o={per_page:e[`per-page`],page:e.page,token_configuration:e[`token-configuration`],action:e.action,enabled:e.enabled,id:e.id,rule_id:e[`rule-id`],host:e.host,hostname:e.hostname};if(e.dryRun){i({command:`cf token-validation rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,r(await a(`Loading`,async()=>s.tokenValidation.rules.list(c,o)),{successLabel:`Loaded`})}};function F(e){return 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/). `})}const I={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:F,handler:async e=>{let s={per_page:e[`per-page`],page:e.page,state:e.state,host:e.host,hostname:e.hostname,method:e.method,endpoint:e.endpoint};if(e.dryRun){i({command:`cf token-validation rules preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/preview`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:s,bodyKind:`json`,body:{body:e.body}});return}let c=await n(e),l=await t({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=o(e.body,`body`,`binary`),n=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();r(await a(`Creating`,async()=>c.post(`/zones/${e.zoneId}/token_validation/rules/preview${n?`?`+n:``}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}r(await a(`Creating`,async()=>c.tokenValidation.rules.preview.create(l,s)),{successLabel:`Created`})}},L={command:`preview`,describe:`Preview token validation rule behavior before applying`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`rules`,describe:`Validation rules that enforce token requirements on specific API endpoints`,builder:e=>e.command(S).command(w).command(E).command(O).command(A).command(M).command(P).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`token-validation`,describe:`Validate JWT tokens at the edge — configure token sources, signing keys, and validation rules`,builder:e=>e.command(b).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
|
|
3
|
+
expensive challenges in response to malicious bots (ENT only).
|
|
4
|
+
`}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
|
|
5
|
+
this setting can determine the clearance level to be set
|
|
6
|
+
`,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).
|
|
7
|
+
`}).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
|
|
8
|
+
set this to a meaningful string to make it easier to identify your
|
|
9
|
+
widget, and where it is used.
|
|
10
|
+
`}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only).
|
|
11
|
+
`}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation.
|
|
12
|
+
`,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)`})}const m={command:`create`,describe:`Lists challenge widgets.`,builder:p,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/challenges/widgets`,pathParams:{},bodyKind:`json`,body:{"bot-fight-mode":e[`bot-fight-mode`],"clearance-level":e[`clearance-level`],domains:e.domains,"ephemeral-id":e[`ephemeral-id`],mode:e.mode,name:e.name,offlabel:e.offlabel,region:e.region,body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/challenges/widgets`,{body:t})),{successLabel:`Created`});return}if(e.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);e.mode===void 0&&(e.mode=await i(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),e.name===void 0&&(e.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 h={};e[`bot-fight-mode`]!==void 0&&o(h,[`bot_fight_mode`],e[`bot-fight-mode`]),e[`clearance-level`]!==void 0&&o(h,[`clearance_level`],d(e[`clearance-level`],`clearance-level`,`text`)),e.domains!==void 0&&o(h,[`domains`],e.domains),e[`ephemeral-id`]!==void 0&&o(h,[`ephemeral_id`],e[`ephemeral-id`]),e.mode!==void 0&&o(h,[`mode`],d(e.mode,`mode`,`text`)),e.name!==void 0&&o(h,[`name`],d(e.name,`name`,`text`)),e.offlabel!==void 0&&o(h,[`offlabel`],e.offlabel),e.region!==void 0&&o(h,[`region`],d(e.region,`region`,`text`)),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/challenges/widgets`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function h(e){return e.positional(`sitekey`,{type:`string`,description:`Sitekey`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <sitekey>`,describe:`Destroy a Turnstile Widget.`,builder:h,handler:async t=>{if(t.dryRun){l({command:`cf turnstile widgets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/challenges/widgets/${t.sitekey==null?`<sitekey>`:encodeURIComponent(String(t.sitekey))}`,pathParams:{sitekey:String(t.sitekey??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
13
|
+
`);return}c(await u(`Deleting`,async()=>i.turnstile.widgets.delete(o,t.sitekey)),{successLabel:`Deleted`})}};function _(e){return e.positional(`sitekey`,{type:`string`,description:`Sitekey`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <sitekey>`,describe:`Show a single challenge widget configuration.`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/challenges/widgets/${e.sitekey==null?`<sitekey>`:encodeURIComponent(String(e.sitekey))}`,pathParams:{sitekey:String(e.sitekey??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.turnstile.widgets.get(i,e.sitekey)),{successLabel:`Loaded`})}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Lists all turnstile widgets of an account.`,builder:y,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/challenges/widgets`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.turnstile.widgets.list(i)),{successLabel:`Loaded`})}};function x(e){return e.positional(`sitekey`,{type:`string`,description:`Sitekey`,demandOption:!0}).option(`invalidate-immediately`,{type:`boolean`,description:"If `invalidate_immediately` is set to `false`, the previous secret will\nremain valid for two hours. Otherwise, the secret is immediately\ninvalidated, and requests using it will be rejected.\n",default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`rotate-secret <sitekey>`,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:x,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets rotate-secret`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/challenges/widgets/${e.sitekey==null?`<sitekey>`:encodeURIComponent(String(e.sitekey))}/rotate_secret`,pathParams:{sitekey:String(e.sitekey??``)},bodyKind:`json`,body:{"invalidate-immediately":e[`invalidate-immediately`],body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/challenges/widgets/${encodeURIComponent(String(e.sitekey))}/rotate_secret`,{body:n})),{successLabel:`Created`});return}let d={};e[`invalidate-immediately`]!==void 0&&o(d,[`invalidate_immediately`],e[`invalidate-immediately`]),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/challenges/widgets/${encodeURIComponent(String(e.sitekey))}/rotate_secret`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function C(e){return e.positional(`sitekey`,{type:`string`,description:`Sitekey`,demandOption:!0}).option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
|
|
14
|
+
expensive challenges in response to malicious bots (ENT only).
|
|
15
|
+
`}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
|
|
16
|
+
this setting can determine the clearance level to be set
|
|
17
|
+
`,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).
|
|
18
|
+
`}).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
|
|
19
|
+
set this to a meaningful string to make it easier to identify your
|
|
20
|
+
widget, and where it is used.
|
|
21
|
+
`}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only).
|
|
22
|
+
`}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation.
|
|
23
|
+
`,choices:[`world`,`china`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`update <sitekey>`,describe:`Update the configuration of a widget.`,builder:C,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/challenges/widgets/${e.sitekey==null?`<sitekey>`:encodeURIComponent(String(e.sitekey))}`,pathParams:{sitekey:String(e.sitekey??``)},bodyKind:`json`,body:{"bot-fight-mode":e[`bot-fight-mode`],"clearance-level":e[`clearance-level`],domains:e.domains,"ephemeral-id":e[`ephemeral-id`],mode:e.mode,name:e.name,offlabel:e.offlabel,region:e.region,body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Updating`,async()=>p.put(`/accounts/${m}/challenges/widgets/${encodeURIComponent(String(e.sitekey))}`,{body:t})),{successLabel:`Updated`});return}if(e.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);e.mode===void 0&&(e.mode=await i(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),e.name===void 0&&(e.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 h={};e[`bot-fight-mode`]!==void 0&&o(h,[`bot_fight_mode`],e[`bot-fight-mode`]),e[`clearance-level`]!==void 0&&o(h,[`clearance_level`],d(e[`clearance-level`],`clearance-level`,`text`)),e.domains!==void 0&&o(h,[`domains`],e.domains),e[`ephemeral-id`]!==void 0&&o(h,[`ephemeral_id`],e[`ephemeral-id`]),e.mode!==void 0&&o(h,[`mode`],d(e.mode,`mode`,`text`)),e.name!==void 0&&o(h,[`name`],d(e.name,`name`,`text`)),e.offlabel!==void 0&&o(h,[`offlabel`],e.offlabel),e.region!==void 0&&o(h,[`region`],d(e.region,`region`,`text`)),c(await u(`Updating`,async()=>p.put(`/accounts/${m}/challenges/widgets/${encodeURIComponent(String(e.sitekey))}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}},T={command:`widgets`,describe:`Turnstile widget configurations — site keys, secret rotation, and challenge mode settings`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},E={command:`turnstile`,describe:`CAPTCHA-free bot verification widgets that protect forms and APIs without degrading user experience`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{E as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./session-
|
|
2
|
+
import"./session-H7IV2BrM.mjs";import{i as e,n as t,t as n}from"./theme-BklJDrb2.mjs";const r={bar:`│`,top:`┌`,bottom:`└`};function i(e,i,o){let s=o?.title??`Error`,c=t(),l=n.error,u=c.hex(l)(r.bar),d=c.hex(l)(r.top),f=c.hex(l)(r.bottom),p=Math.max(20,(process.stdout.columns||80)-2),m=[];if(m.push(``),m.push(`${d} ${c.hex(l).bold(s)}`),o?.rawMessage)for(let t of e.split(`
|
|
3
3
|
`))m.push(t.length>0?`${u} ${t}`:u);else for(let t of a(e,p))m.push(t.length>0?`${u} ${c.hex(l).bold(t)}`:u);if(i){m.push(u);for(let e of a(i,p))m.push(e.length>0?`${u} ${c.dim(e)}`:u)}return m.push(f),m.join(`
|
|
4
4
|
`)}function a(e,t){let n=[];for(let r of e.split(`
|
|
5
5
|
`)){if(r.length<=t){n.push(r);continue}let e=r.split(/\s+/),i=``;for(let r of e){if(!i){i=r;continue}i.length+1+r.length<=t?i+=` `+r:(n.push(i),i=r)}i&&n.push(i)}return n}function o(r){return`${t().hex(n.success)(e.success)} ${r}`}function s(r){return`${t().hex(n.warning)(e.warning)} ${r}`}function c(r){return`${t().hex(n.info)(e.info)} ${r}`}function l(r){let i=t().hex(n.muted);return`${i(e.arrow)} ${i(r)}`}export{i as a,s as i,c as n,o as r,l as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{t as r}from"./output-D7_yAFVR.mjs";import{n as i,t as a}from"./progress-CjcQ6ato.mjs";import{n as o}from"./input-validation-zEO81MWN.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const c={command:`delete`,describe:`Deletes the URL Normalization settings.`,builder:s,handler:async o=>{if(o.dryRun){i({command:`cf url-normalization delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`none`});return}let s=await n(o),c=await t({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,!await e({force:!!o.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}r(await a(`Deleting`,async()=>s.urlNormalization.delete(c)),{successLabel:`Deleted`})}};function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Fetches the current URL Normalization settings.`,builder:l,handler:async e=>{if(e.dryRun){i({command:`cf url-normalization get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(e),s=await t({zone:e.zone},o,{quiet:e.quiet});e.zoneId=s,r(await a(`Loading`,async()=>o.urlNormalization.get(s)),{successLabel:`Loaded`})}};function d(e){return 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.`})}const f={command:`update`,describe:`Updates the URL Normalization settings.`,builder:d,handler:async e=>{if(e.dryRun){i({command:`cf url-normalization update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.put(`/zones/${e.zoneId}/url_normalization`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}r(await a(`Updating`,async()=>s.urlNormalization.update(c)),{successLabel:`Updated`})}},p={command:`url-normalization`,describe:`Normalize incoming request URLs to a consistent format before rule evaluation and caching`,builder:e=>e.command(c).command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{T as e,h as t,t as n,x as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./local-VJaJ3BZ1.mjs";import{n as d,t as f}from"./raw-fetch-hRv-6P3D.mjs";function p(e){return e.positional(`response-id`,{type:`string`,description:`Response hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <response-id>`,describe:"Returns the raw response of the network request. Find the `response_id` in the `data.requests.response.hash`.",builder:p,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner responses get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/responses/${e[`response-id`]==null?`<response-id>`:encodeURIComponent(String(e[`response-id`]))}`,pathParams:{"response-id":String(e[`response-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,d((await c(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/responses/${encodeURIComponent(String(e[`response-id`]))}`,{method:`GET`,localEndpoint: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,`Please specify a subcommand`),handler:()=>{}};function g(e){return 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).`})}const _={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:g,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/bulk`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let i=await n(e),l=e.local?u:await t(i);if(e.accountId=l,e.body){let t=a(e.body);o(await c(`Creating`,async()=>i.post(`/accounts/${l}/urlscanner/v2/bulk`,{body:t})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return 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)`})}const y={command:`create`,describe:`Submit a URL to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/.`,builder:v,handler:async d=>{if(d.dryRun){s({command:`cf url-scanner scans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/scan`,pathParams:{},bodyKind:`json`,body:{"agent-readiness":d[`agent-readiness`],country:d.country,customagent:d.customagent,referer:d.referer,"screenshots-resolutions":d[`screenshots-resolutions`],url:d.url,visibility:d.visibility,body:d.body}});return}let f=await n(d),p=d.local?u:await t(f);if(d.accountId=p,d.body){let e=a(d.body);o(await c(`Creating`,async()=>f.post(`/accounts/${p}/urlscanner/v2/scan`,{body:e})),{successLabel:`Created`});return}d.url===void 0&&(d.url=await e(`url`,`The url field`));let m={};d[`agent-readiness`]!==void 0&&i(m,[`agentReadiness`],d[`agent-readiness`]),d.country!==void 0&&i(m,[`country`],l(d.country,`country`,`text`)),d.customagent!==void 0&&i(m,[`customagent`],l(d.customagent,`customagent`,`text`)),d.referer!==void 0&&i(m,[`referer`],l(d.referer,`referer`,`text`)),d[`screenshots-resolutions`]!==void 0&&i(m,[`screenshotsResolutions`],d[`screenshots-resolutions`]),d.url!==void 0&&i(m,[`url`],l(d.url,`url`,`text`)),d.visibility!==void 0&&i(m,[`visibility`],l(d.visibility,`visibility`,`text`)),o(await c(`Creating`,async()=>f.post(`/accounts/${p}/urlscanner/v2/scan`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function b(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`dom <scan-id>`,describe:`Returns a plain text response, with the scan's DOM content as rendered by Chrome.`,builder:b,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans dom`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/dom/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}`,pathParams:{"scan-id":String(e[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,d((await c(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/dom/${encodeURIComponent(String(e[`scan-id`]))}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}};function S(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <scan-id>`,describe:`Get URL scan by uuid`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/result/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}`,pathParams:{"scan-id":String(e[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.urlScanner.scans.get(e[`scan-id`],a)),{successLabel:`Loaded`})}};function w(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`har <scan-id>`,describe:`Get a URL scan's HAR file. See HAR spec at http://www.softwareishard.com/blog/har-12-spec/.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans har`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/har/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}`,pathParams:{"scan-id":String(e[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.urlScanner.scans.har(e[`scan-id`],a)),{successLabel:`Loaded`})}};function E(e){return e.option(`size`,{type:`number`,description:`Limit the number of objects in the response.`}).option(`q`,{type:`string`,description:`Filter scans`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={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,handler:async e=>{let i={size:e.size,q:e.q};if(e.dryRun){s({command:`cf url-scanner scans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/search`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?u:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.urlScanner.scans.list(l,i)),{successLabel:`Loaded`})}};function O(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`resolution`,{type:`string`,description:`Target device type.`,choices:[`desktop`,`mobile`,`tablet`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`screenshot <scan-id>`,describe:`Get scan's screenshot by resolution (desktop/mobile/tablet).`,builder:O,handler:async e=>{let i={resolution:e.resolution};if(e.dryRun){s({command:`cf url-scanner scans screenshot`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/urlscanner/v2/screenshots/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}.png`,pathParams:{"scan-id":String(e[`scan-id`]??``)},query:i,bodyKind:`none`});return}let a=await n(e),o=e.local?u:await t(a);e.accountId=o;let l=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),p=await c(`Loading`,async()=>f(`/accounts/${o}/urlscanner/v2/screenshots/${encodeURIComponent(String(e[`scan-id`]))}.png${l?`?`+l:``}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));d(e.text===!0?p.toString(`utf-8`):p)}},A={command:`scans`,describe:`URL scan requests and results — submit URLs for analysis and retrieve threat verdicts`,builder:e=>e.command(_).command(y).command(x).command(C).command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`url-scanner`,describe:`Scan URLs for phishing, malware, and other threats — submit scans and retrieve detailed results`,builder:e=>e.command(h).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{j as default};
|