cf 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abuse-reports-Ina5TlsU.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/acm-SqcV8o5o.mjs +3 -0
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-DMPfi54f.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-DSSRDZz8.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/{audit-logs-BuExU_nz.mjs → audit-logs-BvQ9uwuy.mjs} +1 -1
- package/dist/{auth-CSC4yhEJ.mjs → auth-DX9KnJ0P.mjs} +3 -3
- package/dist/{auth-D5hNsOFq.mjs → auth-TYwGydWg.mjs} +1 -1
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/bot-management-DgW--8wM.mjs +5 -0
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/cache-CeN5t6_W.mjs +5 -0
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/{certificate-authorities-CtqzAtxQ.mjs → certificate-authorities-BzZnWCac.mjs} +1 -1
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/{cloud-connector-BA5IRZUP.mjs → cloud-connector-D5h8Dzzg.mjs} +1 -1
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-DOeHPdCG.mjs → completions-Bvzav4Mj.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/{context-jpewmual.mjs → context-C-WbewL6.mjs} +1 -1
- package/dist/custom-certificates-CfRj7QZb.mjs +5 -0
- package/dist/{custom-hostnames-CtuTdFcX.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/{dcv-delegation-Bgf86J-r.mjs → dcv-delegation-BYsNl3qc.mjs} +1 -1
- package/dist/{deploy-dVrgDUOp.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-C01_Lby6.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-DYZcTtIC.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-C03MtdZb.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/healthchecks-BBtW8vRh.mjs +4 -0
- package/dist/hostnames-Bh2IFxIw.mjs +3 -0
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-nv9INuWZ.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/keyless-certificates-CfJmXccT.mjs +3 -0
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{organizations-BqJHyvMK.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/origin-tls-client-auth-B30_2_dO.mjs +4 -0
- package/dist/{page-rules-EZHJePmn.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-CXJioWPs.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/{progress-DrDErV9w.mjs → progress-CL8I-7YK.mjs} +1 -1
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-D986zPJr.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/{raw-fetch-_n0lMAnD.mjs → raw-fetch-bIXC9D1m.mjs} +1 -1
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-CDIwTz3G.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-BR31o4P6.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{secrets-store-BAK9G12O.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/{session-DHYCE-PM.mjs → session-B8r8LNQN.mjs} +1 -1
- package/dist/{build-HuS9-R0V.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/smart-shield-BreBC1Ap.mjs +3 -0
- package/dist/snippets-BAJoWMSJ.mjs +4 -0
- package/dist/{spawn-CCGzKlC4.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-pVGxb7u5.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/{src-DU7FBCOX.mjs → src-BQ1dr9xR.mjs} +4 -4
- package/dist/ssl-D3Pixs8M.mjs +15 -0
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-HLGUazms.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/token-validation-DUvtXWur.mjs +10 -0
- package/dist/{tools-D_hfUU_Z.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-erjBdVKL.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-CBHwWPAM.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-u6KwrzWd.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/zaraz-9l7KuLqh.mjs +2 -0
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-BXtdwt6E.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-B_joQcMi.mjs +0 -22
- package/dist/acm-_kIHqYME.mjs +0 -3
- package/dist/addressing-CaFlw8y1.mjs +0 -12
- package/dist/ai-CqnhNb_c.mjs +0 -2
- package/dist/ai-gateway-pgYGI519.mjs +0 -8
- package/dist/ai-search-eqQMPQol.mjs +0 -7
- package/dist/ai_gateway--vuVLnOm.mjs +0 -4
- package/dist/alerting-CPxHiYHb.mjs +0 -6
- package/dist/analytics_engine-gWyfnsCs.mjs +0 -2
- package/dist/api-gateway-BXXGFCVR.mjs +0 -33
- package/dist/argo-aC6A3JyX.mjs +0 -2
- package/dist/artifacts-HD4V2xpK.mjs +0 -4
- package/dist/billing-COaghyxl.mjs +0 -2
- package/dist/bot-management-DmEzeV1Y.mjs +0 -5
- package/dist/botnet-feed-ByEAXAkw.mjs +0 -3
- package/dist/brand-protection-dPrGe8sL.mjs +0 -3
- package/dist/browser-rendering-BiSGnpBf.mjs +0 -4
- package/dist/cache-CY-7Lt71.mjs +0 -5
- package/dist/calls-wOQGDWPl.mjs +0 -4
- package/dist/client-certificates-CRf41xLe.mjs +0 -3
- package/dist/cloudforce-one-Bq_qPAWs.mjs +0 -21
- package/dist/connectivity-Bx3MgTHX.mjs +0 -3
- package/dist/connector-interrupts-D7ylweJZ.mjs +0 -2
- package/dist/connector-telemetry-events-6izV1kbP.mjs +0 -2
- package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +0 -2
- package/dist/connectors-DRt4e6d_.mjs +0 -3
- package/dist/content-scanning-Cd2vy5Sz.mjs +0 -4
- package/dist/custom-certificates-DYE-9epx.mjs +0 -5
- package/dist/custom-nameservers-CWqA51in.mjs +0 -3
- package/dist/custom-pages-DeUKEFGe.mjs +0 -4
- package/dist/d1-DvWY9Gp4.mjs +0 -4
- package/dist/data-security-BPo6dIWu.mjs +0 -6
- package/dist/diagnostics-6nKPmVgz.mjs +0 -3
- package/dist/dispatch-namespaces-64lXx2WJ.mjs +0 -7
- package/dist/dist-t_YrL25p.mjs +0 -82
- package/dist/dns-ClciFGxx.mjs +0 -29
- package/dist/dns-firewall-DfUmXDCe.mjs +0 -57
- package/dist/durable-objects-CMaYZ-YU.mjs +0 -2
- package/dist/email-routing-CGXhFqF5.mjs +0 -10
- package/dist/email-security-D5viPq8S.mjs +0 -8
- package/dist/email-sending-C2jpc3gh.mjs +0 -3
- package/dist/filters-bzsFcWt0.mjs +0 -4
- package/dist/google-tag-gateway-Dfy887yA.mjs +0 -2
- package/dist/healthchecks-DRoAlWgr.mjs +0 -4
- package/dist/hostnames-CFgIVI3s.mjs +0 -3
- package/dist/hyperdrive-C7-gwTSV.mjs +0 -18
- package/dist/iam-DqVPzGrb.mjs +0 -6
- package/dist/images-BYfl4YgR.mjs +0 -7
- package/dist/intel-duTEPIHc.mjs +0 -3
- package/dist/keyless-certificates-CRCDVd3g.mjs +0 -3
- package/dist/kv-CZoV4tiv.mjs +0 -5
- package/dist/leaked-credential-checks-DNIBg7Pe.mjs +0 -3
- package/dist/load-balancers--OMg0HNt.mjs +0 -6
- package/dist/logpush-C0_lZTyY.mjs +0 -4
- package/dist/logs-BtpWZQfV.mjs +0 -3
- package/dist/magic-cloud-networking-u6rwYbGg.mjs +0 -5
- package/dist/magic-network-monitoring-CKgQyRj4.mjs +0 -4
- package/dist/magic-transit-CLhMcJ_-.mjs +0 -89
- package/dist/managed-transforms-D0Z2mlth.mjs +0 -3
- package/dist/mtls-certificates-BL65NK5T.mjs +0 -3
- package/dist/network-interconnects-Bgu9gmaG.mjs +0 -36
- package/dist/oauth-Bk-F-tIO.mjs +0 -52
- package/dist/observability-BynRbTF4.mjs +0 -4
- package/dist/origin-ca-certificates-BGvYwm3C.mjs +0 -3
- package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +0 -2
- package/dist/origin-tls-client-auth-d3snC3vr.mjs +0 -4
- package/dist/pages-D4aYteKk.mjs +0 -11
- package/dist/pipelines-G8Iusxq-.mjs +0 -6
- package/dist/queues-DEkbKqZX.mjs +0 -6
- package/dist/r2-CV0IkCAW.mjs +0 -21
- package/dist/r2-data-catalog-NtqGC_a_.mjs +0 -14
- package/dist/rate-limits-B2wRsUX1.mjs +0 -5
- package/dist/realtime-kit-Ld3c5eU6.mjs +0 -18
- package/dist/request-tracers-D7SFMDik.mjs +0 -2
- package/dist/resource-sharing-YIQ04jXE.mjs +0 -5
- package/dist/resource-tagging-Bd6Y03sg.mjs +0 -16
- package/dist/rules-DHjLP5Kx.mjs +0 -4
- package/dist/rulesets-q4QABpKs.mjs +0 -8
- package/dist/rum-SmT4HZmM.mjs +0 -4
- package/dist/schema-validation-vVetgC_P.mjs +0 -24
- package/dist/scim-ChOkZpNx.mjs +0 -3
- package/dist/security-center-eScuYDKP.mjs +0 -2
- package/dist/security-txt-x7R4gmQu.mjs +0 -3
- package/dist/shared-BAjo72Lz.mjs +0 -2
- package/dist/smart-shield-CWlSsNi8.mjs +0 -3
- package/dist/snippets-DrlgYJYp.mjs +0 -4
- package/dist/speed-ZFrMWDgd.mjs +0 -4
- package/dist/ssl-9JY05sYt.mjs +0 -15
- package/dist/stream-tRU39b8K.mjs +0 -14
- package/dist/token-validation-_VdamKpz.mjs +0 -10
- package/dist/turnstile-BRzXd28B.mjs +0 -23
- package/dist/url-normalization-D-NxuLtN.mjs +0 -3
- package/dist/url-scanner-BzzR6iDx.mjs +0 -2
- package/dist/user-C4omq__w.mjs +0 -10
- package/dist/vectorize-By6EqcNR.mjs +0 -4
- package/dist/web3-DQ5dmE9W.mjs +0 -4
- package/dist/workers-D8Be7_as.mjs +0 -18
- package/dist/workers-builds-BE3W3qNk.mjs +0 -7
- package/dist/workflows-BWWufqFA.mjs +0 -4
- package/dist/zaraz-Bsa9AvVL.mjs +0 -2
- package/dist/zero-trust-UNVZFnKu.mjs +0 -118
- package/dist/zero_trust-B0_Rk4p2.mjs +0 -3
- /package/dist/{cli-types-BeyOc81z.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{metadata-OOwvpR8m.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-C3h-mwp7.mjs → resolve-DGD57PFH.mjs} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{n as c,t as l}from"./prompt-q3B7sM2A.mjs";import{t as u}from"./cli-types-DGgEbf8K.mjs";function d(e){return e.option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or certificate and the intermediate(s).`}).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 f={command:`create`,describe:`Returns the set of hostnames, the signature algorithm, and the expiration date of the certificate.`,builder:d,handler:async c=>{if(c.dryRun){a({command:`cf ssl analyze create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/ssl/analyze`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({bundle_method:s(c[`bundle-method`],`bundle-method`,`text`),certificate:s(c.certificate,`certificate`,`text`)}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Creating`,async()=>l.ssl.analyze.create({...e,zone_id:u})),{successLabel:`Created`});return}let d=r({bundle_method:s(c[`bundle-method`],`bundle-method`,`text`),certificate:s(c.certificate,`certificate`,`text`)});i(await o(`Creating`,async()=>l.ssl.analyze.create({...d,zone_id:u})),{successLabel:`Created`})}},p={command:`analyze`,describe:`Operations for analyze`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get`,describe:`If the system is enabled, the response will include next_scheduled_scan, representing the next time this zone will be scanned and the zone's ssl/tls encryption mode is potentially upgraded by the system. If the system is disabled, next_scheduled_scan will not be present in the response body.`,builder:m,handler:async n=>{if(n.dryRun){a({command:`cf ssl automatic-upgrader get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/settings/ssl_automatic_mode`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.ssl.automaticUpgrader.get({zone_id:s})),{successLabel:`Loaded`})}};function g(e){return e.option(`value`,{type:`string`,description:`Controls enablement of Automatic SSL/TLS.`,choices:[`auto`,`custom`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Automatic SSL/TLS.`})}const _={command:`patch`,describe:`The automatic system is enabled when this endpoint is hit with value in the request body is set to "auto", and disabled when the request body value is set to "custom".`,builder:g,handler:async l=>{if(l.dryRun){a({command:`cf ssl automatic-upgrader patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/ssl_automatic_mode`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({value:s(l.value,`value`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.ssl.automaticUpgrader.patch({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Controls enablement of Automatic SSL/TLS.`,[`auto`,`custom`]));let f=r({value:s(l.value,`value`,`text`)});i(await o(`Updating`,async()=>u.ssl.automaticUpgrader.patch({...f,zone_id:d})),{successLabel:`Updated`})}},v={command:`automatic-upgrader`,describe:`SSL automatic mode enrollment — get or update automatic SSL/TLS upgrader settings`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`certificate-authority`,{type:`string`,description:`Certificate Authority selected for the order. For information on any certificate authority specific details or restrictions [see this page for more details](https://developers.cloudflare.com/ssl/reference/certificate-authorities).`,choices:[`google`,`lets_encrypt`,`ssl_com`]}).option(`cloudflare-branding`,{type:`boolean`,description:`Whether or not to add Cloudflare Branding for the order. This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to true.`}).option(`hosts`,{type:`string`,array:!0,description:`Comma separated list of valid host names for the certificate packs. Must contain the zone apex, may not contain more than 50 hosts, and may not be empty.`}).option(`type`,{type:`string`,description:`Type of certificate pack.`,choices:[`advanced`]}).option(`validation-method`,{type:`string`,description:`Validation Method selected for the order.`,choices:[`txt`,`http`,`email`]}).option(`validity-days`,{type:`number`,description:`Validity Days selected for the order.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create`,describe:`For a given zone, order an advanced certificate pack.`,builder:y,handler:async l=>{if(l.dryRun){a({command:`cf ssl certificate-packs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/ssl/certificate_packs/order`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({certificate_authority:s(l[`certificate-authority`],`certificate-authority`,`text`),cloudflare_branding:l[`cloudflare-branding`],hosts:l.hosts,type:s(l.type,`type`,`text`),validation_method:s(l[`validation-method`],`validation-method`,`text`),validity_days:l[`validity-days`]}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Creating`,async()=>u.ssl.certificatePacks.create({...e,zone_id:d})),{successLabel:`Created`});return}if(l[`certificate-authority`]===void 0&&(l[`certificate-authority`]=await c(`certificate-authority`,`Certificate Authority selected for the order. For information on any certificate authority specific details or restrictions [see this page for more details](https://developers.cloudflare.com/ssl/reference/certificate-authorities).`,[`google`,`lets_encrypt`,`ssl_com`])),l.hosts===void 0)throw Error(`--hosts is required (or pass --body with this field set).`);if(l.type===void 0&&(l.type=await c(`type`,`Type of certificate pack.`,[`advanced`])),l[`validation-method`]===void 0&&(l[`validation-method`]=await c(`validation-method`,`Validation Method selected for the order.`,[`txt`,`http`,`email`])),l[`validity-days`]===void 0)throw Error(`--validity-days is required (or pass --body with this field set).`);let f=r({certificate_authority:s(l[`certificate-authority`],`certificate-authority`,`text`),cloudflare_branding:l[`cloudflare-branding`],hosts:l.hosts,type:s(l.type,`type`,`text`),validation_method:s(l[`validation-method`],`validation-method`,`text`),validity_days:l[`validity-days`]});i(await o(`Creating`,async()=>u.ssl.certificatePacks.create({...f,zone_id:d})),{successLabel:`Created`})}};function x(e){return e.positional(`certificate-pack-id`,{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})}const S={command:`delete <certificate-pack-id>`,describe:`For a given zone, delete an advanced certificate pack.`,builder:x,handler:async n=>{if(n.dryRun){a({command:`cf ssl certificate-packs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/ssl/certificate_packs/${n[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(n[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(n[`certificate-pack-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>r.ssl.certificatePacks.delete({zone_id:s,certificate_pack_id:n[`certificate-pack-id`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`certificate-pack-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`cloudflare-branding`,{type:`boolean`,description:`Whether or not to add Cloudflare Branding for the order. This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to true.`}).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:`edit <certificate-pack-id>`,describe:`For a given zone, restart validation or add cloudflare branding for an advanced certificate pack. The former is only a validation operation for a Certificate Pack in a validation_timed_out status.`,builder:C,handler:async s=>{if(s.dryRun){a({command:`cf ssl certificate-packs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/ssl/certificate_packs/${s[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(s[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(s[`certificate-pack-id`]??``),"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?r({cloudflare_branding:s[`cloudflare-branding`]}):n(s.body)});return}let c=await t(s),l=await e({zone:s.zone},c,{quiet:s.quiet});if(s.zoneId=l,s.body){let e=n(s.body);i(await o(`Updating`,async()=>c.ssl.certificatePacks.edit({...e,zone_id:l,certificate_pack_id:s[`certificate-pack-id`]})),{successLabel:`Updated`});return}let u=r({cloudflare_branding:s[`cloudflare-branding`]});i(await o(`Updating`,async()=>c.ssl.certificatePacks.edit({...u,zone_id:l,certificate_pack_id:s[`certificate-pack-id`]})),{successLabel:`Updated`})}};function T(e){return e.positional(`certificate-pack-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <certificate-pack-id>`,describe:`For a given zone, get a certificate pack.`,builder:T,handler:async n=>{if(n.dryRun){a({command:`cf ssl certificate-packs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/ssl/certificate_packs/${n[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(n[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(n[`certificate-pack-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.ssl.certificatePacks.get({zone_id:s,certificate_pack_id:n[`certificate-pack-id`]})),{successLabel:`Loaded`})}};function D(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of certificate packs per page.`}).option(`status`,{type:`string`,description:`Include Certificate Packs of all statuses, not just active ones.`,choices:[`all`]}).option(`deploy`,{type:`string`,description:`Specify the deployment environment for the certificate packs.`,choices:[`staging`,`production`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`list`,describe:`For a given zone, list all active certificate packs.`,builder:u(D),handler:async n=>{let r={page:n.page,per_page:n[`per-page`],status:n.status,deploy:n.deploy};if(n.dryRun){a({command:`cf ssl certificate-packs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/ssl/certificate_packs`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.ssl.certificatePacks.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function k(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get`,describe:`For a given zone, list certificate pack quotas.`,builder:k,handler:async n=>{if(n.dryRun){a({command:`cf ssl certificate-packs quota get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/ssl/certificate_packs/quota`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.ssl.certificatePacks.quota.get({zone_id:s})),{successLabel:`Loaded`})}},j={command:`quota`,describe:`Operations for certificate-packs.quota`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`certificate-packs`,describe:`Operations for certificate-packs`,builder:e=>e.command(b).command(S).command(w).command(E).command(O).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`enabled`,{type:`boolean`,description:`Disabling Universal SSL removes any currently active Universal SSL certificates for your zone from the edge and prevents any future Universal SSL certificates from being ordered. If there are no advanced certificates or custom certificates uploaded for the domain, visitors will be unable to access the domain over HTTPS.
|
|
4
|
+
|
|
5
|
+
By disabling Universal SSL, you understand that the following Cloudflare settings and preferences will result in visitors being unable to visit your domain unless you have uploaded a custom certificate or purchased an advanced certificate.
|
|
6
|
+
|
|
7
|
+
* HSTS
|
|
8
|
+
* Always Use HTTPS
|
|
9
|
+
* Opportunistic Encryption
|
|
10
|
+
* Onion Routing
|
|
11
|
+
* Any Page Rules redirecting traffic to HTTPS
|
|
12
|
+
|
|
13
|
+
Similarly, any HTTP redirect to HTTPS at the origin while the Cloudflare proxy is enabled will result in users being unable to visit your site without a valid certificate at Cloudflare's edge.
|
|
14
|
+
|
|
15
|
+
If you do not have a valid custom or advanced certificate at Cloudflare's edge and are unsure if any of the above Cloudflare settings are enabled, or if any HTTP redirects exist at your origin, we advise leaving Universal SSL enabled for your domain.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`edit`,describe:`Patch Universal SSL Settings for a Zone.`,builder:N,handler:async s=>{if(s.dryRun){a({command:`cf ssl universal settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/ssl/universal/settings`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?r({enabled:s.enabled}):n(s.body)});return}let c=await t(s),l=await e({zone:s.zone},c,{quiet:s.quiet});if(s.zoneId=l,s.body){let e=n(s.body);i(await o(`Updating`,async()=>c.ssl.universal.settings.edit({body:e,zone_id:l})),{successLabel:`Updated`});return}let u=r({enabled:s.enabled});i(await o(`Updating`,async()=>c.ssl.universal.settings.edit({body:u,zone_id:l})),{successLabel:`Updated`})}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get`,describe:`Get Universal SSL Settings for a Zone.`,builder:F,handler:async n=>{if(n.dryRun){a({command:`cf ssl universal settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/ssl/universal/settings`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.ssl.universal.settings.get({zone_id:s})),{successLabel:`Loaded`})}},L={command:`settings`,describe:`Operations for universal.settings`,builder:e=>e.command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`universal`,describe:`Operations for universal`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.positional(`certificate-pack-id`,{type:`string`,description:`Certificate Pack UUID.`,demandOption:!0}).option(`validation-method`,{type:`string`,description:`Desired validation method.`,choices:[`http`,`cname`,`txt`,`email`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`edit <certificate-pack-id>`,describe:`Edit SSL validation method for a certificate pack. A PATCH request will request an immediate validation check on any certificate, and return the updated status. If a validation method is provided, the validation will be immediately attempted using that method.`,builder:z,handler:async l=>{if(l.dryRun){a({command:`cf ssl verification edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/ssl/verification/${l[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(l[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(l[`certificate-pack-id`]??``),"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({validation_method:s(l[`validation-method`],`validation-method`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.ssl.verification.edit({...e,zone_id:d,certificate_pack_id:l[`certificate-pack-id`]})),{successLabel:`Updated`});return}l[`validation-method`]===void 0&&(l[`validation-method`]=await c(`validation-method`,`Desired validation method.`,[`http`,`cname`,`txt`,`email`]));let f=r({validation_method:s(l[`validation-method`],`validation-method`,`text`)});i(await o(`Updating`,async()=>u.ssl.verification.edit({...f,zone_id:d,certificate_pack_id:l[`certificate-pack-id`]})),{successLabel:`Updated`})}};function V(e){return e.option(`retry`,{type:`string`,description:`Immediately retry SSL Verification.`,choices:[`true`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get`,describe:`Get SSL Verification Info for a Zone.`,builder:u(V),handler:async n=>{let r={retry:n.retry};if(n.dryRun){a({command:`cf ssl verification get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/ssl/verification`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.ssl.verification.get({zone_id:c,...r})),{successLabel:`Loaded`})}},U={command:`verification`,describe:`Operations for verification`,builder:e=>e.command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`ssl`,describe:`SSL/TLS certificate management — certificate packs, Universal SSL, verification, and TLS mode recommendations`,builder:e=>e.command(p).command(v).command(M).command(R).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{W as default};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{i as n,n as r}from"./auth-DX9KnJ0P.mjs";import{n as i,r as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-CL8I-7YK.mjs";import{n as u,t as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";import{r as p,t as m}from"./prompt-q3B7sM2A.mjs";import{t as h}from"./cli-types-DGgEbf8K.mjs";import{n as g,t as _}from"./raw-fetch-bIXC9D1m.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 n=>{if(n.dryRun){c({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/copy`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?o({label:u(n.label,`label`,`text`),url:u(n.url,`url`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.audioTracks.copy({...e,account_id:d,identifier:n.identifier})),{successLabel:`Created`});return}n.label===void 0&&(n.label=await p(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let m=o({label:u(n.label,`label`,`text`),url:u(n.url,`url`,`text`)});s(await l(`Creating`,async()=>a.stream.audioTracks.copy({...m,account_id:d,identifier:n.identifier})),{successLabel:`Created`})}};function v(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 y={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:v,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/${n[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(n[`audio-identifier`]))}`,pathParams:{identifier:String(n.identifier??``),"audio-identifier":String(n[`audio-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.audioTracks.delete({account_id:a,identifier:n.identifier,audio_identifier:n[`audio-identifier`]})),{successLabel:`Deleted`})}};function b(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 x={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:b,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/${n[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(n[`audio-identifier`]))}`,pathParams:{identifier:String(n.identifier??``),"audio-identifier":String(n[`audio-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({default:n.default,label:u(n.label,`label`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.audioTracks.edit({...e,account_id:d,identifier:n.identifier,audio_identifier:n[`audio-identifier`]})),{successLabel:`Updated`});return}let p=o({default:n.default,label:u(n.label,`label`,`text`)});s(await l(`Updating`,async()=>a.stream.audioTracks.edit({...p,account_id:d,identifier:n.identifier,audio_identifier:n[`audio-identifier`]})),{successLabel:`Updated`})}};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 additional audio tracks on a video. Note this API will not return information for audio attached to the video upload.`,builder:S,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.audioTracks.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}},w={command:`audio-tracks`,describe:`Operations for audio-tracks`,builder:e=>e.command(te).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(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 E={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:T,handler:async n=>{if(n.dryRun){c({command:`cf stream captions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.captions.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}};function D(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 O={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:D,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}/generate`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.captions.language.create({account_id:a,identifier:n.identifier,language:n.language})),{successLabel:`Created`})}};function k(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 A={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:k,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.captions.language.delete({account_id:a,identifier:n.identifier,language:n.language})),{successLabel:`Deleted`})}};function j(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 M={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:j,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.captions.language.get({account_id:a,identifier:n.identifier,language:n.language})),{successLabel:`Loaded`})}};function N(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 P={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:N,handler:async i=>{if(i.dryRun){c({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${i.identifier==null?`<identifier>`:encodeURIComponent(String(i.identifier))}/captions/${i.language==null?`<language>`:encodeURIComponent(String(i.language))}`,pathParams:{language:String(i.language??``),identifier:String(i.identifier??``)},bodyKind:`multipart`,body:{body:i.body,file:i.file}});return}let a=await r(i),o=i.local?f:await e();if(i.accountId=o,i.file!==void 0||i.body!==void 0){let e=new FormData;if(i.file){let t=d(i.file);e.append(`file`,new Blob([t]),i.file.split(/[\\/]/).filter(Boolean).pop())}else i.body!==void 0&&e.append(`file`,i.body);s(await l(`Updating`,async()=>n(a,`PUT`,`/accounts/${o}/stream/${encodeURIComponent(String(i.identifier))}/captions/${encodeURIComponent(String(i.language))}`,{body:e})),{successLabel:`Updated`});return}if(i.body){let e=u(i.body,`body`,`binary`);s(await l(`Updating`,async()=>n(a,`PUT`,`/accounts/${o}/stream/${encodeURIComponent(String(i.identifier))}/captions/${encodeURIComponent(String(i.language))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(i.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function F(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 I={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:F,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language vtt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}/vtt`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}await r(n);let i=n.local?f:await e();n.accountId=i,g((await l(`Loading`,async()=>_(`/accounts/${i}/stream/${encodeURIComponent(String(n.identifier))}/captions/${encodeURIComponent(String(n.language))}/vtt`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}))).toString(`utf-8`))}},L={command:`vtt`,describe:`Operations for captions.language.vtt`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`language`,describe:`Operations for captions.language`,builder:e=>e.command(O).command(A).command(M).command(P).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`captions`,describe:`Operations for captions`,builder:e=>e.command(E).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(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 V={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:B,handler:async n=>{if(n.dryRun){c({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({allowedOrigins:n[`allowed-origins`],clippedFromVideoUID:u(n[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:u(n.creator,`creator`,`text`),endTimeSeconds:n[`end-time-seconds`],input:u(n.input,`input`,`text`),name:u(n.name,`name`,`text`),requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:n[`start-time-seconds`],thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],url:u(n.url,`url`,`text`),watermark:{uid:u(n[`watermark-uid`],`watermark-uid`,`text`)}}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.clip.create({...e,account_id:d})),{successLabel:`Created`});return}if(n[`clipped-from-video-uid`]===void 0&&(n[`clipped-from-video-uid`]=await p(`clipped-from-video-uid`,`The unique video identifier (UID).`)),n[`end-time-seconds`]===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(n[`start-time-seconds`]===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let m=o({allowedOrigins:n[`allowed-origins`],clippedFromVideoUID:u(n[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:u(n.creator,`creator`,`text`),endTimeSeconds:n[`end-time-seconds`],input:u(n.input,`input`,`text`),name:u(n.name,`name`,`text`),requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:n[`start-time-seconds`],thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],url:u(n.url,`url`,`text`),watermark:{uid:u(n[`watermark-uid`],`watermark-uid`,`text`)}});s(await l(`Creating`,async()=>a.stream.clip.create({...m,account_id:d})),{successLabel:`Created`})}},H={command:`clip`,describe:`Operations for clip`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(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 W={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:U,handler:async d=>{let p={};if(d[`upload-creator`]!==void 0&&(p[`Upload-Creator`]=String(d[`upload-creator`])),d.dryRun){c({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:d.body===void 0?o({allowedOrigins:d[`allowed-origins`],creator:u(d.creator,`creator`,`text`),input:u(d.input,`input`,`text`),name:u(d.name,`name`,`text`),requireSignedURLs:d[`require-signed-urls`],scheduledDeletion:u(d[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:d[`thumbnail-timestamp-pct`],url:u(d.url,`url`,`text`),watermark:{uid:u(d[`watermark-uid`],`watermark-uid`,`text`)}}):i(d.body)});return}let m=await r(d),h=d.local?f:await e();if(d.accountId=h,d.body){let e=i(d.body);s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/copy`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`});return}let g={};d[`allowed-origins`]!==void 0&&a(g,[`allowedOrigins`],d[`allowed-origins`]),d.creator!==void 0&&a(g,[`creator`],u(d.creator,`creator`,`text`)),d.input!==void 0&&a(g,[`input`],u(d.input,`input`,`text`)),d.name!==void 0&&a(g,[`name`],u(d.name,`name`,`text`)),d[`require-signed-urls`]!==void 0&&a(g,[`requireSignedURLs`],d[`require-signed-urls`]),d[`scheduled-deletion`]!==void 0&&a(g,[`scheduledDeletion`],u(d[`scheduled-deletion`],`scheduled-deletion`,`text`)),d[`thumbnail-timestamp-pct`]!==void 0&&a(g,[`thumbnailTimestampPct`],d[`thumbnail-timestamp-pct`]),d.url!==void 0&&a(g,[`url`],u(d.url,`url`,`text`)),d[`watermark-uid`]!==void 0&&a(g,[`watermark`,`uid`],u(d[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/copy`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},G={command:`copy`,describe:`Operations for copy`,builder:e=>e.command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.option(`direct-user`,{type:`boolean`,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 q={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:K,handler:async i=>{let a={direct_user:i[`direct-user`]},o={};if(i[`tus-resumable`]!==void 0&&(o[`Tus-Resumable`]=String(i[`tus-resumable`])),i[`upload-creator`]!==void 0&&(o[`Upload-Creator`]=String(i[`upload-creator`])),i[`upload-length`]!==void 0&&(o[`Upload-Length`]=String(i[`upload-length`])),i[`upload-metadata`]!==void 0&&(o[`Upload-Metadata`]=String(i[`upload-metadata`])),i.dryRun){c({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream`,pathParams:{},query:a,bodyKind:`none`});return}let u=await r(i),d=i.local?f:await e();i.accountId=d,s(await l(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/stream`,{query:a,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Created`})}};function J(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 Y={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:J,handler:async n=>{if(n.dryRun){c({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function X(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 Z={command:`create`,describe:`Creates a direct upload that allows video uploads without an API key.`,builder:X,handler:async d=>{let p={};if(d[`upload-creator`]!==void 0&&(p[`Upload-Creator`]=String(d[`upload-creator`])),d.dryRun){c({command:`cf stream direct-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/direct_upload`,pathParams:{},bodyKind:`json`,body:d.body===void 0?o({allowedOrigins:d[`allowed-origins`],creator:u(d.creator,`creator`,`text`),expiry:u(d.expiry,`expiry`,`text`),maxDurationSeconds:d[`max-duration-seconds`],requireSignedURLs:d[`require-signed-urls`],scheduledDeletion:u(d[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:d[`thumbnail-timestamp-pct`],watermark:{uid:u(d[`watermark-uid`],`watermark-uid`,`text`)}}):i(d.body)});return}let m=await r(d),h=d.local?f:await e();if(d.accountId=h,d.body){let e=i(d.body);s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/direct_upload`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`});return}if(d[`max-duration-seconds`]===void 0)throw Error(`--max-duration-seconds is required (or pass --body with this field set).`);let g={};d[`allowed-origins`]!==void 0&&a(g,[`allowedOrigins`],d[`allowed-origins`]),d.creator!==void 0&&a(g,[`creator`],u(d.creator,`creator`,`text`)),d.expiry!==void 0&&a(g,[`expiry`],u(d.expiry,`expiry`,`text`)),d[`max-duration-seconds`]!==void 0&&a(g,[`maxDurationSeconds`],d[`max-duration-seconds`]),d[`require-signed-urls`]!==void 0&&a(g,[`requireSignedURLs`],d[`require-signed-urls`]),d[`scheduled-deletion`]!==void 0&&a(g,[`scheduledDeletion`],u(d[`scheduled-deletion`],`scheduled-deletion`,`text`)),d[`thumbnail-timestamp-pct`]!==void 0&&a(g,[`thumbnailTimestampPct`],d[`thumbnail-timestamp-pct`]),d[`watermark-uid`]!==void 0&&a(g,[`watermark`,`uid`],u(d[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/direct_upload`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},Q={command:`direct-upload`,describe:`Operations for direct-upload`,builder:e=>e.command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(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 re={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:ne,handler:async n=>{if(n.dryRun){c({command:`cf stream downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.downloads.create({account_id:a,identifier:n.identifier})),{successLabel:`Created`})}};function ie(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 ae={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:ie,handler:async n=>{if(n.dryRun){c({command:`cf stream downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.downloads.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function oe(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 se={command:`get <identifier>`,describe:`Lists the downloads created for a video.`,builder:oe,handler:async n=>{if(n.dryRun){c({command:`cf stream downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.downloads.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}},ce={command:`downloads`,describe:`Operations for downloads`,builder:e=>e.command(re).command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(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 ue={command:`edit <identifier>`,describe:`Edit details for a single video.`,builder:le,handler:async n=>{if(n.dryRun){c({command:`cf stream edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?o({allowedOrigins:n[`allowed-origins`],creator:u(n.creator,`creator`,`text`),maxDurationSeconds:n[`max-duration-seconds`],publicDetails:{channel_link:u(n[`public-details-channel-link`],`public-details-channel-link`,`text`),logo:u(n[`public-details-logo`],`public-details-logo`,`text`),share_link:u(n[`public-details-share-link`],`public-details-share-link`,`text`),title:u(n[`public-details-title`],`public-details-title`,`text`)},requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],uid:u(n.uid,`uid`,`text`),uploadExpiry:u(n[`upload-expiry`],`upload-expiry`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.edit({...e,account_id:d,identifier:n.identifier})),{successLabel:`Created`});return}let p=o({allowedOrigins:n[`allowed-origins`],creator:u(n.creator,`creator`,`text`),maxDurationSeconds:n[`max-duration-seconds`],publicDetails:{channel_link:u(n[`public-details-channel-link`],`public-details-channel-link`,`text`),logo:u(n[`public-details-logo`],`public-details-logo`,`text`),share_link:u(n[`public-details-share-link`],`public-details-share-link`,`text`),title:u(n[`public-details-title`],`public-details-title`,`text`)},requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],uid:u(n.uid,`uid`,`text`),uploadExpiry:u(n[`upload-expiry`],`upload-expiry`,`text`)});s(await l(`Creating`,async()=>a.stream.edit({...p,account_id:d,identifier:n.identifier})),{successLabel:`Created`})}};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 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:de,handler:async n=>{if(n.dryRun){c({command:`cf stream embed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/embed`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}await r(n);let i=n.local?f:await e();n.accountId=i,g((await l(`Loading`,async()=>_(`/accounts/${i}/stream/${encodeURIComponent(String(n.identifier))}/embed`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}))).toString(`utf-8`))}},pe={command:`embed`,describe:`Operations for embed`,builder:e=>e.command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(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 he={command:`get <identifier>`,describe:`Fetches details for a single video.`,builder:me,handler:async n=>{if(n.dryRun){c({command:`cf stream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}};function ge(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={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:ge,handler:async n=>{if(n.dryRun){c({command:`cf stream keys create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.keys.create({account_id:a})),{successLabel:`Created`})}};function ve(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})}const ye={command:`delete <identifier>`,describe:`Deletes signing keys and revokes all signed URLs generated with the key.`,builder:ve,handler:async n=>{if(n.dryRun){c({command:`cf stream keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/keys/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.keys.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get`,describe:`Lists the video ID and creation date and time when a signing key was created.`,builder:be,handler:async n=>{if(n.dryRun){c({command:`cf stream keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.keys.get({account_id:a})),{successLabel:`Loaded`})}},Se={command:`keys`,describe:`Operations for keys`,builder:e=>e.command(_e).command(ye).command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(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:`boolean`,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:`boolean`,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 we={command:`list`,describe:`Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.`,builder:h(Ce),handler:async n=>{let i={status:n.status,creator:n.creator,type:n.type,asc:n.asc,video_name:n[`video-name`],search:n.search,start:n.start,end:n.end,include_counts:n[`include-counts`],id:n.id,name:n.name,live_input_id:n[`live-input-id`],before:n.before,after:n.after,limit:n.limit};if(n.dryRun){c({command:`cf stream list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?f:await e();n.accountId=o,s(await l(`Loading`,async()=>a.stream.list({account_id:o,...i})),{successLabel:`Loaded`})}};function Te(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(`prefer-low-latency`,{type:`boolean`,description:`When enabled, the live stream is delivered using Low-Latency HLS (LL-HLS), reducing glass-to-glass latency for viewers at the cost of reduced player compatibility.`,default:!1}).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 Ee={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:Te,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.liveInputs.create({...e,account_id:d})),{successLabel:`Created`});return}let p=o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}});s(await l(`Creating`,async()=>a.stream.liveInputs.create({...p,account_id:d})),{successLabel:`Created`})}};function De(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 Oe={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:De,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.liveInputs.delete({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Deleted`})}};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}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={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:ke,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs disable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/disable`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.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()=>i.stream.liveInputs.disable.create({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Deleted`})}},je={command:`disable`,describe:`Operations for live-inputs.disable`,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:`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:Me,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs enable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/enable`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.liveInputs.enable.create({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}},Pe={command:`enable`,describe:`Operations for live-inputs.enable`,builder:e=>e.command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(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 Ie={command:`get <live-input-identifier>`,describe:`Retrieves details of an existing live input.`,builder:Fe,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.liveInputs.get({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Loaded`})}};function Le(e){return e.option(`include-counts`,{type:`boolean`,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 Re={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:Le,handler:async n=>{let i={include_counts:n[`include-counts`]};if(n.dryRun){c({command:`cf stream live-inputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?f:await e();n.accountId=o,s(await l(`Loading`,async()=>a.stream.liveInputs.list({account_id:o,...i})),{successLabel:`Loaded`})}};function ze(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 Be={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:ze,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({enabled:n.enabled,streamKey:u(n[`stream-key`],`stream-key`,`text`),url:u(n.url,`url`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.liveInputs.outputs.create({...e,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`});return}n[`stream-key`]===void 0&&(n[`stream-key`]=await p(`stream-key`,`The streamKey used to authenticate against an output's target.`,{kind:`secret`})),n.url===void 0&&(n.url=await p(`url`,`The URL an output uses to restream.`,{kind:`secret`}));let m=o({enabled:n.enabled,streamKey:u(n[`stream-key`],`stream-key`,`text`),url:u(n.url,`url`,`text`)});s(await l(`Creating`,async()=>a.stream.liveInputs.outputs.create({...m,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}};function Ve(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})}const He={command:`delete <output-identifier>`,describe:`Deletes an output and removes it from the associated live input.`,builder:Ve,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs/${n[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(n[`output-identifier`]))}`,pathParams:{"output-identifier":String(n[`output-identifier`]??``),"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
11
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.liveInputs.outputs.delete({account_id:a,live_input_identifier:n[`live-input-identifier`],output_identifier:n[`output-identifier`]})),{successLabel:`Deleted`})}};function Ue(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 We={command:`list`,describe:`Retrieves all outputs associated with a specified live input.`,builder:Ue,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.liveInputs.outputs.list({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Loaded`})}};function Ge(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 Ke={command:`update <output-identifier>`,describe:`Updates the state of an output.`,builder:Ge,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs/${n[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(n[`output-identifier`]))}`,pathParams:{"output-identifier":String(n[`output-identifier`]??``),"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({enabled:n.enabled}):i(n.body)});return}let a=await r(n),u=n.local?f:await e();if(n.accountId=u,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.liveInputs.outputs.update({...e,account_id:u,live_input_identifier:n[`live-input-identifier`],output_identifier:n[`output-identifier`]})),{successLabel:`Updated`});return}if(n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let d=o({enabled:n.enabled});s(await l(`Updating`,async()=>a.stream.liveInputs.outputs.update({...d,account_id:u,live_input_identifier:n[`live-input-identifier`],output_identifier:n[`output-identifier`]})),{successLabel:`Updated`})}},qe={command:`outputs`,describe:`Operations for live-inputs.outputs`,builder:e=>e.command(Be).command(He).command(We).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(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 Ye={command:`update <live-input-identifier>`,describe:`Rotates the credentials for a live input without changing its identifier. Old credentials are revoked, broadcasts using stale credentials are automatically disconnected shortly after rotation, and the response returns refreshed credentials.`,builder:Je,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs rotate update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/rotate_keys`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.liveInputs.rotate.update({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}},Xe={command:`rotate`,describe:`Operations for live-inputs.rotate`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(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(`prefer-low-latency`,{type:`boolean`,description:`When enabled, the live stream is delivered using Low-Latency HLS (LL-HLS), reducing glass-to-glass latency for viewers at the cost of reduced player compatibility.`}).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 Qe={command:`update <live-input-identifier>`,describe:`Updates a specified live input.`,builder:Ze,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.liveInputs.update({...e,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Updated`});return}let p=o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}});s(await l(`Updating`,async()=>a.stream.liveInputs.update({...p,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Updated`})}},$e={command:`live-inputs`,describe:`Operations for live-inputs`,builder:e=>e.command(Ee).command(Oe).command(Ie).command(Re).command(Qe).command(je).command(Pe).command(qe).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(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 tt={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:et,handler:async n=>{if(n.dryRun){c({command:`cf stream token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/token`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?o({downloadable:n.downloadable,exp:n.exp,flags:{original:n[`flags-original`]},id:u(n.id,`id`,`text`),nbf:n.nbf,pem:u(n.pem,`pem`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.token.create({...e,account_id:d,identifier:n.identifier})),{successLabel:`Created`});return}let p=o({downloadable:n.downloadable,exp:n.exp,flags:{original:n[`flags-original`]},id:u(n.id,`id`,`text`),nbf:n.nbf,pem:u(n.pem,`pem`,`text`)});s(await l(`Creating`,async()=>a.stream.token.create({...p,account_id:d,identifier:n.identifier})),{successLabel:`Created`})}},nt={command:`token`,describe:`Operations for token`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rt(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 it={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:h(rt),handler:async n=>{if(n.dryRun){c({command:`cf stream typed-downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads/${n[`download-type`]==null?`<download-type>`:encodeURIComponent(String(n[`download-type`]))}`,pathParams:{identifier:String(n.identifier??``),"download-type":String(n[`download-type`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.typedDownloads.create({account_id:a,identifier:n.identifier,download_type:n[`download-type`]})),{successLabel:`Created`})}};function at(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 ot={command:`delete <download-type>`,describe:`Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.`,builder:h(at),handler:async n=>{if(n.dryRun){c({command:`cf stream typed-downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads/${n[`download-type`]==null?`<download-type>`:encodeURIComponent(String(n[`download-type`]))}`,pathParams:{identifier:String(n.identifier??``),"download-type":String(n[`download-type`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
12
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.typedDownloads.delete({account_id:a,identifier:n.identifier,download_type:n[`download-type`]})),{successLabel:`Deleted`})}},st={command:`typed-downloads`,describe:`Operations for typed-downloads`,builder:e=>e.command(it).command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ct(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 lt={command:`storage-usage`,describe:`Returns information about an account's storage use.`,builder:ct,handler:async n=>{let i={creator:n.creator};if(n.dryRun){c({command:`cf stream videos storage-usage`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/storage-usage`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?f:await e();n.accountId=o,s(await l(`Loading`,async()=>a.stream.videos.storageUsage({account_id:o,...i})),{successLabel:`Loaded`})}},ut={command:`videos`,describe:`Operations for videos`,builder:e=>e.command(lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dt(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 ft={command:`create`,describe:"Creates watermark profiles using a single `HTTP POST multipart/form-data` request.",builder:dt,handler:async o=>{if(o.dryRun){c({command:`cf stream watermarks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`multipart`,body:{name:o.name,opacity:o.opacity,padding:o.padding,position:o.position,scale:o.scale,url:o.url,body:o.body,file:o.file}});return}let p=await r(o),m=o.local?f:await e();if(o.accountId=m,o.file!==void 0||o.body!==void 0||o.name!==void 0||o.opacity!==void 0||o.padding!==void 0||o.position!==void 0||o.scale!==void 0){let e=new FormData;if(o.file){let t=d(o.file);e.append(`file`,new Blob([t]),o.file.split(/[\\/]/).filter(Boolean).pop())}else o.body!==void 0&&e.append(`file`,o.body);o.name!==void 0&&e.append(`name`,String(u(o.name,`name`,`text`)??``)),o.opacity!==void 0&&e.append(`opacity`,String(o.opacity)),o.padding!==void 0&&e.append(`padding`,String(o.padding)),o.position!==void 0&&e.append(`position`,String(u(o.position,`position`,`text`)??``)),o.scale!==void 0&&e.append(`scale`,String(o.scale)),s(await l(`Creating`,async()=>n(p,`POST`,`/accounts/${m}/stream/watermarks`,{body:e})),{successLabel:`Created`});return}if(o.body){let e=i(o.body);s(await l(`Creating`,async()=>n(p,`POST`,`/accounts/${m}/stream/watermarks`,{body:e})),{successLabel:`Created`});return}let h={};o.name!==void 0&&a(h,[`name`],u(o.name,`name`,`text`)),o.opacity!==void 0&&a(h,[`opacity`],o.opacity),o.padding!==void 0&&a(h,[`padding`],o.padding),o.position!==void 0&&a(h,[`position`],u(o.position,`position`,`text`)),o.scale!==void 0&&a(h,[`scale`],o.scale),o.url!==void 0&&a(h,[`url`],u(o.url,`url`,`text`)),s(await l(`Creating`,async()=>n(p,`POST`,`/accounts/${m}/stream/watermarks`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function $(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 pt={command:`delete <identifier>`,describe:`Deletes a watermark profile.`,builder:$,handler:async n=>{if(n.dryRun){c({command:`cf stream watermarks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
13
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.watermarks.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function mt(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 ht={command:`get <identifier>`,describe:`Retrieves details for a single watermark profile.`,builder:mt,handler:async n=>{if(n.dryRun){c({command:`cf stream watermarks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.watermarks.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}};function gt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`list`,describe:`Lists all watermark profiles for an account.`,builder:gt,handler:async n=>{if(n.dryRun){c({command:`cf stream watermarks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.watermarks.list({account_id:a})),{successLabel:`Loaded`})}},vt={command:`watermarks`,describe:`Operations for watermarks`,builder:e=>e.command(ft).command(pt).command(ht).command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yt(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 bt={command:`delete`,describe:`Deletes a webhook.`,builder:yt,handler:async n=>{if(n.dryRun){c({command:`cf stream webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
14
|
+
`);return}s(await l(`Deleting`,async()=>i.stream.webhooks.delete({account_id:a})),{successLabel:`Deleted`})}};function xt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const St={command:`get`,describe:`Retrieves a list of webhooks.`,builder:xt,handler:async n=>{if(n.dryRun){c({command:`cf stream webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.webhooks.get({account_id:a})),{successLabel:`Loaded`})}};function Ct(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 wt={command:`update`,describe:`Creates a webhook notification.`,builder:Ct,handler:async n=>{if(n.dryRun){c({command:`cf stream webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({notificationUrl:u(n[`notification-url`],`notification-url`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.webhooks.update({...e,account_id:d})),{successLabel:`Updated`});return}let p=o({notificationUrl:u(n[`notification-url`],`notification-url`,`text`)});s(await l(`Updating`,async()=>a.stream.webhooks.update({...p,account_id:d})),{successLabel:`Updated`})}},Tt={command:`webhooks`,describe:`Operations for webhooks`,builder:e=>e.command(bt).command(St).command(wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Et={command:`stream`,describe:`stream`,builder:e=>e.command(q).command(Y).command(ue).command(he).command(we).command(w).command(z).command(H).command(G).command(Q).command(ce).command(pe).command(Se).command($e).command(nt).command(st).command(ut).command(vt).command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Et as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e}from"./auth-
|
|
2
|
+
import{n as e}from"./auth-DX9KnJ0P.mjs";import{t}from"./output-B6fBFRqe.mjs";import{n,t as r}from"./progress-CL8I-7YK.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({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},o={command:`account-types`,describe:`Operations for account-types`,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({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},l={command:`accounts`,describe:`Operations for accounts`,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({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},f={command:`entitlements`,describe:`Operations for entitlements`,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({tenant_id: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({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},_={command:`memberships`,describe:`Operations for memberships`,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,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{n as c,r as l,t as u}from"./prompt-q3B7sM2A.mjs";import{t as d}from"./cli-types-DGgEbf8K.mjs";function f(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`title`,{type:`string`,description:`The title field`}).option(`token-type`,{type:`string`,description:`The token_type field`,choices:[`JWT`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`create`,describe:`Create a new Token Validation configuration`,builder:f,handler:async u=>{if(u.dryRun){a({command:`cf token-validation configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/token_validation/config`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?r({description:s(u.description,`description`,`text`),title:s(u.title,`title`,`text`),token_type:s(u[`token-type`],`token-type`,`text`)}):n(u.body)});return}let d=await t(u),f=await e({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=n(u.body);i(await o(`Creating`,async()=>d.tokenValidation.configuration.create({...e,zone_id:f})),{successLabel:`Created`});return}u.description===void 0&&(u.description=await l(`description`,`The description field`)),u.title===void 0&&(u.title=await l(`title`,`The title field`)),u[`token-type`]===void 0&&(u[`token-type`]=await c(`token-type`,`The token_type field`,[`JWT`]));let p=r({description:s(u.description,`description`,`text`),title:s(u.title,`title`,`text`),token_type:s(u[`token-type`],`token-type`,`text`)});i(await o(`Creating`,async()=>d.tokenValidation.configuration.create({...p,zone_id:f})),{successLabel:`Created`})}};function m(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request payload for create and PUT credentials operations. Provided keys define the complete stored key set. Key identities (`{alg,kid}`) must be unique."})}const h={command:`update <config-id>`,describe:'Update Token Configuration credentials with full replacement semantics. Key identities (`{alg,kid}`) must be unique within the request. Symmetric keys (`kty: "oct"`) require `k`; `k: null` is invalid.',builder:m,handler:async r=>{if(r.dryRun){a({command:`cf token-validation configuration credentials update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/token_validation/config/${r[`config-id`]==null?`<config-id>`:encodeURIComponent(String(r[`config-id`]))}/credentials`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),"config-id":String(r[`config-id`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:n(r.body)});return}let s=await t(r),c=await e({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,r.body){let e=n(r.body);i(await o(`Updating`,async()=>s.tokenValidation.configuration.credentials.update({body:e,zone_id:c,config_id:r[`config-id`]})),{successLabel:`Updated`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`credentials`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration 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 v={command:`delete <config-id>`,describe:`Delete Token Configuration`,builder:_,handler:async n=>{if(n.dryRun){a({command:`cf token-validation configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/config/${n[`config-id`]==null?`<config-id>`:encodeURIComponent(String(n[`config-id`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"config-id":String(n[`config-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await u({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>r.tokenValidation.configuration.delete({zone_id:s,config_id:n[`config-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`title`,{type:`string`,description:`The title field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`edit <config-id>`,describe:`Edit fields of an existing Token Configuration`,builder:y,handler:async c=>{if(c.dryRun){a({command:`cf token-validation configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/token_validation/config/${c[`config-id`]==null?`<config-id>`:encodeURIComponent(String(c[`config-id`]))}`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``),"config-id":String(c[`config-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({description:s(c.description,`description`,`text`),title:s(c.title,`title`,`text`)}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.tokenValidation.configuration.edit({...e,zone_id:u,config_id:c[`config-id`]})),{successLabel:`Updated`});return}let d=r({description:s(c.description,`description`,`text`),title:s(c.title,`title`,`text`)});i(await o(`Updating`,async()=>l.tokenValidation.configuration.edit({...d,zone_id:u,config_id:c[`config-id`]})),{successLabel:`Updated`})}};function x(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <config-id>`,describe:`Get a single Token Configuration`,builder:x,handler:async n=>{if(n.dryRun){a({command:`cf token-validation configuration get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/config/${n[`config-id`]==null?`<config-id>`:encodeURIComponent(String(n[`config-id`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"config-id":String(n[`config-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.tokenValidation.configuration.get({zone_id:s,config_id:n[`config-id`]})),{successLabel:`Loaded`})}};function C(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Lists all token validation configurations for this zone`,builder:C,handler:async n=>{let r={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf token-validation configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/config`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.tokenValidation.configuration.list({zone_id:c,...r})),{successLabel:`Loaded`})}},T={command:`configuration`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(p).command(v).command(b).command(S).command(w).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`bulk-create`,describe:`Create zone token validation rules. A request can create multiple Token Validation Rules.`,builder:E,handler:async r=>{if(r.dryRun){a({command:`cf token-validation rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/token_validation/rules/bulk`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:n(r.body)});return}let s=await t(r),c=await e({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,r.body){let e=n(r.body);i(await o(`Creating`,async()=>s.tokenValidation.rules.bulkCreate({body:e,zone_id:c})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function O(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 k={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:O,handler:async r=>{if(r.dryRun){a({command:`cf token-validation rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/token_validation/rules/bulk`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:n(r.body)});return}let s=await t(r),c=await e({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,r.body){let e=n(r.body);i(await o(`Updating`,async()=>s.tokenValidation.rules.bulkEdit({body:e,zone_id:c})),{successLabel:`Updated`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function A(e){return e.option(`action`,{type:`string`,description:"Action to take on requests that match operations included in `selector` and fail `expression`.",choices:[`log`,`block`]}).option(`description`,{type:`string`,description:"A human-readable description that gives more details than `title`."}).option(`enabled`,{type:`boolean`,description:`Toggle rule on or off.`}).option(`expression`,{type:`string`,description:`Rule expression. Requests that fail to match this expression will be subject to \`action\`.
|
|
4
|
+
|
|
5
|
+
For details on expressions, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/).
|
|
6
|
+
`}).option(`title`,{type:`string`,description:`A human-readable name for the rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`create`,describe:`Create a token validation rule.`,builder:A,handler:async u=>{if(u.dryRun){a({command:`cf token-validation rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/token_validation/rules`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?r({action:s(u.action,`action`,`text`),description:s(u.description,`description`,`text`),enabled:u.enabled,expression:s(u.expression,`expression`,`text`),title:s(u.title,`title`,`text`)}):n(u.body)});return}let d=await t(u),f=await e({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=n(u.body);i(await o(`Creating`,async()=>d.tokenValidation.rules.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(u.action===void 0&&(u.action=await c(`action`,"Action to take on requests that match operations included in `selector` and fail `expression`.",[`log`,`block`])),u.description===void 0&&(u.description=await l(`description`,"A human-readable description that gives more details than `title`.")),u.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);u.expression===void 0&&(u.expression=await l(`expression`,"Rule expression. Requests that fail to match this expression will be subject to `action`. For details on expressions, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). ")),u.title===void 0&&(u.title=await l(`title`,`A human-readable name for the rule.`));let p=r({action:s(u.action,`action`,`text`),description:s(u.description,`description`,`text`),enabled:u.enabled,expression:s(u.expression,`expression`,`text`),title:s(u.title,`title`,`text`)});i(await o(`Creating`,async()=>d.tokenValidation.rules.create({body:p,zone_id:f})),{successLabel:`Created`})}};function M(e){return e.positional(`rule-id`,{type:`string`,description:`Token Validation 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 N={command:`delete <rule-id>`,describe:`Delete a zone token validation rule.`,builder:M,handler:async n=>{if(n.dryRun){a({command:`cf token-validation rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await u({force:!!n.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}i(await o(`Deleting`,async()=>r.tokenValidation.rules.delete({zone_id:s,rule_id:n[`rule-id`]})),{successLabel:`Deleted`})}};function P(e){return e.positional(`rule-id`,{type:`string`,description:`Token Validation Rule ID`,demandOption:!0}).option(`action`,{type:`string`,description:"Action to take on requests that match operations included in `selector` and fail `expression`.",choices:[`log`,`block`]}).option(`description`,{type:`string`,description:"A human-readable description that gives more details than `title`."}).option(`enabled`,{type:`boolean`,description:`Toggle rule on or off.`}).option(`expression`,{type:`string`,description:`Rule expression. Requests that fail to match this expression will be subject to \`action\`.
|
|
8
|
+
|
|
9
|
+
For details on expressions, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/).
|
|
10
|
+
`}).option(`title`,{type:`string`,description:`A human-readable name for the rule.`}).option(`position-index`,{type:`number`,description:`Move rule to this position`}).option(`position-before`,{type:`string`,description:`Move rule to before rule with this ID.`}).option(`position-after`,{type:`string`,description:`Move rule to after rule with this ID.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-index`,[`position-before`,`position-after`]).conflicts(`position-before`,[`position-index`,`position-after`]).conflicts(`position-after`,[`position-index`,`position-before`])}const F={command:`edit <rule-id>`,describe:`Edit a zone token validation rule.`,builder:P,handler:async c=>{if(c.dryRun){a({command:`cf token-validation rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/token_validation/rules/${c[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(c[`rule-id`]))}`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``),"rule-id":String(c[`rule-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({action:s(c.action,`action`,`text`),description:s(c.description,`description`,`text`),enabled:c.enabled,expression:s(c.expression,`expression`,`text`),title:s(c.title,`title`,`text`),position:{index:c[`position-index`],before:s(c[`position-before`],`position-before`,`text`),after:s(c[`position-after`],`position-after`,`text`)}}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.tokenValidation.rules.edit({body:e,zone_id:u,rule_id:c[`rule-id`]})),{successLabel:`Updated`});return}let d=r({action:s(c.action,`action`,`text`),description:s(c.description,`description`,`text`),enabled:c.enabled,expression:s(c.expression,`expression`,`text`),title:s(c.title,`title`,`text`),position:{index:c[`position-index`],before:s(c[`position-before`],`position-before`,`text`),after:s(c[`position-after`],`position-after`,`text`)}});i(await o(`Updating`,async()=>l.tokenValidation.rules.edit({body:d,zone_id:u,rule_id:c[`rule-id`]})),{successLabel:`Updated`})}};function I(e){return e.positional(`rule-id`,{type:`string`,description:`Token Validation Rule ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <rule-id>`,describe:`Get a zone token validation rule.`,builder:I,handler:async n=>{if(n.dryRun){a({command:`cf token-validation rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.tokenValidation.rules.get({zone_id:s,rule_id:n[`rule-id`]})),{successLabel:`Loaded`})}};function R(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:`boolean`,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 z={command:`list`,describe:`List token validation rules`,builder:d(R),handler:async n=>{let r={per_page:n[`per-page`],page:n.page,token_configuration:n[`token-configuration`],action:n.action,enabled:n.enabled,id:n.id,rule_id:n[`rule-id`],host:n.host,hostname:n.hostname};if(n.dryRun){a({command:`cf token-validation rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/rules`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.tokenValidation.rules.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function B(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 V={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:d(B),handler:async r=>{let s={per_page:r[`per-page`],page:r.page,state:r.state,host:r.host,hostname:r.hostname,method:r.method,endpoint:r.endpoint};if(r.dryRun){a({command:`cf token-validation rules preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/token_validation/rules/preview`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},query:s,bodyKind:`json`,body:r.body===void 0?void 0:n(r.body)});return}let c=await t(r),l=await e({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,r.body){let e=n(r.body);new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>c.tokenValidation.rules.preview.create({body:e,zone_id:l,...s})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},H={command:`preview`,describe:`Preview token validation rule behavior before applying`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`rules`,describe:`Validation rules that enforce token requirements on specific API endpoints`,builder:e=>e.command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`token-validation`,describe:`Validate JWT tokens at the edge — configure token sources, signing keys, and validation rules`,builder:e=>e.command(T).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{W as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./output-B6fBFRqe.mjs";import{n as t,t as n}from"./metadata-
|
|
2
|
+
import{t as e}from"./output-B6fBFRqe.mjs";import{n as t,t as n}from"./metadata-MPDDi08e.mjs";function r(e){return e.replace(/[\s-]+/g,`_`)}function i(e){let t={type:e.type,description:e.description};return`default`in e&&e.default!==void 0&&(t.default=e.default),e.enum&&e.enum.length>0&&(t.enum=e.enum),t}function a(e){let t={},n=[];for(let r of e.arguments)t[r.name]=i(r),r.required&&n.push(r.name);for(let r of e.options)t[r.name]=i(r),r.required&&n.push(r.name);return{name:r(e.command),description:e.description,inputSchema:{type:`object`,properties:t,required:n}}}const o={command:`tools`,describe:!1,builder:e=>e,handler:async r=>{let i=t(import.meta.url,`commands.json`,n)?.commands??null;if(i===null){console.error(`Warning: Command metadata file not found. Run the build to generate it.`),e({version:`1.0`,tools:[]});return}e({version:`1.0`,tools:i.map(a)})}};export{o as default};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{n as u,r as d,t as f}from"./prompt-q3B7sM2A.mjs";import{t as p}from"./cli-types-DGgEbf8K.mjs";function m(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).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 h={command:`create`,describe:`Lists challenge widgets.`,builder:p(m),handler:async f=>{let p={page:f.page,per_page:f[`per-page`],order:f.order,direction:f.direction,filter:f.filter};if(f.dryRun){o({command:`cf turnstile widgets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets`,pathParams:{},query:p,bodyKind:`json`,body:f.body===void 0?i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)}):r(f.body)});return}let m=await n(f),h=f.local?l:await e();if(f.accountId=h,f.body){let e=r(f.body);new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>m.turnstile.widgets.create({...e,account_id:h,...p})),{successLabel:`Created`});return}if(f.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);f.mode===void 0&&(f.mode=await u(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),f.name===void 0&&(f.name=await d(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let g=i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)});new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>m.turnstile.widgets.create({...g,account_id:h,...p})),{successLabel:`Created`})}};function g(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <sitekey>`,describe:`Destroy a Turnstile Widget.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf turnstile widgets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${r.sitekey==null?`<sitekey>`:encodeURIComponent(String(r.sitekey))}`,pathParams:{sitekey:String(r.sitekey??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await f({force:!!r.force})){process.stderr.write(`Aborted.
|
|
13
|
+
`);return}a(await s(`Deleting`,async()=>i.turnstile.widgets.delete({account_id:c,sitekey:r.sitekey})),{successLabel:`Deleted`})}};function v(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <sitekey>`,describe:`Show a single challenge widget configuration.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf turnstile widgets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${r.sitekey==null?`<sitekey>`:encodeURIComponent(String(r.sitekey))}`,pathParams:{sitekey:String(r.sitekey??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.turnstile.widgets.get({account_id:c,sitekey:r.sitekey})),{successLabel:`Loaded`})}};function b(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all turnstile widgets of an account.`,builder:p(b),handler:async r=>{let i={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction,filter:r.filter};if(r.dryRun){o({command:`cf turnstile widgets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.turnstile.widgets.list({account_id:u,...i})),{successLabel:`Loaded`})}};function S(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,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 C={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:S,handler:async c=>{if(c.dryRun){o({command:`cf turnstile widgets rotate-secret`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${c.sitekey==null?`<sitekey>`:encodeURIComponent(String(c.sitekey))}/rotate_secret`,pathParams:{sitekey:String(c.sitekey??``)},bodyKind:`json`,body:c.body===void 0?i({invalidate_immediately:c[`invalidate-immediately`]}):r(c.body)});return}let u=await n(c),d=c.local?l:await e();if(c.accountId=d,c.body){let e=r(c.body);a(await s(`Creating`,async()=>u.turnstile.widgets.rotateSecret({...e,account_id:d,sitekey:c.sitekey})),{successLabel:`Created`});return}let f=i({invalidate_immediately:c[`invalidate-immediately`]});a(await s(`Creating`,async()=>u.turnstile.widgets.rotateSecret({...f,account_id:d,sitekey:c.sitekey})),{successLabel:`Created`})}};function w(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,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 T={command:`update <sitekey>`,describe:`Update the configuration of a widget.`,builder:w,handler:async f=>{if(f.dryRun){o({command:`cf turnstile widgets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${f.sitekey==null?`<sitekey>`:encodeURIComponent(String(f.sitekey))}`,pathParams:{sitekey:String(f.sitekey??``)},bodyKind:`json`,body:f.body===void 0?i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)}):r(f.body)});return}let p=await n(f),m=f.local?l:await e();if(f.accountId=m,f.body){let e=r(f.body);a(await s(`Updating`,async()=>p.turnstile.widgets.update({...e,account_id:m,sitekey:f.sitekey})),{successLabel:`Updated`});return}if(f.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);f.mode===void 0&&(f.mode=await u(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),f.name===void 0&&(f.name=await d(`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=i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)});a(await s(`Updating`,async()=>p.turnstile.widgets.update({...h,account_id:m,sitekey:f.sitekey})),{successLabel:`Updated`})}},E={command:`widgets`,describe:`Operations for widgets`,builder:e=>e.command(h).command(_).command(y).command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`turnstile`,describe:`turnstile`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{D as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./session-
|
|
2
|
+
import"./session-B8r8LNQN.mjs";import{i as e,n as t,t as n}from"./theme-DbNbIY4d.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{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{n as c,t as l}from"./prompt-q3B7sM2A.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const d={command:`delete`,describe:`Deletes the URL Normalization settings.`,builder:u,handler:async n=>{if(n.dryRun){a({command:`cf url-normalization delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>r.urlNormalization.delete({zone_id:s})),{successLabel:`Deleted`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Fetches the current URL Normalization settings.`,builder:f,handler:async n=>{if(n.dryRun){a({command:`cf url-normalization get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.urlNormalization.get({zone_id:s})),{successLabel:`Loaded`})}};function m(e){return e.option(`scope`,{type:`string`,description:`The scope of the URL normalization.`,choices:[`incoming`,`both`,`none`]}).option(`type`,{type:`string`,description:`The type of URL normalization performed by Cloudflare.`,choices:[`cloudflare`,`rfc3986`]}).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 h={command:`update`,describe:`Updates the URL Normalization settings.`,builder:m,handler:async l=>{if(l.dryRun){a({command:`cf url-normalization update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({scope:s(l.scope,`scope`,`text`),type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.urlNormalization.update({body:e,zone_id:d})),{successLabel:`Updated`});return}l.scope===void 0&&(l.scope=await c(`scope`,`The scope of the URL normalization.`,[`incoming`,`both`,`none`])),l.type===void 0&&(l.type=await c(`type`,`The type of URL normalization performed by Cloudflare.`,[`cloudflare`,`rfc3986`]));let f=r({scope:s(l.scope,`scope`,`text`),type:s(l.type,`type`,`text`)});i(await o(`Updating`,async()=>u.urlNormalization.update({body:f,zone_id:d})),{successLabel:`Updated`})}},g={command:`url-normalization`,describe:`Normalize incoming request URLs to a consistent format before rule evaluation and caching`,builder:e=>e.command(d).command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{r as u}from"./prompt-q3B7sM2A.mjs";import{n as d,t as f}from"./raw-fetch-bIXC9D1m.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 r=>{if(r.dryRun){o({command:`cf url-scanner responses get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/responses/${r[`response-id`]==null?`<response-id>`:encodeURIComponent(String(r[`response-id`]))}`,pathParams:{"response-id":String(r[`response-id`]??``)},bodyKind:`none`});return}await n(r);let i=r.local?l:await e();r.accountId=i,d((await s(`Loading`,async()=>f(`/accounts/${i}/urlscanner/v2/responses/${encodeURIComponent(String(r[`response-id`]))}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}))).toString(`utf-8`))}},h={command:`responses`,describe:`Operations for responses`,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 i=>{if(i.dryRun){o({command:`cf url-scanner scans bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/bulk`,pathParams:{},bodyKind:`json`,body:i.body===void 0?void 0:r(i.body)});return}let c=await n(i),u=i.local?l:await e();if(i.accountId=u,i.body){let e=r(i.body);a(await s(`Creating`,async()=>c.urlScanner.scans.bulkCreate({body:e,account_id:u})),{successLabel:`Created`});return}if(i.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){o({command:`cf url-scanner scans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/scan`,pathParams:{},bodyKind:`json`,body:d.body===void 0?i({agentReadiness:d[`agent-readiness`],country:c(d.country,`country`,`text`),customagent:c(d.customagent,`customagent`,`text`),referer:c(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:c(d.url,`url`,`text`),visibility:c(d.visibility,`visibility`,`text`)}):r(d.body)});return}let f=await n(d),p=d.local?l:await e();if(d.accountId=p,d.body){let e=r(d.body);a(await s(`Creating`,async()=>f.urlScanner.scans.create({...e,account_id:p})),{successLabel:`Created`});return}d.url===void 0&&(d.url=await u(`url`,`The url field`));let m=i({agentReadiness:d[`agent-readiness`],country:c(d.country,`country`,`text`),customagent:c(d.customagent,`customagent`,`text`),referer:c(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:c(d.url,`url`,`text`),visibility:c(d.visibility,`visibility`,`text`)});a(await s(`Creating`,async()=>f.urlScanner.scans.create({...m,account_id:p})),{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 r=>{if(r.dryRun){o({command:`cf url-scanner scans dom`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/dom/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}`,pathParams:{"scan-id":String(r[`scan-id`]??``)},bodyKind:`none`});return}await n(r);let i=r.local?l:await e();r.accountId=i,d((await s(`Loading`,async()=>f(`/accounts/${i}/urlscanner/v2/dom/${encodeURIComponent(String(r[`scan-id`]))}`,{method:`GET`,localEndpoint:r.local?r.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 r=>{if(r.dryRun){o({command:`cf url-scanner scans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/result/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}`,pathParams:{"scan-id":String(r[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.urlScanner.scans.get({account_id:c,scan_id:r[`scan-id`]})),{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 r=>{if(r.dryRun){o({command:`cf url-scanner scans har`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/har/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}`,pathParams:{"scan-id":String(r[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.urlScanner.scans.har({account_id:c,scan_id:r[`scan-id`]})),{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 r=>{let i={size:r.size,q:r.q};if(r.dryRun){o({command:`cf url-scanner scans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/search`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.urlScanner.scans.list({account_id:u,...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 r=>{let i={resolution:r.resolution};if(r.dryRun){o({command:`cf url-scanner scans screenshot`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/screenshots/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}.png`,pathParams:{"scan-id":String(r[`scan-id`]??``)},query:i,bodyKind:`none`});return}await n(r);let a=r.local?l:await e();r.accountId=a;let c=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),u=await s(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/screenshots/${encodeURIComponent(String(r[`scan-id`]))}.png${c?`?`+c:``}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}));d(r.text===!0?u.toString(`utf-8`):u)}},A={command:`scans`,describe:`Operations for scans`,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};
|