cf 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_meta/agent-context.json +63 -62
- package/dist/_meta/commands.json +12365 -9690
- package/dist/_meta/schemas.json +19206 -15404
- package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
- package/dist/accounts-Kx1epdA1.mjs +22 -0
- package/dist/acm-Utu252kC.mjs +3 -0
- package/dist/addressing-CBq7Z7Vq.mjs +12 -0
- package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
- package/dist/ai-DOOKLPkG.mjs +2 -0
- package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
- package/dist/ai-search-CQF_Sn7d.mjs +7 -0
- package/dist/ai_gateway-C3fH22C0.mjs +4 -0
- package/dist/alerting-CqmEIaKn.mjs +6 -0
- package/dist/analytics-Dv-X8x7D.mjs +20 -0
- package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
- package/dist/api-gateway-CNv0IHTU.mjs +33 -0
- package/dist/argo-CX_A4kcn.mjs +2 -0
- package/dist/audit-logs-BfBf3oo-.mjs +2 -0
- package/dist/auth-SyWhMmPu.mjs +6 -0
- package/dist/auth-ffdf9yR0.mjs +135 -0
- package/dist/autorag-BuGhGTeZ.mjs +2 -0
- package/dist/billing-PoG81XaQ.mjs +2 -0
- package/dist/body-parser-DKa8Ipg1.mjs +2 -0
- package/dist/bot-management-CFvtVx62.mjs +5 -0
- package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
- package/dist/brand-protection-D05Eg-_6.mjs +3 -0
- package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
- package/dist/{build-5jmmOZhm.mjs → build-DYkGW4dh.mjs} +1 -1
- package/dist/cache-DsoW6Xwv.mjs +5 -0
- package/dist/calls-CZbO7TyR.mjs +4 -0
- package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
- package/dist/cli-types-CRIDdDw3.mjs +2 -0
- package/dist/client-certificates-MJcDsTId.mjs +3 -0
- package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
- package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
- package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
- package/dist/connectivity-BX8C7tvK.mjs +3 -0
- package/dist/content-scanning-r6uzMO1r.mjs +4 -0
- package/dist/context-DGlHRGWM.mjs +2 -0
- package/dist/custom-certificates-aAiEguR7.mjs +5 -0
- package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
- package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
- package/dist/custom-pages-DQCi2plU.mjs +4 -0
- package/dist/d1-DbnYhw45.mjs +4 -0
- package/dist/data-security-D_EtYBfo.mjs +6 -0
- package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
- package/dist/{deploy-DbkiIzUr.mjs → deploy-CQial3kN.mjs} +1 -1
- package/dist/{dev-C6iSuQZm.mjs → dev-B38LfCTl.mjs} +1 -1
- package/dist/diagnostics-BJQGjVJn.mjs +3 -0
- package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
- package/dist/{dist-CnSubA1Z.mjs → dist-AIcZFk0U.mjs} +7 -7
- package/dist/dns-VMhQSr5n.mjs +29 -0
- package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
- package/dist/durable-objects-CTboySEo.mjs +2 -0
- package/dist/email-routing-tIR2SFu-.mjs +10 -0
- package/dist/email-security-Ca1id3rZ.mjs +8 -0
- package/dist/email-sending-DwWKc5jC.mjs +3 -0
- package/dist/filters-A4dg_a68.mjs +4 -0
- package/dist/firewall-DWPQgYd9.mjs +11 -0
- package/dist/fraud-BMkSsJGU.mjs +20 -0
- package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
- package/dist/healthchecks-CtIfrFql.mjs +4 -0
- package/dist/hostnames-BiomxukN.mjs +3 -0
- package/dist/hyperdrive-Da104VaQ.mjs +18 -0
- package/dist/iam-BIGKo0WW.mjs +6 -0
- package/dist/images-BO8FbDAa.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-CY6_79v8.mjs +3 -0
- package/dist/{ips-B8fwxKZD.mjs → ips-K4bzaGqd.mjs} +1 -1
- package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
- package/dist/kv-8o27w_pY.mjs +5 -0
- package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
- package/dist/load-balancers-DtG8nj25.mjs +6 -0
- package/dist/logpush-4L0njy1d.mjs +4 -0
- package/dist/logs-B_Yp95hv.mjs +3 -0
- package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
- package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
- package/dist/magic-transit-CXDyvhxq.mjs +90 -0
- package/dist/managed-transforms-D15yVbZx.mjs +3 -0
- package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
- package/dist/network-interconnects-rrr7red3.mjs +36 -0
- package/dist/observability-DWvpqnQJ.mjs +4 -0
- package/dist/organizations-T77D50Sq.mjs +41 -0
- package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
- package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
- package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
- package/dist/output-BJFNwj7b.mjs +2 -0
- package/dist/page-rules-CjZPTMQX.mjs +18 -0
- package/dist/page-shield-D5RRNJCY.mjs +37 -0
- package/dist/pages-CWJtJnL0.mjs +11 -0
- package/dist/pipelines-B0L_7j9e.mjs +6 -0
- package/dist/{progress-CjcQ6ato.mjs → progress-CrCGTq7N.mjs} +1 -1
- package/dist/queues-CN6DPhRR.mjs +6 -0
- package/dist/r2-DQIcyRtA.mjs +21 -0
- package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
- package/dist/radar-Bxb0WX8V.mjs +2 -0
- package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
- package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
- package/dist/realtime-kit-CaquuVOE.mjs +18 -0
- package/dist/registrar-Ko-xZemf.mjs +46 -0
- package/dist/request-tracers-DOW_reTJ.mjs +2 -0
- package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
- package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
- package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
- package/dist/rules-BXRADHL5.mjs +4 -0
- package/dist/rulesets-CBgpeSvJ.mjs +8 -0
- package/dist/rum-BjPptTUP.mjs +4 -0
- package/dist/{schema-CHBfkARI.mjs → schema-D16TgWBg.mjs} +1 -1
- package/dist/schema-validation-Dgv_opM3.mjs +24 -0
- package/dist/scim-DdSEr4kZ.mjs +3 -0
- package/dist/secrets-store-7BfyvJLb.mjs +25 -0
- package/dist/security-center-DAy6AKtT.mjs +2 -0
- package/dist/security-txt-xAMb7K6Y.mjs +3 -0
- package/dist/session-COHHdS7A.mjs +5 -0
- package/dist/{shared-DEzmTsEC.mjs → shared-AGtpXwwL.mjs} +1 -1
- package/dist/smart-shield-TeWZFnH2.mjs +3 -0
- package/dist/snippets-CCSsCXVs.mjs +4 -0
- package/dist/{spawn-13QQ0IwO.mjs → spawn-DcppKGI5.mjs} +1 -1
- package/dist/spectrum-CTTZID8u.mjs +63 -0
- package/dist/speed-CuzTE0AL.mjs +4 -0
- package/dist/{src-B9cKsgsg.mjs → src-BW6vfAwE.mjs} +10 -10
- package/dist/ssl-BWA2LdwC.mjs +15 -0
- package/dist/stream-GFsIZ-pP.mjs +14 -0
- package/dist/tenants-Bd7NGQ_m.mjs +2 -0
- package/dist/token-validation-DAgtFOvs.mjs +10 -0
- package/dist/{tools-B7QiNu-d.mjs → tools-DXQmfFuE.mjs} +1 -1
- package/dist/turnstile-cfdaO4ca.mjs +23 -0
- package/dist/{ui-BXjU1dX1.mjs → ui-D4KtlMh9.mjs} +1 -1
- package/dist/url-normalization-B5RN4nLD.mjs +3 -0
- package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
- package/dist/user-CAo-yCJA.mjs +10 -0
- package/dist/vectorize-C7_oQlaI.mjs +4 -0
- package/dist/{versions-DzyrlUAi.mjs → versions-CUwWJWmy.mjs} +1 -1
- package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
- package/dist/web3-HQJRm38W.mjs +4 -0
- package/dist/workers-Dg7ddG2Q.mjs +18 -0
- package/dist/workers-builds-AVfx8IyL.mjs +7 -0
- package/dist/workflows-VquuSh2J.mjs +4 -0
- package/dist/zaraz-xYSWIV4P.mjs +2 -0
- package/dist/zero-trust-CP96wnSh.mjs +118 -0
- package/dist/zones-BSgmZ9WC.mjs +21 -0
- package/package.json +4 -3
- package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
- package/dist/accounts-BopMfODC.mjs +0 -21
- package/dist/acm-BT4vlnEJ.mjs +0 -3
- package/dist/addressing-B3uFxHst.mjs +0 -13
- package/dist/ai-DWHqwMap.mjs +0 -2
- package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
- package/dist/ai-search-VnOQ5n--.mjs +0 -7
- package/dist/alerting-BmmgIlIO.mjs +0 -6
- package/dist/analytics-isY03taL.mjs +0 -20
- package/dist/api-gateway-DXurEbA-.mjs +0 -33
- package/dist/argo-B02BL_hp.mjs +0 -2
- package/dist/audit-logs-DcgR9xUc.mjs +0 -2
- package/dist/auth-CQcAgnOy.mjs +0 -135
- package/dist/auth-DenWm_X0.mjs +0 -6
- package/dist/autorag-CmrwnGVj.mjs +0 -2
- package/dist/billing-CaW1ZAB1.mjs +0 -2
- package/dist/body-parser-Br-BoYk-.mjs +0 -2
- package/dist/bot-management-CeBsFx68.mjs +0 -5
- package/dist/botnet-feed-B396vQeQ.mjs +0 -3
- package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
- package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
- package/dist/builds-C_ySULja.mjs +0 -2
- package/dist/cache-DmXizSMi.mjs +0 -5
- package/dist/calls-x4KQpTB4.mjs +0 -4
- package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
- package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
- package/dist/cloud-connector-BClQpEzI.mjs +0 -2
- package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
- package/dist/connectivity-G0NP6LtW.mjs +0 -3
- package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
- package/dist/context-CC0Rhkhy.mjs +0 -2
- package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
- package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
- package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
- package/dist/custom-pages-D-oErw57.mjs +0 -4
- package/dist/d1-C95ckPKI.mjs +0 -3
- package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
- package/dist/diagnostics-DEEhPnXj.mjs +0 -3
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
- package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
- package/dist/dns-qW-3TZOT.mjs +0 -29
- package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
- package/dist/email-routing-tdNJaCpJ.mjs +0 -10
- package/dist/email-security-DTVHNr2h.mjs +0 -60
- package/dist/email-sending-DsFTvE31.mjs +0 -3
- package/dist/filters-DO1Is_tI.mjs +0 -4
- package/dist/firewall-DbUhVTCg.mjs +0 -11
- package/dist/fraud-Bzr4njYb.mjs +0 -8
- package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
- package/dist/healthchecks-BBAs-lS_.mjs +0 -4
- package/dist/hostnames-Dz9PEUKS.mjs +0 -3
- package/dist/hyperdrive-B1iUJddG.mjs +0 -18
- package/dist/iam-CJM8gHpG.mjs +0 -6
- package/dist/images-DEoBmtFS.mjs +0 -5
- package/dist/intel-BM6xkZ0C.mjs +0 -3
- package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
- package/dist/kv-BTceLtWZ.mjs +0 -5
- package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
- package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
- package/dist/logpush-CSYhgevA.mjs +0 -4
- package/dist/logs-DlIwmMpt.mjs +0 -3
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
- package/dist/magic-transit-qQmA-981.mjs +0 -89
- package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
- package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
- package/dist/network-interconnects-CxG2deY0.mjs +0 -36
- package/dist/organizations-DyEAiGiR.mjs +0 -41
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
- package/dist/output-D7_yAFVR.mjs +0 -2
- package/dist/page-rules-DP-w6TAm.mjs +0 -18
- package/dist/page-shield-Bf7kFp8c.mjs +0 -37
- package/dist/pages-D0Y_XRqW.mjs +0 -10
- package/dist/pipelines-C-SPESAk.mjs +0 -6
- package/dist/queues-wv6CZsi8.mjs +0 -6
- package/dist/r2-DuXjp9n5.mjs +0 -21
- package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
- package/dist/radar-BW_ZHP8X.mjs +0 -2
- package/dist/rate-limits-DLTkIvwr.mjs +0 -5
- package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
- package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
- package/dist/registrar-DIIv6fWd.mjs +0 -46
- package/dist/request-tracers-DMej0Drs.mjs +0 -2
- package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
- package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
- package/dist/rules-DLJpOYbC.mjs +0 -4
- package/dist/rulesets-D9nqEJT5.mjs +0 -8
- package/dist/rum-DBVmdPkp.mjs +0 -4
- package/dist/schema-validation-MCd3xdtX.mjs +0 -4
- package/dist/scim-DZA3VXog.mjs +0 -3
- package/dist/scm-CilfPOue.mjs +0 -2
- package/dist/secrets-store-BrvcZSOM.mjs +0 -21
- package/dist/security-center-BU6f3Cm1.mjs +0 -2
- package/dist/security-txt-BPIbP3dG.mjs +0 -3
- package/dist/session-H7IV2BrM.mjs +0 -2
- package/dist/smart-shield-e8XFBkiF.mjs +0 -3
- package/dist/snippets-B4M3MMb8.mjs +0 -4
- package/dist/spectrum-B0adfSRI.mjs +0 -59
- package/dist/speed-BVcUtkAz.mjs +0 -4
- package/dist/ssl-BAa91gsc.mjs +0 -15
- package/dist/stream-D53sxKb3.mjs +0 -14
- package/dist/tenants-bH5pt3dJ.mjs +0 -2
- package/dist/token-validation-M61Vx_Tw.mjs +0 -4
- package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
- package/dist/url-normalization-DZrWDgB5.mjs +0 -3
- package/dist/url-scanner-Zo49edNp.mjs +0 -2
- package/dist/user-DbXlVReB.mjs +0 -10
- package/dist/vectorize-CUnTM0DT.mjs +0 -4
- package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
- package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
- package/dist/web3-DueyOQtx.mjs +0 -4
- package/dist/workers-builds-BM_aoeUR.mjs +0 -7
- package/dist/workers-nV_vBCfV.mjs +0 -16
- package/dist/workflows-CQITmo-s.mjs +0 -4
- package/dist/zaraz-DIbpF5Op.mjs +0 -2
- package/dist/zero-trust-CKp8j512.mjs +0 -119
- package/dist/zones-BZ5tZDbH.mjs +0 -28
- /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,b as n,t as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The request body is currently not used.`})}const d={command:`clear`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield cache-reserve-clear clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=a(e.body);o(await c(`Creating`,async()=>t.post(`/zones/${e.zoneId}/smart_shield/cache_reserve_clear`,{body:n})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>t.smartShield.cacheReserveClear.clear(i)),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`status`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield cache-reserve-clear status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.smartShield.cacheReserveClear.status(i)),{successLabel:`Loaded`})}},m={command:`cache-reserve-clear`,describe:`Cache Reserve Clear operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve Smart Shield Settings.`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.smartShield.get(i)),{successLabel:`Loaded`})}};function _(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`create`,describe:`Create a new health check.`,builder:_,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{address:e.address,"check-regions":e[`check-regions`],"consecutive-fails":e[`consecutive-fails`],"consecutive-successes":e[`consecutive-successes`],description:e.description,"http-config-allow-insecure":e[`http-config-allow-insecure`],"http-config-expected-body":e[`http-config-expected-body`],"http-config-expected-codes":e[`http-config-expected-codes`],"http-config-follow-redirects":e[`http-config-follow-redirects`],"http-config-method":e[`http-config-method`],"http-config-path":e[`http-config-path`],"http-config-port":e[`http-config-port`],interval:e.interval,name:e.name,retries:e.retries,suspended:e.suspended,"tcp-config-method":e[`tcp-config-method`],"tcp-config-port":e[`tcp-config-port`],timeout:e.timeout,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/smart_shield/healthchecks`,{body:t})),{successLabel:`Created`});return}e.address===void 0&&(e.address=await t(`address`,`The hostname or IP address of the origin server to run health checks on.`)),e.name===void 0&&(e.name=await t(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};e.address!==void 0&&i(d,[`address`],l(e.address,`address`,`text`)),e[`check-regions`]!==void 0&&i(d,[`check_regions`],e[`check-regions`]),e[`consecutive-fails`]!==void 0&&i(d,[`consecutive_fails`],e[`consecutive-fails`]),e[`consecutive-successes`]!==void 0&&i(d,[`consecutive_successes`],e[`consecutive-successes`]),e.description!==void 0&&i(d,[`description`],l(e.description,`description`,`text`)),e[`http-config-allow-insecure`]!==void 0&&i(d,[`http_config`,`allow_insecure`],e[`http-config-allow-insecure`]),e[`http-config-expected-body`]!==void 0&&i(d,[`http_config`,`expected_body`],l(e[`http-config-expected-body`],`http-config-expected-body`,`text`)),e[`http-config-expected-codes`]!==void 0&&i(d,[`http_config`,`expected_codes`],e[`http-config-expected-codes`]),e[`http-config-follow-redirects`]!==void 0&&i(d,[`http_config`,`follow_redirects`],e[`http-config-follow-redirects`]),e[`http-config-method`]!==void 0&&i(d,[`http_config`,`method`],l(e[`http-config-method`],`http-config-method`,`text`)),e[`http-config-path`]!==void 0&&i(d,[`http_config`,`path`],l(e[`http-config-path`],`http-config-path`,`text`)),e[`http-config-port`]!==void 0&&i(d,[`http_config`,`port`],e[`http-config-port`]),e.interval!==void 0&&i(d,[`interval`],e.interval),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.retries!==void 0&&i(d,[`retries`],e.retries),e.suspended!==void 0&&i(d,[`suspended`],e.suspended),e[`tcp-config-method`]!==void 0&&i(d,[`tcp_config`,`method`],l(e[`tcp-config-method`],`tcp-config-method`,`text`)),e[`tcp-config-port`]!==void 0&&i(d,[`tcp_config`,`port`],e[`tcp-config-port`]),e.timeout!==void 0&&i(d,[`timeout`],e.timeout),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/smart_shield/healthchecks`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function y(e){return e.positional(`healthcheck-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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:y,handler:async t=>{if(t.dryRun){s({command:`cf smart-shield health-checks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/smart_shield/healthchecks/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),l=await n({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=l,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(t.body){let e=a(t.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${t.zoneId}/smart_shield/healthchecks/${encodeURIComponent(String(t[`healthcheck-id`]))}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.smartShield.healthChecks.delete(t[`healthcheck-id`],l)),{successLabel:`Deleted`})}};function x(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:x,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{address:e.address,"check-regions":e[`check-regions`],"consecutive-fails":e[`consecutive-fails`],"consecutive-successes":e[`consecutive-successes`],description:e.description,"http-config-allow-insecure":e[`http-config-allow-insecure`],"http-config-expected-body":e[`http-config-expected-body`],"http-config-expected-codes":e[`http-config-expected-codes`],"http-config-follow-redirects":e[`http-config-follow-redirects`],"http-config-method":e[`http-config-method`],"http-config-path":e[`http-config-path`],"http-config-port":e[`http-config-port`],interval:e.interval,name:e.name,retries:e.retries,suspended:e.suspended,"tcp-config-method":e[`tcp-config-method`],"tcp-config-port":e[`tcp-config-port`],timeout:e.timeout,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/smart_shield/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.address===void 0&&(e.address=await t(`address`,`The hostname or IP address of the origin server to run health checks on.`)),e.name===void 0&&(e.name=await t(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};e.address!==void 0&&i(d,[`address`],l(e.address,`address`,`text`)),e[`check-regions`]!==void 0&&i(d,[`check_regions`],e[`check-regions`]),e[`consecutive-fails`]!==void 0&&i(d,[`consecutive_fails`],e[`consecutive-fails`]),e[`consecutive-successes`]!==void 0&&i(d,[`consecutive_successes`],e[`consecutive-successes`]),e.description!==void 0&&i(d,[`description`],l(e.description,`description`,`text`)),e[`http-config-allow-insecure`]!==void 0&&i(d,[`http_config`,`allow_insecure`],e[`http-config-allow-insecure`]),e[`http-config-expected-body`]!==void 0&&i(d,[`http_config`,`expected_body`],l(e[`http-config-expected-body`],`http-config-expected-body`,`text`)),e[`http-config-expected-codes`]!==void 0&&i(d,[`http_config`,`expected_codes`],e[`http-config-expected-codes`]),e[`http-config-follow-redirects`]!==void 0&&i(d,[`http_config`,`follow_redirects`],e[`http-config-follow-redirects`]),e[`http-config-method`]!==void 0&&i(d,[`http_config`,`method`],l(e[`http-config-method`],`http-config-method`,`text`)),e[`http-config-path`]!==void 0&&i(d,[`http_config`,`path`],l(e[`http-config-path`],`http-config-path`,`text`)),e[`http-config-port`]!==void 0&&i(d,[`http_config`,`port`],e[`http-config-port`]),e.interval!==void 0&&i(d,[`interval`],e.interval),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.retries!==void 0&&i(d,[`retries`],e.retries),e.suspended!==void 0&&i(d,[`suspended`],e.suspended),e[`tcp-config-method`]!==void 0&&i(d,[`tcp_config`,`method`],l(e[`tcp-config-method`],`tcp-config-method`,`text`)),e[`tcp-config-port`]!==void 0&&i(d,[`tcp_config`,`port`],e[`tcp-config-port`]),e.timeout!==void 0&&i(d,[`timeout`],e.timeout),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/smart_shield/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}};function C(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:C,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.smartShield.healthChecks.get(e[`healthcheck-id`],i)),{successLabel:`Loaded`})}};function T(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. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`List configured health checks.`,builder:T,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf smart-shield health-checks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.smartShield.healthChecks.list(a,t)),{successLabel:`Loaded`})}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`result-address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`result-check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`result-consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`result-consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`result-description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`result-http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`result-http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`result-http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`result-http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`result-http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`result-http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`result-http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`result-interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`result-name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`result-retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`result-suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`result-tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`result-tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`result-timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`result-type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`success`,{type:`boolean`,description:`Whether the API call was successful.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"result-address":e[`result-address`],"result-check-regions":e[`result-check-regions`],"result-consecutive-fails":e[`result-consecutive-fails`],"result-consecutive-successes":e[`result-consecutive-successes`],"result-description":e[`result-description`],"result-http-config-allow-insecure":e[`result-http-config-allow-insecure`],"result-http-config-expected-body":e[`result-http-config-expected-body`],"result-http-config-expected-codes":e[`result-http-config-expected-codes`],"result-http-config-follow-redirects":e[`result-http-config-follow-redirects`],"result-http-config-method":e[`result-http-config-method`],"result-http-config-path":e[`result-http-config-path`],"result-http-config-port":e[`result-http-config-port`],"result-interval":e[`result-interval`],"result-name":e[`result-name`],"result-retries":e[`result-retries`],"result-suspended":e[`result-suspended`],"result-tcp-config-method":e[`result-tcp-config-method`],"result-tcp-config-port":e[`result-tcp-config-port`],"result-timeout":e[`result-timeout`],"result-type":e[`result-type`],success:e.success,body:e.body}});return}let t=await r(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=a(e.body);o(await c(`Updating`,async()=>t.put(`/zones/${e.zoneId}/smart_shield/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:n})),{successLabel:`Updated`});return}if(e.success===void 0)throw Error(`--success is required (or pass --body with this field set).`);let u={};e[`result-address`]!==void 0&&i(u,[`result`,`address`],l(e[`result-address`],`result-address`,`text`)),e[`result-check-regions`]!==void 0&&i(u,[`result`,`check_regions`],e[`result-check-regions`]),e[`result-consecutive-fails`]!==void 0&&i(u,[`result`,`consecutive_fails`],e[`result-consecutive-fails`]),e[`result-consecutive-successes`]!==void 0&&i(u,[`result`,`consecutive_successes`],e[`result-consecutive-successes`]),e[`result-description`]!==void 0&&i(u,[`result`,`description`],l(e[`result-description`],`result-description`,`text`)),e[`result-http-config-allow-insecure`]!==void 0&&i(u,[`result`,`http_config`,`allow_insecure`],e[`result-http-config-allow-insecure`]),e[`result-http-config-expected-body`]!==void 0&&i(u,[`result`,`http_config`,`expected_body`],l(e[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`)),e[`result-http-config-expected-codes`]!==void 0&&i(u,[`result`,`http_config`,`expected_codes`],e[`result-http-config-expected-codes`]),e[`result-http-config-follow-redirects`]!==void 0&&i(u,[`result`,`http_config`,`follow_redirects`],e[`result-http-config-follow-redirects`]),e[`result-http-config-method`]!==void 0&&i(u,[`result`,`http_config`,`method`],l(e[`result-http-config-method`],`result-http-config-method`,`text`)),e[`result-http-config-path`]!==void 0&&i(u,[`result`,`http_config`,`path`],l(e[`result-http-config-path`],`result-http-config-path`,`text`)),e[`result-http-config-port`]!==void 0&&i(u,[`result`,`http_config`,`port`],e[`result-http-config-port`]),e[`result-interval`]!==void 0&&i(u,[`result`,`interval`],e[`result-interval`]),e[`result-name`]!==void 0&&i(u,[`result`,`name`],l(e[`result-name`],`result-name`,`text`)),e[`result-retries`]!==void 0&&i(u,[`result`,`retries`],e[`result-retries`]),e[`result-suspended`]!==void 0&&i(u,[`result`,`suspended`],e[`result-suspended`]),e[`result-tcp-config-method`]!==void 0&&i(u,[`result`,`tcp_config`,`method`],l(e[`result-tcp-config-method`],`result-tcp-config-method`,`text`)),e[`result-tcp-config-port`]!==void 0&&i(u,[`result`,`tcp_config`,`port`],e[`result-tcp-config-port`]),e[`result-timeout`]!==void 0&&i(u,[`result`,`timeout`],e[`result-timeout`]),e[`result-type`]!==void 0&&i(u,[`result`,`type`],l(e[`result-type`],`result-type`,`text`)),e.success!==void 0&&i(u,[`success`],e.success),o(await c(`Updating`,async()=>t.put(`/zones/${e.zoneId}/smart_shield/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}},k={command:`health-checks`,describe:`Health checks operations`,builder:e=>e.command(v).command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`cache-reserve-value`,{type:`string`,description:`Specifies the enablement value of Cache Reserve.`,choices:[`on`,`off`]}).option(`regional-tiered-cache-value`,{type:`string`,description:`Specifies the enablement value of Regional Tiered Cache.`,choices:[`on`,`off`]}).option(`smart-routing-value`,{type:`string`,description:`Specifies the enablement value of Smart Routing.`,choices:[`on`,`off`]}).option(`smart-tiered-cache-value`,{type:`string`,description:`Specifies the enablement value of Smart Tiered Cache.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The patch body for Smart Shield.`})}const j={command:`update`,describe:`Set Smart Shield Settings.`,builder:A,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"cache-reserve-value":e[`cache-reserve-value`],"regional-tiered-cache-value":e[`regional-tiered-cache-value`],"smart-routing-value":e[`smart-routing-value`],"smart-tiered-cache-value":e[`smart-tiered-cache-value`],body:e.body}});return}let t=await r(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=a(e.body);o(await c(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/smart_shield`,{body:n})),{successLabel:`Updated`});return}let u={};e[`cache-reserve-value`]!==void 0&&i(u,[`cache_reserve`,`value`],l(e[`cache-reserve-value`],`cache-reserve-value`,`text`)),e[`regional-tiered-cache-value`]!==void 0&&i(u,[`regional_tiered_cache`,`value`],l(e[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)),e[`smart-routing-value`]!==void 0&&i(u,[`smart_routing`,`value`],l(e[`smart-routing-value`],`smart-routing-value`,`text`)),e[`smart-tiered-cache-value`]!==void 0&&i(u,[`smart_tiered_cache`,`value`],l(e[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)),o(await c(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/smart_shield`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}},M={command:`smart-shield`,describe:`Smart Shield settings, health checks, and cache reserve management`,builder:e=>e.command(g).command(j).command(m).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{t as r}from"./output-D7_yAFVR.mjs";import{n as i,t as a}from"./progress-CjcQ6ato.mjs";import{n as o}from"./input-validation-zEO81MWN.mjs";import{n as s,t as c}from"./raw-fetch-hRv-6P3D.mjs";function l(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const u={command:`get <snippet-name>`,describe:`Fetches the content of a snippet belonging to the zone.`,builder:l,handler:async e=>{if(e.dryRun){i({command:`cf snippets content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/snippets/${e[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(e[`snippet-name`]))}/content`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"snippet-name":String(e[`snippet-name`]??``)},bodyKind:`none`});return}let r=await n(e);e.zoneId=await t({zone:e.zone},r,{quiet:e.quiet});let o=await a(`Loading`,async()=>c(`/zones/${e.zoneId}/snippets/${encodeURIComponent(String(e[`snippet-name`]))}/content`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));s(e.text===!0?o.toString(`utf-8`):o)}},d={command:`content`,describe:`Raw JavaScript source code content of individual snippets`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <snippet-name>`,describe:`Deletes a snippet belonging to the zone.`,builder:f,handler:async o=>{if(o.dryRun){i({command:`cf snippets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/snippets/${o[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(o[`snippet-name`]))}`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``),"snippet-name":String(o[`snippet-name`]??``)},bodyKind:`none`});return}let s=await n(o),c=await t({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,!await e({force:!!o.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}r(await a(`Deleting`,async()=>s.snippets.delete(c,o[`snippet-name`])),{successLabel:`Deleted`})}};function m(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <snippet-name>`,describe:`Fetches a snippet belonging to the zone.`,builder:m,handler:async e=>{if(e.dryRun){i({command:`cf snippets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/snippets/${e[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(e[`snippet-name`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"snippet-name":String(e[`snippet-name`]??``)},bodyKind:`none`});return}let o=await n(e),s=await t({zone:e.zone},o,{quiet:e.quiet});e.zoneId=s,r(await a(`Loading`,async()=>o.snippets.get(s,e[`snippet-name`])),{successLabel:`Loaded`})}};function g(e){return e.option(`page`,{type:`string`,description:`Specifies the current page number.`}).option(`per-page`,{type:`string`,description:`Specifies how many results to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`list`,describe:`Fetches all snippets belonging to the zone.`,builder:g,handler:async e=>{let o={page:e.page,per_page:e[`per-page`]};if(e.dryRun){i({command:`cf snippets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/snippets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,r(await a(`Loading`,async()=>s.snippets.list(c,o)),{successLabel:`Loaded`})}};function v(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 y={command:`delete`,describe:`Deletes all snippet rules belonging to the zone.`,builder:v,handler:async o=>{if(o.dryRun){i({command:`cf snippets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`none`});return}let s=await n(o),c=await t({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,!await e({force:!!o.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}r(await a(`Deleting`,async()=>s.snippets.rules.delete(c)),{successLabel:`Deleted`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Fetches all snippet rules belonging to the zone.`,builder:b,handler:async e=>{if(e.dryRun){i({command:`cf snippets rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(e),s=await t({zone:e.zone},o,{quiet:e.quiet});e.zoneId=s,r(await a(`Loading`,async()=>o.snippets.rules.list(s)),{successLabel:`Loaded`})}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Define a snippet rules object.`})}const C={command:`update`,describe:`Updates all snippet rules belonging to the zone.`,builder:S,handler:async e=>{if(e.dryRun){i({command:`cf snippets rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.put(`/zones/${e.zoneId}/snippets/snippet_rules`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}r(await a(`Updating`,async()=>s.snippets.rules.update(c)),{successLabel:`Updated`})}},w={command:`rules`,describe:`Rules that determine which requests trigger specific snippets based on URL patterns`,builder:e=>e.command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Define a snippet object.`})}const E={command:`update <snippet-name>`,describe:`Creates or updates a snippet belonging to the zone.`,builder:T,handler:async e=>{if(e.dryRun){i({command:`cf snippets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/snippets/${e[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(e[`snippet-name`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"snippet-name":String(e[`snippet-name`]??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e);if(e.zoneId=await t({zone:e.zone},s,{quiet:e.quiet}),e.body){let t=o(e.body,`body`,`binary`);r(await a(`Updating`,async()=>s.put(`/zones/${e.zoneId}/snippets/${encodeURIComponent(String(e[`snippet-name`]))}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},D={command:`snippets`,describe:`Lightweight JavaScript snippets that run on requests before Workers — for quick header modifications and redirects`,builder:e=>e.command(p).command(h).command(_).command(E).command(d).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{D as default};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,b as n,t as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`app-id`,{type:`string`,description:`Comma-delimited list of Spectrum Application Id(s). If provided, the response will be limited to Spectrum Application Id(s) that match.`}).option(`colo-name`,{type:`string`,description:`Co-location identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`get`,describe:`Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.`,builder:u,handler:async e=>{let t={appID:e[`app-id`],colo_name:e[`colo-name`]};if(e.dryRun){s({command:`cf spectrum analytics aggregates currents get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/analytics/aggregate/current`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.analytics.aggregates.currents.get(a,t)),{successLabel:`Loaded`})}},f={command:`currents`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`aggregates`,describe:`Operations for analytics.aggregates`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
|
|
3
|
-
|
|
4
|
-
Dimension | Name | Example
|
|
5
|
-
--------------------------|---------------------------------|--------------------------
|
|
6
|
-
event | Connection Event | connect, progress, disconnect, originError, clientFiltered
|
|
7
|
-
appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85
|
|
8
|
-
coloName | Colo Name | SFO
|
|
9
|
-
ipVersion | IP version used by the client | 4, 6.`}).option(`sort`,{type:`string`,description:"The sort order for the result set; sort fields must be included in `metrics` or `dimensions`."}).option(`until`,{type:`string`,description:`Until`}).option(`metrics`,{type:`string`,description:`One or more metrics to compute. Options are:
|
|
10
|
-
|
|
11
|
-
Metric | Name | Example | Unit
|
|
12
|
-
--------------------------|-------------------------------------|--------------------------|--------------------------
|
|
13
|
-
count | Count of total events | 1000 | Count
|
|
14
|
-
bytesIngress | Sum of ingress bytes | 1000 | Sum
|
|
15
|
-
bytesEgress | Sum of egress bytes | 1000 | Sum
|
|
16
|
-
durationAvg | Average connection duration | 1.0 | Time in milliseconds
|
|
17
|
-
durationMedian | Median connection duration | 1.0 | Time in milliseconds
|
|
18
|
-
duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds
|
|
19
|
-
duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds.`}).option(`filters`,{type:`string`,description:`Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are:
|
|
20
|
-
|
|
21
|
-
Operator | Name | URL Encoded
|
|
22
|
-
--------------------------|---------------------------------|--------------------------
|
|
23
|
-
== | Equals | %3D%3D
|
|
24
|
-
!= | Does not equals | !%3D
|
|
25
|
-
\\> | Greater Than | %3E
|
|
26
|
-
\\< | Less Than | %3C
|
|
27
|
-
\\>= | Greater than or equal to | %3E%3D
|
|
28
|
-
\\<= | Less than or equal to | %3C%3D`}).option(`since`,{type:`string`,description:`Since`}).option(`time-delta`,{type:`string`,description:`Used to select time series resolution.`,choices:[`year`,`quarter`,`month`,`week`,`day`,`hour`,`dekaminute`,`minute`],demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get`,describe:`Retrieves a list of aggregate metrics grouped by time interval.`,builder:m,handler:async e=>{let t={dimensions:e.dimensions,sort:e.sort,until:e.until,metrics:e.metrics,filters:e.filters,since:e.since,time_delta:e[`time-delta`]};if(e.dryRun){s({command:`cf spectrum analytics events bytimes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/analytics/events/bytime`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.analytics.events.bytimes.get(a,t)),{successLabel:`Loaded`})}},g={command:`bytimes`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
|
|
29
|
-
|
|
30
|
-
Dimension | Name | Example
|
|
31
|
-
--------------------------|---------------------------------|--------------------------
|
|
32
|
-
event | Connection Event | connect, progress, disconnect, originError, clientFiltered
|
|
33
|
-
appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85
|
|
34
|
-
coloName | Colo Name | SFO
|
|
35
|
-
ipVersion | IP version used by the client | 4, 6.`}).option(`sort`,{type:`string`,description:"The sort order for the result set; sort fields must be included in `metrics` or `dimensions`."}).option(`until`,{type:`string`,description:`Until`}).option(`metrics`,{type:`string`,description:`One or more metrics to compute. Options are:
|
|
36
|
-
|
|
37
|
-
Metric | Name | Example | Unit
|
|
38
|
-
--------------------------|-------------------------------------|--------------------------|--------------------------
|
|
39
|
-
count | Count of total events | 1000 | Count
|
|
40
|
-
bytesIngress | Sum of ingress bytes | 1000 | Sum
|
|
41
|
-
bytesEgress | Sum of egress bytes | 1000 | Sum
|
|
42
|
-
durationAvg | Average connection duration | 1.0 | Time in milliseconds
|
|
43
|
-
durationMedian | Median connection duration | 1.0 | Time in milliseconds
|
|
44
|
-
duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds
|
|
45
|
-
duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds.`}).option(`filters`,{type:`string`,description:`Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are:
|
|
46
|
-
|
|
47
|
-
Operator | Name | URL Encoded
|
|
48
|
-
--------------------------|---------------------------------|--------------------------
|
|
49
|
-
== | Equals | %3D%3D
|
|
50
|
-
!= | Does not equals | !%3D
|
|
51
|
-
\\> | Greater Than | %3E
|
|
52
|
-
\\< | Less Than | %3C
|
|
53
|
-
\\>= | Greater than or equal to | %3E%3D
|
|
54
|
-
\\<= | Less than or equal to | %3C%3D`}).option(`since`,{type:`string`,description:`Since`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Retrieves a list of summarised aggregate metrics over a given time period.`,builder:_,handler:async e=>{let t={dimensions:e.dimensions,sort:e.sort,until:e.until,metrics:e.metrics,filters:e.filters,since:e.since};if(e.dryRun){s({command:`cf spectrum analytics events summaries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/analytics/events/summary`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.analytics.events.summaries.get(a,t)),{successLabel:`Loaded`})}},y={command:`summaries`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`events`,describe:`Operations for analytics.events`,builder:e=>e.command(g).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},x={command:`analytics`,describe:`Operations for analytics`,builder:e=>e.command(p).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application.
|
|
55
|
-
Notes: Only available for TCP applications with traffic_type set to "direct".`,default:!1}).option(`dns-name`,{type:`string`,description:`The name of the DNS record associated with the application.`}).option(`dns-type`,{type:`string`,description:`The type of DNS record associated with the application.`,choices:[`CNAME`,`ADDRESS`]}).option(`edge-ips-connectivity`,{type:`string`,description:`The IP versions supported for inbound connections on Spectrum anycast IPs.`,choices:[`all`,`ipv4`,`ipv6`]}).option(`edge-ips-type`,{type:`string`,description:`The type of edge IP configuration specified. Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the connectivity you specify. Only valid with CNAME DNS names.`,choices:[`dynamic`,`static`]}).option(`edge-ips-ips`,{type:`string`,array:!0,description:`The array of customer owned IPs we broadcast via anycast for this hostname and application.`}).option(`ip-firewall`,{type:`boolean`,description:`Enables IP Access Rules for this application.
|
|
56
|
-
Notes: Only available for TCP applications.`,default:!1}).option(`origin-direct`,{type:`string`,array:!0,description:`List of origin IP addresses. Array may contain multiple IP addresses for load balancing.`}).option(`origin-dns-name`,{type:`string`,description:`The name of the DNS record associated with the origin.`}).option(`origin-dns-ttl`,{type:`number`,description:`The TTL of our resolution of your DNS record in seconds.`}).option(`origin-dns-type`,{type:`string`,description:`The type of DNS record associated with the origin. "" is used to specify a combination of A/AAAA records.`,choices:[`A`,`AAAA`,`SRV`]}).option(`protocol`,{type:`string`,description:'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'}).option(`proxy-protocol`,{type:`string`,description:`Enables Proxy Protocol to the origin. Refer to [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple Proxy Protocol.`,choices:[`off`,`v1`,`v2`,`simple`],default:`off`}).option(`tls`,{type:`string`,description:`The type of TLS termination associated with the application.`,choices:[`off`,`flexible`,`full`,`strict`],default:`off`}).option(`traffic-type`,{type:`string`,description:`Determines how data travels from the edge to your origin. When set to "direct", Spectrum will send traffic directly to your origin, and the application's type is derived from the \`protocol\`. When set to "http" or "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly.`,choices:[`direct`,`http`,`https`],default:`direct`}).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(`edge-ips-connectivity`,[`edge-ips-ips`]).conflicts(`edge-ips-ips`,[`edge-ips-connectivity`])}const C={command:`create`,describe:`Creates a new Spectrum application from a configuration using a name for the origin.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf spectrum apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"argo-smart-routing":e[`argo-smart-routing`],"dns-name":e[`dns-name`],"dns-type":e[`dns-type`],"edge-ips-connectivity":e[`edge-ips-connectivity`],"edge-ips-type":e[`edge-ips-type`],"edge-ips-ips":e[`edge-ips-ips`],"ip-firewall":e[`ip-firewall`],"origin-direct":e[`origin-direct`],"origin-dns-name":e[`origin-dns-name`],"origin-dns-ttl":e[`origin-dns-ttl`],"origin-dns-type":e[`origin-dns-type`],protocol:e.protocol,"proxy-protocol":e[`proxy-protocol`],tls:e.tls,"traffic-type":e[`traffic-type`],body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/spectrum/apps`,{body:t})),{successLabel:`Created`});return}e.protocol===void 0&&(e.protocol=await t(`protocol`,'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'));let d={};e[`argo-smart-routing`]!==void 0&&i(d,[`argo_smart_routing`],e[`argo-smart-routing`]),e[`dns-name`]!==void 0&&i(d,[`dns`,`name`],l(e[`dns-name`],`dns-name`,`text`)),e[`dns-type`]!==void 0&&i(d,[`dns`,`type`],l(e[`dns-type`],`dns-type`,`text`)),e[`edge-ips-connectivity`]!==void 0&&i(d,[`edge_ips`,`connectivity`],l(e[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`)),e[`edge-ips-type`]!==void 0&&i(d,[`edge_ips`,`type`],l(e[`edge-ips-type`],`edge-ips-type`,`text`)),e[`edge-ips-ips`]!==void 0&&i(d,[`edge_ips`,`ips`],e[`edge-ips-ips`]),e[`ip-firewall`]!==void 0&&i(d,[`ip_firewall`],e[`ip-firewall`]),e[`origin-direct`]!==void 0&&i(d,[`origin_direct`],e[`origin-direct`]),e[`origin-dns-name`]!==void 0&&i(d,[`origin_dns`,`name`],l(e[`origin-dns-name`],`origin-dns-name`,`text`)),e[`origin-dns-ttl`]!==void 0&&i(d,[`origin_dns`,`ttl`],e[`origin-dns-ttl`]),e[`origin-dns-type`]!==void 0&&i(d,[`origin_dns`,`type`],l(e[`origin-dns-type`],`origin-dns-type`,`text`)),e.protocol!==void 0&&i(d,[`protocol`],l(e.protocol,`protocol`,`text`)),e[`proxy-protocol`]!==void 0&&i(d,[`proxy_protocol`],l(e[`proxy-protocol`],`proxy-protocol`,`text`)),e.tls!==void 0&&i(d,[`tls`],l(e.tls,`tls`,`text`)),e[`traffic-type`]!==void 0&&i(d,[`traffic_type`],l(e[`traffic-type`],`traffic-type`,`text`)),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/spectrum/apps`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function w(e){return e.positional(`app-id`,{type:`string`,description:`App 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 T={command:`delete <app-id>`,describe:`Deletes a previously existing application.`,builder:w,handler:async t=>{if(t.dryRun){s({command:`cf spectrum apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/spectrum/apps/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}`,pathParams:{"app-id":String(t[`app-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=await n({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=a,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
57
|
-
`);return}o(await c(`Deleting`,async()=>i.spectrum.apps.delete(t[`app-id`],a)),{successLabel:`Deleted`})}};function E(e){return e.positional(`app-id`,{type:`string`,description:`App ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <app-id>`,describe:`Gets the application configuration of a specific application inside a zone.`,builder:E,handler:async e=>{if(e.dryRun){s({command:`cf spectrum apps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps/${e[`app-id`]==null?`<app-id>`:encodeURIComponent(String(e[`app-id`]))}`,pathParams:{"app-id":String(e[`app-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.spectrum.apps.get(e[`app-id`],i)),{successLabel:`Loaded`})}};function O(e){return e.option(`page`,{type:`number`,description:"Page number of paginated results. This parameter is required in order to use other pagination parameters. If included in the query, `result_info` will be present in the response."}).option(`per-page`,{type:`number`,description:`Sets the maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Sets the direction by which results are ordered.`,choices:[`asc`,`desc`]}).option(`order`,{type:`string`,description:`Application field by which results are ordered.`,choices:[`protocol`,`app_id`,`created_on`,`modified_on`,`dns`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Retrieves a list of currently existing Spectrum applications inside a zone.`,builder:O,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],direction:e.direction,order:e.order};if(e.dryRun){s({command:`cf spectrum apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.apps.list(a,t)),{successLabel:`Loaded`})}};function A(e){return e.positional(`app-id`,{type:`string`,description:`App ID`,demandOption:!0}).option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application.
|
|
58
|
-
Notes: Only available for TCP applications with traffic_type set to "direct".`}).option(`dns-name`,{type:`string`,description:`The name of the DNS record associated with the application.`}).option(`dns-type`,{type:`string`,description:`The type of DNS record associated with the application.`,choices:[`CNAME`,`ADDRESS`]}).option(`edge-ips-connectivity`,{type:`string`,description:`The IP versions supported for inbound connections on Spectrum anycast IPs.`,choices:[`all`,`ipv4`,`ipv6`]}).option(`edge-ips-type`,{type:`string`,description:`The type of edge IP configuration specified. Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the connectivity you specify. Only valid with CNAME DNS names.`,choices:[`dynamic`,`static`]}).option(`edge-ips-ips`,{type:`string`,array:!0,description:`The array of customer owned IPs we broadcast via anycast for this hostname and application.`}).option(`ip-firewall`,{type:`boolean`,description:`Enables IP Access Rules for this application.
|
|
59
|
-
Notes: Only available for TCP applications.`}).option(`origin-direct`,{type:`string`,array:!0,description:`List of origin IP addresses. Array may contain multiple IP addresses for load balancing.`}).option(`origin-dns-name`,{type:`string`,description:`The name of the DNS record associated with the origin.`}).option(`origin-dns-ttl`,{type:`number`,description:`The TTL of our resolution of your DNS record in seconds.`}).option(`origin-dns-type`,{type:`string`,description:`The type of DNS record associated with the origin. "" is used to specify a combination of A/AAAA records.`,choices:[`A`,`AAAA`,`SRV`]}).option(`protocol`,{type:`string`,description:'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'}).option(`proxy-protocol`,{type:`string`,description:`Enables Proxy Protocol to the origin. Refer to [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple Proxy Protocol.`,choices:[`off`,`v1`,`v2`,`simple`]}).option(`tls`,{type:`string`,description:`The type of TLS termination associated with the application.`,choices:[`off`,`flexible`,`full`,`strict`]}).option(`traffic-type`,{type:`string`,description:`Determines how data travels from the edge to your origin. When set to "direct", Spectrum will send traffic directly to your origin, and the application's type is derived from the \`protocol\`. When set to "http" or "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly.`,choices:[`direct`,`http`,`https`]}).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(`edge-ips-connectivity`,[`edge-ips-ips`]).conflicts(`edge-ips-ips`,[`edge-ips-connectivity`])}const j={command:`update <app-id>`,describe:`Updates a previously existing application's configuration that uses a name for the origin.`,builder:A,handler:async e=>{if(e.dryRun){s({command:`cf spectrum apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps/${e[`app-id`]==null?`<app-id>`:encodeURIComponent(String(e[`app-id`]))}`,pathParams:{"app-id":String(e[`app-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"argo-smart-routing":e[`argo-smart-routing`],"dns-name":e[`dns-name`],"dns-type":e[`dns-type`],"edge-ips-connectivity":e[`edge-ips-connectivity`],"edge-ips-type":e[`edge-ips-type`],"edge-ips-ips":e[`edge-ips-ips`],"ip-firewall":e[`ip-firewall`],"origin-direct":e[`origin-direct`],"origin-dns-name":e[`origin-dns-name`],"origin-dns-ttl":e[`origin-dns-ttl`],"origin-dns-type":e[`origin-dns-type`],protocol:e.protocol,"proxy-protocol":e[`proxy-protocol`],tls:e.tls,"traffic-type":e[`traffic-type`],body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/spectrum/apps/${encodeURIComponent(String(e[`app-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.protocol===void 0&&(e.protocol=await t(`protocol`,'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'));let d={};e[`argo-smart-routing`]!==void 0&&i(d,[`argo_smart_routing`],e[`argo-smart-routing`]),e[`dns-name`]!==void 0&&i(d,[`dns`,`name`],l(e[`dns-name`],`dns-name`,`text`)),e[`dns-type`]!==void 0&&i(d,[`dns`,`type`],l(e[`dns-type`],`dns-type`,`text`)),e[`edge-ips-connectivity`]!==void 0&&i(d,[`edge_ips`,`connectivity`],l(e[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`)),e[`edge-ips-type`]!==void 0&&i(d,[`edge_ips`,`type`],l(e[`edge-ips-type`],`edge-ips-type`,`text`)),e[`edge-ips-ips`]!==void 0&&i(d,[`edge_ips`,`ips`],e[`edge-ips-ips`]),e[`ip-firewall`]!==void 0&&i(d,[`ip_firewall`],e[`ip-firewall`]),e[`origin-direct`]!==void 0&&i(d,[`origin_direct`],e[`origin-direct`]),e[`origin-dns-name`]!==void 0&&i(d,[`origin_dns`,`name`],l(e[`origin-dns-name`],`origin-dns-name`,`text`)),e[`origin-dns-ttl`]!==void 0&&i(d,[`origin_dns`,`ttl`],e[`origin-dns-ttl`]),e[`origin-dns-type`]!==void 0&&i(d,[`origin_dns`,`type`],l(e[`origin-dns-type`],`origin-dns-type`,`text`)),e.protocol!==void 0&&i(d,[`protocol`],l(e.protocol,`protocol`,`text`)),e[`proxy-protocol`]!==void 0&&i(d,[`proxy_protocol`],l(e[`proxy-protocol`],`proxy-protocol`,`text`)),e.tls!==void 0&&i(d,[`tls`],l(e.tls,`tls`,`text`)),e[`traffic-type`]!==void 0&&i(d,[`traffic_type`],l(e[`traffic-type`],`traffic-type`,`text`)),o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/spectrum/apps/${encodeURIComponent(String(e[`app-id`]))}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},M={command:`apps`,describe:`Spectrum application configurations that map protocols and ports to origin servers`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`spectrum`,describe:`Proxy and protect arbitrary TCP/UDP applications through Cloudflare's network with DDoS mitigation`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};
|
package/dist/speed-BVcUtkAz.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{t as r}from"./body-parser-Br-BoYk-.mjs";import{t as i}from"./output-D7_yAFVR.mjs";import{n as a,t as o}from"./progress-CjcQ6ato.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`list`,describe:`Retrieves quota for all plans, as well as the current zone quota.`,builder:s,handler:async e=>{if(e.dryRun){a({command:`cf speed availabilities list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/availabilities`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),s=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading`,async()=>r.speed.availabilities.list(s)),{successLabel:`Loaded`})}},l={command:`availabilities`,describe:`Check which speed test regions and configurations are available for your zone`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`Lists all webpages which have been tested.`,builder:u,handler:async e=>{if(e.dryRun){a({command:`cf speed pages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/pages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),s=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading`,async()=>r.speed.pages.list(s)),{successLabel:`Loaded`})}};function f(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`create <url>`,describe:`Starts a test for a specific webpage, in a specific region.`,builder:f,handler:async e=>{if(e.dryRun){a({command:`cf speed pages tests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/pages/${e.url==null?`<url>`:encodeURIComponent(String(e.url))}/tests`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),url:String(e.url??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body);i(await o(`Creating`,async()=>s.post(`/zones/${e.zoneId}/speed_api/pages/${encodeURIComponent(String(e.url))}/tests`,{body:t})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>s.speed.pages.tests.create(c,e.url)),{successLabel:`Created`})}};function m(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).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 h={command:`delete <url>`,describe:`Deletes all tests for a specific webpage from a specific region. Deleted tests are still counted as part of the quota.`,builder:m,handler:async r=>{let s={region:r.region};if(r.dryRun){a({command:`cf speed pages tests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/speed_api/pages/${r.url==null?`<url>`:encodeURIComponent(String(r.url))}/tests`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),url:String(r.url??``)},query:s,bodyKind:`none`});return}let c=await n(r),l=await t({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await e({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting`,async()=>c.speed.pages.tests.delete(l,r.url,s)),{successLabel:`Deleted`})}};function g(e){return e.positional(`test-id`,{type:`string`,description:`Test ID`,demandOption:!0}).option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <test-id>`,describe:`Retrieves the result of a specific test.`,builder:g,handler:async e=>{if(e.dryRun){a({command:`cf speed pages tests get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/pages/${e.url==null?`<url>`:encodeURIComponent(String(e.url))}/tests/${e[`test-id`]==null?`<test-id>`:encodeURIComponent(String(e[`test-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),url:String(e.url??``),"test-id":String(e[`test-id`]??``)},bodyKind:`none`});return}let r=await n(e),s=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading`,async()=>r.speed.pages.tests.get(s,e.url,e[`test-id`])),{successLabel:`Loaded`})}};function v(e){return e.option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`region`,{type:`string`,description:`Region`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`Test history (list of tests) for a specific webpage.`,builder:v,handler:async e=>{let r={page:e.page,per_page:e[`per-page`],region:e.region};if(e.dryRun){a({command:`cf speed pages tests list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/pages/${e.url==null?`<url>`:encodeURIComponent(String(e.url))}/tests`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),url:String(e.url??``)},query:r,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,i(await o(`Loading`,async()=>s.speed.pages.tests.list(c,e.url,r)),{successLabel:`Loaded`})}},b={command:`tests`,describe:`Tested pages with their performance history, trends, and individual test results`,builder:e=>e.command(p).command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`],demandOption:!0}).option(`device-type`,{type:`string`,description:`The type of device.`,choices:[`DESKTOP`,`MOBILE`],demandOption:!0}).option(`start`,{type:`string`,description:`Start`,demandOption:!0}).option(`end`,{type:`string`,description:`End`}).option(`tz`,{type:`string`,description:`The timezone of the start and end timestamps.`,demandOption:!0}).option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to include in the results.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`trend <url>`,describe:`Lists the core web vital metrics trend over time for a specific page.`,builder:x,handler:async e=>{let r={region:e.region,deviceType:e[`device-type`],start:e.start,end:e.end,tz:e.tz,metrics:e.metrics};if(e.dryRun){a({command:`cf speed pages trend`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/pages/${e.url==null?`<url>`:encodeURIComponent(String(e.url))}/trend`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),url:String(e.url??``)},query:r,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,i(await o(`Loading`,async()=>s.speed.pages.trend(c,e.url,r)),{successLabel:`Loaded`})}},C={command:`pages`,describe:`Tested pages with their performance history, trends, and individual test results`,builder:e=>e.command(d).command(S).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).option(`frequency`,{type:`string`,description:`The frequency of the scheduled test. Defaults to WEEKLY for free plans, DAILY for paid plans.`,choices:[`DAILY`,`WEEKLY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`create <url>`,describe:`Creates a scheduled test for a page.`,builder:w,handler:async e=>{let r={region:e.region,frequency:e.frequency};if(e.dryRun){a({command:`cf speed schedule create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/schedule/${e.url==null?`<url>`:encodeURIComponent(String(e.url))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),url:String(e.url??``)},query:r,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,i(await o(`Creating`,async()=>s.speed.schedule.create(c,e.url,r)),{successLabel:`Created`})}};function E(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).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 <url>`,describe:`Deletes a scheduled test for a page.`,builder:E,handler:async r=>{let s={region:r.region};if(r.dryRun){a({command:`cf speed schedule delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/speed_api/schedule/${r.url==null?`<url>`:encodeURIComponent(String(r.url))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),url:String(r.url??``)},query:s,bodyKind:`none`});return}let c=await n(r),l=await t({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await e({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}i(await o(`Deleting`,async()=>c.speed.schedule.delete(l,r.url,s)),{successLabel:`Deleted`})}};function O(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <url>`,describe:`Retrieves the test schedule for a page in a specific region.`,builder:O,handler:async e=>{let r={region:e.region};if(e.dryRun){a({command:`cf speed schedule get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/speed_api/schedule/${e.url==null?`<url>`:encodeURIComponent(String(e.url))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),url:String(e.url??``)},query:r,bodyKind:`none`});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c,i(await o(`Loading`,async()=>s.speed.schedule.get(c,e.url,r)),{successLabel:`Loaded`})}},A={command:`schedule`,describe:`Scheduled recurring speed tests that automatically run at regular intervals`,builder:e=>e.command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`speed`,describe:`Observatory speed tests — run Lighthouse audits, track performance trends, and schedule recurring tests`,builder:e=>e.command(l).command(C).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{j as default};
|
package/dist/ssl-BAa91gsc.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,b as t,t as n,w as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(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 d={command:`create`,describe:`Returns the set of hostnames, the signature algorithm, and the expiration date of the certificate.`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf ssl analyze create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/analyze`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"bundle-method":e[`bundle-method`],certificate:e.certificate,body:e.body}});return}let r=await n(e);if(e.zoneId=await t({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>r.post(`/zones/${e.zoneId}/ssl/analyze`,{body:t})),{successLabel:`Created`});return}let u={};e[`bundle-method`]!==void 0&&i(u,[`bundle_method`],l(e[`bundle-method`],`bundle-method`,`text`)),e.certificate!==void 0&&i(u,[`certificate`],l(e.certificate,`certificate`,`text`)),o(await c(`Creating`,async()=>r.post(`/zones/${e.zoneId}/ssl/analyze`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created`})}},f={command:`analyze`,describe:`Analyze a certificate or certificate chain for validity and compatibility issues`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:`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:p,handler:async e=>{if(e.dryRun){s({command:`cf ssl automatic-upgrader get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/ssl_automatic_mode`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>r.ssl.automaticUpgrader.get(i)),{successLabel:`Loaded`})}};function h(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 g={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:h,handler:async e=>{if(e.dryRun){s({command:`cf ssl automatic-upgrader patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/ssl_automatic_mode`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{value:e.value,body:e.body}});return}let u=await n(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/settings/ssl_automatic_mode`,{body:t})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await r(`value`,`Controls enablement of Automatic SSL/TLS.`,[`auto`,`custom`]));let d={};e.value!==void 0&&i(d,[`value`],l(e.value,`value`,`text`)),o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/settings/ssl_automatic_mode`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},_={command:`automatic-upgrader`,describe:`SSL automatic mode enrollment — get or update automatic SSL/TLS upgrader settings`,builder:e=>e.command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(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 y={command:`create`,describe:`For a given zone, order an advanced certificate pack.`,builder:v,handler:async e=>{if(e.dryRun){s({command:`cf ssl certificate-packs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/certificate_packs/order`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"certificate-authority":e[`certificate-authority`],"cloudflare-branding":e[`cloudflare-branding`],hosts:e.hosts,type:e.type,"validation-method":e[`validation-method`],"validity-days":e[`validity-days`],body:e.body}});return}let u=await n(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/ssl/certificate_packs/order`,{body:t})),{successLabel:`Created`});return}if(e[`certificate-authority`]===void 0&&(e[`certificate-authority`]=await r(`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`])),e.hosts===void 0)throw Error(`--hosts is required (or pass --body with this field set).`);if(e.type===void 0&&(e.type=await r(`type`,`Type of certificate pack.`,[`advanced`])),e[`validation-method`]===void 0&&(e[`validation-method`]=await r(`validation-method`,`Validation Method selected for the order.`,[`txt`,`http`,`email`])),e[`validity-days`]===void 0)throw Error(`--validity-days is required (or pass --body with this field set).`);let d={};e[`certificate-authority`]!==void 0&&i(d,[`certificate_authority`],l(e[`certificate-authority`],`certificate-authority`,`text`)),e[`cloudflare-branding`]!==void 0&&i(d,[`cloudflare_branding`],e[`cloudflare-branding`]),e.hosts!==void 0&&i(d,[`hosts`],e.hosts),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),e[`validation-method`]!==void 0&&i(d,[`validation_method`],l(e[`validation-method`],`validation-method`,`text`)),e[`validity-days`]!==void 0&&i(d,[`validity_days`],e[`validity-days`]),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/ssl/certificate_packs/order`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function b(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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`delete <certificate-pack-id>`,describe:`For a given zone, delete an advanced certificate pack.`,builder:b,handler:async r=>{if(r.dryRun){s({command:`cf ssl certificate-packs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/ssl/certificate_packs/${r[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(r[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(r[`certificate-pack-id`]??``),"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:{body:r.body}});return}let i=await n(r),l=await t({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=l,!await e({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(r.body){let e=a(r.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${r.zoneId}/ssl/certificate_packs/${encodeURIComponent(String(r[`certificate-pack-id`]))}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.ssl.certificatePacks.delete(r[`certificate-pack-id`],l)),{successLabel:`Deleted`})}};function S(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 C={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:S,handler:async e=>{if(e.dryRun){s({command:`cf ssl certificate-packs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/certificate_packs/${e[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(e[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(e[`certificate-pack-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"cloudflare-branding":e[`cloudflare-branding`],body:e.body}});return}let r=await n(e);if(e.zoneId=await t({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>r.patch(`/zones/${e.zoneId}/ssl/certificate_packs/${encodeURIComponent(String(e[`certificate-pack-id`]))}`,{body:t})),{successLabel:`Updated`});return}let l={};e[`cloudflare-branding`]!==void 0&&i(l,[`cloudflare_branding`],e[`cloudflare-branding`]),o(await c(`Updating`,async()=>r.patch(`/zones/${e.zoneId}/ssl/certificate_packs/${encodeURIComponent(String(e[`certificate-pack-id`]))}`,{body:Object.keys(l).length>0?l:void 0})),{successLabel:`Updated`})}};function w(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 T={command:`get <certificate-pack-id>`,describe:`For a given zone, get a certificate pack.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf ssl certificate-packs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/certificate_packs/${e[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(e[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(e[`certificate-pack-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>r.ssl.certificatePacks.get(e[`certificate-pack-id`],i)),{successLabel:`Loaded`})}};function E(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 D={command:`list`,describe:`For a given zone, list all active certificate packs.`,builder:E,handler:async e=>{let r={page:e.page,per_page:e[`per-page`],status:e.status,deploy:e.deploy};if(e.dryRun){s({command:`cf ssl certificate-packs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/certificate_packs`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:r,bodyKind:`none`});return}let i=await n(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.ssl.certificatePacks.list(a,r)),{successLabel:`Loaded`})}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get`,describe:`For a given zone, list certificate pack quotas.`,builder:O,handler:async e=>{if(e.dryRun){s({command:`cf ssl certificate-packs quota get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/certificate_packs/quota`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>r.ssl.certificatePacks.quota.get(i)),{successLabel:`Loaded`})}},A={command:`quota`,describe:`Advanced Certificate Manager packs — order, renew, and manage dedicated SSL certificates`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`certificate-packs`,describe:`Advanced Certificate Manager packs — order, renew, and manage dedicated SSL certificates`,builder:e=>e.command(y).command(x).command(C).command(T).command(D).command(A).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 N={command:`get`,describe:`Retrieve the SSL/TLS Recommender's recommendation for a zone.`,builder:M,handler:async e=>{if(e.dryRun){s({command:`cf ssl recommendations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/recommendation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>r.ssl.recommendations.get(i)),{successLabel:`Loaded`})}},P={command:`recommendations`,describe:`Get the recommended SSL/TLS encryption mode based on your origin server's certificate configuration`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(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 I={command:`edit`,describe:`Patch Universal SSL Settings for a Zone.`,builder:F,handler:async e=>{if(e.dryRun){s({command:`cf ssl universal settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/universal/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body}});return}let r=await n(e);if(e.zoneId=await t({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>r.patch(`/zones/${e.zoneId}/ssl/universal/settings`,{body:t})),{successLabel:`Updated`});return}let l={};e.enabled!==void 0&&i(l,[`enabled`],e.enabled),o(await c(`Updating`,async()=>r.patch(`/zones/${e.zoneId}/ssl/universal/settings`,{body:Object.keys(l).length>0?l:void 0})),{successLabel:`Updated`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get`,describe:`Get Universal SSL Settings for a Zone.`,builder:L,handler:async e=>{if(e.dryRun){s({command:`cf ssl universal settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/universal/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>r.ssl.universal.settings.get(i)),{successLabel:`Loaded`})}},z={command:`settings`,describe:`Universal SSL settings — enable/disable automatic free SSL certificates for the zone`,builder:e=>e.command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`universal`,describe:`Operations for universal`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(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 H={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:V,handler:async e=>{if(e.dryRun){s({command:`cf ssl verification edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/verification/${e[`certificate-pack-id`]==null?`<certificate-pack-id>`:encodeURIComponent(String(e[`certificate-pack-id`]))}`,pathParams:{"certificate-pack-id":String(e[`certificate-pack-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"validation-method":e[`validation-method`],body:e.body}});return}let u=await n(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/ssl/verification/${encodeURIComponent(String(e[`certificate-pack-id`]))}`,{body:t})),{successLabel:`Updated`});return}e[`validation-method`]===void 0&&(e[`validation-method`]=await r(`validation-method`,`Desired validation method.`,[`http`,`cname`,`txt`,`email`]));let d={};e[`validation-method`]!==void 0&&i(d,[`validation_method`],l(e[`validation-method`],`validation-method`,`text`)),o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/ssl/verification/${encodeURIComponent(String(e[`certificate-pack-id`]))}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}};function U(e){return e.option(`retry`,{type:`string`,description:`Immediately retry SSL Verification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`get`,describe:`Get SSL Verification Info for a Zone.`,builder:U,handler:async e=>{let r={retry:e.retry};if(e.dryRun){s({command:`cf ssl verification get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ssl/verification`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:r,bodyKind:`none`});return}let i=await n(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.ssl.verification.get(a,r)),{successLabel:`Loaded`})}},G={command:`verification`,describe:`Check or modify the domain control validation (DCV) method for pending certificate orders`,builder:e=>e.command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},K={command:`ssl`,describe:`SSL/TLS certificate management — certificate packs, Universal SSL, verification, and TLS mode recommendations`,builder:e=>e.command(f).command(_).command(j).command(P).command(B).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
|
package/dist/stream-D53sxKb3.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,h as n,t as r,x as i}from"./auth-CQcAgnOy.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-CjcQ6ato.mjs";import{n as u,t as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{n as p,t as m}from"./raw-fetch-hRv-6P3D.mjs";function ee(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`url`,{type:`string`,description:"An audio track URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`copy <identifier>`,describe:`Adds an additional audio track to a video using the provided audio track URL.`,builder:ee,handler:async e=>{if(e.dryRun){c({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/audio/copy`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{label:e.label,url:e.url,body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/${encodeURIComponent(String(e.identifier))}/audio/copy`,{body:t})),{successLabel:`Created`});return}e.label===void 0&&(e.label=await t(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let m={};e.label!==void 0&&a(m,[`label`],u(e.label,`label`,`text`)),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/${encodeURIComponent(String(e.identifier))}/audio/copy`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function h(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <audio-identifier>`,describe:`Deletes additional audio tracks on a video. Deleting a default audio track is not allowed. You must assign another audio track as default prior to deletion.`,builder:h,handler:async t=>{if(t.dryRun){c({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/audio/${t[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(t[`audio-identifier`]))}`,pathParams:{identifier:String(t.identifier??``),"audio-identifier":String(t[`audio-identifier`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.audioTracks.delete(o,t.identifier,t[`audio-identifier`])),{successLabel:`Deleted`})}};function _(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`default`,{type:`boolean`,description:`Denotes whether the audio track will be played by default in a player.`}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <audio-identifier>`,describe:"Edits additional audio tracks on a video. Editing the default status of an audio track to `true` will mark all other audio tracks on the video default status to `false`.",builder:_,handler:async e=>{if(e.dryRun){c({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/audio/${e[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(e[`audio-identifier`]))}`,pathParams:{identifier:String(e.identifier??``),"audio-identifier":String(e[`audio-identifier`]??``)},bodyKind:`json`,body:{default:e.default,label:e.label,body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.patch(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/audio/${encodeURIComponent(String(e[`audio-identifier`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.default!==void 0&&a(p,[`default`],e.default),e.label!==void 0&&a(p,[`label`],u(e.label,`label`,`text`)),s(await l(`Updating`,async()=>t.patch(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/audio/${encodeURIComponent(String(e[`audio-identifier`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function y(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <identifier>`,describe:`Lists additional audio tracks on a video. Note this API will not return information for audio attached to the video upload.`,builder:y,handler:async e=>{if(e.dryRun){c({command:`cf stream audio-tracks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/audio`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.audioTracks.get(a,e.identifier)),{successLabel:`Loaded`})}},x={command:`audio-tracks`,describe:`Add, edit, or remove additional audio tracks on a video`,builder:e=>e.command(te).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:S,handler:async e=>{if(e.dryRun){c({command:`cf stream captions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.captions.get(e.identifier,a)),{successLabel:`Loaded`})}};function w(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:w,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}/generate`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.captions.language.create(e.language,e.identifier,a)),{successLabel:`Created`})}};function E(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:E,handler:async t=>{if(t.dryRun){c({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/captions/${t.language==null?`<language>`:encodeURIComponent(String(t.language))}`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.captions.language.delete(t.language,t.identifier,o)),{successLabel:`Deleted`})}};function O(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.captions.language.get(e.language,e.identifier,a)),{successLabel:`Loaded`})}};function A(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const j={command:`update <language>`,describe:`Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed.`,builder:A,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file}});return}let t=await r(e),a=e.local?f:await n(t);if(e.accountId=a,e.file!==void 0||e.body!==void 0){let n=new FormData;if(e.file){let t=d(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/captions/${encodeURIComponent(String(e.language))}`,{body:n})),{successLabel:`Updated`});return}if(e.body){let n=u(e.body,`body`,`binary`);s(await l(`Updating`,async()=>t.put(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/captions/${encodeURIComponent(String(e.language))}`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function M(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf stream captions language vtt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/captions/${e.language==null?`<language>`:encodeURIComponent(String(e.language))}/vtt`,pathParams:{language:String(e.language??``),identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,p((await l(`Loading`,async()=>m(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/captions/${encodeURIComponent(String(e.language))}/vtt`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}},P={command:`vtt`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`language`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(T).command(D).command(k).command(j).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},I={command:`captions`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(C).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`clipped-from-video-uid`,{type:`string`,description:`The unique video identifier (UID).`}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`end-time-seconds`,{type:`number`,description:`Specifies the end time for the video clip in seconds.`}).option(`input`,{type:`string`,description:`A video's URL. Preferred over 'url'.`}).option(`name`,{type:`string`,description:`A name for the video.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`start-time-seconds`,{type:`number`,description:`Specifies the start time for the video clip in seconds.`}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:`A video's URL (legacy field, use 'input' instead).`}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],"clipped-from-video-uid":e[`clipped-from-video-uid`],creator:e.creator,"end-time-seconds":e[`end-time-seconds`],input:e.input,name:e.name,"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"start-time-seconds":e[`start-time-seconds`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],url:e.url,"watermark-uid":e[`watermark-uid`],body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/clip`,{body:t})),{successLabel:`Created`});return}if(e[`clipped-from-video-uid`]===void 0&&(e[`clipped-from-video-uid`]=await t(`clipped-from-video-uid`,`The unique video identifier (UID).`)),e[`end-time-seconds`]===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(e[`start-time-seconds`]===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let m={};e[`allowed-origins`]!==void 0&&a(m,[`allowedOrigins`],e[`allowed-origins`]),e[`clipped-from-video-uid`]!==void 0&&a(m,[`clippedFromVideoUID`],u(e[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`)),e.creator!==void 0&&a(m,[`creator`],u(e.creator,`creator`,`text`)),e[`end-time-seconds`]!==void 0&&a(m,[`endTimeSeconds`],e[`end-time-seconds`]),e.input!==void 0&&a(m,[`input`],u(e.input,`input`,`text`)),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),e[`require-signed-urls`]!==void 0&&a(m,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(m,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`start-time-seconds`]!==void 0&&a(m,[`startTimeSeconds`],e[`start-time-seconds`]),e[`thumbnail-timestamp-pct`]!==void 0&&a(m,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),e[`watermark-uid`]!==void 0&&a(m,[`watermark`,`uid`],u(e[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/clip`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},z={command:`clip`,describe:`Create a new video clip from an existing video by specifying start and end times`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`input`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This is the preferred field over `url`."}).option(`name`,{type:`string`,description:`A video's name. Used for legacy compatibility.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This field is deprecated in favor of `input`."}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Copy upload request. Provide `input` (preferred) or `url` (deprecated)."})}const V={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:B,handler:async e=>{let t={};if(e[`upload-creator`]!==void 0&&(t[`Upload-Creator`]=String(e[`upload-creator`])),e.dryRun){c({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],creator:e.creator,input:e.input,name:e.name,"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],url:e.url,"watermark-uid":e[`watermark-uid`],body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let n=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/copy`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`});return}let m={};e[`allowed-origins`]!==void 0&&a(m,[`allowedOrigins`],e[`allowed-origins`]),e.creator!==void 0&&a(m,[`creator`],u(e.creator,`creator`,`text`)),e.input!==void 0&&a(m,[`input`],u(e.input,`input`,`text`)),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),e[`require-signed-urls`]!==void 0&&a(m,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(m,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`thumbnail-timestamp-pct`]!==void 0&&a(m,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),e[`watermark-uid`]!==void 0&&a(m,[`watermark`,`uid`],u(e[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/copy`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`})}},H={command:`copy`,describe:`Import a video from a URL into Stream for processing and delivery`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`direct-user`,{type:`string`,description:`Provisions a URL to let your end users upload videos directly to Cloudflare Stream without exposing your API token to clients.`}).option(`tus-resumable`,{type:`string`,description:`Specifies the TUS protocol version. This value must be included in every upload request.
|
|
5
|
-
Notes: The only supported version of TUS protocol is 1.0.0.`,demandOption:!0}).option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`upload-length`,{type:`string`,description:`Indicates the size of the entire upload in bytes. The value must be a non-negative integer.`,demandOption:!0}).option(`upload-metadata`,{type:`string`,description:"Comma-separated key-value pairs following the TUS protocol specification. Values are Base-64 encoded.\nSupported keys: `name`, `requiresignedurls`, `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`, `maxdurationseconds`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`create`,describe:"Initiates a video upload using the TUS protocol. On success, the server responds with a status code 201 (created) and includes a `location` header to indicate where the content should be uploaded. Refer to https://tus.io for protocol details.",builder:U,handler:async e=>{let t={direct_user:e[`direct-user`]},a={};if(e[`tus-resumable`]!==void 0&&(a[`Tus-Resumable`]=String(e[`tus-resumable`])),e[`upload-creator`]!==void 0&&(a[`Upload-Creator`]=String(e[`upload-creator`])),e[`upload-length`]!==void 0&&(a[`Upload-Length`]=String(e[`upload-length`])),e[`upload-metadata`]!==void 0&&(a[`Upload-Metadata`]=String(e[`upload-metadata`])),e.dryRun){c({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream`,pathParams:{},query:t,bodyKind:`none`});return}let o=await r(e),u=e.local?f:await n(o);e.accountId=u,s(await l(`Creating`,async()=>o.post(`/accounts/${u}/stream`,{query:t,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Created`})}};function G(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:G,handler:async t=>{if(t.dryRun){c({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.delete(t.identifier,o)),{successLabel:`Deleted`})}};function q(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`expiry`,{type:`string`,description:`The date and time after upload when videos will not be accepted.`,default:`Now + 30 minutes`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const J={command:`create`,describe:`Creates a direct upload that allows video uploads without an API key.`,builder:q,handler:async e=>{let t={};if(e[`upload-creator`]!==void 0&&(t[`Upload-Creator`]=String(e[`upload-creator`])),e.dryRun){c({command:`cf stream direct-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/direct_upload`,pathParams:{},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],creator:e.creator,expiry:e.expiry,"max-duration-seconds":e[`max-duration-seconds`],"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],"watermark-uid":e[`watermark-uid`],body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let n=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/direct_upload`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`});return}if(e[`max-duration-seconds`]===void 0)throw Error(`--max-duration-seconds is required (or pass --body with this field set).`);let m={};e[`allowed-origins`]!==void 0&&a(m,[`allowedOrigins`],e[`allowed-origins`]),e.creator!==void 0&&a(m,[`creator`],u(e.creator,`creator`,`text`)),e.expiry!==void 0&&a(m,[`expiry`],u(e.expiry,`expiry`,`text`)),e[`max-duration-seconds`]!==void 0&&a(m,[`maxDurationSeconds`],e[`max-duration-seconds`]),e[`require-signed-urls`]!==void 0&&a(m,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(m,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`thumbnail-timestamp-pct`]!==void 0&&a(m,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e[`watermark-uid`]!==void 0&&a(m,[`watermark`,`uid`],u(e[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/direct_upload`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Created`})}},Y={command:`direct-upload`,describe:`Generate a tokenized URL that lets end-users upload video directly to Stream`,builder:e=>e.command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`create <identifier>`,describe:"Creates a download for a video when a video is ready to view. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:X,handler:async e=>{if(e.dryRun){c({command:`cf stream downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/downloads`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.downloads.create(e.identifier,a)),{successLabel:`Created`})}};function Q(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ne={command:`delete <identifier>`,describe:"Delete the downloads for a video. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:Q,handler:async t=>{if(t.dryRun){c({command:`cf stream downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.downloads.delete(t.identifier,o)),{successLabel:`Deleted`})}};function re(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <identifier>`,describe:`Lists the downloads created for a video.`,builder:re,handler:async e=>{if(e.dryRun){c({command:`cf stream downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/downloads`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.downloads.get(e.identifier,a)),{successLabel:`Loaded`})}},ae={command:`downloads`,describe:`Create downloadable MP4 renditions of a video for offline viewing`,builder:e=>e.command(Z).command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`public-details-channel-link`,{type:`string`,description:`The publicDetails.channel_link field`}).option(`public-details-logo`,{type:`string`,description:`The publicDetails.logo field`}).option(`public-details-share-link`,{type:`string`,description:`The publicDetails.share_link field`}).option(`public-details-title`,{type:`string`,description:`The publicDetails.title field`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`uid`,{type:`string`,description:`The unique identifier for the video. Can be used to verify the video being updated.`}).option(`upload-expiry`,{type:`string`,description:`The date and time when the video upload URL is no longer valid for direct user uploads.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const se={command:`edit <identifier>`,describe:`Edit details for a single video.`,builder:oe,handler:async e=>{if(e.dryRun){c({command:`cf stream edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{"allowed-origins":e[`allowed-origins`],creator:e.creator,"max-duration-seconds":e[`max-duration-seconds`],"public-details-channel-link":e[`public-details-channel-link`],"public-details-logo":e[`public-details-logo`],"public-details-share-link":e[`public-details-share-link`],"public-details-title":e[`public-details-title`],"require-signed-urls":e[`require-signed-urls`],"scheduled-deletion":e[`scheduled-deletion`],"thumbnail-timestamp-pct":e[`thumbnail-timestamp-pct`],uid:e.uid,"upload-expiry":e[`upload-expiry`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}`,{body:n})),{successLabel:`Created`});return}let p={};e[`allowed-origins`]!==void 0&&a(p,[`allowedOrigins`],e[`allowed-origins`]),e.creator!==void 0&&a(p,[`creator`],u(e.creator,`creator`,`text`)),e[`max-duration-seconds`]!==void 0&&a(p,[`maxDurationSeconds`],e[`max-duration-seconds`]),e[`public-details-channel-link`]!==void 0&&a(p,[`publicDetails`,`channel_link`],u(e[`public-details-channel-link`],`public-details-channel-link`,`text`)),e[`public-details-logo`]!==void 0&&a(p,[`publicDetails`,`logo`],u(e[`public-details-logo`],`public-details-logo`,`text`)),e[`public-details-share-link`]!==void 0&&a(p,[`publicDetails`,`share_link`],u(e[`public-details-share-link`],`public-details-share-link`,`text`)),e[`public-details-title`]!==void 0&&a(p,[`publicDetails`,`title`],u(e[`public-details-title`],`public-details-title`,`text`)),e[`require-signed-urls`]!==void 0&&a(p,[`requireSignedURLs`],e[`require-signed-urls`]),e[`scheduled-deletion`]!==void 0&&a(p,[`scheduledDeletion`],u(e[`scheduled-deletion`],`scheduled-deletion`,`text`)),e[`thumbnail-timestamp-pct`]!==void 0&&a(p,[`thumbnailTimestampPct`],e[`thumbnail-timestamp-pct`]),e.uid!==void 0&&a(p,[`uid`],u(e.uid,`uid`,`text`)),e[`upload-expiry`]!==void 0&&a(p,[`uploadExpiry`],u(e[`upload-expiry`],`upload-expiry`,`text`)),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function ce(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`get <identifier>`,describe:`Fetches an HTML code snippet to embed a video in a web page delivered through Cloudflare. On success, returns an HTML fragment for use on web pages to display a video. On failure, returns a JSON response body.`,builder:ce,handler:async e=>{if(e.dryRun){c({command:`cf stream embed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/embed`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,p((await l(`Loading`,async()=>m(`/accounts/${a}/stream/${encodeURIComponent(String(e.identifier))}/embed`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}},ue={command:`embed`,describe:`Retrieve the HTML embed code snippet for a video`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get <identifier>`,describe:`Fetches details for a single video.`,builder:de,handler:async e=>{if(e.dryRun){c({command:`cf stream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.get(e.identifier,a)),{successLabel:`Loaded`})}};function pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`create`,describe:`Creates an RSA private key in PEM and JWK formats. Key files are only displayed once after creation. Keys are created, used, and deleted independently of videos, and every key can sign any video.`,builder:pe,handler:async e=>{if(e.dryRun){c({command:`cf stream keys create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),a=e.local?f:await n(t);if(e.accountId=a,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${a}/stream/keys`,{body:n})),{successLabel:`Created`});return}s(await l(`Creating`,async()=>t.stream.keys.create(a)),{successLabel:`Created`})}};function he(e){return e.positional(`identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ge={command:`delete <identifier>`,describe:`Deletes signing keys and revokes all signed URLs generated with the key.`,builder:he,handler:async t=>{if(t.dryRun){c({command:`cf stream keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/keys/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/stream/keys/${encodeURIComponent(String(t.identifier))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.stream.keys.delete(t.identifier,u)),{successLabel:`Deleted`})}};function _e(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`get`,describe:`Lists the video ID and creation date and time when a signing key was created.`,builder:_e,handler:async e=>{if(e.dryRun){c({command:`cf stream keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.keys.get(a)),{successLabel:`Loaded`})}},ye={command:`keys`,describe:`Signing keys used to generate short-lived signed URLs for private video playback`,builder:e=>e.command(me).command(ge).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.option(`status`,{type:`string`,description:`Specifies the processing status for all quality levels for a video.`,choices:[`pendingupload`,`downloading`,`queued`,`inprogress`,`ready`,`error`,`live-inprogress`]}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`type`,{type:`string`,description:"Specifies whether the video is `vod` or `live`."}).option(`asc`,{type:`string`,description:`Lists videos in ascending order of creation.`}).option(`video-name`,{type:`string`,description:"Provides a fast, exact string match on the `name` key in the `meta` field."}).option(`search`,{type:`string`,description:"Provides a partial word match of the `name` key in the `meta` field. Slow for medium to large video libraries. May be unavailable for very large libraries."}).option(`start`,{type:`string`,description:`Lists videos created after the specified date.`}).option(`end`,{type:`string`,description:`Lists videos created before the specified date.`}).option(`include-counts`,{type:`string`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`id`,{type:`string`,description:`Filter by video ID(s). Can be a single ID or a comma-separated list of IDs.`}).option(`name`,{type:`string`,description:`Filter by video name/UID(s). Can be a single name or a comma-separated list.`}).option(`live-input-id`,{type:`string`,description:`Filter by live input ID to find videos associated with a specific live stream.`}).option(`before`,{type:`string`,description:`Alias for 'end'. Returns videos created before this date/time (RFC 3339 format).`}).option(`after`,{type:`string`,description:`Alias for 'start'. Returns videos created after this date/time (RFC 3339 format).`}).option(`limit`,{type:`number`,description:`Maximum number of videos to return (default 1000, max 1000).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.`,builder:be,handler:async e=>{let t={status:e.status,creator:e.creator,type:e.type,asc:e.asc,video_name:e[`video-name`],search:e.search,start:e.start,end:e.end,include_counts:e[`include-counts`],id:e.id,name:e.name,live_input_id:e[`live-input-id`],before:e.before,after:e.after,limit:e.limit};if(e.dryRun){c({command:`cf stream list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.stream.list(o,t)),{successLabel:`Loaded`})}};function Se(e){return e.option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`,default:!0}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`.",default:!1}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`],default:`off`}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input.",default:!1}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used.",default:0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ce={command:`create`,describe:`Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream.`,builder:Se,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs`,pathParams:{},bodyKind:`json`,body:{"default-creator":e[`default-creator`],"delete-recording-after-days":e[`delete-recording-after-days`],enabled:e.enabled,"recording-allowed-origins":e[`recording-allowed-origins`],"recording-hide-live-viewer-count":e[`recording-hide-live-viewer-count`],"recording-mode":e[`recording-mode`],"recording-require-signed-urls":e[`recording-require-signed-urls`],"recording-timeout-seconds":e[`recording-timeout-seconds`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/live_inputs`,{body:n})),{successLabel:`Created`});return}let p={};e[`default-creator`]!==void 0&&a(p,[`defaultCreator`],u(e[`default-creator`],`default-creator`,`text`)),e[`delete-recording-after-days`]!==void 0&&a(p,[`deleteRecordingAfterDays`],e[`delete-recording-after-days`]),e.enabled!==void 0&&a(p,[`enabled`],e.enabled),e[`recording-allowed-origins`]!==void 0&&a(p,[`recording`,`allowedOrigins`],e[`recording-allowed-origins`]),e[`recording-hide-live-viewer-count`]!==void 0&&a(p,[`recording`,`hideLiveViewerCount`],e[`recording-hide-live-viewer-count`]),e[`recording-mode`]!==void 0&&a(p,[`recording`,`mode`],u(e[`recording-mode`],`recording-mode`,`text`)),e[`recording-require-signed-urls`]!==void 0&&a(p,[`recording`,`requireSignedURLs`],e[`recording-require-signed-urls`]),e[`recording-timeout-seconds`]!==void 0&&a(p,[`recording`,`timeoutSeconds`],e[`recording-timeout-seconds`]),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/live_inputs`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function we(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Te={command:`delete <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls.`,builder:we,handler:async t=>{if(t.dryRun){c({command:`cf stream live-inputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(t[`live-input-identifier`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.stream.liveInputs.delete(t[`live-input-identifier`],u)),{successLabel:`Deleted`})}};function Ee(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const De={command:`create <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls until enabled.`,builder:Ee,handler:async t=>{if(t.dryRun){c({command:`cf stream live-inputs disable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/disable`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force,message:`This operation disables a live input. Active streams to it are dropped.`})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.liveInputs.disable.create(t[`live-input-identifier`],o)),{successLabel:`Deleted`})}},Oe={command:`disable`,describe:`Enable and disable live input streams`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`create <live-input-identifier>`,describe:`Allows a live input to be streamed to and makes the live input accessible to any future API calls.`,builder:ke,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs enable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/enable`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.liveInputs.enable.create(e[`live-input-identifier`],a)),{successLabel:`Created`})}},je={command:`enable`,describe:`Enable and disable live input streams`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ne={command:`get <live-input-identifier>`,describe:`Retrieves details of an existing live input.`,builder:Me,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.liveInputs.get(e[`live-input-identifier`],a)),{successLabel:`Loaded`})}};function Pe(e){return e.option(`include-counts`,{type:`string`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Lists the live inputs created for an account. To get the credentials needed to stream to a specific live input, request a single live input.`,builder:Pe,handler:async e=>{let t={include_counts:e[`include-counts`]};if(e.dryRun){c({command:`cf stream live-inputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.stream.liveInputs.list(o,t)),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`,default:!0}).option(`stream-key`,{type:`string`,description:`The streamKey used to authenticate against an output's target.`}).option(`url`,{type:`string`,description:`The URL an output uses to restream.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Le={command:`create <live-input-identifier>`,describe:`Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live input — one live input can have many outputs.`,builder:Ie,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs outputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`json`,body:{enabled:e.enabled,"stream-key":e[`stream-key`],url:e.url,body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,{body:t})),{successLabel:`Created`});return}e[`stream-key`]===void 0&&(e[`stream-key`]=await t(`stream-key`,`The streamKey used to authenticate against an output's target.`,{kind:`secret`})),e.url===void 0&&(e.url=await t(`url`,`The URL an output uses to restream.`,{kind:`secret`}));let m={};e.enabled!==void 0&&a(m,[`enabled`],e.enabled),e[`stream-key`]!==void 0&&a(m,[`streamKey`],u(e[`stream-key`],`stream-key`,`text`)),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Re(e){return e.positional(`output-identifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ze={command:`delete <output-identifier>`,describe:`Deletes an output and removes it from the associated live input.`,builder:Re,handler:async t=>{if(t.dryRun){c({command:`cf stream live-inputs outputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/outputs/${t[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(t[`output-identifier`]))}`,pathParams:{"output-identifier":String(t[`output-identifier`]??``),"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(t[`live-input-identifier`]))}/outputs/${encodeURIComponent(String(t[`output-identifier`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.stream.liveInputs.outputs.delete(t[`output-identifier`],t[`live-input-identifier`],u)),{successLabel:`Deleted`})}};function Be(e){return e.option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Retrieves all outputs associated with a specified live input.`,builder:Be,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs outputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.liveInputs.outputs.list(e[`live-input-identifier`],a)),{successLabel:`Loaded`})}};function He(e){return e.positional(`output-identifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ue={command:`update <output-identifier>`,describe:`Updates the state of an output.`,builder:He,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs outputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}/outputs/${e[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(e[`output-identifier`]))}`,pathParams:{"output-identifier":String(e[`output-identifier`]??``),"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body}});return}let t=await r(e),u=e.local?f:await n(t);if(e.accountId=u,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs/${encodeURIComponent(String(e[`output-identifier`]))}`,{body:n})),{successLabel:`Updated`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let d={};e.enabled!==void 0&&a(d,[`enabled`],e.enabled),s(await l(`Updating`,async()=>t.put(`/accounts/${u}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}/outputs/${encodeURIComponent(String(e[`output-identifier`]))}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},We={command:`outputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Le).command(ze).command(Ve).command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ge(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`."}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`]}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input."}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`update <live-input-identifier>`,describe:`Updates a specified live input.`,builder:Ge,handler:async e=>{if(e.dryRun){c({command:`cf stream live-inputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/live_inputs/${e[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(e[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(e[`live-input-identifier`]??``)},bodyKind:`json`,body:{"default-creator":e[`default-creator`],"delete-recording-after-days":e[`delete-recording-after-days`],enabled:e.enabled,"recording-allowed-origins":e[`recording-allowed-origins`],"recording-hide-live-viewer-count":e[`recording-hide-live-viewer-count`],"recording-mode":e[`recording-mode`],"recording-require-signed-urls":e[`recording-require-signed-urls`],"recording-timeout-seconds":e[`recording-timeout-seconds`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e[`default-creator`]!==void 0&&a(p,[`defaultCreator`],u(e[`default-creator`],`default-creator`,`text`)),e[`delete-recording-after-days`]!==void 0&&a(p,[`deleteRecordingAfterDays`],e[`delete-recording-after-days`]),e.enabled!==void 0&&a(p,[`enabled`],e.enabled),e[`recording-allowed-origins`]!==void 0&&a(p,[`recording`,`allowedOrigins`],e[`recording-allowed-origins`]),e[`recording-hide-live-viewer-count`]!==void 0&&a(p,[`recording`,`hideLiveViewerCount`],e[`recording-hide-live-viewer-count`]),e[`recording-mode`]!==void 0&&a(p,[`recording`,`mode`],u(e[`recording-mode`],`recording-mode`,`text`)),e[`recording-require-signed-urls`]!==void 0&&a(p,[`recording`,`requireSignedURLs`],e[`recording-require-signed-urls`]),e[`recording-timeout-seconds`]!==void 0&&a(p,[`recording`,`timeoutSeconds`],e[`recording-timeout-seconds`]),s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/live_inputs/${encodeURIComponent(String(e[`live-input-identifier`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},qe={command:`live-inputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Ce).command(Te).command(Ne).command(Fe).command(Ke).command(Oe).command(je).command(We).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`downloadable`,{type:`boolean`,description:`The optional boolean value that enables using signed tokens to access MP4 download links for a video.`,default:!1}).option(`exp`,{type:`number`,description:`The optional unix epoch timestamp that specficies the time after a token is not accepted. The maximum time specification is 24 hours from issuing time. If this field is not set, the default is one hour after issuing.`}).option(`flags-original`,{type:`boolean`,description:`Whether to return the original video without transformations.`,default:!1}).option(`id`,{type:`string`,description:"The optional ID of a Stream signing key. If present, the `pem` field is also required."}).option(`nbf`,{type:`number`,description:`The optional unix epoch timestamp that specifies the time before a the token is not accepted. If this field is not set, the default is one hour before issuing.`}).option(`pem`,{type:`string`,description:"The optional base64 encoded private key in PEM format associated with a Stream signing key. If present, the `id` field is also required."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ye={command:`create <identifier>`,describe:`Creates a signed URL token for a video. If a body is not provided in the request, a token is created with default values.`,builder:Je,handler:async e=>{if(e.dryRun){c({command:`cf stream token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/token`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:{downloadable:e.downloadable,exp:e.exp,"flags-original":e[`flags-original`],id:e.id,nbf:e.nbf,pem:e.pem,body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/token`,{body:n})),{successLabel:`Created`});return}let p={};e.downloadable!==void 0&&a(p,[`downloadable`],e.downloadable),e.exp!==void 0&&a(p,[`exp`],e.exp),e[`flags-original`]!==void 0&&a(p,[`flags`,`original`],e[`flags-original`]),e.id!==void 0&&a(p,[`id`],u(e.id,`id`,`text`)),e.nbf!==void 0&&a(p,[`nbf`],e.nbf),e.pem!==void 0&&a(p,[`pem`],u(e.pem,`pem`,`text`)),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/stream/${encodeURIComponent(String(e.identifier))}/token`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},Xe={command:`token`,describe:`Generate short-lived signed URL tokens for secure private video playback`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(e){return e.positional(`download-type`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qe={command:`create <download-type>`,describe:`Creates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.`,builder:Ze,handler:async e=>{if(e.dryRun){c({command:`cf stream typed-downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/downloads/${e[`download-type`]==null?`<download-type>`:encodeURIComponent(String(e[`download-type`]))}`,pathParams:{identifier:String(e.identifier??``),"download-type":String(e[`download-type`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.stream.typedDownloads.create(e.identifier,a,e[`download-type`])),{successLabel:`Created`})}};function $e(e){return e.positional(`download-type`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const et={command:`delete <download-type>`,describe:`Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.`,builder:$e,handler:async t=>{if(t.dryRun){c({command:`cf stream typed-downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads/${t[`download-type`]==null?`<download-type>`:encodeURIComponent(String(t[`download-type`]))}`,pathParams:{identifier:String(t.identifier??``),"download-type":String(t[`download-type`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
12
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.typedDownloads.delete(t.identifier,o,t[`download-type`])),{successLabel:`Deleted`})}},tt={command:`typed-downloads`,describe:`Type-specific stream download creation and deletion`,builder:e=>e.command(Qe).command(et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nt(e){return e.option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rt={command:`storage-usage`,describe:`Returns information about an account's storage use.`,builder:nt,handler:async e=>{let t={creator:e.creator};if(e.dryRun){c({command:`cf stream videos storage-usage`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/storage-usage`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.stream.videos.storageUsage(o,t)),{successLabel:`Loaded`})}},it={command:`videos`,describe:`Aggregate video storage usage statistics for the account`,builder:e=>e.command(rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function at(e){return e.option(`name`,{type:`string`,description:`A short description of the watermark profile.`,default:``}).option(`opacity`,{type:`number`,description:"The translucency of the image. A value of `0.0` makes the image completely transparent, and `1.0` makes the image completely opaque. Note that if the image is already semi-transparent, setting this to `1.0` will not make the image completely opaque.",default:1}).option(`padding`,{type:`number`,description:"The whitespace between the adjacent edges (determined by position) of the video and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded video width or length, as determined by the algorithm.",default:.05}).option(`position`,{type:`string`,description:"The location of the image. Valid positions are: `upperRight`, `upperLeft`, `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the `padding` parameter.",default:`upperRight`}).option(`scale`,{type:`number`,description:"The size of the image relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. `0.0` indicates no scaling (use the size of the image as-is), and `1.0 `fills the entire video.",default:.15}).option(`url`,{type:`string`,description:`URL of the watermark image to copy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const ot={command:`create`,describe:"Creates watermark profiles using a single `HTTP POST multipart/form-data` request.",builder:at,handler:async e=>{if(e.dryRun){c({command:`cf stream watermarks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`multipart`,body:{name:e.name,opacity:e.opacity,padding:e.padding,position:e.position,scale:e.scale,url:e.url,body:e.body,file:e.file}});return}let t=await r(e),p=e.local?f:await n(t);if(e.accountId=p,e.file!==void 0||e.body!==void 0||e.name!==void 0||e.opacity!==void 0||e.padding!==void 0||e.position!==void 0||e.scale!==void 0){let n=new FormData;if(e.file){let t=d(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);e.name!==void 0&&n.append(`name`,String(u(e.name,`name`,`text`)??``)),e.opacity!==void 0&&n.append(`opacity`,String(e.opacity)),e.padding!==void 0&&n.append(`padding`,String(e.padding)),e.position!==void 0&&n.append(`position`,String(u(e.position,`position`,`text`)??``)),e.scale!==void 0&&n.append(`scale`,String(e.scale)),s(await l(`Creating`,async()=>t.post(`/accounts/${p}/stream/watermarks`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${p}/stream/watermarks`,{body:n})),{successLabel:`Created`});return}let m={};e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),e.opacity!==void 0&&a(m,[`opacity`],e.opacity),e.padding!==void 0&&a(m,[`padding`],e.padding),e.position!==void 0&&a(m,[`position`],u(e.position,`position`,`text`)),e.scale!==void 0&&a(m,[`scale`],e.scale),e.url!==void 0&&a(m,[`url`],u(e.url,`url`,`text`)),s(await l(`Creating`,async()=>t.post(`/accounts/${p}/stream/watermarks`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function st(e){return e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ct={command:`delete <identifier>`,describe:`Deletes a watermark profile.`,builder:st,handler:async t=>{if(t.dryRun){c({command:`cf stream watermarks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.watermarks.delete(t.identifier,o)),{successLabel:`Deleted`})}};function lt(e){return e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`get <identifier>`,describe:`Retrieves details for a single watermark profile.`,builder:lt,handler:async e=>{if(e.dryRun){c({command:`cf stream watermarks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.watermarks.get(e.identifier,a)),{successLabel:`Loaded`})}};function dt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ft={command:`list`,describe:`Lists all watermark profiles for an account.`,builder:dt,handler:async e=>{if(e.dryRun){c({command:`cf stream watermarks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.watermarks.list(a)),{successLabel:`Loaded`})}},$={command:`watermarks`,describe:`Watermark profiles that overlay an image on every video in the account`,builder:e=>e.command(ot).command(ct).command(ut).command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const mt={command:`delete`,describe:`Deletes a webhook.`,builder:pt,handler:async t=>{if(t.dryRun){c({command:`cf stream webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let a=await r(t),o=t.local?f:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
14
|
-
`);return}s(await l(`Deleting`,async()=>a.stream.webhooks.delete(o)),{successLabel:`Deleted`})}};function ht(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gt={command:`get`,describe:`Retrieves a list of webhooks.`,builder:ht,handler:async e=>{if(e.dryRun){c({command:`cf stream webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.stream.webhooks.get(a)),{successLabel:`Loaded`})}};function _t(e){return e.option(`notification-url`,{type:`string`,description:`The URL where webhooks will be sent.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const vt={command:`update`,describe:`Creates a webhook notification.`,builder:_t,handler:async e=>{if(e.dryRun){c({command:`cf stream webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`json`,body:{"notification-url":e[`notification-url`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/webhook`,{body:n})),{successLabel:`Updated`});return}let p={};e[`notification-url`]!==void 0&&a(p,[`notificationUrl`],u(e[`notification-url`],`notification-url`,`text`)),s(await l(`Updating`,async()=>t.put(`/accounts/${d}/stream/webhook`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},yt={command:`webhooks`,describe:`Webhook notifications for video lifecycle events (ready, error, etc.)`,builder:e=>e.command(mt).command(gt).command(vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bt={command:`stream`,describe:`Video encoding, storage, and delivery — upload, live-stream, clip, caption, and embed video at scale`,builder:e=>e.command(W).command(K).command(se).command(fe).command(xe).command(x).command(I).command(z).command(H).command(Y).command(ae).command(ue).command(ye).command(qe).command(Xe).command(tt).command(it).command($).command(yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{bt as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./auth-CQcAgnOy.mjs";import{t}from"./output-D7_yAFVR.mjs";import{n,t as r}from"./progress-CjcQ6ato.mjs";function i(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={command:`get <tenant-id>`,describe:`List of account types available for the Tenant to provision accounts.`,builder:i,handler:async i=>{if(i.dryRun){n({command:`cf tenants account-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/account_types`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.accountTypes.get(i[`tenant-id`])),{successLabel:`Loaded`})}},o={command:`account-types`,describe:`Account Types operations`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function s(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`list`,describe:`List of accounts for the Tenant.`,builder:s,handler:async i=>{if(i.dryRun){n({command:`cf tenants accounts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/accounts`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.accounts.list(i[`tenant-id`])),{successLabel:`Loaded`})}},l={command:`accounts`,describe:`Accounts operations`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`List of innate entitlements available for the Tenant.`,builder:u,handler:async i=>{if(i.dryRun){n({command:`cf tenants entitlements list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/entitlements`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.entitlements.list(i[`tenant-id`])),{successLabel:`Loaded`})}},f={command:`entitlements`,describe:`Entitlements operations`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <tenant-id>`,describe:`Retrieves a Tenant by Tenant ID.`,builder:p,handler:async i=>{if(i.dryRun){n({command:`cf tenants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.get(i[`tenant-id`])),{successLabel:`Loaded`})}};function h(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List of active members (Cloudflare users) for the Tenant.`,builder:h,handler:async i=>{if(i.dryRun){n({command:`cf tenants memberships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/memberships`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.memberships.list(i[`tenant-id`])),{successLabel:`Loaded`})}},_={command:`memberships`,describe:`Memberships operations`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`tenants`,describe:`Multi-tenant account management — manage tenant accounts, entitlements, and memberships`,builder:e=>e.command(m).command(o).command(l).command(f).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
|