cf 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/_meta/agent-context.json +26 -21
- package/dist/_meta/commands.json +7696 -18100
- package/dist/_meta/schemas.json +6411 -13925
- package/dist/{abuse-reports-dMIfUJ8v.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
- package/dist/{accounts-Kx1epdA1.mjs → accounts-B_joQcMi.mjs} +9 -9
- package/dist/{acm-Utu252kC.mjs → acm-_kIHqYME.mjs} +2 -2
- package/dist/{addressing-CBq7Z7Vq.mjs → addressing-CaFlw8y1.mjs} +10 -10
- package/dist/{agent-context-BGTU299M.mjs → agent-context-DMPfi54f.mjs} +1 -1
- package/dist/ai-CqnhNb_c.mjs +2 -0
- package/dist/ai-gateway-pgYGI519.mjs +8 -0
- package/dist/ai-search-eqQMPQol.mjs +7 -0
- package/dist/ai_gateway--vuVLnOm.mjs +4 -0
- package/dist/{alerting-CqmEIaKn.mjs → alerting-CPxHiYHb.mjs} +5 -5
- package/dist/{analytics-Dv-X8x7D.mjs → analytics-DSSRDZz8.mjs} +1 -1
- package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
- package/dist/{api-gateway-CNv0IHTU.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
- package/dist/argo-aC6A3JyX.mjs +2 -0
- package/dist/artifacts-HD4V2xpK.mjs +4 -0
- package/dist/audit-logs-BuExU_nz.mjs +2 -0
- package/dist/auth-CSC4yhEJ.mjs +9 -0
- package/dist/auth-D5hNsOFq.mjs +5 -0
- package/dist/billing-COaghyxl.mjs +2 -0
- package/dist/bot-management-DmEzeV1Y.mjs +5 -0
- package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
- package/dist/brand-protection-dPrGe8sL.mjs +3 -0
- package/dist/browser-rendering-BiSGnpBf.mjs +4 -0
- package/dist/{build-DYkGW4dh.mjs → build-HuS9-R0V.mjs} +131 -131
- package/dist/{cache-DsoW6Xwv.mjs → cache-CY-7Lt71.mjs} +4 -4
- package/dist/calls-wOQGDWPl.mjs +4 -0
- package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
- package/dist/chunk-6IEM75FG-BEjRFMGh.mjs +2 -0
- package/dist/client-certificates-CRf41xLe.mjs +3 -0
- package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
- package/dist/{cloudforce-one-2Bhz8YdW.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
- package/dist/{completions-BwRpZQVn.mjs → completions-DOeHPdCG.mjs} +2 -2
- package/dist/config-B5k-XbwS.mjs +2 -0
- package/dist/connectivity-Bx3MgTHX.mjs +3 -0
- package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
- package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
- package/dist/connectors-DRt4e6d_.mjs +3 -0
- package/dist/content-scanning-Cd2vy5Sz.mjs +4 -0
- package/dist/context-jpewmual.mjs +2 -0
- package/dist/{custom-certificates-aAiEguR7.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
- package/dist/{custom-hostnames-AG5yBHIi.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
- package/dist/custom-nameservers-CWqA51in.mjs +3 -0
- package/dist/custom-pages-DeUKEFGe.mjs +4 -0
- package/dist/d1-DvWY9Gp4.mjs +4 -0
- package/dist/data-security-BPo6dIWu.mjs +6 -0
- package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
- package/dist/{deploy-CQial3kN.mjs → deploy-dVrgDUOp.mjs} +1 -1
- package/dist/{dev-B38LfCTl.mjs → dev-C01_Lby6.mjs} +1 -1
- package/dist/diagnostics-6nKPmVgz.mjs +3 -0
- package/dist/{dispatch-namespaces-DmHvoBOg.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
- package/dist/dist-C6zxsVdY.mjs +306 -0
- package/dist/{dist-AIcZFk0U.mjs → dist-t_YrL25p.mjs} +7 -7
- package/dist/{dns-VMhQSr5n.mjs → dns-ClciFGxx.mjs} +13 -13
- package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
- package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
- package/dist/{email-routing-tIR2SFu-.mjs → email-routing-CGXhFqF5.mjs} +9 -9
- package/dist/{email-security-Ca1id3rZ.mjs → email-security-D5viPq8S.mjs} +7 -7
- package/dist/email-sending-C2jpc3gh.mjs +3 -0
- package/dist/{filters-A4dg_a68.mjs → filters-bzsFcWt0.mjs} +3 -3
- package/dist/{firewall-DWPQgYd9.mjs → firewall-DYZcTtIC.mjs} +10 -10
- package/dist/{fraud-BMkSsJGU.mjs → fraud-C03MtdZb.mjs} +1 -1
- package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
- package/dist/{healthchecks-CtIfrFql.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
- package/dist/hostnames-CFgIVI3s.mjs +3 -0
- package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
- package/dist/iam-DqVPzGrb.mjs +6 -0
- package/dist/images-BYfl4YgR.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-duTEPIHc.mjs +3 -0
- package/dist/{ips-K4bzaGqd.mjs → ips-nv9INuWZ.mjs} +1 -1
- package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
- package/dist/{kv-8o27w_pY.mjs → kv-CZoV4tiv.mjs} +4 -4
- package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
- package/dist/{load-balancers-DtG8nj25.mjs → load-balancers--OMg0HNt.mjs} +5 -5
- package/dist/{logpush-4L0njy1d.mjs → logpush-C0_lZTyY.mjs} +3 -3
- package/dist/{logs-B_Yp95hv.mjs → logs-BtpWZQfV.mjs} +2 -2
- package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
- package/dist/{magic-network-monitoring-BnwvM4-I.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
- package/dist/{magic-transit-CXDyvhxq.mjs → magic-transit-CLhMcJ_-.mjs} +32 -33
- package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
- package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
- package/dist/{network-interconnects-rrr7red3.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
- package/dist/oauth-Bk-F-tIO.mjs +52 -0
- package/dist/{observability-DWvpqnQJ.mjs → observability-BynRbTF4.mjs} +3 -3
- package/dist/open-YWOUIZ5Y-3jqSKAB1.mjs +4 -0
- package/dist/{organizations-T77D50Sq.mjs → organizations-BqJHyvMK.mjs} +3 -3
- package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
- package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
- package/dist/{origin-tls-client-auth-CaVW1Ztp.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
- package/dist/{output-BJFNwj7b.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CjZPTMQX.mjs → page-rules-EZHJePmn.mjs} +4 -4
- package/dist/{page-shield-D5RRNJCY.mjs → page-shield-CXJioWPs.mjs} +5 -5
- package/dist/{pages-CWJtJnL0.mjs → pages-D4aYteKk.mjs} +8 -8
- package/dist/{pipelines-B0L_7j9e.mjs → pipelines-G8Iusxq-.mjs} +5 -5
- package/dist/progress-DrDErV9w.mjs +2 -0
- package/dist/queues-DEkbKqZX.mjs +6 -0
- package/dist/{r2-DQIcyRtA.mjs → r2-CV0IkCAW.mjs} +9 -9
- package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
- package/dist/radar-D986zPJr.mjs +2 -0
- package/dist/{rate-limits-DcrQV6Ar.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
- package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
- package/dist/{realtime-kit-CaquuVOE.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
- package/dist/{registrar-Ko-xZemf.mjs → registrar-CDIwTz3G.mjs} +6 -6
- package/dist/request-tracers-D7SFMDik.mjs +2 -0
- package/dist/resource-sharing-YIQ04jXE.mjs +5 -0
- package/dist/{resource-tagging-C3qtLzCz.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
- package/dist/rules-DHjLP5Kx.mjs +4 -0
- package/dist/{rulesets-CBgpeSvJ.mjs → rulesets-q4QABpKs.mjs} +7 -7
- package/dist/rum-SmT4HZmM.mjs +4 -0
- package/dist/{schema-D16TgWBg.mjs → schema-BR31o4P6.mjs} +1 -1
- package/dist/{schema-validation-Dgv_opM3.mjs → schema-validation-vVetgC_P.mjs} +5 -5
- package/dist/{scim-DdSEr4kZ.mjs → scim-ChOkZpNx.mjs} +2 -2
- package/dist/{session-COHHdS7A.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-7BfyvJLb.mjs → secrets-store-BAK9G12O.mjs} +12 -12
- package/dist/security-center-eScuYDKP.mjs +2 -0
- package/dist/security-txt-x7R4gmQu.mjs +3 -0
- package/dist/session-DHYCE-PM.mjs +93 -0
- package/dist/shared-BAjo72Lz.mjs +2 -0
- package/dist/{smart-shield-TeWZFnH2.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
- package/dist/snippets-DrlgYJYp.mjs +4 -0
- package/dist/{spawn-DcppKGI5.mjs → spawn-CCGzKlC4.mjs} +1 -1
- package/dist/{spectrum-CTTZID8u.mjs → spectrum-pVGxb7u5.mjs} +6 -6
- package/dist/speed-ZFrMWDgd.mjs +4 -0
- package/dist/src-DU7FBCOX.mjs +108 -0
- package/dist/ssl-9JY05sYt.mjs +15 -0
- package/dist/stream-tRU39b8K.mjs +14 -0
- package/dist/{tenants-Bd7NGQ_m.mjs → tenants-HLGUazms.mjs} +1 -1
- package/dist/{token-validation-DAgtFOvs.mjs → token-validation-_VdamKpz.mjs} +4 -4
- package/dist/{tools-DXQmfFuE.mjs → tools-D_hfUU_Z.mjs} +1 -1
- package/dist/{turnstile-cfdaO4ca.mjs → turnstile-BRzXd28B.mjs} +4 -4
- package/dist/{ui-D4KtlMh9.mjs → ui-erjBdVKL.mjs} +1 -1
- package/dist/url-normalization-D-NxuLtN.mjs +3 -0
- package/dist/url-scanner-BzzR6iDx.mjs +2 -0
- package/dist/{user-CAo-yCJA.mjs → user-C4omq__w.mjs} +2 -2
- package/dist/vectorize-By6EqcNR.mjs +4 -0
- package/dist/{versions-CUwWJWmy.mjs → versions-CBHwWPAM.mjs} +1 -1
- package/dist/{waiting-rooms-Dln5ICg5.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
- package/dist/{web3-HQJRm38W.mjs → web3-DQ5dmE9W.mjs} +3 -3
- package/dist/{workers-Dg7ddG2Q.mjs → workers-D8Be7_as.mjs} +14 -14
- package/dist/workers-builds-BE3W3qNk.mjs +7 -0
- package/dist/{workflows-VquuSh2J.mjs → workflows-BWWufqFA.mjs} +3 -3
- package/dist/zaraz-Bsa9AvVL.mjs +2 -0
- package/dist/{zero-trust-CP96wnSh.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
- package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
- package/dist/zones-BXtdwt6E.mjs +21 -0
- package/package.json +4 -4
- package/dist/ai-DOOKLPkG.mjs +0 -2
- package/dist/ai-gateway-Cj1T3avF.mjs +0 -8
- package/dist/ai-search-CQF_Sn7d.mjs +0 -7
- package/dist/ai_gateway-C3fH22C0.mjs +0 -4
- package/dist/analytics_engine-DdXVR8z2.mjs +0 -2
- package/dist/argo-CX_A4kcn.mjs +0 -2
- package/dist/audit-logs-BfBf3oo-.mjs +0 -2
- package/dist/auth-SyWhMmPu.mjs +0 -6
- package/dist/auth-ffdf9yR0.mjs +0 -135
- package/dist/autorag-BuGhGTeZ.mjs +0 -2
- package/dist/billing-PoG81XaQ.mjs +0 -2
- package/dist/bot-management-CFvtVx62.mjs +0 -5
- package/dist/botnet-feed-B-M4Yu0W.mjs +0 -3
- package/dist/brand-protection-D05Eg-_6.mjs +0 -3
- package/dist/browser-rendering-xu8F_Rrv.mjs +0 -4
- package/dist/calls-CZbO7TyR.mjs +0 -4
- package/dist/certificate-authorities-D2yr7_3t.mjs +0 -2
- package/dist/client-certificates-MJcDsTId.mjs +0 -3
- package/dist/cloud-connector-DWOrN2eM.mjs +0 -2
- package/dist/config-DYzlVxcB.mjs +0 -2
- package/dist/connectivity-BX8C7tvK.mjs +0 -3
- package/dist/content-scanning-r6uzMO1r.mjs +0 -4
- package/dist/context-DGlHRGWM.mjs +0 -2
- package/dist/custom-nameservers-D1DtlRue.mjs +0 -3
- package/dist/custom-pages-DQCi2plU.mjs +0 -4
- package/dist/d1-DbnYhw45.mjs +0 -4
- package/dist/data-security-D_EtYBfo.mjs +0 -6
- package/dist/dcv-delegation-CHspSzTI.mjs +0 -2
- package/dist/diagnostics-BJQGjVJn.mjs +0 -3
- package/dist/dist-DNBSHor6.mjs +0 -301
- package/dist/dns-firewall-B4DVXFBQ.mjs +0 -57
- package/dist/durable-objects-CTboySEo.mjs +0 -2
- package/dist/email-sending-DwWKc5jC.mjs +0 -3
- package/dist/google-tag-gateway-BGD49nRC.mjs +0 -2
- package/dist/hostnames-BiomxukN.mjs +0 -3
- package/dist/hyperdrive-Da104VaQ.mjs +0 -18
- package/dist/iam-BIGKo0WW.mjs +0 -6
- package/dist/images-BO8FbDAa.mjs +0 -5
- package/dist/intel-CY6_79v8.mjs +0 -3
- package/dist/keyless-certificates-CZC-L8gM.mjs +0 -3
- package/dist/leaked-credential-checks-qLzRyu85.mjs +0 -3
- package/dist/magic-cloud-networking-CSOM3EM-.mjs +0 -5
- package/dist/managed-transforms-D15yVbZx.mjs +0 -3
- package/dist/mtls-certificates-D8k0AXWK.mjs +0 -3
- package/dist/origin-ca-certificates-DXIvD8H5.mjs +0 -3
- package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +0 -2
- package/dist/progress-CrCGTq7N.mjs +0 -2
- package/dist/queues-CN6DPhRR.mjs +0 -6
- package/dist/r2-data-catalog-Bbo93TJx.mjs +0 -14
- package/dist/radar-Bxb0WX8V.mjs +0 -2
- package/dist/raw-fetch-Dlccg0Tr.mjs +0 -2
- package/dist/request-tracers-DOW_reTJ.mjs +0 -2
- package/dist/resource-sharing-D7TX0JV0.mjs +0 -5
- package/dist/rules-BXRADHL5.mjs +0 -4
- package/dist/rum-BjPptTUP.mjs +0 -4
- package/dist/security-center-DAy6AKtT.mjs +0 -2
- package/dist/security-txt-xAMb7K6Y.mjs +0 -3
- package/dist/shared-AGtpXwwL.mjs +0 -2
- package/dist/snippets-CCSsCXVs.mjs +0 -4
- package/dist/speed-CuzTE0AL.mjs +0 -4
- package/dist/src-BW6vfAwE.mjs +0 -108
- package/dist/ssl-BWA2LdwC.mjs +0 -15
- package/dist/stream-GFsIZ-pP.mjs +0 -14
- package/dist/url-normalization-B5RN4nLD.mjs +0 -3
- package/dist/url-scanner-BrZ1L9OC.mjs +0 -2
- package/dist/vectorize-C7_oQlaI.mjs +0 -4
- package/dist/workers-builds-AVfx8IyL.mjs +0 -7
- package/dist/zaraz-xYSWIV4P.mjs +0 -2
- package/dist/zones-BSgmZ9WC.mjs +0 -21
- /package/dist/{body-parser-DKa8Ipg1.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{cli-types-CRIDdDw3.mjs → cli-types-BeyOc81z.mjs} +0 -0
- /package/dist/{input-validation-zEO81MWN.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-Eu1wXxuh.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-VJaJ3BZ1.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-5VwHPW6C.mjs → metadata-OOwvpR8m.mjs} +0 -0
- /package/dist/{resolve-4-OSeHlK.mjs → resolve-C3h-mwp7.mjs} +0 -0
- /package/dist/{theme-BklJDrb2.mjs → theme-DbNbIY4d.mjs} +0 -0
package/dist/stream-GFsIZ-pP.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,T as n,_ as r,i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,r as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f,t as p}from"./input-validation-zEO81MWN.mjs";import{t as m}from"./local-VJaJ3BZ1.mjs";import{t as h}from"./cli-types-CRIDdDw3.mjs";import{n as g,t as _}from"./raw-fetch-Dlccg0Tr.mjs";function ee(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`url`,{type:`string`,description:"An audio track URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`copy <identifier>`,describe:`Adds an additional audio track to a video using the provided audio track URL.`,builder:ee,handler:async n=>{if(n.dryRun){u({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/copy`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?c({label:f(n.label,`label`,`text`),url:f(n.url,`url`,`text`)}):o(n.body)});return}let i=await a(n),s=n.local?m:await r(i);if(n.accountId=s,n.body){let e=o(n.body);l(await d(`Creating`,async()=>i.stream.audioTracks.copy({...e,account_id:s,identifier:n.identifier})),{successLabel:`Created`});return}n.label===void 0&&(n.label=await t(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let p=c({label:f(n.label,`label`,`text`),url:f(n.url,`url`,`text`)});l(await d(`Creating`,async()=>i.stream.audioTracks.copy({...p,account_id:s,identifier:n.identifier})),{successLabel:`Created`})}};function v(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const y={command:`delete <audio-identifier>`,describe:`Deletes additional audio tracks on a video. Deleting a default audio track is not allowed. You must assign another audio track as default prior to deletion.`,builder:v,handler:async t=>{if(t.dryRun){u({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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 i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.audioTracks.delete({account_id:o,identifier:t.identifier,audio_identifier:t[`audio-identifier`]})),{successLabel:`Deleted`})}};function b(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`default`,{type:`boolean`,description:`Denotes whether the audio track will be played by default in a player.`}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`edit <audio-identifier>`,describe:"Edits additional audio tracks on a video. Editing the default status of an audio track to `true` will mark all other audio tracks on the video default status to `false`.",builder:b,handler:async t=>{if(t.dryRun){u({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:`json`,body:t.body===void 0?c({default:t.default,label:f(t.label,`label`,`text`)}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Updating`,async()=>n.stream.audioTracks.edit({...e,account_id:i,identifier:t.identifier,audio_identifier:t[`audio-identifier`]})),{successLabel:`Updated`});return}let s=c({default:t.default,label:f(t.label,`label`,`text`)});l(await d(`Updating`,async()=>n.stream.audioTracks.edit({...s,account_id:i,identifier:t.identifier,audio_identifier:t[`audio-identifier`]})),{successLabel:`Updated`})}};function S(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <identifier>`,describe:`Lists additional audio tracks on a video. Note this API will not return information for audio attached to the video upload.`,builder:S,handler:async t=>{if(t.dryRun){u({command:`cf stream audio-tracks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/audio`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.audioTracks.get({account_id:i,identifier:t.identifier})),{successLabel:`Loaded`})}},w={command:`audio-tracks`,describe:`Add, edit, or remove additional audio tracks on a video`,builder:e=>e.command(te).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:T,handler:async t=>{if(t.dryRun){u({command:`cf stream captions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/captions`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.captions.get({account_id:i,identifier:t.identifier})),{successLabel:`Loaded`})}};function D(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:D,handler:async t=>{if(t.dryRun){u({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/captions/${t.language==null?`<language>`:encodeURIComponent(String(t.language))}/generate`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Creating`,async()=>n.stream.captions.language.create({account_id:i,identifier:t.identifier,language:t.language})),{successLabel:`Created`})}};function k(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const A={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:k,handler:async t=>{if(t.dryRun){u({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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 i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.captions.language.delete({account_id:o,identifier:t.identifier,language:t.language})),{successLabel:`Deleted`})}};function j(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:j,handler:async t=>{if(t.dryRun){u({command:`cf stream captions language get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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 n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.captions.language.get({account_id:i,identifier:t.identifier,language:t.language})),{successLabel:`Loaded`})}};function N(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const P={command:`update <language>`,describe:`Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed.`,builder:N,handler:async t=>{if(t.dryRun){u({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:`multipart`,body:{body:t.body,file:t.file}});return}let n=await a(t),o=t.local?m:await r(n);if(t.accountId=o,t.file!==void 0||t.body!==void 0){let e=new FormData;if(t.file){let n=p(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);l(await d(`Updating`,async()=>i(n,`PUT`,`/accounts/${o}/stream/${encodeURIComponent(String(t.identifier))}/captions/${encodeURIComponent(String(t.language))}`,{body:e})),{successLabel:`Updated`});return}if(t.body){let e=f(t.body,`body`,`binary`);l(await d(`Updating`,async()=>i(n,`PUT`,`/accounts/${o}/stream/${encodeURIComponent(String(t.identifier))}/captions/${encodeURIComponent(String(t.language))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function F(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:F,handler:async t=>{if(t.dryRun){u({command:`cf stream captions language vtt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/captions/${t.language==null?`<language>`:encodeURIComponent(String(t.language))}/vtt`,pathParams:{language:String(t.language??``),identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,g((await d(`Loading`,async()=>_(`/accounts/${i}/stream/${encodeURIComponent(String(t.identifier))}/captions/${encodeURIComponent(String(t.language))}/vtt`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}))).toString(`utf-8`))}},L={command:`vtt`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`language`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(O).command(A).command(M).command(P).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`captions`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(E).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`clipped-from-video-uid`,{type:`string`,description:`The unique video identifier (UID).`}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`end-time-seconds`,{type:`number`,description:`Specifies the end time for the video clip in seconds.`}).option(`input`,{type:`string`,description:`A video's URL. Preferred over 'url'.`}).option(`name`,{type:`string`,description:`A name for the video.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`start-time-seconds`,{type:`number`,description:`Specifies the start time for the video clip in seconds.`}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:`A video's URL (legacy field, use 'input' instead).`}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:B,handler:async n=>{if(n.dryRun){u({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({allowedOrigins:n[`allowed-origins`],clippedFromVideoUID:f(n[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:f(n.creator,`creator`,`text`),endTimeSeconds:n[`end-time-seconds`],input:f(n.input,`input`,`text`),name:f(n.name,`name`,`text`),requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:f(n[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:n[`start-time-seconds`],thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],url:f(n.url,`url`,`text`),watermark:{uid:f(n[`watermark-uid`],`watermark-uid`,`text`)}}):o(n.body)});return}let i=await a(n),s=n.local?m:await r(i);if(n.accountId=s,n.body){let e=o(n.body);l(await d(`Creating`,async()=>i.stream.clip.create({...e,account_id:s})),{successLabel:`Created`});return}if(n[`clipped-from-video-uid`]===void 0&&(n[`clipped-from-video-uid`]=await t(`clipped-from-video-uid`,`The unique video identifier (UID).`)),n[`end-time-seconds`]===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(n[`start-time-seconds`]===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let p=c({allowedOrigins:n[`allowed-origins`],clippedFromVideoUID:f(n[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:f(n.creator,`creator`,`text`),endTimeSeconds:n[`end-time-seconds`],input:f(n.input,`input`,`text`),name:f(n.name,`name`,`text`),requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:f(n[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:n[`start-time-seconds`],thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],url:f(n.url,`url`,`text`),watermark:{uid:f(n[`watermark-uid`],`watermark-uid`,`text`)}});l(await d(`Creating`,async()=>i.stream.clip.create({...p,account_id:s})),{successLabel:`Created`})}},H={command:`clip`,describe:`Create a new video clip from an existing video by specifying start and end times`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`input`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This is the preferred field over `url`."}).option(`name`,{type:`string`,description:`A video's name. Used for legacy compatibility.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This field is deprecated in favor of `input`."}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Copy upload request. Provide `input` (preferred) or `url` (deprecated)."})}const W={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:U,handler:async t=>{let n={};if(t[`upload-creator`]!==void 0&&(n[`Upload-Creator`]=String(t[`upload-creator`])),t.dryRun){u({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({allowedOrigins:t[`allowed-origins`],creator:f(t.creator,`creator`,`text`),input:f(t.input,`input`,`text`),name:f(t.name,`name`,`text`),requireSignedURLs:t[`require-signed-urls`],scheduledDeletion:f(t[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:t[`thumbnail-timestamp-pct`],url:f(t.url,`url`,`text`),watermark:{uid:f(t[`watermark-uid`],`watermark-uid`,`text`)}}):o(t.body)});return}let p=await a(t),h=t.local?m:await r(p);if(t.accountId=h,t.body){let e=o(t.body);l(await d(`Creating`,async()=>i(p,`POST`,`/accounts/${h}/stream/copy`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Created`});return}let g={};t[`allowed-origins`]!==void 0&&s(g,[`allowedOrigins`],t[`allowed-origins`]),t.creator!==void 0&&s(g,[`creator`],f(t.creator,`creator`,`text`)),t.input!==void 0&&s(g,[`input`],f(t.input,`input`,`text`)),t.name!==void 0&&s(g,[`name`],f(t.name,`name`,`text`)),t[`require-signed-urls`]!==void 0&&s(g,[`requireSignedURLs`],t[`require-signed-urls`]),t[`scheduled-deletion`]!==void 0&&s(g,[`scheduledDeletion`],f(t[`scheduled-deletion`],`scheduled-deletion`,`text`)),t[`thumbnail-timestamp-pct`]!==void 0&&s(g,[`thumbnailTimestampPct`],t[`thumbnail-timestamp-pct`]),t.url!==void 0&&s(g,[`url`],f(t.url,`url`,`text`)),t[`watermark-uid`]!==void 0&&s(g,[`watermark`,`uid`],f(t[`watermark-uid`],`watermark-uid`,`text`)),l(await d(`Creating`,async()=>i(p,`POST`,`/accounts/${h}/stream/copy`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Created`})}},G={command:`copy`,describe:`Import a video from a URL into Stream for processing and delivery`,builder:e=>e.command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.option(`direct-user`,{type:`boolean`,description:`Provisions a URL to let your end users upload videos directly to Cloudflare Stream without exposing your API token to clients.`}).option(`tus-resumable`,{type:`string`,description:`Specifies the TUS protocol version. This value must be included in every upload request.
|
|
5
|
-
Notes: The only supported version of TUS protocol is 1.0.0.`,demandOption:!0}).option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`upload-length`,{type:`string`,description:`Indicates the size of the entire upload in bytes. The value must be a non-negative integer.`,demandOption:!0}).option(`upload-metadata`,{type:`string`,description:"Comma-separated key-value pairs following the TUS protocol specification. Values are Base-64 encoded.\nSupported keys: `name`, `requiresignedurls`, `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`, `maxdurationseconds`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`create`,describe:"Initiates a video upload using the TUS protocol. On success, the server responds with a status code 201 (created) and includes a `location` header to indicate where the content should be uploaded. Refer to https://tus.io for protocol details.",builder:K,handler:async t=>{let n={direct_user:t[`direct-user`]},o={};if(t[`tus-resumable`]!==void 0&&(o[`Tus-Resumable`]=String(t[`tus-resumable`])),t[`upload-creator`]!==void 0&&(o[`Upload-Creator`]=String(t[`upload-creator`])),t[`upload-length`]!==void 0&&(o[`Upload-Length`]=String(t[`upload-length`])),t[`upload-metadata`]!==void 0&&(o[`Upload-Metadata`]=String(t[`upload-metadata`])),t.dryRun){u({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream`,pathParams:{},query:n,bodyKind:`none`});return}let s=await a(t),c=t.local?m:await r(s);t.accountId=c,l(await d(`Creating`,async()=>i(s,`POST`,`/accounts/${c}/stream`,{query:n,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Created`})}};function J(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Y={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:J,handler:async t=>{if(t.dryRun){u({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.delete({account_id:o,identifier:t.identifier})),{successLabel:`Deleted`})}};function X(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`expiry`,{type:`string`,description:`The date and time after upload when videos will not be accepted.`,default:`Now + 30 minutes`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Z={command:`create`,describe:`Creates a direct upload that allows video uploads without an API key.`,builder:X,handler:async t=>{let n={};if(t[`upload-creator`]!==void 0&&(n[`Upload-Creator`]=String(t[`upload-creator`])),t.dryRun){u({command:`cf stream direct-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/direct_upload`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({allowedOrigins:t[`allowed-origins`],creator:f(t.creator,`creator`,`text`),expiry:f(t.expiry,`expiry`,`text`),maxDurationSeconds:t[`max-duration-seconds`],requireSignedURLs:t[`require-signed-urls`],scheduledDeletion:f(t[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:t[`thumbnail-timestamp-pct`],watermark:{uid:f(t[`watermark-uid`],`watermark-uid`,`text`)}}):o(t.body)});return}let p=await a(t),h=t.local?m:await r(p);if(t.accountId=h,t.body){let e=o(t.body);l(await d(`Creating`,async()=>i(p,`POST`,`/accounts/${h}/stream/direct_upload`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Created`});return}if(t[`max-duration-seconds`]===void 0)throw Error(`--max-duration-seconds is required (or pass --body with this field set).`);let g={};t[`allowed-origins`]!==void 0&&s(g,[`allowedOrigins`],t[`allowed-origins`]),t.creator!==void 0&&s(g,[`creator`],f(t.creator,`creator`,`text`)),t.expiry!==void 0&&s(g,[`expiry`],f(t.expiry,`expiry`,`text`)),t[`max-duration-seconds`]!==void 0&&s(g,[`maxDurationSeconds`],t[`max-duration-seconds`]),t[`require-signed-urls`]!==void 0&&s(g,[`requireSignedURLs`],t[`require-signed-urls`]),t[`scheduled-deletion`]!==void 0&&s(g,[`scheduledDeletion`],f(t[`scheduled-deletion`],`scheduled-deletion`,`text`)),t[`thumbnail-timestamp-pct`]!==void 0&&s(g,[`thumbnailTimestampPct`],t[`thumbnail-timestamp-pct`]),t[`watermark-uid`]!==void 0&&s(g,[`watermark`,`uid`],f(t[`watermark-uid`],`watermark-uid`,`text`)),l(await d(`Creating`,async()=>i(p,`POST`,`/accounts/${h}/stream/direct_upload`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Created`})}},Q={command:`direct-upload`,describe:`Generate a tokenized URL that lets end-users upload video directly to Stream`,builder:e=>e.command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`create <identifier>`,describe:"Creates a download for a video when a video is ready to view. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:ne,handler:async t=>{if(t.dryRun){u({command:`cf stream downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Creating`,async()=>n.stream.downloads.create({account_id:i,identifier:t.identifier})),{successLabel:`Created`})}};function ie(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ae={command:`delete <identifier>`,describe:"Delete the downloads for a video. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:ie,handler:async t=>{if(t.dryRun){u({command:`cf stream downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.downloads.delete({account_id:o,identifier:t.identifier})),{successLabel:`Deleted`})}};function oe(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`get <identifier>`,describe:`Lists the downloads created for a video.`,builder:oe,handler:async t=>{if(t.dryRun){u({command:`cf stream downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/downloads`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.downloads.get({account_id:i,identifier:t.identifier})),{successLabel:`Loaded`})}},ce={command:`downloads`,describe:`Create downloadable MP4 renditions of a video for offline viewing`,builder:e=>e.command(re).command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`public-details-channel-link`,{type:`string`,description:`The publicDetails.channel_link field`}).option(`public-details-logo`,{type:`string`,description:`The publicDetails.logo field`}).option(`public-details-share-link`,{type:`string`,description:`The publicDetails.share_link field`}).option(`public-details-title`,{type:`string`,description:`The publicDetails.title field`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`uid`,{type:`string`,description:`The unique identifier for the video. Can be used to verify the video being updated.`}).option(`upload-expiry`,{type:`string`,description:`The date and time when the video upload URL is no longer valid for direct user uploads.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`edit <identifier>`,describe:`Edit details for a single video.`,builder:le,handler:async t=>{if(t.dryRun){u({command:`cf stream edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:t.body===void 0?c({allowedOrigins:t[`allowed-origins`],creator:f(t.creator,`creator`,`text`),maxDurationSeconds:t[`max-duration-seconds`],publicDetails:{channel_link:f(t[`public-details-channel-link`],`public-details-channel-link`,`text`),logo:f(t[`public-details-logo`],`public-details-logo`,`text`),share_link:f(t[`public-details-share-link`],`public-details-share-link`,`text`),title:f(t[`public-details-title`],`public-details-title`,`text`)},requireSignedURLs:t[`require-signed-urls`],scheduledDeletion:f(t[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:t[`thumbnail-timestamp-pct`],uid:f(t.uid,`uid`,`text`),uploadExpiry:f(t[`upload-expiry`],`upload-expiry`,`text`)}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Creating`,async()=>n.stream.edit({...e,account_id:i,identifier:t.identifier})),{successLabel:`Created`});return}let s=c({allowedOrigins:t[`allowed-origins`],creator:f(t.creator,`creator`,`text`),maxDurationSeconds:t[`max-duration-seconds`],publicDetails:{channel_link:f(t[`public-details-channel-link`],`public-details-channel-link`,`text`),logo:f(t[`public-details-logo`],`public-details-logo`,`text`),share_link:f(t[`public-details-share-link`],`public-details-share-link`,`text`),title:f(t[`public-details-title`],`public-details-title`,`text`)},requireSignedURLs:t[`require-signed-urls`],scheduledDeletion:f(t[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:t[`thumbnail-timestamp-pct`],uid:f(t.uid,`uid`,`text`),uploadExpiry:f(t[`upload-expiry`],`upload-expiry`,`text`)});l(await d(`Creating`,async()=>n.stream.edit({...s,account_id:i,identifier:t.identifier})),{successLabel:`Created`})}};function de(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get <identifier>`,describe:`Fetches an HTML code snippet to embed a video in a web page delivered through Cloudflare. On success, returns an HTML fragment for use on web pages to display a video. On failure, returns a JSON response body.`,builder:de,handler:async t=>{if(t.dryRun){u({command:`cf stream embed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/embed`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,g((await d(`Loading`,async()=>_(`/accounts/${i}/stream/${encodeURIComponent(String(t.identifier))}/embed`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}))).toString(`utf-8`))}},pe={command:`embed`,describe:`Retrieve the HTML embed code snippet for a video`,builder:e=>e.command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`get <identifier>`,describe:`Fetches details for a single video.`,builder:me,handler:async t=>{if(t.dryRun){u({command:`cf stream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.get({account_id:i,identifier:t.identifier})),{successLabel:`Loaded`})}};function ge(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={command:`create`,describe:`Creates an RSA private key in PEM and JWK formats. Key files are only displayed once after creation. Keys are created, used, and deleted independently of videos, and every key can sign any video.`,builder:ge,handler:async t=>{if(t.dryRun){u({command:`cf stream keys create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Creating`,async()=>n.stream.keys.create({account_id:i})),{successLabel:`Created`})}};function ve(e){return e.positional(`identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ye={command:`delete <identifier>`,describe:`Deletes signing keys and revokes all signed URLs generated with the key.`,builder:ve,handler:async t=>{if(t.dryRun){u({command:`cf stream keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/keys/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.keys.delete({account_id:o,identifier:t.identifier})),{successLabel:`Deleted`})}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get`,describe:`Lists the video ID and creation date and time when a signing key was created.`,builder:be,handler:async t=>{if(t.dryRun){u({command:`cf stream keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.keys.get({account_id:i})),{successLabel:`Loaded`})}},Se={command:`keys`,describe:`Signing keys used to generate short-lived signed URLs for private video playback`,builder:e=>e.command(_e).command(ye).command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.option(`status`,{type:`string`,description:`Specifies the processing status for all quality levels for a video.`,choices:[`pendingupload`,`downloading`,`queued`,`inprogress`,`ready`,`error`,`live-inprogress`]}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`type`,{type:`string`,description:"Specifies whether the video is `vod` or `live`."}).option(`asc`,{type:`boolean`,description:`Lists videos in ascending order of creation.`}).option(`video-name`,{type:`string`,description:"Provides a fast, exact string match on the `name` key in the `meta` field."}).option(`search`,{type:`string`,description:"Provides a partial word match of the `name` key in the `meta` field. Slow for medium to large video libraries. May be unavailable for very large libraries."}).option(`start`,{type:`string`,description:`Lists videos created after the specified date.`}).option(`end`,{type:`string`,description:`Lists videos created before the specified date.`}).option(`include-counts`,{type:`boolean`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`id`,{type:`string`,description:`Filter by video ID(s). Can be a single ID or a comma-separated list of IDs.`}).option(`name`,{type:`string`,description:`Filter by video name/UID(s). Can be a single name or a comma-separated list.`}).option(`live-input-id`,{type:`string`,description:`Filter by live input ID to find videos associated with a specific live stream.`}).option(`before`,{type:`string`,description:`Alias for 'end'. Returns videos created before this date/time (RFC 3339 format).`}).option(`after`,{type:`string`,description:`Alias for 'start'. Returns videos created after this date/time (RFC 3339 format).`}).option(`limit`,{type:`number`,description:`Maximum number of videos to return (default 1000, max 1000).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`list`,describe:`Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.`,builder:h(Ce),handler:async t=>{let n={status:t.status,creator:t.creator,type:t.type,asc:t.asc,video_name:t[`video-name`],search:t.search,start:t.start,end:t.end,include_counts:t[`include-counts`],id:t.id,name:t.name,live_input_id:t[`live-input-id`],before:t.before,after:t.after,limit:t.limit};if(t.dryRun){u({command:`cf stream list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);t.accountId=o,l(await d(`Loading`,async()=>i.stream.list({account_id:o,...n})),{successLabel:`Loaded`})}};function Te(e){return e.option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`,default:!0}).option(`prefer-low-latency`,{type:`boolean`,description:`When enabled, the live stream is delivered using Low-Latency HLS (LL-HLS), reducing glass-to-glass latency for viewers at the cost of reduced player compatibility.`,default:!1}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`.",default:!1}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`],default:`off`}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input.",default:!1}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used.",default:0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ee={command:`create`,describe:`Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream.`,builder:Te,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/live_inputs`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({defaultCreator:f(t[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:t[`delete-recording-after-days`],enabled:t.enabled,preferLowLatency:t[`prefer-low-latency`],recording:{allowedOrigins:t[`recording-allowed-origins`],hideLiveViewerCount:t[`recording-hide-live-viewer-count`],mode:f(t[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:t[`recording-require-signed-urls`],timeoutSeconds:t[`recording-timeout-seconds`]}}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Creating`,async()=>n.stream.liveInputs.create({...e,account_id:i})),{successLabel:`Created`});return}let s=c({defaultCreator:f(t[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:t[`delete-recording-after-days`],enabled:t.enabled,preferLowLatency:t[`prefer-low-latency`],recording:{allowedOrigins:t[`recording-allowed-origins`],hideLiveViewerCount:t[`recording-hide-live-viewer-count`],mode:f(t[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:t[`recording-require-signed-urls`],timeoutSeconds:t[`recording-timeout-seconds`]}});l(await d(`Creating`,async()=>n.stream.liveInputs.create({...s,account_id:i})),{successLabel:`Created`})}};function De(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Oe={command:`delete <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls.`,builder:De,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.liveInputs.delete({account_id:o,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Deleted`})}};function ke(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`create <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls until enabled.`,builder:ke,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs disable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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 i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force,message:`This operation disables a live input. Active streams to it are dropped.`})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.liveInputs.disable.create({account_id:o,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Deleted`})}},je={command:`disable`,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:`create <live-input-identifier>`,describe:`Allows a live input to be streamed to and makes the live input accessible to any future API calls.`,builder:Me,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs enable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/enable`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Creating`,async()=>n.stream.liveInputs.enable.create({account_id:i,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Created`})}},Pe={command:`enable`,describe:`Enable and disable live input streams`,builder:e=>e.command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`get <live-input-identifier>`,describe:`Retrieves details of an existing live input.`,builder:Fe,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.liveInputs.get({account_id:i,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Loaded`})}};function Le(e){return e.option(`include-counts`,{type:`boolean`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Re={command:`list`,describe:`Lists the live inputs created for an account. To get the credentials needed to stream to a specific live input, request a single live input.`,builder:Le,handler:async t=>{let n={include_counts:t[`include-counts`]};if(t.dryRun){u({command:`cf stream live-inputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/live_inputs`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);t.accountId=o,l(await d(`Loading`,async()=>i.stream.liveInputs.list({account_id:o,...n})),{successLabel:`Loaded`})}};function ze(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`,default:!0}).option(`stream-key`,{type:`string`,description:`The streamKey used to authenticate against an output's target.`}).option(`url`,{type:`string`,description:`The URL an output uses to restream.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Be={command:`create <live-input-identifier>`,describe:`Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live input — one live input can have many outputs.`,builder:ze,handler:async n=>{if(n.dryRun){u({command:`cf stream live-inputs outputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?c({enabled:n.enabled,streamKey:f(n[`stream-key`],`stream-key`,`text`),url:f(n.url,`url`,`text`)}):o(n.body)});return}let i=await a(n),s=n.local?m:await r(i);if(n.accountId=s,n.body){let e=o(n.body);l(await d(`Creating`,async()=>i.stream.liveInputs.outputs.create({...e,account_id:s,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`});return}n[`stream-key`]===void 0&&(n[`stream-key`]=await t(`stream-key`,`The streamKey used to authenticate against an output's target.`,{kind:`secret`})),n.url===void 0&&(n.url=await t(`url`,`The URL an output uses to restream.`,{kind:`secret`}));let p=c({enabled:n.enabled,streamKey:f(n[`stream-key`],`stream-key`,`text`),url:f(n.url,`url`,`text`)});l(await d(`Creating`,async()=>i.stream.liveInputs.outputs.create({...p,account_id:s,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}};function Ve(e){return e.positional(`output-identifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const He={command:`delete <output-identifier>`,describe:`Deletes an output and removes it from the associated live input.`,builder:Ve,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs outputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.liveInputs.outputs.delete({account_id:o,live_input_identifier:t[`live-input-identifier`],output_identifier:t[`output-identifier`]})),{successLabel:`Deleted`})}};function Ue(e){return e.option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const We={command:`list`,describe:`Retrieves all outputs associated with a specified live input.`,builder:Ue,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs outputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.liveInputs.outputs.list({account_id:i,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Loaded`})}};function Ge(e){return e.positional(`output-identifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`update <output-identifier>`,describe:`Updates the state of an output.`,builder:Ge,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs outputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:t.body===void 0?c({enabled:t.enabled}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Updating`,async()=>n.stream.liveInputs.outputs.update({...e,account_id:i,live_input_identifier:t[`live-input-identifier`],output_identifier:t[`output-identifier`]})),{successLabel:`Updated`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let s=c({enabled:t.enabled});l(await d(`Updating`,async()=>n.stream.liveInputs.outputs.update({...s,account_id:i,live_input_identifier:t[`live-input-identifier`],output_identifier:t[`output-identifier`]})),{successLabel:`Updated`})}},qe={command:`outputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Be).command(He).command(We).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`update <live-input-identifier>`,describe:`Rotates the credentials for a live input without changing its identifier. Old credentials are revoked, broadcasts using stale credentials are automatically disconnected shortly after rotation, and the response returns refreshed credentials.`,builder:Je,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs rotate update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/live_inputs/${t[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(t[`live-input-identifier`]))}/rotate_keys`,pathParams:{"live-input-identifier":String(t[`live-input-identifier`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Creating`,async()=>n.stream.liveInputs.rotate.update({account_id:i,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Created`})}},Xe={command:`rotate`,describe:`Operations for live-inputs.rotate`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`}).option(`prefer-low-latency`,{type:`boolean`,description:`When enabled, the live stream is delivered using Low-Latency HLS (LL-HLS), reducing glass-to-glass latency for viewers at the cost of reduced player compatibility.`}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`."}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`]}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input."}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Qe={command:`update <live-input-identifier>`,describe:`Updates a specified live input.`,builder:Ze,handler:async t=>{if(t.dryRun){u({command:`cf stream live-inputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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:t.body===void 0?c({defaultCreator:f(t[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:t[`delete-recording-after-days`],enabled:t.enabled,preferLowLatency:t[`prefer-low-latency`],recording:{allowedOrigins:t[`recording-allowed-origins`],hideLiveViewerCount:t[`recording-hide-live-viewer-count`],mode:f(t[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:t[`recording-require-signed-urls`],timeoutSeconds:t[`recording-timeout-seconds`]}}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Updating`,async()=>n.stream.liveInputs.update({...e,account_id:i,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Updated`});return}let s=c({defaultCreator:f(t[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:t[`delete-recording-after-days`],enabled:t.enabled,preferLowLatency:t[`prefer-low-latency`],recording:{allowedOrigins:t[`recording-allowed-origins`],hideLiveViewerCount:t[`recording-hide-live-viewer-count`],mode:f(t[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:t[`recording-require-signed-urls`],timeoutSeconds:t[`recording-timeout-seconds`]}});l(await d(`Updating`,async()=>n.stream.liveInputs.update({...s,account_id:i,live_input_identifier:t[`live-input-identifier`]})),{successLabel:`Updated`})}},$e={command:`live-inputs`,describe:`RTMPS/SRT ingest endpoints for live streaming, including multi-output simulcasting`,builder:e=>e.command(Ee).command(Oe).command(Ie).command(Re).command(Qe).command(je).command(Pe).command(qe).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`downloadable`,{type:`boolean`,description:`The optional boolean value that enables using signed tokens to access MP4 download links for a video.`,default:!1}).option(`exp`,{type:`number`,description:`The optional unix epoch timestamp that specficies the time after a token is not accepted. The maximum time specification is 24 hours from issuing time. If this field is not set, the default is one hour after issuing.`}).option(`flags-original`,{type:`boolean`,description:`Whether to return the original video without transformations.`,default:!1}).option(`id`,{type:`string`,description:"The optional ID of a Stream signing key. If present, the `pem` field is also required."}).option(`nbf`,{type:`number`,description:`The optional unix epoch timestamp that specifies the time before a the token is not accepted. If this field is not set, the default is one hour before issuing.`}).option(`pem`,{type:`string`,description:"The optional base64 encoded private key in PEM format associated with a Stream signing key. If present, the `id` field is also required."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const tt={command:`create <identifier>`,describe:`Creates a signed URL token for a video. If a body is not provided in the request, a token is created with default values.`,builder:et,handler:async t=>{if(t.dryRun){u({command:`cf stream token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}/token`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`json`,body:t.body===void 0?c({downloadable:t.downloadable,exp:t.exp,flags:{original:t[`flags-original`]},id:f(t.id,`id`,`text`),nbf:t.nbf,pem:f(t.pem,`pem`,`text`)}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Creating`,async()=>n.stream.token.create({...e,account_id:i,identifier:t.identifier})),{successLabel:`Created`});return}let s=c({downloadable:t.downloadable,exp:t.exp,flags:{original:t[`flags-original`]},id:f(t.id,`id`,`text`),nbf:t.nbf,pem:f(t.pem,`pem`,`text`)});l(await d(`Creating`,async()=>n.stream.token.create({...s,account_id:i,identifier:t.identifier})),{successLabel:`Created`})}},nt={command:`token`,describe:`Generate short-lived signed URL tokens for secure private video playback`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rt(e){return e.positional(`download-type`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const it={command:`create <download-type>`,describe:`Creates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.`,builder:h(rt),handler:async t=>{if(t.dryRun){u({command:`cf stream typed-downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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 n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Creating`,async()=>n.stream.typedDownloads.create({account_id:i,identifier:t.identifier,download_type:t[`download-type`]})),{successLabel:`Created`})}};function at(e){return e.positional(`download-type`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ot={command:`delete <download-type>`,describe:`Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.`,builder:h(at),handler:async t=>{if(t.dryRun){u({command:`cf stream typed-downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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 i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
12
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.typedDownloads.delete({account_id:o,identifier:t.identifier,download_type:t[`download-type`]})),{successLabel:`Deleted`})}},st={command:`typed-downloads`,describe:`Type-specific stream download creation and deletion`,builder:e=>e.command(it).command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ct(e){return e.option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lt={command:`storage-usage`,describe:`Returns information about an account's storage use.`,builder:ct,handler:async t=>{let n={creator:t.creator};if(t.dryRun){u({command:`cf stream videos storage-usage`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/storage-usage`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);t.accountId=o,l(await d(`Loading`,async()=>i.stream.videos.storageUsage({account_id:o,...n})),{successLabel:`Loaded`})}},ut={command:`videos`,describe:`Aggregate video storage usage statistics for the account`,builder:e=>e.command(lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dt(e){return e.option(`name`,{type:`string`,description:`A short description of the watermark profile.`,default:``}).option(`opacity`,{type:`number`,description:"The translucency of the image. A value of `0.0` makes the image completely transparent, and `1.0` makes the image completely opaque. Note that if the image is already semi-transparent, setting this to `1.0` will not make the image completely opaque.",default:1}).option(`padding`,{type:`number`,description:"The whitespace between the adjacent edges (determined by position) of the video and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded video width or length, as determined by the algorithm.",default:.05}).option(`position`,{type:`string`,description:"The location of the image. Valid positions are: `upperRight`, `upperLeft`, `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the `padding` parameter.",default:`upperRight`}).option(`scale`,{type:`number`,description:"The size of the image relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. `0.0` indicates no scaling (use the size of the image as-is), and `1.0 `fills the entire video.",default:.15}).option(`url`,{type:`string`,description:`URL of the watermark image to copy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const ft={command:`create`,describe:"Creates watermark profiles using a single `HTTP POST multipart/form-data` request.",builder:dt,handler:async t=>{if(t.dryRun){u({command:`cf stream watermarks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`multipart`,body:{name:t.name,opacity:t.opacity,padding:t.padding,position:t.position,scale:t.scale,url:t.url,body:t.body,file:t.file}});return}let n=await a(t),c=t.local?m:await r(n);if(t.accountId=c,t.file!==void 0||t.body!==void 0||t.name!==void 0||t.opacity!==void 0||t.padding!==void 0||t.position!==void 0||t.scale!==void 0){let e=new FormData;if(t.file){let n=p(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);t.name!==void 0&&e.append(`name`,String(f(t.name,`name`,`text`)??``)),t.opacity!==void 0&&e.append(`opacity`,String(t.opacity)),t.padding!==void 0&&e.append(`padding`,String(t.padding)),t.position!==void 0&&e.append(`position`,String(f(t.position,`position`,`text`)??``)),t.scale!==void 0&&e.append(`scale`,String(t.scale)),l(await d(`Creating`,async()=>i(n,`POST`,`/accounts/${c}/stream/watermarks`,{body:e})),{successLabel:`Created`});return}if(t.body){let e=o(t.body);l(await d(`Creating`,async()=>i(n,`POST`,`/accounts/${c}/stream/watermarks`,{body:e})),{successLabel:`Created`});return}let h={};t.name!==void 0&&s(h,[`name`],f(t.name,`name`,`text`)),t.opacity!==void 0&&s(h,[`opacity`],t.opacity),t.padding!==void 0&&s(h,[`padding`],t.padding),t.position!==void 0&&s(h,[`position`],f(t.position,`position`,`text`)),t.scale!==void 0&&s(h,[`scale`],t.scale),t.url!==void 0&&s(h,[`url`],f(t.url,`url`,`text`)),l(await d(`Creating`,async()=>i(n,`POST`,`/accounts/${c}/stream/watermarks`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function $(e){return e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const pt={command:`delete <identifier>`,describe:`Deletes a watermark profile.`,builder:$,handler:async t=>{if(t.dryRun){u({command:`cf stream watermarks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/watermarks/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.watermarks.delete({account_id:o,identifier:t.identifier})),{successLabel:`Deleted`})}};function mt(e){return e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ht={command:`get <identifier>`,describe:`Retrieves details for a single watermark profile.`,builder:mt,handler:async t=>{if(t.dryRun){u({command:`cf stream watermarks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/watermarks/${t.identifier==null?`<identifier>`:encodeURIComponent(String(t.identifier))}`,pathParams:{identifier:String(t.identifier??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.watermarks.get({account_id:i,identifier:t.identifier})),{successLabel:`Loaded`})}};function gt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`list`,describe:`Lists all watermark profiles for an account.`,builder:gt,handler:async t=>{if(t.dryRun){u({command:`cf stream watermarks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.watermarks.list({account_id:i})),{successLabel:`Loaded`})}},vt={command:`watermarks`,describe:`Watermark profiles that overlay an image on every video in the account`,builder:e=>e.command(ft).command(pt).command(ht).command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const bt={command:`delete`,describe:`Deletes a webhook.`,builder:yt,handler:async t=>{if(t.dryRun){u({command:`cf stream webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let i=await a(t),o=t.local?m:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
14
|
-
`);return}l(await d(`Deleting`,async()=>i.stream.webhooks.delete({account_id:o})),{successLabel:`Deleted`})}};function xt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const St={command:`get`,describe:`Retrieves a list of webhooks.`,builder:xt,handler:async t=>{if(t.dryRun){u({command:`cf stream webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let n=await a(t),i=t.local?m:await r(n);t.accountId=i,l(await d(`Loading`,async()=>n.stream.webhooks.get({account_id:i})),{successLabel:`Loaded`})}};function Ct(e){return e.option(`notification-url`,{type:`string`,description:`The URL where webhooks will be sent.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const wt={command:`update`,describe:`Creates a webhook notification.`,builder:Ct,handler:async t=>{if(t.dryRun){u({command:`cf stream webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({notificationUrl:f(t[`notification-url`],`notification-url`,`text`)}):o(t.body)});return}let n=await a(t),i=t.local?m:await r(n);if(t.accountId=i,t.body){let e=o(t.body);l(await d(`Updating`,async()=>n.stream.webhooks.update({...e,account_id:i})),{successLabel:`Updated`});return}let s=c({notificationUrl:f(t[`notification-url`],`notification-url`,`text`)});l(await d(`Updating`,async()=>n.stream.webhooks.update({...s,account_id:i})),{successLabel:`Updated`})}},Tt={command:`webhooks`,describe:`Webhook notifications for video lifecycle events (ready, error, etc.)`,builder:e=>e.command(bt).command(St).command(wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Et={command:`stream`,describe:`Video encoding, storage, and delivery — upload, live-stream, clip, caption, and embed video at scale`,builder:e=>e.command(q).command(Y).command(ue).command(he).command(we).command(w).command(z).command(H).command(G).command(Q).command(ce).command(pe).command(Se).command($e).command(nt).command(st).command(ut).command(vt).command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Et as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,S as t,T as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.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(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const d={command:`delete`,describe:`Deletes the URL Normalization settings.`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf url-normalization delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>i.urlNormalization.delete({zone_id:a})),{successLabel:`Deleted`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Fetches the current URL Normalization settings.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf url-normalization get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.urlNormalization.get({zone_id:i})),{successLabel:`Loaded`})}};function m(e){return e.option(`scope`,{type:`string`,description:`The scope of the URL normalization.`,choices:[`incoming`,`both`,`none`]}).option(`type`,{type:`string`,description:`The type of URL normalization performed by Cloudflare.`,choices:[`cloudflare`,`rfc3986`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A URL Normalization object.`})}const h={command:`update`,describe:`Updates the URL Normalization settings.`,builder:m,handler:async n=>{if(n.dryRun){s({command:`cf url-normalization update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({scope:l(n.scope,`scope`,`text`),type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.urlNormalization.update({body:e,zone_id:d})),{successLabel:`Updated`});return}n.scope===void 0&&(n.scope=await e(`scope`,`The scope of the URL normalization.`,[`incoming`,`both`,`none`])),n.type===void 0&&(n.type=await e(`type`,`The type of URL normalization performed by Cloudflare.`,[`cloudflare`,`rfc3986`]));let f=a({scope:l(n.scope,`scope`,`text`),type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.urlNormalization.update({body:f,zone_id:d})),{successLabel:`Updated`})}},g={command:`url-normalization`,describe:`Normalize incoming request URLs to a consistent format before rule evaluation and caching`,builder:e=>e.command(d).command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,_ as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./local-VJaJ3BZ1.mjs";import{n as d,t as f}from"./raw-fetch-Dlccg0Tr.mjs";function p(e){return e.positional(`response-id`,{type:`string`,description:`Response hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <response-id>`,describe:"Returns the raw response of the network request. Find the `response_id` in the `data.requests.response.hash`.",builder:p,handler:async t=>{if(t.dryRun){s({command:`cf url-scanner responses get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/responses/${t[`response-id`]==null?`<response-id>`:encodeURIComponent(String(t[`response-id`]))}`,pathParams:{"response-id":String(t[`response-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,d((await c(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/responses/${encodeURIComponent(String(t[`response-id`]))}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}))).toString(`utf-8`))}},h={command:`responses`,describe:`Operations for responses`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`List of urls to scan (up to a 100).`})}const _={command:`bulk-create`,describe:`Submit URLs to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/ and take into account scans submitted in bulk have lower priority and may take longer to finish.`,builder:g,handler:async t=>{if(t.dryRun){s({command:`cf url-scanner scans bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/bulk`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:i(t.body)});return}let a=await r(t),l=t.local?u:await n(a);if(t.accountId=l,t.body){let e=i(t.body);o(await c(`Creating`,async()=>a.urlScanner.scans.bulkCreate({body:e,account_id:l})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.option(`agent-readiness`,{type:`boolean`,description:`Enable agent readiness checks.`}).option(`country`,{type:`string`,description:`Country to geo egress from`,choices:`AF.AL.DZ.AD.AO.AG.AR.AM.AU.AT.AZ.BH.BD.BB.BY.BE.BZ.BJ.BM.BT.BO.BA.BW.BR.BN.BG.BF.BI.KH.CM.CA.CV.KY.CF.TD.CL.CN.CO.KM.CG.CR.CI.HR.CU.CY.CZ.CD.DK.DJ.DM.DO.EC.EG.SV.GQ.ER.EE.SZ.ET.FJ.FI.FR.GA.GE.DE.GH.GR.GL.GD.GT.GN.GW.GY.HT.HN.HU.IS.IN.ID.IR.IQ.IE.IL.IT.JM.JP.JO.KZ.KE.KI.KW.KG.LA.LV.LB.LS.LR.LY.LI.LT.LU.MO.MG.MW.MY.MV.ML.MR.MU.MX.FM.MD.MC.MN.MS.MA.MZ.MM.NA.NR.NP.NL.NZ.NI.NE.NG.KP.MK.NO.OM.PK.PS.PA.PG.PY.PE.PH.PL.PT.QA.RO.RU.RW.SH.KN.LC.VC.WS.SM.ST.SA.SN.RS.SC.SL.SK.SI.SB.SO.ZA.KR.SS.ES.LK.SD.SR.SE.CH.SY.TW.TJ.TZ.TH.BS.GM.TL.TG.TO.TT.TN.TR.TM.UG.UA.AE.GB.US.UY.UZ.VU.VE.VN.YE.ZM.ZW`.split(`.`)}).option(`customagent`,{type:`string`,description:`The customagent field`}).option(`referer`,{type:`string`,description:`The referer field`}).option(`screenshots-resolutions`,{type:`string`,array:!0,description:`Take multiple screenshots targeting different device types.`}).option(`url`,{type:`string`,description:`The url field`}).option(`visibility`,{type:`string`,description:"The option `Public` means it will be included in listings like recent scans and search results. `Unlisted` means it will not be included in the aforementioned listings, users will need to have the scan's ID to access it. A a scan will be automatically marked as unlisted if it fails, if it contains potential PII or other sensitive material.",choices:[`Public`,`Unlisted`],default:`Public`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`create`,describe:`Submit a URL to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/.`,builder:v,handler:async d=>{if(d.dryRun){s({command:`cf url-scanner scans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/scan`,pathParams:{},bodyKind:`json`,body:d.body===void 0?a({agentReadiness:d[`agent-readiness`],country:l(d.country,`country`,`text`),customagent:l(d.customagent,`customagent`,`text`),referer:l(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:l(d.url,`url`,`text`),visibility:l(d.visibility,`visibility`,`text`)}):i(d.body)});return}let f=await r(d),p=d.local?u:await n(f);if(d.accountId=p,d.body){let e=i(d.body);o(await c(`Creating`,async()=>f.urlScanner.scans.create({...e,account_id:p})),{successLabel:`Created`});return}d.url===void 0&&(d.url=await t(`url`,`The url field`));let m=a({agentReadiness:d[`agent-readiness`],country:l(d.country,`country`,`text`),customagent:l(d.customagent,`customagent`,`text`),referer:l(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:l(d.url,`url`,`text`),visibility:l(d.visibility,`visibility`,`text`)});o(await c(`Creating`,async()=>f.urlScanner.scans.create({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`dom <scan-id>`,describe:`Returns a plain text response, with the scan's DOM content as rendered by Chrome.`,builder:b,handler:async t=>{if(t.dryRun){s({command:`cf url-scanner scans dom`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/dom/${t[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(t[`scan-id`]))}`,pathParams:{"scan-id":String(t[`scan-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,d((await c(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/dom/${encodeURIComponent(String(t[`scan-id`]))}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}))).toString(`utf-8`))}};function S(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <scan-id>`,describe:`Get URL scan by uuid`,builder:S,handler:async t=>{if(t.dryRun){s({command:`cf url-scanner scans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/result/${t[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(t[`scan-id`]))}`,pathParams:{"scan-id":String(t[`scan-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.urlScanner.scans.get({account_id:a,scan_id:t[`scan-id`]})),{successLabel:`Loaded`})}};function w(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`har <scan-id>`,describe:`Get a URL scan's HAR file. See HAR spec at http://www.softwareishard.com/blog/har-12-spec/.`,builder:w,handler:async t=>{if(t.dryRun){s({command:`cf url-scanner scans har`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/har/${t[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(t[`scan-id`]))}`,pathParams:{"scan-id":String(t[`scan-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.urlScanner.scans.har({account_id:a,scan_id:t[`scan-id`]})),{successLabel:`Loaded`})}};function E(e){return e.option(`size`,{type:`number`,description:`Limit the number of objects in the response.`}).option(`q`,{type:`string`,description:`Filter scans`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`Use a subset of ElasticSearch Query syntax to filter scans. Some example queries:<br/> <br/>- 'path:"/bundles/jquery.js"': Searches for scans who requested resources with the given path.<br/>- 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940 where a resource with the given hash was downloaded.<br/>- 'page.domain:microsoft* AND verdicts.malicious:true AND NOT page.domain:microsoft.com': malicious scans whose hostname starts with "microsoft".<br/>- 'apikey:me AND date:[2025-01 TO 2025-02]': my scans from 2025 January to 2025 February.`,builder:E,handler:async t=>{let i={size:t.size,q:t.q};if(t.dryRun){s({command:`cf url-scanner scans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/search`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),l=t.local?u:await n(a);t.accountId=l,o(await c(`Loading`,async()=>a.urlScanner.scans.list({account_id:l,...i})),{successLabel:`Loaded`})}};function O(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`resolution`,{type:`string`,description:`Target device type.`,choices:[`desktop`,`mobile`,`tablet`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`screenshot <scan-id>`,describe:`Get scan's screenshot by resolution (desktop/mobile/tablet).`,builder:O,handler:async t=>{let i={resolution:t.resolution};if(t.dryRun){s({command:`cf url-scanner scans screenshot`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/urlscanner/v2/screenshots/${t[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(t[`scan-id`]))}.png`,pathParams:{"scan-id":String(t[`scan-id`]??``)},query:i,bodyKind:`none`});return}let a=await r(t),o=t.local?u:await n(a);t.accountId=o;let l=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),p=await c(`Loading`,async()=>f(`/accounts/${o}/urlscanner/v2/screenshots/${encodeURIComponent(String(t[`scan-id`]))}.png${l?`?`+l:``}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));d(t.text===!0?p.toString(`utf-8`):p)}},A={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(_).command(y).command(x).command(C).command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`url-scanner`,describe:`Scan URLs for phishing, malware, and other threats — submit scans and retrieve detailed results`,builder:e=>e.command(h).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{j as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f,t as p}from"./input-validation-zEO81MWN.mjs";import{t as m}from"./local-VJaJ3BZ1.mjs";function h(e){return e.option(`config-dimensions`,{type:`number`,description:`Specifies the number of dimensions for the index`}).option(`config-metric`,{type:`string`,description:`Specifies the type of metric to use calculating distance.`,choices:[`cosine`,`euclidean`,`dot-product`]}).option(`config-preset`,{type:`string`,description:`Specifies the preset to use for the index.`,choices:[`@cf/baai/bge-small-en-v1.5`,`@cf/baai/bge-base-en-v1.5`,`@cf/baai/bge-large-en-v1.5`,`openai/text-embedding-ada-002`,`cohere/embed-multilingual-v2.0`]}).option(`description`,{type:`string`,description:`Specifies the description of the index.`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`config-dimensions`,[`config-preset`]).implies(`config-dimensions`,[`config-metric`]).conflicts(`config-metric`,[`config-preset`]).implies(`config-metric`,[`config-dimensions`]).conflicts(`config-preset`,[`config-dimensions`,`config-metric`])}const g={command:`create`,describe:`Creates and returns a new Vectorize Index.`,builder:h,handler:async n=>{if(n.dryRun){u({command:`cf vectorize create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({config:{dimensions:n[`config-dimensions`],metric:f(n[`config-metric`],`config-metric`,`text`),preset:f(n[`config-preset`],`config-preset`,`text`)},description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>r.vectorize.create({body:e,account_id:a})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name field`));let p=c({config:{dimensions:n[`config-dimensions`],metric:f(n[`config-metric`],`config-metric`,`text`),preset:f(n[`config-preset`],`config-preset`,`text`)},description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>r.vectorize.create({body:p,account_id:a})),{successLabel:`Created`})}};function _(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`A list of vector identifiers to delete from the index indicated by the path.`}).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:`delete-by-ids <index-name>`,describe:`Delete a set of vectors from an index by their vector identifiers.`,builder:_,handler:async t=>{if(t.dryRun){u({command:`cf vectorize delete-by-ids`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/delete_by_ids`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`json`,body:t.body===void 0?c({ids:t.ids}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.vectorize.deleteByIds({body:e,account_id:r,index_name:t[`index-name`]})),{successLabel:`Created`});return}let a=c({ids:t.ids});l(await d(`Creating`,async()=>n.vectorize.deleteByIds({body:a,account_id:r,index_name:t[`index-name`]})),{successLabel:`Created`})}};function y(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,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 b={command:`delete <index-name>`,describe:`Deletes the specified Vectorize Index.`,builder:y,handler:async t=>{if(t.dryRun){u({command:`cf vectorize delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await d(`Deleting`,async()=>n.vectorize.delete({account_id:a,index_name:t[`index-name`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`A list of vector identifiers to retrieve from the index indicated by the path.`}).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:`get-by-ids <index-name>`,describe:`Get a set of vectors from an index by their vector identifiers.`,builder:x,handler:async t=>{if(t.dryRun){u({command:`cf vectorize get-by-ids`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/get_by_ids`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`json`,body:t.body===void 0?c({ids:t.ids}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.vectorize.getByIds({body:e,account_id:r,index_name:t[`index-name`]})),{successLabel:`Created`});return}let a=c({ids:t.ids});l(await d(`Creating`,async()=>n.vectorize.getByIds({body:a,account_id:r,index_name:t[`index-name`]})),{successLabel:`Created`})}};function C(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <index-name>`,describe:`Returns the specified Vectorize Index.`,builder:C,handler:async t=>{if(t.dryRun){u({command:`cf vectorize get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.vectorize.get({account_id:r,index_name:t[`index-name`]})),{successLabel:`Loaded`})}};function T(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`info <index-name>`,describe:`Get information about a vectorize index.`,builder:T,handler:async t=>{if(t.dryRun){u({command:`cf vectorize info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/info`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.vectorize.info({account_id:r,index_name:t[`index-name`]})),{successLabel:`Loaded`})}};function D(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`unparsable-behavior`,{type:`string`,description:`Behavior for ndjson parse failures.`,choices:[`error`,`discard`]}).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 O={command:`insert <index-name>`,describe:`Inserts vectors into the specified index and returns a mutation id corresponding to the vectors enqueued for insertion.`,builder:D,handler:async t=>{let n={"unparsable-behavior":t[`unparsable-behavior`]};if(t.dryRun){u({command:`cf vectorize insert`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/insert`,pathParams:{"index-name":String(t[`index-name`]??``)},query:n,bodyKind:`octet-stream`,body:t.body});return}let r=await o(t),s=t.local?m:await i(r);if(t.accountId=s,t.file){let e=p(t.file);l(await d(`Creating`,async()=>a(r,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(t[`index-name`]))}/insert`,{body:e,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(t.body){let e=f(t.body,`body`,`binary`),i=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await d(`Creating`,async()=>a(r,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(t[`index-name`]))}/insert${i?`?`+i:``}`,{body:e,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function k(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`count`,{type:`number`,description:`Maximum number of vectors to return`}).option(`cursor`,{type:`string`,description:`Cursor for pagination to get the next page of results`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-vectors <index-name>`,describe:`Returns a paginated list of vector identifiers from the specified index.`,builder:k,handler:async t=>{let n={count:t.count,cursor:t.cursor};if(t.dryRun){u({command:`cf vectorize list-vectors`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/list`,pathParams:{"index-name":String(t[`index-name`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.vectorize.listVectors({account_id:a,index_name:t[`index-name`],...n})),{successLabel:`Loaded`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list`,describe:`Returns a list of Vectorize Indexes`,builder:j,handler:async t=>{if(t.dryRun){u({command:`cf vectorize list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.vectorize.list({account_id:r})),{successLabel:`Loaded`})}};function N(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`index-type`,{type:`string`,description:`Specifies the type of metadata property to index.`,choices:[`string`,`number`,`boolean`]}).option(`property-name`,{type:`string`,description:`Specifies the metadata property to index.`}).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 <index-name>`,describe:`Enable metadata filtering based on metadata property. Limited to 10 properties.`,builder:N,handler:async r=>{if(r.dryRun){u({command:`cf vectorize metadata-index create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${r[`index-name`]==null?`<index-name>`:encodeURIComponent(String(r[`index-name`]))}/metadata_index/create`,pathParams:{"index-name":String(r[`index-name`]??``)},bodyKind:`json`,body:r.body===void 0?c({indexType:f(r[`index-type`],`index-type`,`text`),propertyName:f(r[`property-name`],`property-name`,`text`)}):s(r.body)});return}let a=await o(r),p=r.local?m:await i(a);if(r.accountId=p,r.body){let e=s(r.body);l(await d(`Creating`,async()=>a.vectorize.metadataIndex.create({...e,account_id:p,index_name:r[`index-name`]})),{successLabel:`Created`});return}r[`index-type`]===void 0&&(r[`index-type`]=await n(`index-type`,`Specifies the type of metadata property to index.`,[`string`,`number`,`boolean`])),r[`property-name`]===void 0&&(r[`property-name`]=await t(`property-name`,`Specifies the metadata property to index.`));let h=c({indexType:f(r[`index-type`],`index-type`,`text`),propertyName:f(r[`property-name`],`property-name`,`text`)});l(await d(`Creating`,async()=>a.vectorize.metadataIndex.create({...h,account_id:p,index_name:r[`index-name`]})),{successLabel:`Created`})}};function F(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`property-name`,{type:`string`,description:`Specifies the metadata property for which the index must be deleted.`}).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 I={command:`delete <index-name>`,describe:`Allow Vectorize to delete the specified metadata index.`,builder:F,handler:async n=>{if(n.dryRun){u({command:`cf vectorize metadata-index delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${n[`index-name`]==null?`<index-name>`:encodeURIComponent(String(n[`index-name`]))}/metadata_index/delete`,pathParams:{"index-name":String(n[`index-name`]??``)},bodyKind:`json`,body:n.body===void 0?c({propertyName:f(n[`property-name`],`property-name`,`text`)}):s(n.body)});return}let a=await o(n),p=n.local?m:await i(a);if(n.accountId=p,!await r({force:!!n.force,message:`This operation deletes a metadata index destructively.`})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(n.body){let e=s(n.body);l(await d(`Deleting`,async()=>a.vectorize.metadataIndex.delete({...e,account_id:p,index_name:n[`index-name`]})),{successLabel:`Deleted`});return}n[`property-name`]===void 0&&(n[`property-name`]=await t(`property-name`,`Specifies the metadata property for which the index must be deleted.`));let h=c({propertyName:f(n[`property-name`],`property-name`,`text`)});l(await d(`Deleting`,async()=>a.vectorize.metadataIndex.delete({...h,account_id:p,index_name:n[`index-name`]})),{successLabel:`Deleted`})}};function L(e){return e.option(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`List Metadata Indexes for the specified Vectorize Index.`,builder:L,handler:async t=>{if(t.dryRun){u({command:`cf vectorize metadata-index list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/metadata_index/list`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.vectorize.metadataIndex.list({account_id:r,index_name:t[`index-name`]})),{successLabel:`Loaded`})}},z={command:`metadata-index`,describe:`Metadata indexes for filtered vector search`,builder:e=>e.command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`return-metadata`,{type:`string`,description:`Whether to return no metadata, indexed metadata or all metadata associated with the closest vectors.`,choices:[`none`,`indexed`,`all`],default:`none`}).option(`return-values`,{type:`boolean`,description:`Whether to return the values associated with the closest vectors.`,default:!1}).option(`top-k`,{type:`number`,description:`The number of nearest neighbors to find.`,default:5}).option(`vector`,{type:`string`,array:!0,description:`The search vector that will be used to find the nearest neighbors.`}).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:`query <index-name>`,describe:`Finds vectors closest to a given vector in an index.`,builder:B,handler:async t=>{if(t.dryRun){u({command:`cf vectorize query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/query`,pathParams:{"index-name":String(t[`index-name`]??``)},bodyKind:`json`,body:t.body===void 0?c({returnMetadata:f(t[`return-metadata`],`return-metadata`,`text`),returnValues:t[`return-values`],topK:t[`top-k`],vector:t.vector}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Loading`,async()=>n.vectorize.query({...e,account_id:r,index_name:t[`index-name`]})),{successLabel:`Loaded`});return}if(t.vector===void 0)throw Error(`--vector is required (or pass --body with this field set).`);let a=c({returnMetadata:f(t[`return-metadata`],`return-metadata`,`text`),returnValues:t[`return-values`],topK:t[`top-k`],vector:t.vector});l(await d(`Loading`,async()=>n.vectorize.query({...a,account_id:r,index_name:t[`index-name`]})),{successLabel:`Loaded`})}};function H(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`unparsable-behavior`,{type:`string`,description:`Behavior for ndjson parse failures.`,choices:[`error`,`discard`]}).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 U={command:`upsert <index-name>`,describe:`Upserts vectors into the specified index, creating them if they do not exist and returns a mutation id corresponding to the vectors enqueued for upsertion.`,builder:H,handler:async t=>{let n={"unparsable-behavior":t[`unparsable-behavior`]};if(t.dryRun){u({command:`cf vectorize upsert`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/vectorize/v2/indexes/${t[`index-name`]==null?`<index-name>`:encodeURIComponent(String(t[`index-name`]))}/upsert`,pathParams:{"index-name":String(t[`index-name`]??``)},query:n,bodyKind:`octet-stream`,body:t.body});return}let r=await o(t),s=t.local?m:await i(r);if(t.accountId=s,t.file){let e=p(t.file);l(await d(`Creating`,async()=>a(r,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(t[`index-name`]))}/upsert`,{body:e,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(t.body){let e=f(t.body,`body`,`binary`),i=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await d(`Creating`,async()=>a(r,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(t[`index-name`]))}/upsert${i?`?`+i:``}`,{body:e,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},W={command:`vectorize`,describe:`Globally distributed vector database for building semantic search, recommendations, and RAG applications on Workers`,builder:e=>e.command(g).command(b).command(v).command(w).command(S).command(E).command(O).command(M).command(A).command(V).command(U).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{W as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{t as p}from"./cli-types-CRIDdDw3.mjs";function m(e){return e.positional(`build-uuid`,{type:`string`,description:`Build UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`cancel <build-uuid>`,describe:`Cancel a running or queued build`,builder:m,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds builds cancel`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/${t[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(t[`build-uuid`]))}/cancel`,pathParams:{"build-uuid":String(t[`build-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Updating`,async()=>n.workersBuilds.builds.cancel({account_id:r,build_uuid:t[`build-uuid`]})),{successLabel:`Updated`})}};function ee(e){return e.positional(`build-uuid`,{type:`string`,description:`Build UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <build-uuid>`,describe:`Retrieve detailed information about a specific build`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds builds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/${t[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(t[`build-uuid`]))}`,pathParams:{"build-uuid":String(t[`build-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.builds.get({account_id:r,build_uuid:t[`build-uuid`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`external-script-id`,{type:`string`,description:`System-generated worker script tag.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number for pagination`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Get all builds for a specific worker script with pagination`,builder:_,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf workers-builds builds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/workers/${t[`external-script-id`]==null?`<external-script-id>`:encodeURIComponent(String(t[`external-script-id`]))}/builds`,pathParams:{"external-script-id":String(t[`external-script-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.builds.list({account_id:o,external_script_id:t[`external-script-id`],...n})),{successLabel:`Loaded`})}};function y(e){return e.positional(`build-uuid`,{type:`string`,description:`Build UUID.`,demandOption:!0}).option(`cursor`,{type:`string`,description:`Pagination cursor for log retrieval.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <build-uuid>`,describe:`Retrieve logs for a specific build with cursor-based pagination`,builder:y,handler:async t=>{let n={cursor:t.cursor};if(t.dryRun){l({command:`cf workers-builds builds logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/${t[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(t[`build-uuid`]))}/logs`,pathParams:{"build-uuid":String(t[`build-uuid`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.builds.logs.get({account_id:o,build_uuid:t[`build-uuid`],...n})),{successLabel:`Loaded`})}},x={command:`logs`,describe:`Operations for builds.logs`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`builds`,describe:`Operations for builds`,builder:e=>e.command(h).command(g).command(v).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get-account-limits`,describe:`Retrieve account limits and usage information`,builder:C,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds get-account-limits`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/account/limits`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.getAccountLimits({account_id:r})),{successLabel:`Loaded`})}};function T(e){return e.option(`version-ids`,{type:`string`,description:`Comma-separated list of version UUIDs (max 20).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get-builds-by-version`,describe:`Retrieve builds for specific version IDs`,builder:T,handler:async t=>{let n={version_ids:t[`version-ids`]};if(t.dryRun){l({command:`cf workers-builds get-builds-by-version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.getBuildsByVersion({account_id:o,...n})),{successLabel:`Loaded`})}};function D(e){return e.option(`external-script-ids`,{type:`string`,description:`Comma-separated list of system-generated worker script tags (max 20).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get-latest-builds`,describe:`Retrieve the most recent builds for multiple worker scripts`,builder:D,handler:async t=>{let n={external_script_ids:t[`external-script-ids`]};if(t.dryRun){l({command:`cf workers-builds get-latest-builds`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/latest`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.getLatestBuilds({account_id:o,...n})),{successLabel:`Loaded`})}};function k(e){return e.positional(`repo-id`,{type:`string`,description:`Repository identifier.`,demandOption:!0}).option(`provider-type`,{type:`string`,description:`SCM provider type`,demandOption:!0}).option(`provider-account-id`,{type:`string`,description:`Provider account identifier.`,demandOption:!0}).option(`branch`,{type:`string`,description:`Git branch name.`,demandOption:!0}).option(`root-directory`,{type:`string`,description:`Root directory path.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get <repo-id>`,describe:`Analyze repository for automatic configuration detection`,builder:p(k),handler:async t=>{let n={branch:t.branch,root_directory:t[`root-directory`]};if(t.dryRun){l({command:`cf workers-builds repos config-autofill get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/repos/${t[`provider-type`]==null?`<provider-type>`:encodeURIComponent(String(t[`provider-type`]))}/${t[`provider-account-id`]==null?`<provider-account-id>`:encodeURIComponent(String(t[`provider-account-id`]))}/${t[`repo-id`]==null?`<repo-id>`:encodeURIComponent(String(t[`repo-id`]))}/config_autofill`,pathParams:{"provider-type":String(t[`provider-type`]??``),"provider-account-id":String(t[`provider-account-id`]??``),"repo-id":String(t[`repo-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.repos.configAutofill.get({account_id:o,provider_type:t[`provider-type`],provider_account_id:t[`provider-account-id`],repo_id:t[`repo-id`],...n})),{successLabel:`Loaded`})}},j={command:`config-autofill`,describe:`Operations for repos.config-autofill`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.positional(`repo-connection-uuid`,{type:`string`,description:`Repository connection UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const N={command:`delete <repo-connection-uuid>`,describe:`Remove a repository connection`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds repos connections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/repos/connections/${t[`repo-connection-uuid`]==null?`<repo-connection-uuid>`:encodeURIComponent(String(t[`repo-connection-uuid`]))}`,pathParams:{"repo-connection-uuid":String(t[`repo-connection-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}c(await u(`Deleting`,async()=>n.workersBuilds.repos.connections.delete({account_id:o,repo_connection_uuid:t[`repo-connection-uuid`]})),{successLabel:`Deleted`})}};function P(e){return e.option(`provider-account-id`,{type:`string`,description:`Provider account identifier.`}).option(`provider-account-name`,{type:`string`,description:`The provider_account_name field`}).option(`provider-type`,{type:`string`,description:`The provider_type field`,choices:[`github`,`gitlab`,`gitlab_internal`]}).option(`repo-id`,{type:`string`,description:`Repository identifier.`}).option(`repo-name`,{type:`string`,description:`The repo_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const F={command:`upsert`,describe:`Upsert a repository connection for CI/CD integration`,builder:P,handler:async r=>{if(r.dryRun){l({command:`cf workers-builds repos connections upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/repos/connections`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({provider_account_id:d(r[`provider-account-id`],`provider-account-id`,`text`),provider_account_name:d(r[`provider-account-name`],`provider-account-name`,`text`),provider_type:d(r[`provider-type`],`provider-type`,`text`),repo_id:d(r[`repo-id`],`repo-id`,`text`),repo_name:d(r[`repo-name`],`repo-name`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Updating`,async()=>p.workersBuilds.repos.connections.upsert({...e,account_id:m})),{successLabel:`Updated`});return}r[`provider-account-id`]===void 0&&(r[`provider-account-id`]=await t(`provider-account-id`,`Provider account identifier.`)),r[`provider-account-name`]===void 0&&(r[`provider-account-name`]=await t(`provider-account-name`,`The provider_account_name field`)),r[`provider-type`]===void 0&&(r[`provider-type`]=await n(`provider-type`,`The provider_type field`,[`github`,`gitlab`,`gitlab_internal`])),r[`repo-id`]===void 0&&(r[`repo-id`]=await t(`repo-id`,`Repository identifier.`)),r[`repo-name`]===void 0&&(r[`repo-name`]=await t(`repo-name`,`The repo_name field`));let h=s({provider_account_id:d(r[`provider-account-id`],`provider-account-id`,`text`),provider_account_name:d(r[`provider-account-name`],`provider-account-name`,`text`),provider_type:d(r[`provider-type`],`provider-type`,`text`),repo_id:d(r[`repo-id`],`repo-id`,`text`),repo_name:d(r[`repo-name`],`repo-name`,`text`)});c(await u(`Updating`,async()=>p.workersBuilds.repos.connections.upsert({...h,account_id:m})),{successLabel:`Updated`})}},I={command:`connections`,describe:`Operations for repos.connections`,builder:e=>e.command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`repos`,describe:`Operations for repos`,builder:e=>e.command(j).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`build-token-name`,{type:`string`,description:`The build_token_name field`}).option(`build-token-secret`,{type:`string`,description:`The build_token_secret field`}).option(`cloudflare-token-id`,{type:`string`,description:`The cloudflare_token_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`create`,describe:`Create a new build authentication token`,builder:R,handler:async n=>{if(n.dryRun){l({command:`cf workers-builds tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/tokens`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({build_token_name:d(n[`build-token-name`],`build-token-name`,`text`),build_token_secret:d(n[`build-token-secret`],`build-token-secret`,`text`),cloudflare_token_id:d(n[`cloudflare-token-id`],`cloudflare-token-id`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.workersBuilds.tokens.create({...e,account_id:p})),{successLabel:`Created`});return}n[`build-token-name`]===void 0&&(n[`build-token-name`]=await t(`build-token-name`,`The build_token_name field`)),n[`build-token-secret`]===void 0&&(n[`build-token-secret`]=await t(`build-token-secret`,`The build_token_secret field`)),n[`cloudflare-token-id`]===void 0&&(n[`cloudflare-token-id`]=await t(`cloudflare-token-id`,`The cloudflare_token_id field`));let m=s({build_token_name:d(n[`build-token-name`],`build-token-name`,`text`),build_token_secret:d(n[`build-token-secret`],`build-token-secret`,`text`),cloudflare_token_id:d(n[`cloudflare-token-id`],`cloudflare-token-id`,`text`)});c(await u(`Creating`,async()=>r.workersBuilds.tokens.create({...m,account_id:p})),{successLabel:`Created`})}};function te(e){return e.positional(`build-token-uuid`,{type:`string`,description:`Build token UUID.`,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 B={command:`delete <build-token-uuid>`,describe:`Remove a build authentication token`,builder:te,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/tokens/${t[`build-token-uuid`]==null?`<build-token-uuid>`:encodeURIComponent(String(t[`build-token-uuid`]))}`,pathParams:{"build-token-uuid":String(t[`build-token-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}c(await u(`Deleting`,async()=>n.workersBuilds.tokens.delete({account_id:o,build_token_uuid:t[`build-token-uuid`]})),{successLabel:`Deleted`})}};function V(e){return e.option(`page`,{type:`number`,description:`Page number for pagination`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`list`,describe:`Get all build tokens with pagination`,builder:V,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf workers-builds tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.tokens.list({account_id:o,...n})),{successLabel:`Loaded`})}},U={command:`tokens`,describe:`Operations for tokens`,builder:e=>e.command(z).command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`seed-repo-branch`,{type:`string`,description:`Git branch name.`}).option(`seed-repo-owner`,{type:`string`,description:`The seed_repo.owner field`}).option(`seed-repo-path`,{type:`string`,description:`The seed_repo.path field`}).option(`seed-repo-provider`,{type:`string`,description:`The seed_repo.provider field`,choices:[`github`,`gitlab`,`gitlab_internal`]}).option(`seed-repo-repository`,{type:`string`,description:`The seed_repo.repository field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`seed-repo-branch`,`seed-repo-owner`,`seed-repo-path`,`seed-repo-provider`,`seed-repo-repository`].some(t=>e[t]!==void 0)){let t=[`seed-repo-branch`,`seed-repo-owner`,`seed-repo-path`,`seed-repo-provider`,`seed-repo-repository`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --seed_repo-* flag is set`)}return!0})}const G={command:`create-build <trigger-uuid>`,describe:`Trigger a manual build for a specific trigger`,builder:W,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers create-build`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/builds`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`json`,body:t.body===void 0?s({seed_repo:{branch:d(t[`seed-repo-branch`],`seed-repo-branch`,`text`),owner:d(t[`seed-repo-owner`],`seed-repo-owner`,`text`),path:d(t[`seed-repo-path`],`seed-repo-path`,`text`),provider:d(t[`seed-repo-provider`],`seed-repo-provider`,`text`),repository:d(t[`seed-repo-repository`],`seed-repo-repository`,`text`)}}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.workersBuilds.triggers.createBuild({...e,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Created`});return}let p=s({seed_repo:{branch:d(t[`seed-repo-branch`],`seed-repo-branch`,`text`),owner:d(t[`seed-repo-owner`],`seed-repo-owner`,`text`),path:d(t[`seed-repo-path`],`seed-repo-path`,`text`),provider:d(t[`seed-repo-provider`],`seed-repo-provider`,`text`),repository:d(t[`seed-repo-repository`],`seed-repo-repository`,`text`)}});c(await u(`Creating`,async()=>n.workersBuilds.triggers.createBuild({...p,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Created`})}};function K(e){return e.option(`branch-excludes`,{type:`string`,array:!0,description:`The branch_excludes field`}).option(`branch-includes`,{type:`string`,array:!0,description:`The branch_includes field`}).option(`build-caching-enabled`,{type:`boolean`,description:`The build_caching_enabled field`,default:!1}).option(`build-command`,{type:`string`,description:`The build_command field`}).option(`build-token-uuid`,{type:`string`,description:`Build token UUID.`}).option(`deploy-command`,{type:`string`,description:`The deploy_command field`}).option(`external-script-id`,{type:`string`,description:`System-generated worker script tag.`}).option(`path-excludes`,{type:`string`,array:!0,description:`The path_excludes field`}).option(`path-includes`,{type:`string`,array:!0,description:`The path_includes field`}).option(`repo-connection-uuid`,{type:`string`,description:`Repository connection UUID.`}).option(`root-directory`,{type:`string`,description:`Root directory path.`}).option(`trigger-name`,{type:`string`,description:`The trigger_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const q={command:`create`,describe:`Create a new CI/CD trigger`,builder:K,handler:async n=>{if(n.dryRun){l({command:`cf workers-builds triggers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({branch_excludes:n[`branch-excludes`],branch_includes:n[`branch-includes`],build_caching_enabled:n[`build-caching-enabled`],build_command:d(n[`build-command`],`build-command`,`text`),build_token_uuid:d(n[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(n[`deploy-command`],`deploy-command`,`text`),external_script_id:d(n[`external-script-id`],`external-script-id`,`text`),path_excludes:n[`path-excludes`],path_includes:n[`path-includes`],repo_connection_uuid:d(n[`repo-connection-uuid`],`repo-connection-uuid`,`text`),root_directory:d(n[`root-directory`],`root-directory`,`text`),trigger_name:d(n[`trigger-name`],`trigger-name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.workersBuilds.triggers.create({...e,account_id:p})),{successLabel:`Created`});return}if(n[`branch-excludes`]===void 0)throw Error(`--branch-excludes is required (or pass --body with this field set).`);if(n[`branch-includes`]===void 0)throw Error(`--branch-includes is required (or pass --body with this field set).`);if(n[`build-command`]===void 0&&(n[`build-command`]=await t(`build-command`,`The build_command field`)),n[`build-token-uuid`]===void 0&&(n[`build-token-uuid`]=await t(`build-token-uuid`,`Build token UUID.`)),n[`deploy-command`]===void 0&&(n[`deploy-command`]=await t(`deploy-command`,`The deploy_command field`)),n[`external-script-id`]===void 0&&(n[`external-script-id`]=await t(`external-script-id`,`System-generated worker script tag.`)),n[`path-excludes`]===void 0)throw Error(`--path-excludes is required (or pass --body with this field set).`);if(n[`path-includes`]===void 0)throw Error(`--path-includes is required (or pass --body with this field set).`);n[`repo-connection-uuid`]===void 0&&(n[`repo-connection-uuid`]=await t(`repo-connection-uuid`,`Repository connection UUID.`)),n[`root-directory`]===void 0&&(n[`root-directory`]=await t(`root-directory`,`Root directory path.`)),n[`trigger-name`]===void 0&&(n[`trigger-name`]=await t(`trigger-name`,`The trigger_name field`));let m=s({branch_excludes:n[`branch-excludes`],branch_includes:n[`branch-includes`],build_caching_enabled:n[`build-caching-enabled`],build_command:d(n[`build-command`],`build-command`,`text`),build_token_uuid:d(n[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(n[`deploy-command`],`deploy-command`,`text`),external_script_id:d(n[`external-script-id`],`external-script-id`,`text`),path_excludes:n[`path-excludes`],path_includes:n[`path-includes`],repo_connection_uuid:d(n[`repo-connection-uuid`],`repo-connection-uuid`,`text`),root_directory:d(n[`root-directory`],`root-directory`,`text`),trigger_name:d(n[`trigger-name`],`trigger-name`,`text`)});c(await u(`Creating`,async()=>r.workersBuilds.triggers.create({...m,account_id:p})),{successLabel:`Created`})}};function J(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Y={command:`delete <trigger-uuid>`,describe:`Remove a CI/CD trigger`,builder:J,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}c(await u(`Deleting`,async()=>n.workersBuilds.triggers.delete({account_id:o,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Deleted`})}};function X(e){return e.positional(`environment-variable-key`,{type:`string`,description:`Environment variable key.`,demandOption:!0}).option(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,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 Z={command:`delete <environment-variable-key>`,describe:`Remove a specific environment variable from a trigger`,builder:X,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers environment-variables delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/environment_variables/${t[`environment-variable-key`]==null?`<environment-variable-key>`:encodeURIComponent(String(t[`environment-variable-key`]))}`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``),"environment-variable-key":String(t[`environment-variable-key`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}c(await u(`Deleting`,async()=>n.workersBuilds.triggers.environmentVariables.delete({account_id:o,trigger_uuid:t[`trigger-uuid`],environment_variable_key:t[`environment-variable-key`]})),{successLabel:`Deleted`})}};function Q(e){return e.option(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`list`,describe:`Get all environment variables for a trigger`,builder:Q,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers environment-variables list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/environment_variables`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.triggers.environmentVariables.list({account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Loaded`})}};function re(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,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 ie={command:`upsert <trigger-uuid>`,describe:`Create or update environment variables for a trigger`,builder:re,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers environment-variables upsert`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/environment_variables`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.workersBuilds.triggers.environmentVariables.upsert({body:e,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ae={command:`environment-variables`,describe:`Operations for triggers.environment-variables`,builder:e=>e.command(Z).command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`external-script-id`,{type:`string`,description:`System-generated worker script tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Get all triggers for a specific worker script`,builder:oe,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/workers/${t[`external-script-id`]==null?`<external-script-id>`:encodeURIComponent(String(t[`external-script-id`]))}/triggers`,pathParams:{"external-script-id":String(t[`external-script-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.triggers.list({account_id:r,external_script_id:t[`external-script-id`]})),{successLabel:`Loaded`})}};function se(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,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 ce={command:`purge-cache <trigger-uuid>`,describe:`Clear the build cache for a specific trigger`,builder:se,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/purge_build_cache`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force,message:`This operation wipes the workers-build cache.`})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}c(await u(`Deleting`,async()=>n.workersBuilds.triggers.purgeCache({account_id:o,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Deleted`})}};function le(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`branch-excludes`,{type:`string`,array:!0,description:`The branch_excludes field`}).option(`branch-includes`,{type:`string`,array:!0,description:`The branch_includes field`}).option(`build-caching-enabled`,{type:`boolean`,description:`The build_caching_enabled field`}).option(`build-command`,{type:`string`,description:`The build_command field`}).option(`build-token-uuid`,{type:`string`,description:`Build token UUID.`}).option(`deploy-command`,{type:`string`,description:`The deploy_command field`}).option(`path-excludes`,{type:`string`,array:!0,description:`The path_excludes field`}).option(`path-includes`,{type:`string`,array:!0,description:`The path_includes field`}).option(`root-directory`,{type:`string`,description:`Root directory path.`}).option(`trigger-name`,{type:`string`,description:`The trigger_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`update <trigger-uuid>`,describe:`Update an existing CI/CD trigger`,builder:le,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`json`,body:t.body===void 0?s({branch_excludes:t[`branch-excludes`],branch_includes:t[`branch-includes`],build_caching_enabled:t[`build-caching-enabled`],build_command:d(t[`build-command`],`build-command`,`text`),build_token_uuid:d(t[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(t[`deploy-command`],`deploy-command`,`text`),path_excludes:t[`path-excludes`],path_includes:t[`path-includes`],root_directory:d(t[`root-directory`],`root-directory`,`text`),trigger_name:d(t[`trigger-name`],`trigger-name`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.workersBuilds.triggers.update({...e,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Updated`});return}let p=s({branch_excludes:t[`branch-excludes`],branch_includes:t[`branch-includes`],build_caching_enabled:t[`build-caching-enabled`],build_command:d(t[`build-command`],`build-command`,`text`),build_token_uuid:d(t[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(t[`deploy-command`],`deploy-command`,`text`),path_excludes:t[`path-excludes`],path_includes:t[`path-includes`],root_directory:d(t[`root-directory`],`root-directory`,`text`),trigger_name:d(t[`trigger-name`],`trigger-name`,`text`)});c(await u(`Updating`,async()=>n.workersBuilds.triggers.update({...p,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Updated`})}},de={command:`triggers`,describe:`Operations for triggers`,builder:e=>e.command(q).command(G).command(Y).command($).command(ce).command(ue).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`workers-builds`,describe:`Automated build and deployment pipeline for Workers — track builds, logs, and repo connections`,builder:e=>e.command(w).command(E).command(O).command(S).command(L).command(U).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{fe as default};
|
package/dist/zaraz-xYSWIV4P.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{D as e,S as t,i as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./cli-types-CRIDdDw3.mjs";function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Gets latest Zaraz configuration for a zone. It can be preview or published configuration, whichever was the last updated. Secret variables values will not be included.`,builder:d,handler:async e=>{if(e.dryRun){s({command:`cf zaraz config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.config.get({zone_id:i})),{successLabel:`Loaded`})}};function p(e){return e.option(`analytics-default-purpose`,{type:`string`,description:`Consent purpose assigned to Monitoring.`}).option(`analytics-enabled`,{type:`boolean`,description:`Whether Advanced Monitoring reports are enabled.`}).option(`analytics-session-exp-time`,{type:`number`,description:`Session expiration time (seconds).`}).option(`consent-company-email`,{type:`string`,description:`The consent.companyEmail field`}).option(`consent-company-name`,{type:`string`,description:`The consent.companyName field`}).option(`consent-company-street-address`,{type:`string`,description:`The consent.companyStreetAddress field`}).option(`consent-consent-modal-intro-html`,{type:`string`,description:`The consent.consentModalIntroHTML field`}).option(`consent-cookie-name`,{type:`string`,description:`The consent.cookieName field`}).option(`consent-custom-css`,{type:`string`,description:`The consent.customCSS field`}).option(`consent-custom-intro-disclaimer-dismissed`,{type:`boolean`,description:`The consent.customIntroDisclaimerDismissed field`}).option(`consent-default-language`,{type:`string`,description:`The consent.defaultLanguage field`}).option(`consent-enabled`,{type:`boolean`,description:`The consent.enabled field`}).option(`consent-hide-modal`,{type:`boolean`,description:`The consent.hideModal field`}).option(`consent-tcf-compliant`,{type:`boolean`,description:`The consent.tcfCompliant field`}).option(`data-layer`,{type:`boolean`,description:`Data layer compatibility mode enabled.`}).option(`debug-key`,{type:`string`,description:`The key for Zaraz debug mode.`}).option(`history-change`,{type:`boolean`,description:`Single Page Application support enabled.`}).option(`settings-auto-inject-script`,{type:`boolean`,description:`Automatic injection of Zaraz scripts enabled.`}).option(`settings-context-enricher-escaped-worker-name`,{type:`string`,description:`The settings.contextEnricher.escapedWorkerName field`}).option(`settings-context-enricher-worker-tag`,{type:`string`,description:`The settings.contextEnricher.workerTag field`}).option(`settings-cookie-domain`,{type:`string`,description:`The domain Zaraz will use for writing and reading its cookies.`}).option(`settings-ecommerce`,{type:`boolean`,description:`Ecommerce API enabled.`}).option(`settings-events-api-path`,{type:`string`,description:`Custom endpoint for server-side track events.`}).option(`settings-hide-external-referer`,{type:`boolean`,description:`Hiding external referrer URL enabled.`}).option(`settings-hide-ipaddress`,{type:`boolean`,description:`Trimming IP address enabled.`}).option(`settings-hide-query-params`,{type:`boolean`,description:`Removing URL query params enabled.`}).option(`settings-hide-user-agent`,{type:`boolean`,description:`Removing sensitive data from User Agent string enabled.`}).option(`settings-init-path`,{type:`string`,description:`Custom endpoint for Zaraz init script.`}).option(`settings-inject-iframes`,{type:`boolean`,description:`Injection of Zaraz scripts into iframes enabled.`}).option(`settings-mc-root-path`,{type:`string`,description:`Custom path for Managed Components server functionalities.`}).option(`settings-script-path`,{type:`string`,description:`Custom endpoint for Zaraz main script.`}).option(`settings-track-path`,{type:`string`,description:`Custom endpoint for Zaraz tracking requests.`}).option(`zaraz-version`,{type:`number`,description:`Zaraz internal version of the config.`}).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)`}).check(e=>{if([`consent-company-email`,`consent-company-name`,`consent-company-street-address`,`consent-consent-modal-intro-html`,`consent-cookie-name`,`consent-custom-css`,`consent-custom-intro-disclaimer-dismissed`,`consent-default-language`,`consent-enabled`,`consent-hide-modal`,`consent-tcf-compliant`].some(t=>e[t]!==void 0)){let t=[`consent-enabled`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --consent-* flag is set`)}return!0})}const m={command:`update`,describe:`Updates Zaraz configuration for a zone.`,builder:p,handler:async n=>{if(n.dryRun){s({command:`cf zaraz config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/settings/zaraz/config`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({analytics:{defaultPurpose:l(n[`analytics-default-purpose`],`analytics-default-purpose`,`text`),enabled:n[`analytics-enabled`],sessionExpTime:n[`analytics-session-exp-time`]},consent:{companyEmail:l(n[`consent-company-email`],`consent-company-email`,`text`),companyName:l(n[`consent-company-name`],`consent-company-name`,`text`),companyStreetAddress:l(n[`consent-company-street-address`],`consent-company-street-address`,`text`),consentModalIntroHTML:l(n[`consent-consent-modal-intro-html`],`consent-consent-modal-intro-html`,`text`),cookieName:l(n[`consent-cookie-name`],`consent-cookie-name`,`text`),customCSS:l(n[`consent-custom-css`],`consent-custom-css`,`text`),customIntroDisclaimerDismissed:n[`consent-custom-intro-disclaimer-dismissed`],defaultLanguage:l(n[`consent-default-language`],`consent-default-language`,`text`),enabled:n[`consent-enabled`],hideModal:n[`consent-hide-modal`],tcfCompliant:n[`consent-tcf-compliant`]},dataLayer:n[`data-layer`],debugKey:l(n[`debug-key`],`debug-key`,`text`),historyChange:n[`history-change`],settings:{autoInjectScript:n[`settings-auto-inject-script`],contextEnricher:{escapedWorkerName:l(n[`settings-context-enricher-escaped-worker-name`],`settings-context-enricher-escaped-worker-name`,`text`),workerTag:l(n[`settings-context-enricher-worker-tag`],`settings-context-enricher-worker-tag`,`text`)},cookieDomain:l(n[`settings-cookie-domain`],`settings-cookie-domain`,`text`),ecommerce:n[`settings-ecommerce`],eventsApiPath:l(n[`settings-events-api-path`],`settings-events-api-path`,`text`),hideExternalReferer:n[`settings-hide-external-referer`],hideIPAddress:n[`settings-hide-ipaddress`],hideQueryParams:n[`settings-hide-query-params`],hideUserAgent:n[`settings-hide-user-agent`],initPath:l(n[`settings-init-path`],`settings-init-path`,`text`),injectIframes:n[`settings-inject-iframes`],mcRootPath:l(n[`settings-mc-root-path`],`settings-mc-root-path`,`text`),scriptPath:l(n[`settings-script-path`],`settings-script-path`,`text`),trackPath:l(n[`settings-track-path`],`settings-track-path`,`text`)},zarazVersion:n[`zaraz-version`]}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.zaraz.config.update({...e,zone_id:d})),{successLabel:`Updated`});return}if(n[`data-layer`]===void 0)throw Error(`--data-layer is required (or pass --body with this field set).`);if(n[`debug-key`]===void 0&&(n[`debug-key`]=await e(`debug-key`,`The key for Zaraz debug mode.`)),n[`settings-auto-inject-script`]===void 0)throw Error(`--settings-auto-inject-script is required (or pass --body with this field set).`);if(n[`settings-context-enricher-escaped-worker-name`]===void 0&&(n[`settings-context-enricher-escaped-worker-name`]=await e(`settings-context-enricher-escaped-worker-name`,`The settings.contextEnricher.escapedWorkerName field`)),n[`settings-context-enricher-worker-tag`]===void 0&&(n[`settings-context-enricher-worker-tag`]=await e(`settings-context-enricher-worker-tag`,`The settings.contextEnricher.workerTag field`)),n[`zaraz-version`]===void 0)throw Error(`--zaraz-version is required (or pass --body with this field set).`);let f=a({analytics:{defaultPurpose:l(n[`analytics-default-purpose`],`analytics-default-purpose`,`text`),enabled:n[`analytics-enabled`],sessionExpTime:n[`analytics-session-exp-time`]},consent:{companyEmail:l(n[`consent-company-email`],`consent-company-email`,`text`),companyName:l(n[`consent-company-name`],`consent-company-name`,`text`),companyStreetAddress:l(n[`consent-company-street-address`],`consent-company-street-address`,`text`),consentModalIntroHTML:l(n[`consent-consent-modal-intro-html`],`consent-consent-modal-intro-html`,`text`),cookieName:l(n[`consent-cookie-name`],`consent-cookie-name`,`text`),customCSS:l(n[`consent-custom-css`],`consent-custom-css`,`text`),customIntroDisclaimerDismissed:n[`consent-custom-intro-disclaimer-dismissed`],defaultLanguage:l(n[`consent-default-language`],`consent-default-language`,`text`),enabled:n[`consent-enabled`],hideModal:n[`consent-hide-modal`],tcfCompliant:n[`consent-tcf-compliant`]},dataLayer:n[`data-layer`],debugKey:l(n[`debug-key`],`debug-key`,`text`),historyChange:n[`history-change`],settings:{autoInjectScript:n[`settings-auto-inject-script`],contextEnricher:{escapedWorkerName:l(n[`settings-context-enricher-escaped-worker-name`],`settings-context-enricher-escaped-worker-name`,`text`),workerTag:l(n[`settings-context-enricher-worker-tag`],`settings-context-enricher-worker-tag`,`text`)},cookieDomain:l(n[`settings-cookie-domain`],`settings-cookie-domain`,`text`),ecommerce:n[`settings-ecommerce`],eventsApiPath:l(n[`settings-events-api-path`],`settings-events-api-path`,`text`),hideExternalReferer:n[`settings-hide-external-referer`],hideIPAddress:n[`settings-hide-ipaddress`],hideQueryParams:n[`settings-hide-query-params`],hideUserAgent:n[`settings-hide-user-agent`],initPath:l(n[`settings-init-path`],`settings-init-path`,`text`),injectIframes:n[`settings-inject-iframes`],mcRootPath:l(n[`settings-mc-root-path`],`settings-mc-root-path`,`text`),scriptPath:l(n[`settings-script-path`],`settings-script-path`,`text`),trackPath:l(n[`settings-track-path`],`settings-track-path`,`text`)},zarazVersion:n[`zaraz-version`]});o(await c(`Updating`,async()=>u.zaraz.config.update({...f,zone_id:d})),{successLabel:`Updated`})}},h={command:`config`,describe:`Full Zaraz configuration including tools, triggers, and variables for the zone`,builder:e=>e.command(f).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Gets default Zaraz configuration for a zone.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf zaraz default get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/default`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.default.get({zone_id:i})),{successLabel:`Loaded`})}},v={command:`default`,describe:`Default Zaraz configuration template used as a starting point for new zones`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Exports full current published Zaraz configuration for a zone, secret variables included.`,builder:y,handler:async e=>{if(e.dryRun){s({command:`cf zaraz export get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/export`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.export.get({zone_id:i})),{successLabel:`Loaded`})}},x={command:`export`,describe:`Export the current Zaraz configuration as a portable JSON document`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`ids`,{type:`string`,description:`Comma separated list of Zaraz configuration IDs.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Gets a history of published Zaraz configurations by ID(s) for a zone.`,builder:u(S),handler:async e=>{let n={ids:e.ids};if(e.dryRun){s({command:`cf zaraz history configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/history/configs`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.zaraz.history.configs.get({zone_id:a,...n})),{successLabel:`Loaded`})}},w={command:`configs`,describe:`Configuration version history — browse and restore previous Zaraz configurations`,builder:e=>e.command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.option(`offset`,{type:`number`,description:`Ordinal number to start listing the results with. Default value is 0.`}).option(`limit`,{type:`number`,description:`Maximum amount of results to list. Default value is 10.`}).option(`sort-field`,{type:`string`,description:`The field to sort by. Default is updated_at.`,choices:[`id`,`user_id`,`description`,`created_at`,`updated_at`]}).option(`sort-order`,{type:`string`,description:`Sorting order. Default is DESC.`,choices:[`DESC`,`ASC`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Lists a history of published Zaraz configuration records for a zone.`,builder:u(T),handler:async e=>{let n={offset:e.offset,limit:e.limit,sortField:e[`sort-field`],sortOrder:e[`sort-order`]};if(e.dryRun){s({command:`cf zaraz history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/history`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.zaraz.history.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function D(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`ID of the Zaraz configuration to restore.`})}const O={command:`update`,describe:`Restores a historical published Zaraz configuration by ID for a zone.`,builder:D,handler:async e=>{if(e.dryRun){s({command:`cf zaraz history update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/history`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let a=await r(e),l=await t({zone:e.zone},a,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);o(await c(`Updating`,async()=>a.zaraz.history.update({body:t,zone_id:l})),{successLabel:`Updated`});return}o(await c(`Updating`,async()=>n(a,`PUT`,`/zones/${e.zoneId}/settings/zaraz/history`)),{successLabel:`Updated`})}},k={command:`history`,describe:`Configuration version history — browse and restore previous Zaraz configurations`,builder:e=>e.command(E).command(O).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Zaraz configuration description.`})}const j={command:`create`,describe:`Publish current Zaraz preview configuration for a zone.`,builder:A,handler:async e=>{if(e.dryRun){s({command:`cf zaraz publish create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/publish`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let a=await r(e),l=await t({zone:e.zone},a,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);o(await c(`Creating`,async()=>a.zaraz.publish.create({body:t,zone_id:l})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>n(a,`POST`,`/zones/${e.zoneId}/settings/zaraz/publish`)),{successLabel:`Created`})}},M={command:`publish`,describe:`Publish pending Zaraz configuration changes to make them live on the zone`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Zaraz workflow.`})}const P={command:`update`,describe:`Updates Zaraz workflow for a zone.`,builder:N,handler:async e=>{if(e.dryRun){s({command:`cf zaraz update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/workflow`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let n=await r(e),a=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=a,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.zaraz.update({body:t,zone_id:a})),{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 F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get`,describe:`Gets Zaraz workflow for a zone.`,builder:F,handler:async e=>{if(e.dryRun){s({command:`cf zaraz workflow get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/workflow`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.workflow.get({zone_id:i})),{successLabel:`Loaded`})}},L={command:`workflow`,describe:`Workflow state for Zaraz configuration changes (draft vs. published)`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`zaraz`,describe:`Server-side tag manager — load third-party tools (analytics, pixels, etc.) from Cloudflare's edge without client-side JS`,builder:e=>e.command(P).command(h).command(v).command(x).command(k).command(M).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{R as default};
|