cf 0.6.0 → 0.7.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.
Files changed (299) hide show
  1. package/dist/_meta/agent-context.json +78 -41
  2. package/dist/_meta/commands.json +19888 -21071
  3. package/dist/_meta/schemas.json +14305 -15328
  4. package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
  5. package/dist/account-D8mYiWxQ.mjs +2 -0
  6. package/dist/accounts-CJci1Oez.mjs +23 -0
  7. package/dist/acm-CmCd985Q.mjs +3 -0
  8. package/dist/addressing-R7p6TRBe.mjs +12 -0
  9. package/dist/{agent-context-CKb6w43K.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
  10. package/dist/ai-BzJg0RIX.mjs +3 -0
  11. package/dist/ai-audit-B0vJNOZG.mjs +2 -0
  12. package/dist/ai-gateway-D3vJR3My.mjs +10 -0
  13. package/dist/ai-search-CNg7W7U4.mjs +7 -0
  14. package/dist/alerting-_sdM0B0S.mjs +6 -0
  15. package/dist/alerts-dpT6Qsdu.mjs +2 -0
  16. package/dist/{analytics-CwFrx-Dr.mjs → analytics-BFBJhDrP.mjs} +1 -1
  17. package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
  18. package/dist/{api-gateway-D9PMVVqL.mjs → api-gateway-D4AIEtUq.mjs} +10 -10
  19. package/dist/argo-Bjk6nFfs.mjs +2 -0
  20. package/dist/artifacts-Ba4b3iOa.mjs +4 -0
  21. package/dist/{audit-logs-BvQ9uwuy.mjs → audit-logs-BE0T5All.mjs} +1 -1
  22. package/dist/{auth-DX9KnJ0P.mjs → auth-CZ0E51rF.mjs} +3 -3
  23. package/dist/auth-D_zyQbDR.mjs +5 -0
  24. package/dist/autorag-Cnpp8PAG.mjs +2 -0
  25. package/dist/billing-Dz6Zj8Eq.mjs +2 -0
  26. package/dist/bot-management-pFwIbFi-.mjs +5 -0
  27. package/dist/botnet-feed-BY9uGChY.mjs +3 -0
  28. package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
  29. package/dist/brands-CGpk9nZB.mjs +2 -0
  30. package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
  31. package/dist/browser-run-DhHtz4y3.mjs +4 -0
  32. package/dist/build-CWuStmDi.mjs +2 -0
  33. package/dist/{cache-CeN5t6_W.mjs → cache-DVhkiIGK.mjs} +4 -4
  34. package/dist/calls-95zjvIcO.mjs +4 -0
  35. package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
  36. package/dist/cf-BLT7uKJF.mjs +18 -0
  37. package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
  38. package/dist/clear-DXx8WBAN.mjs +2 -0
  39. package/dist/client-certificates-D6mE4vJu.mjs +3 -0
  40. package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
  41. package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
  42. package/dist/{completions-Bvzav4Mj.mjs → completions-DMc_PlIw.mjs} +2 -2
  43. package/dist/connectivity-DJkE3crz.mjs +3 -0
  44. package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
  45. package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
  46. package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
  47. package/dist/connectors-zWaZTi2A.mjs +3 -0
  48. package/dist/content-scanning-CGvGf04y.mjs +4 -0
  49. package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
  50. package/dist/{custom-certificates-CfRj7QZb.mjs → custom-certificates-CWUrPYLP.mjs} +4 -4
  51. package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
  52. package/dist/{custom-hostnames-CcK7_17e.mjs → custom-hostnames-CVQSksqq.mjs} +4 -4
  53. package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
  54. package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
  55. package/dist/d1-78Ym1P6D.mjs +4 -0
  56. package/dist/data-security-zmFoMwRU.mjs +6 -0
  57. package/dist/{dcv-delegation-BYsNl3qc.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
  58. package/dist/{deploy-BzlPv3ro.mjs → deploy-CVvkZFjR.mjs} +1 -1
  59. package/dist/{dev-IOg-_s5_.mjs → dev-DSslyDXx.mjs} +1 -1
  60. package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
  61. package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
  62. package/dist/dist-BH-4NQOV.mjs +134 -0
  63. package/dist/dns-D7VAaCyO.mjs +29 -0
  64. package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
  65. package/dist/domain-info-CRvKc2Lg.mjs +2 -0
  66. package/dist/durable-objects-BIpvyu9m.mjs +2 -0
  67. package/dist/email-auth-Cx--s8W4.mjs +2 -0
  68. package/dist/email-routing-CiDbivcN.mjs +10 -0
  69. package/dist/email-security-BYeAuSc6.mjs +12 -0
  70. package/dist/email-sending-Dg2rSmHH.mjs +4 -0
  71. package/dist/{filters-DKs-wEzt.mjs → filters-DZ8YnQ90.mjs} +3 -3
  72. package/dist/firewall-DEd1hs_I.mjs +11 -0
  73. package/dist/flagship-DVw7xGoP.mjs +4 -0
  74. package/dist/{fraud-D8WmLKyH.mjs → fraud-BbGS3FZs.mjs} +2 -2
  75. package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
  76. package/dist/{healthchecks-BBtW8vRh.mjs → healthchecks-Da9N3ix4.mjs} +3 -3
  77. package/dist/{hostnames-Bh2IFxIw.mjs → hostnames-mimZu2tB.mjs} +2 -2
  78. package/dist/hyperdrive-BNdvxOos.mjs +21 -0
  79. package/dist/iam-DGQ-OgRl.mjs +6 -0
  80. package/dist/images-CI6Iy9ho.mjs +7 -0
  81. package/dist/index.mjs +1 -1
  82. package/dist/intel-BDB-aRtU.mjs +3 -0
  83. package/dist/internal-Czlp5Ekb.mjs +2 -0
  84. package/dist/{ips-BE7JbAnc.mjs → ips-B9UuPvsY.mjs} +1 -1
  85. package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
  86. package/dist/kv-BHerx4dZ.mjs +5 -0
  87. package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
  88. package/dist/live-Ce7dZW7p.mjs +2 -0
  89. package/dist/load-balancers-DSjS5WKw.mjs +6 -0
  90. package/dist/logexplorer-DBIfTlRP.mjs +24 -0
  91. package/dist/logo-matches-C00iGpzW.mjs +2 -0
  92. package/dist/logos-CJLhx1go.mjs +3 -0
  93. package/dist/logpush-Cr1U-eK-.mjs +5 -0
  94. package/dist/logs-DMvtchc6.mjs +3 -0
  95. package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
  96. package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
  97. package/dist/magic-transit-DiKiPUax.mjs +110 -0
  98. package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
  99. package/dist/matches-B0yHbQ2I.mjs +2 -0
  100. package/dist/moq-UgBawOXe.mjs +13 -0
  101. package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
  102. package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
  103. package/dist/oauth-DBJ5GSFk.mjs +40 -0
  104. package/dist/observability-B-1y36QS.mjs +4 -0
  105. package/dist/organization-Dq3PClZ7.mjs +41 -0
  106. package/dist/organizations-AhsQkHyX.mjs +2 -0
  107. package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
  108. package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
  109. package/dist/{origin-tls-client-auth-B30_2_dO.mjs → origin-tls-client-auth-BDw5q-6G.mjs} +3 -3
  110. package/dist/{page-rules-zQJGmTCd.mjs → page-rules-DqYQ23eg.mjs} +5 -5
  111. package/dist/{page-shield-CxQk5k9X.mjs → page-shield-DKdlZOLO.mjs} +5 -5
  112. package/dist/pages-BsXF11Kv.mjs +11 -0
  113. package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
  114. package/dist/pipelines-D_QhSnGW.mjs +6 -0
  115. package/dist/progress-O88q63Bk.mjs +2 -0
  116. package/dist/{prompt-q3B7sM2A.mjs → prompt-DTAWiEm2.mjs} +1 -1
  117. package/dist/queries-CAE95-OH.mjs +3 -0
  118. package/dist/queues-BBz35Mqd.mjs +6 -0
  119. package/dist/r2-Zp99S5xF.mjs +21 -0
  120. package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
  121. package/dist/radar-Cij-XVQJ.mjs +2 -0
  122. package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
  123. package/dist/rate-limits-DSdToIWv.mjs +5 -0
  124. package/dist/raw-fetch-DgezeshQ.mjs +2 -0
  125. package/dist/ready-DMpJvyaz.mjs +2 -0
  126. package/dist/realtime-kit-9rJcapfM.mjs +18 -0
  127. package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
  128. package/dist/refute-BGTpr5sy.mjs +2 -0
  129. package/dist/registrar-CXViZlah.mjs +83 -0
  130. package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
  131. package/dist/request-tracers-DATfBnE9.mjs +2 -0
  132. package/dist/{resolve-DGD57PFH.mjs → resolve-Bs2sMRYS.mjs} +1 -1
  133. package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
  134. package/dist/resource-tagging-BTn05AOj.mjs +16 -0
  135. package/dist/rules-ens3OHme.mjs +4 -0
  136. package/dist/rulesets-bkreZRao.mjs +8 -0
  137. package/dist/rum-CpgXFcwl.mjs +4 -0
  138. package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
  139. package/dist/scan-page-BqoQTk3R.mjs +2 -0
  140. package/dist/{schema-D8o6HcCr.mjs → schema-DCF4yEp_.mjs} +1 -1
  141. package/dist/{schema-validation-BWNDnnIT.mjs → schema-validation-Ca6o94ts.mjs} +5 -5
  142. package/dist/scim-C4oT8TMc.mjs +4 -0
  143. package/dist/sdk-pQ5kaGUX.mjs +3 -0
  144. package/dist/search-C4T5riPh.mjs +2 -0
  145. package/dist/secrets-store-CWEuiDNo.mjs +7 -0
  146. package/dist/security-center-BOvm7xy6.mjs +2 -0
  147. package/dist/{security-txt-CVpmJo29.mjs → security-txt-BCAUBctN.mjs} +2 -2
  148. package/dist/session-B1ARgLG7.mjs +2 -0
  149. package/dist/share-DhmVspmL.mjs +5 -0
  150. package/dist/{shared-DQI8NGja.mjs → shared-Bod3-Exx.mjs} +332 -332
  151. package/dist/signed-url-DA509wgp.mjs +2 -0
  152. package/dist/{smart-shield-BreBC1Ap.mjs → smart-shield-DZm4fn6z.mjs} +2 -2
  153. package/dist/{snippets-BAJoWMSJ.mjs → snippets-oQ0u26-z.mjs} +3 -3
  154. package/dist/{spawn-pmGERpdB.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
  155. package/dist/{spectrum-DnIRLY95.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
  156. package/dist/speed-DqNnvLBD.mjs +4 -0
  157. package/dist/{src-BQ1dr9xR.mjs → src-By-zTCHz.mjs} +9 -9
  158. package/dist/ssl-tS3CYZsZ.mjs +15 -0
  159. package/dist/state-OsdDJvdj.mjs +2 -0
  160. package/dist/stream-Bud9Os5V.mjs +14 -0
  161. package/dist/submission-info-DfIXmu-M.mjs +2 -0
  162. package/dist/submit-BtP8she2.mjs +2 -0
  163. package/dist/tenant-CMwHa-tU.mjs +2 -0
  164. package/dist/{token-validation-DUvtXWur.mjs → token-validation-BYC7HTok.mjs} +5 -5
  165. package/dist/{tools-CQtA5-cr.mjs → tools-Dru4l8yh.mjs} +1 -1
  166. package/dist/total-queries-DdLBNJzd.mjs +2 -0
  167. package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
  168. package/dist/turnstile-CP4nScaL.mjs +23 -0
  169. package/dist/{ui-BrNwNHX9.mjs → ui-BNoF0KpD.mjs} +2 -2
  170. package/dist/url-info-Chs9h7Y-.mjs +2 -0
  171. package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
  172. package/dist/url-scanner-D4pYNlO-.mjs +2 -0
  173. package/dist/user-DtefniLc.mjs +11 -0
  174. package/dist/vectorize-BeAY2g-7.mjs +4 -0
  175. package/dist/verify-D7J3F_NZ.mjs +2 -0
  176. package/dist/{versions-NUXxCr0s.mjs → versions-dMW3bLVv.mjs} +1 -1
  177. package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
  178. package/dist/{web3-n3GW50u-.mjs → web3-Dhw79l4S.mjs} +3 -3
  179. package/dist/workers-builds-CuOAB3u4.mjs +7 -0
  180. package/dist/workers-l3zMNOU6.mjs +20 -0
  181. package/dist/workflows-rb7RYBKP.mjs +6 -0
  182. package/dist/{zaraz-9l7KuLqh.mjs → zaraz-CHecMYuo.mjs} +1 -1
  183. package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
  184. package/dist/zone-BnnqJwW-.mjs +2 -0
  185. package/dist/zones-DpI2YikF.mjs +21 -0
  186. package/package.json +1 -1
  187. package/dist/abuse-reports-DUs4SKVx.mjs +0 -8
  188. package/dist/accounts-BIY8wNGA.mjs +0 -22
  189. package/dist/acm-SqcV8o5o.mjs +0 -3
  190. package/dist/addressing-CygRm0pN.mjs +0 -12
  191. package/dist/ai-BAmEAjN3.mjs +0 -2
  192. package/dist/ai-gateway-BENwPvvB.mjs +0 -8
  193. package/dist/ai-search-Bv_Whw3E.mjs +0 -7
  194. package/dist/ai_gateway-C6WP9oBH.mjs +0 -4
  195. package/dist/alerting-D_qWrsoY.mjs +0 -6
  196. package/dist/analytics_engine-BjV6XLyG.mjs +0 -2
  197. package/dist/argo-DwYGbyld.mjs +0 -2
  198. package/dist/artifacts-DKAjY_n4.mjs +0 -4
  199. package/dist/auth-TYwGydWg.mjs +0 -5
  200. package/dist/billing-CRTlRU88.mjs +0 -2
  201. package/dist/bot-management-DgW--8wM.mjs +0 -5
  202. package/dist/botnet-feed-CIX6ZORT.mjs +0 -3
  203. package/dist/brand-protection-ZikBtl0y.mjs +0 -3
  204. package/dist/browser-rendering-D_ZQVWn8.mjs +0 -4
  205. package/dist/build-Bgw8TV1p.mjs +0 -134
  206. package/dist/calls-Cv0ieVg4.mjs +0 -4
  207. package/dist/certificate-authorities-BzZnWCac.mjs +0 -2
  208. package/dist/client-certificates-BFuzeBrj.mjs +0 -3
  209. package/dist/cloud-connector-D5h8Dzzg.mjs +0 -2
  210. package/dist/cloudforce-one-aqDCIBMp.mjs +0 -21
  211. package/dist/config-B5k-XbwS.mjs +0 -2
  212. package/dist/connectivity-CjkXmEhO.mjs +0 -3
  213. package/dist/connector-interrupts-B7eSface.mjs +0 -2
  214. package/dist/connector-telemetry-events-F3Co8HUf.mjs +0 -2
  215. package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +0 -2
  216. package/dist/connectors-YYu_Vx3H.mjs +0 -3
  217. package/dist/content-scanning-BorfRGKT.mjs +0 -4
  218. package/dist/context-C-WbewL6.mjs +0 -2
  219. package/dist/custom-nameservers-BkKx0THn.mjs +0 -3
  220. package/dist/custom-pages-DamGVA75.mjs +0 -4
  221. package/dist/d1-sK0O5THv.mjs +0 -4
  222. package/dist/data-security-DsWpoWiS.mjs +0 -6
  223. package/dist/diagnostics-CH7T2WR3.mjs +0 -3
  224. package/dist/dispatch-namespaces-Bgj9XCRx.mjs +0 -7
  225. package/dist/dist-C6zxsVdY.mjs +0 -306
  226. package/dist/dns-firewall-VmQf3UVP.mjs +0 -57
  227. package/dist/dns-o7hUPMCG.mjs +0 -29
  228. package/dist/durable-objects-DgrTbvoF.mjs +0 -2
  229. package/dist/email-routing-owCvAEpf.mjs +0 -10
  230. package/dist/email-security-Dng3DVuf.mjs +0 -8
  231. package/dist/email-sending-bExMH4lu.mjs +0 -3
  232. package/dist/firewall-BLaTtX3r.mjs +0 -11
  233. package/dist/google-tag-gateway-DyCY43k0.mjs +0 -2
  234. package/dist/hyperdrive-DJm1eD-M.mjs +0 -18
  235. package/dist/iam-apCCcy7R.mjs +0 -6
  236. package/dist/images-Cxe45OHm.mjs +0 -7
  237. package/dist/intel-8V4h6H46.mjs +0 -3
  238. package/dist/keyless-certificates-CfJmXccT.mjs +0 -3
  239. package/dist/kv-Dz6then8.mjs +0 -5
  240. package/dist/leaked-credential-checks-BJ-zQMlx.mjs +0 -3
  241. package/dist/load-balancers-ilsGgudX.mjs +0 -6
  242. package/dist/logpush-BH14TtuA.mjs +0 -4
  243. package/dist/logs-B8-mkf_I.mjs +0 -3
  244. package/dist/magic-cloud-networking-DylCXoG4.mjs +0 -5
  245. package/dist/magic-network-monitoring-DnyrZy77.mjs +0 -4
  246. package/dist/magic-transit-B-kU5e3s.mjs +0 -89
  247. package/dist/managed-transforms-GC9Pq5dg.mjs +0 -3
  248. package/dist/mtls-certificates-BRlhWw_G.mjs +0 -3
  249. package/dist/network-interconnects-DuyoFD9_.mjs +0 -36
  250. package/dist/oauth-B5k80sip.mjs +0 -61
  251. package/dist/observability-9APhqFHo.mjs +0 -4
  252. package/dist/organizations-Dy3kiV_z.mjs +0 -41
  253. package/dist/origin-ca-certificates-2rwPoQdG.mjs +0 -3
  254. package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +0 -2
  255. package/dist/pages-5DKLs7CQ.mjs +0 -11
  256. package/dist/pipelines-DfGE44xo.mjs +0 -6
  257. package/dist/progress-CL8I-7YK.mjs +0 -2
  258. package/dist/queues-BoenUGIw.mjs +0 -6
  259. package/dist/r2-Cq_JCjK0.mjs +0 -21
  260. package/dist/r2-data-catalog-eLxltWdO.mjs +0 -14
  261. package/dist/radar-YNOCio6T.mjs +0 -2
  262. package/dist/rate-limits-CcAF3tMl.mjs +0 -5
  263. package/dist/raw-fetch-bIXC9D1m.mjs +0 -2
  264. package/dist/realtime-kit-4bCGviO5.mjs +0 -18
  265. package/dist/registrar-CfHlaOOf.mjs +0 -46
  266. package/dist/request-tracers-DlHawg5l.mjs +0 -2
  267. package/dist/resource-sharing-7FhuboJE.mjs +0 -5
  268. package/dist/resource-tagging-divcugVb.mjs +0 -16
  269. package/dist/rules-CAXkege8.mjs +0 -4
  270. package/dist/rulesets-CBsdc8IV.mjs +0 -8
  271. package/dist/rum-D0hHPNl9.mjs +0 -4
  272. package/dist/scim-CWLli4fi.mjs +0 -3
  273. package/dist/sdk-DhIhH6GB.mjs +0 -5
  274. package/dist/secrets-store-B7_HkE8I.mjs +0 -25
  275. package/dist/security-center-BQT21oiM.mjs +0 -2
  276. package/dist/session-B8r8LNQN.mjs +0 -93
  277. package/dist/speed-UYEVue28.mjs +0 -4
  278. package/dist/ssl-D3Pixs8M.mjs +0 -15
  279. package/dist/stream-BUsuOfQh.mjs +0 -14
  280. package/dist/tenants-BdWJTtcg.mjs +0 -2
  281. package/dist/turnstile-CAKVnS1L.mjs +0 -23
  282. package/dist/url-normalization-DA-RAxs4.mjs +0 -3
  283. package/dist/url-scanner-DmYu43f7.mjs +0 -2
  284. package/dist/user-Bah4wGGN.mjs +0 -10
  285. package/dist/vectorize-DhvVG2By.mjs +0 -4
  286. package/dist/waiting-rooms-DoOkT4Mu.mjs +0 -11
  287. package/dist/workers-D6IaQ_F0.mjs +0 -18
  288. package/dist/workers-builds-DYi0OMMU.mjs +0 -7
  289. package/dist/workflows-DrdXUQ2g.mjs +0 -4
  290. package/dist/zero-trust-D6V9GH2W.mjs +0 -118
  291. package/dist/zero_trust-BzXKAX_x.mjs +0 -3
  292. package/dist/zones-0MTkuaFk.mjs +0 -21
  293. /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
  294. /package/dist/{cli-types-DGgEbf8K.mjs → cli-types-CFw6Xygp.mjs} +0 -0
  295. /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
  296. /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
  297. /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
  298. /package/dist/{metadata-MPDDi08e.mjs → metadata-Cnyws6iO.mjs} +0 -0
  299. /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{i as n,n as r}from"./auth-DX9KnJ0P.mjs";import{n as i,r as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-CL8I-7YK.mjs";import{n as u,t as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";import{r as p,t as m}from"./prompt-q3B7sM2A.mjs";import{t as h}from"./cli-types-DGgEbf8K.mjs";import{n as g,t as _}from"./raw-fetch-bIXC9D1m.mjs";function ee(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`url`,{type:`string`,description:"An audio track URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`copy <identifier>`,describe:`Adds an additional audio track to a video using the provided audio track URL.`,builder:ee,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/copy`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?o({label:u(n.label,`label`,`text`),url:u(n.url,`url`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.audioTracks.copy({...e,account_id:d,identifier:n.identifier})),{successLabel:`Created`});return}n.label===void 0&&(n.label=await p(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let m=o({label:u(n.label,`label`,`text`),url:u(n.url,`url`,`text`)});s(await l(`Creating`,async()=>a.stream.audioTracks.copy({...m,account_id:d,identifier:n.identifier})),{successLabel:`Created`})}};function v(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const y={command:`delete <audio-identifier>`,describe:`Deletes additional audio tracks on a video. Deleting a default audio track is not allowed. You must assign another audio track as default prior to deletion.`,builder:v,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/${n[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(n[`audio-identifier`]))}`,pathParams:{identifier:String(n.identifier??``),"audio-identifier":String(n[`audio-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}s(await l(`Deleting`,async()=>i.stream.audioTracks.delete({account_id:a,identifier:n.identifier,audio_identifier:n[`audio-identifier`]})),{successLabel:`Deleted`})}};function b(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`default`,{type:`boolean`,description:`Denotes whether the audio track will be played by default in a player.`}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`edit <audio-identifier>`,describe:"Edits additional audio tracks on a video. Editing the default status of an audio track to `true` will mark all other audio tracks on the video default status to `false`.",builder:b,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio/${n[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(n[`audio-identifier`]))}`,pathParams:{identifier:String(n.identifier??``),"audio-identifier":String(n[`audio-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({default:n.default,label:u(n.label,`label`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.audioTracks.edit({...e,account_id:d,identifier:n.identifier,audio_identifier:n[`audio-identifier`]})),{successLabel:`Updated`});return}let p=o({default:n.default,label:u(n.label,`label`,`text`)});s(await l(`Updating`,async()=>a.stream.audioTracks.edit({...p,account_id:d,identifier:n.identifier,audio_identifier:n[`audio-identifier`]})),{successLabel:`Updated`})}};function S(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <identifier>`,describe:`Lists additional audio tracks on a video. Note this API will not return information for audio attached to the video upload.`,builder:S,handler:async n=>{if(n.dryRun){c({command:`cf stream audio-tracks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/audio`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.audioTracks.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}},w={command:`audio-tracks`,describe:`Operations for audio-tracks`,builder:e=>e.command(te).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:T,handler:async n=>{if(n.dryRun){c({command:`cf stream captions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.captions.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}};function D(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:D,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}/generate`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.captions.language.create({account_id:a,identifier:n.identifier,language:n.language})),{successLabel:`Created`})}};function k(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const A={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:k,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
4
- `);return}s(await l(`Deleting`,async()=>i.stream.captions.language.delete({account_id:a,identifier:n.identifier,language:n.language})),{successLabel:`Deleted`})}};function j(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:j,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.captions.language.get({account_id:a,identifier:n.identifier,language:n.language})),{successLabel:`Loaded`})}};function N(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const P={command:`update <language>`,describe:`Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed.`,builder:N,handler:async i=>{if(i.dryRun){c({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${i.identifier==null?`<identifier>`:encodeURIComponent(String(i.identifier))}/captions/${i.language==null?`<language>`:encodeURIComponent(String(i.language))}`,pathParams:{language:String(i.language??``),identifier:String(i.identifier??``)},bodyKind:`multipart`,body:{body:i.body,file:i.file}});return}let a=await r(i),o=i.local?f:await e();if(i.accountId=o,i.file!==void 0||i.body!==void 0){let e=new FormData;if(i.file){let t=d(i.file);e.append(`file`,new Blob([t]),i.file.split(/[\\/]/).filter(Boolean).pop())}else i.body!==void 0&&e.append(`file`,i.body);s(await l(`Updating`,async()=>n(a,`PUT`,`/accounts/${o}/stream/${encodeURIComponent(String(i.identifier))}/captions/${encodeURIComponent(String(i.language))}`,{body:e})),{successLabel:`Updated`});return}if(i.body){let e=u(i.body,`body`,`binary`);s(await l(`Updating`,async()=>n(a,`PUT`,`/accounts/${o}/stream/${encodeURIComponent(String(i.identifier))}/captions/${encodeURIComponent(String(i.language))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(i.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function F(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:F,handler:async n=>{if(n.dryRun){c({command:`cf stream captions language vtt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/captions/${n.language==null?`<language>`:encodeURIComponent(String(n.language))}/vtt`,pathParams:{language:String(n.language??``),identifier:String(n.identifier??``)},bodyKind:`none`});return}await r(n);let i=n.local?f:await e();n.accountId=i,g((await l(`Loading`,async()=>_(`/accounts/${i}/stream/${encodeURIComponent(String(n.identifier))}/captions/${encodeURIComponent(String(n.language))}/vtt`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}))).toString(`utf-8`))}},L={command:`vtt`,describe:`Operations for captions.language.vtt`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`language`,describe:`Operations for captions.language`,builder:e=>e.command(O).command(A).command(M).command(P).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`captions`,describe:`Operations for captions`,builder:e=>e.command(E).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`clipped-from-video-uid`,{type:`string`,description:`The unique video identifier (UID).`}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`end-time-seconds`,{type:`number`,description:`Specifies the end time for the video clip in seconds.`}).option(`input`,{type:`string`,description:`A video's URL. Preferred over 'url'.`}).option(`name`,{type:`string`,description:`A name for the video.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`start-time-seconds`,{type:`number`,description:`Specifies the start time for the video clip in seconds.`}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:`A video's URL (legacy field, use 'input' instead).`}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:B,handler:async n=>{if(n.dryRun){c({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({allowedOrigins:n[`allowed-origins`],clippedFromVideoUID:u(n[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:u(n.creator,`creator`,`text`),endTimeSeconds:n[`end-time-seconds`],input:u(n.input,`input`,`text`),name:u(n.name,`name`,`text`),requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:n[`start-time-seconds`],thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],url:u(n.url,`url`,`text`),watermark:{uid:u(n[`watermark-uid`],`watermark-uid`,`text`)}}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.clip.create({...e,account_id:d})),{successLabel:`Created`});return}if(n[`clipped-from-video-uid`]===void 0&&(n[`clipped-from-video-uid`]=await p(`clipped-from-video-uid`,`The unique video identifier (UID).`)),n[`end-time-seconds`]===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(n[`start-time-seconds`]===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let m=o({allowedOrigins:n[`allowed-origins`],clippedFromVideoUID:u(n[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:u(n.creator,`creator`,`text`),endTimeSeconds:n[`end-time-seconds`],input:u(n.input,`input`,`text`),name:u(n.name,`name`,`text`),requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:n[`start-time-seconds`],thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],url:u(n.url,`url`,`text`),watermark:{uid:u(n[`watermark-uid`],`watermark-uid`,`text`)}});s(await l(`Creating`,async()=>a.stream.clip.create({...m,account_id:d})),{successLabel:`Created`})}},H={command:`clip`,describe:`Operations for clip`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`input`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This is the preferred field over `url`."}).option(`name`,{type:`string`,description:`A video's name. Used for legacy compatibility.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This field is deprecated in favor of `input`."}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Copy upload request. Provide `input` (preferred) or `url` (deprecated)."})}const W={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:U,handler:async d=>{let p={};if(d[`upload-creator`]!==void 0&&(p[`Upload-Creator`]=String(d[`upload-creator`])),d.dryRun){c({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:d.body===void 0?o({allowedOrigins:d[`allowed-origins`],creator:u(d.creator,`creator`,`text`),input:u(d.input,`input`,`text`),name:u(d.name,`name`,`text`),requireSignedURLs:d[`require-signed-urls`],scheduledDeletion:u(d[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:d[`thumbnail-timestamp-pct`],url:u(d.url,`url`,`text`),watermark:{uid:u(d[`watermark-uid`],`watermark-uid`,`text`)}}):i(d.body)});return}let m=await r(d),h=d.local?f:await e();if(d.accountId=h,d.body){let e=i(d.body);s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/copy`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`});return}let g={};d[`allowed-origins`]!==void 0&&a(g,[`allowedOrigins`],d[`allowed-origins`]),d.creator!==void 0&&a(g,[`creator`],u(d.creator,`creator`,`text`)),d.input!==void 0&&a(g,[`input`],u(d.input,`input`,`text`)),d.name!==void 0&&a(g,[`name`],u(d.name,`name`,`text`)),d[`require-signed-urls`]!==void 0&&a(g,[`requireSignedURLs`],d[`require-signed-urls`]),d[`scheduled-deletion`]!==void 0&&a(g,[`scheduledDeletion`],u(d[`scheduled-deletion`],`scheduled-deletion`,`text`)),d[`thumbnail-timestamp-pct`]!==void 0&&a(g,[`thumbnailTimestampPct`],d[`thumbnail-timestamp-pct`]),d.url!==void 0&&a(g,[`url`],u(d.url,`url`,`text`)),d[`watermark-uid`]!==void 0&&a(g,[`watermark`,`uid`],u(d[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/copy`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},G={command:`copy`,describe:`Operations for copy`,builder:e=>e.command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.option(`direct-user`,{type:`boolean`,description:`Provisions a URL to let your end users upload videos directly to Cloudflare Stream without exposing your API token to clients.`}).option(`tus-resumable`,{type:`string`,description:`Specifies the TUS protocol version. This value must be included in every upload request.
5
- Notes: The only supported version of TUS protocol is 1.0.0.`,demandOption:!0}).option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`upload-length`,{type:`string`,description:`Indicates the size of the entire upload in bytes. The value must be a non-negative integer.`,demandOption:!0}).option(`upload-metadata`,{type:`string`,description:"Comma-separated key-value pairs following the TUS protocol specification. Values are Base-64 encoded.\nSupported keys: `name`, `requiresignedurls`, `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`, `maxdurationseconds`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`create`,describe:"Initiates a video upload using the TUS protocol. On success, the server responds with a status code 201 (created) and includes a `location` header to indicate where the content should be uploaded. Refer to https://tus.io for protocol details.",builder:K,handler:async i=>{let a={direct_user:i[`direct-user`]},o={};if(i[`tus-resumable`]!==void 0&&(o[`Tus-Resumable`]=String(i[`tus-resumable`])),i[`upload-creator`]!==void 0&&(o[`Upload-Creator`]=String(i[`upload-creator`])),i[`upload-length`]!==void 0&&(o[`Upload-Length`]=String(i[`upload-length`])),i[`upload-metadata`]!==void 0&&(o[`Upload-Metadata`]=String(i[`upload-metadata`])),i.dryRun){c({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream`,pathParams:{},query:a,bodyKind:`none`});return}let u=await r(i),d=i.local?f:await e();i.accountId=d,s(await l(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/stream`,{query:a,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Created`})}};function J(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Y={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:J,handler:async n=>{if(n.dryRun){c({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
6
- `);return}s(await l(`Deleting`,async()=>i.stream.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function X(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`expiry`,{type:`string`,description:`The date and time after upload when videos will not be accepted.`,default:`Now + 30 minutes`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Z={command:`create`,describe:`Creates a direct upload that allows video uploads without an API key.`,builder:X,handler:async d=>{let p={};if(d[`upload-creator`]!==void 0&&(p[`Upload-Creator`]=String(d[`upload-creator`])),d.dryRun){c({command:`cf stream direct-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/direct_upload`,pathParams:{},bodyKind:`json`,body:d.body===void 0?o({allowedOrigins:d[`allowed-origins`],creator:u(d.creator,`creator`,`text`),expiry:u(d.expiry,`expiry`,`text`),maxDurationSeconds:d[`max-duration-seconds`],requireSignedURLs:d[`require-signed-urls`],scheduledDeletion:u(d[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:d[`thumbnail-timestamp-pct`],watermark:{uid:u(d[`watermark-uid`],`watermark-uid`,`text`)}}):i(d.body)});return}let m=await r(d),h=d.local?f:await e();if(d.accountId=h,d.body){let e=i(d.body);s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/direct_upload`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`});return}if(d[`max-duration-seconds`]===void 0)throw Error(`--max-duration-seconds is required (or pass --body with this field set).`);let g={};d[`allowed-origins`]!==void 0&&a(g,[`allowedOrigins`],d[`allowed-origins`]),d.creator!==void 0&&a(g,[`creator`],u(d.creator,`creator`,`text`)),d.expiry!==void 0&&a(g,[`expiry`],u(d.expiry,`expiry`,`text`)),d[`max-duration-seconds`]!==void 0&&a(g,[`maxDurationSeconds`],d[`max-duration-seconds`]),d[`require-signed-urls`]!==void 0&&a(g,[`requireSignedURLs`],d[`require-signed-urls`]),d[`scheduled-deletion`]!==void 0&&a(g,[`scheduledDeletion`],u(d[`scheduled-deletion`],`scheduled-deletion`,`text`)),d[`thumbnail-timestamp-pct`]!==void 0&&a(g,[`thumbnailTimestampPct`],d[`thumbnail-timestamp-pct`]),d[`watermark-uid`]!==void 0&&a(g,[`watermark`,`uid`],u(d[`watermark-uid`],`watermark-uid`,`text`)),s(await l(`Creating`,async()=>n(m,`POST`,`/accounts/${h}/stream/direct_upload`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},Q={command:`direct-upload`,describe:`Operations for direct-upload`,builder:e=>e.command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`create <identifier>`,describe:"Creates a download for a video when a video is ready to view. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:ne,handler:async n=>{if(n.dryRun){c({command:`cf stream downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.downloads.create({account_id:a,identifier:n.identifier})),{successLabel:`Created`})}};function ie(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ae={command:`delete <identifier>`,describe:"Delete the downloads for a video. Use `/downloads/{download_type}` instead for type-specific downloads. Available types are `default` and `audio`.",builder:ie,handler:async n=>{if(n.dryRun){c({command:`cf stream downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
7
- `);return}s(await l(`Deleting`,async()=>i.stream.downloads.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function oe(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`get <identifier>`,describe:`Lists the downloads created for a video.`,builder:oe,handler:async n=>{if(n.dryRun){c({command:`cf stream downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.downloads.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}},ce={command:`downloads`,describe:`Operations for downloads`,builder:e=>e.command(re).command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`max-duration-seconds`,{type:`number`,description:"The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown."}).option(`public-details-channel-link`,{type:`string`,description:`The publicDetails.channel_link field`}).option(`public-details-logo`,{type:`string`,description:`The publicDetails.logo field`}).option(`public-details-share-link`,{type:`string`,description:`The publicDetails.share_link field`}).option(`public-details-title`,{type:`string`,description:`The publicDetails.title field`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`uid`,{type:`string`,description:`The unique identifier for the video. Can be used to verify the video being updated.`}).option(`upload-expiry`,{type:`string`,description:`The date and time when the video upload URL is no longer valid for direct user uploads.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`edit <identifier>`,describe:`Edit details for a single video.`,builder:le,handler:async n=>{if(n.dryRun){c({command:`cf stream edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?o({allowedOrigins:n[`allowed-origins`],creator:u(n.creator,`creator`,`text`),maxDurationSeconds:n[`max-duration-seconds`],publicDetails:{channel_link:u(n[`public-details-channel-link`],`public-details-channel-link`,`text`),logo:u(n[`public-details-logo`],`public-details-logo`,`text`),share_link:u(n[`public-details-share-link`],`public-details-share-link`,`text`),title:u(n[`public-details-title`],`public-details-title`,`text`)},requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],uid:u(n.uid,`uid`,`text`),uploadExpiry:u(n[`upload-expiry`],`upload-expiry`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.edit({...e,account_id:d,identifier:n.identifier})),{successLabel:`Created`});return}let p=o({allowedOrigins:n[`allowed-origins`],creator:u(n.creator,`creator`,`text`),maxDurationSeconds:n[`max-duration-seconds`],publicDetails:{channel_link:u(n[`public-details-channel-link`],`public-details-channel-link`,`text`),logo:u(n[`public-details-logo`],`public-details-logo`,`text`),share_link:u(n[`public-details-share-link`],`public-details-share-link`,`text`),title:u(n[`public-details-title`],`public-details-title`,`text`)},requireSignedURLs:n[`require-signed-urls`],scheduledDeletion:u(n[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:n[`thumbnail-timestamp-pct`],uid:u(n.uid,`uid`,`text`),uploadExpiry:u(n[`upload-expiry`],`upload-expiry`,`text`)});s(await l(`Creating`,async()=>a.stream.edit({...p,account_id:d,identifier:n.identifier})),{successLabel:`Created`})}};function de(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get <identifier>`,describe:`Fetches an HTML code snippet to embed a video in a web page delivered through Cloudflare. On success, returns an HTML fragment for use on web pages to display a video. On failure, returns a JSON response body.`,builder:de,handler:async n=>{if(n.dryRun){c({command:`cf stream embed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/embed`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}await r(n);let i=n.local?f:await e();n.accountId=i,g((await l(`Loading`,async()=>_(`/accounts/${i}/stream/${encodeURIComponent(String(n.identifier))}/embed`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}))).toString(`utf-8`))}},pe={command:`embed`,describe:`Operations for embed`,builder:e=>e.command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`get <identifier>`,describe:`Fetches details for a single video.`,builder:me,handler:async n=>{if(n.dryRun){c({command:`cf stream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}};function ge(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={command:`create`,describe:`Creates an RSA private key in PEM and JWK formats. Key files are only displayed once after creation. Keys are created, used, and deleted independently of videos, and every key can sign any video.`,builder:ge,handler:async n=>{if(n.dryRun){c({command:`cf stream keys create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.keys.create({account_id:a})),{successLabel:`Created`})}};function ve(e){return e.positional(`identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ye={command:`delete <identifier>`,describe:`Deletes signing keys and revokes all signed URLs generated with the key.`,builder:ve,handler:async n=>{if(n.dryRun){c({command:`cf stream keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/keys/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
8
- `);return}s(await l(`Deleting`,async()=>i.stream.keys.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get`,describe:`Lists the video ID and creation date and time when a signing key was created.`,builder:be,handler:async n=>{if(n.dryRun){c({command:`cf stream keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/keys`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.keys.get({account_id:a})),{successLabel:`Loaded`})}},Se={command:`keys`,describe:`Operations for keys`,builder:e=>e.command(_e).command(ye).command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.option(`status`,{type:`string`,description:`Specifies the processing status for all quality levels for a video.`,choices:[`pendingupload`,`downloading`,`queued`,`inprogress`,`ready`,`error`,`live-inprogress`]}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`type`,{type:`string`,description:"Specifies whether the video is `vod` or `live`."}).option(`asc`,{type:`boolean`,description:`Lists videos in ascending order of creation.`}).option(`video-name`,{type:`string`,description:"Provides a fast, exact string match on the `name` key in the `meta` field."}).option(`search`,{type:`string`,description:"Provides a partial word match of the `name` key in the `meta` field. Slow for medium to large video libraries. May be unavailable for very large libraries."}).option(`start`,{type:`string`,description:`Lists videos created after the specified date.`}).option(`end`,{type:`string`,description:`Lists videos created before the specified date.`}).option(`include-counts`,{type:`boolean`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`id`,{type:`string`,description:`Filter by video ID(s). Can be a single ID or a comma-separated list of IDs.`}).option(`name`,{type:`string`,description:`Filter by video name/UID(s). Can be a single name or a comma-separated list.`}).option(`live-input-id`,{type:`string`,description:`Filter by live input ID to find videos associated with a specific live stream.`}).option(`before`,{type:`string`,description:`Alias for 'end'. Returns videos created before this date/time (RFC 3339 format).`}).option(`after`,{type:`string`,description:`Alias for 'start'. Returns videos created after this date/time (RFC 3339 format).`}).option(`limit`,{type:`number`,description:`Maximum number of videos to return (default 1000, max 1000).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`list`,describe:`Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.`,builder:h(Ce),handler:async n=>{let i={status:n.status,creator:n.creator,type:n.type,asc:n.asc,video_name:n[`video-name`],search:n.search,start:n.start,end:n.end,include_counts:n[`include-counts`],id:n.id,name:n.name,live_input_id:n[`live-input-id`],before:n.before,after:n.after,limit:n.limit};if(n.dryRun){c({command:`cf stream list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?f:await e();n.accountId=o,s(await l(`Loading`,async()=>a.stream.list({account_id:o,...i})),{successLabel:`Loaded`})}};function Te(e){return e.option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`,default:!0}).option(`prefer-low-latency`,{type:`boolean`,description:`When enabled, the live stream is delivered using Low-Latency HLS (LL-HLS), reducing glass-to-glass latency for viewers at the cost of reduced player compatibility.`,default:!1}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`.",default:!1}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`],default:`off`}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input.",default:!1}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used.",default:0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ee={command:`create`,describe:`Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream.`,builder:Te,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.liveInputs.create({...e,account_id:d})),{successLabel:`Created`});return}let p=o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}});s(await l(`Creating`,async()=>a.stream.liveInputs.create({...p,account_id:d})),{successLabel:`Created`})}};function De(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Oe={command:`delete <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls.`,builder:De,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
9
- `);return}s(await l(`Deleting`,async()=>i.stream.liveInputs.delete({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Deleted`})}};function ke(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`create <live-input-identifier>`,describe:`Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls until enabled.`,builder:ke,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs disable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/disable`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation disables a live input. Active streams to it are dropped.`})){process.stderr.write(`Aborted.
10
- `);return}s(await l(`Deleting`,async()=>i.stream.liveInputs.disable.create({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Deleted`})}},je={command:`disable`,describe:`Operations for live-inputs.disable`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ne={command:`create <live-input-identifier>`,describe:`Allows a live input to be streamed to and makes the live input accessible to any future API calls.`,builder:Me,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs enable create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/enable`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.liveInputs.enable.create({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}},Pe={command:`enable`,describe:`Operations for live-inputs.enable`,builder:e=>e.command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`get <live-input-identifier>`,describe:`Retrieves details of an existing live input.`,builder:Fe,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.liveInputs.get({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Loaded`})}};function Le(e){return e.option(`include-counts`,{type:`boolean`,description:`Includes the total number of videos associated with the submitted query parameters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Re={command:`list`,describe:`Lists the live inputs created for an account. To get the credentials needed to stream to a specific live input, request a single live input.`,builder:Le,handler:async n=>{let i={include_counts:n[`include-counts`]};if(n.dryRun){c({command:`cf stream live-inputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?f:await e();n.accountId=o,s(await l(`Loading`,async()=>a.stream.liveInputs.list({account_id:o,...i})),{successLabel:`Loaded`})}};function ze(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`,default:!0}).option(`stream-key`,{type:`string`,description:`The streamKey used to authenticate against an output's target.`}).option(`url`,{type:`string`,description:`The URL an output uses to restream.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Be={command:`create <live-input-identifier>`,describe:`Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live input — one live input can have many outputs.`,builder:ze,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({enabled:n.enabled,streamKey:u(n[`stream-key`],`stream-key`,`text`),url:u(n.url,`url`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.liveInputs.outputs.create({...e,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`});return}n[`stream-key`]===void 0&&(n[`stream-key`]=await p(`stream-key`,`The streamKey used to authenticate against an output's target.`,{kind:`secret`})),n.url===void 0&&(n.url=await p(`url`,`The URL an output uses to restream.`,{kind:`secret`}));let m=o({enabled:n.enabled,streamKey:u(n[`stream-key`],`stream-key`,`text`),url:u(n.url,`url`,`text`)});s(await l(`Creating`,async()=>a.stream.liveInputs.outputs.create({...m,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}};function Ve(e){return e.positional(`output-identifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const He={command:`delete <output-identifier>`,describe:`Deletes an output and removes it from the associated live input.`,builder:Ve,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs/${n[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(n[`output-identifier`]))}`,pathParams:{"output-identifier":String(n[`output-identifier`]??``),"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
11
- `);return}s(await l(`Deleting`,async()=>i.stream.liveInputs.outputs.delete({account_id:a,live_input_identifier:n[`live-input-identifier`],output_identifier:n[`output-identifier`]})),{successLabel:`Deleted`})}};function Ue(e){return e.option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const We={command:`list`,describe:`Retrieves all outputs associated with a specified live input.`,builder:Ue,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.liveInputs.outputs.list({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Loaded`})}};function Ge(e){return e.positional(`output-identifier`,{type:`string`,description:`A unique identifier for the output.`,demandOption:!0}).option(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`update <output-identifier>`,describe:`Updates the state of an output.`,builder:Ge,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs outputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/outputs/${n[`output-identifier`]==null?`<output-identifier>`:encodeURIComponent(String(n[`output-identifier`]))}`,pathParams:{"output-identifier":String(n[`output-identifier`]??``),"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({enabled:n.enabled}):i(n.body)});return}let a=await r(n),u=n.local?f:await e();if(n.accountId=u,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.liveInputs.outputs.update({...e,account_id:u,live_input_identifier:n[`live-input-identifier`],output_identifier:n[`output-identifier`]})),{successLabel:`Updated`});return}if(n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let d=o({enabled:n.enabled});s(await l(`Updating`,async()=>a.stream.liveInputs.outputs.update({...d,account_id:u,live_input_identifier:n[`live-input-identifier`],output_identifier:n[`output-identifier`]})),{successLabel:`Updated`})}},qe={command:`outputs`,describe:`Operations for live-inputs.outputs`,builder:e=>e.command(Be).command(He).command(We).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`update <live-input-identifier>`,describe:`Rotates the credentials for a live input without changing its identifier. Old credentials are revoked, broadcasts using stale credentials are automatically disconnected shortly after rotation, and the response returns refreshed credentials.`,builder:Je,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs rotate update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}/rotate_keys`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.liveInputs.rotate.update({account_id:a,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Created`})}},Xe={command:`rotate`,describe:`Operations for live-inputs.rotate`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(e){return e.positional(`live-input-identifier`,{type:`string`,description:`A unique identifier for a live input.`,demandOption:!0}).option(`default-creator`,{type:`string`,description:`Sets the creator ID asssociated with this live input.`}).option(`delete-recording-after-days`,{type:`number`,description:"Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion."}).option(`enabled`,{type:`boolean`,description:`Indicates whether the live input is enabled and can accept streams.`}).option(`prefer-low-latency`,{type:`boolean`,description:`When enabled, the live stream is delivered using Low-Latency HLS (LL-HLS), reducing glass-to-glass latency for viewers at the cost of reduced player compatibility.`}).option(`recording-allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin."}).option(`recording-hide-live-viewer-count`,{type:`boolean`,description:"Disables reporting the number of live viewers when this property is set to `true`."}).option(`recording-mode`,{type:`string`,description:"Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input.",choices:[`off`,`automatic`]}).option(`recording-require-signed-urls`,{type:`boolean`,description:"Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input."}).option(`recording-timeout-seconds`,{type:`number`,description:"Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Qe={command:`update <live-input-identifier>`,describe:`Updates a specified live input.`,builder:Ze,handler:async n=>{if(n.dryRun){c({command:`cf stream live-inputs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/live_inputs/${n[`live-input-identifier`]==null?`<live-input-identifier>`:encodeURIComponent(String(n[`live-input-identifier`]))}`,pathParams:{"live-input-identifier":String(n[`live-input-identifier`]??``)},bodyKind:`json`,body:n.body===void 0?o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.liveInputs.update({...e,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Updated`});return}let p=o({defaultCreator:u(n[`default-creator`],`default-creator`,`text`),deleteRecordingAfterDays:n[`delete-recording-after-days`],enabled:n.enabled,preferLowLatency:n[`prefer-low-latency`],recording:{allowedOrigins:n[`recording-allowed-origins`],hideLiveViewerCount:n[`recording-hide-live-viewer-count`],mode:u(n[`recording-mode`],`recording-mode`,`text`),requireSignedURLs:n[`recording-require-signed-urls`],timeoutSeconds:n[`recording-timeout-seconds`]}});s(await l(`Updating`,async()=>a.stream.liveInputs.update({...p,account_id:d,live_input_identifier:n[`live-input-identifier`]})),{successLabel:`Updated`})}},$e={command:`live-inputs`,describe:`Operations for live-inputs`,builder:e=>e.command(Ee).command(Oe).command(Ie).command(Re).command(Qe).command(je).command(Pe).command(qe).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`downloadable`,{type:`boolean`,description:`The optional boolean value that enables using signed tokens to access MP4 download links for a video.`,default:!1}).option(`exp`,{type:`number`,description:`The optional unix epoch timestamp that specficies the time after a token is not accepted. The maximum time specification is 24 hours from issuing time. If this field is not set, the default is one hour after issuing.`}).option(`flags-original`,{type:`boolean`,description:`Whether to return the original video without transformations.`,default:!1}).option(`id`,{type:`string`,description:"The optional ID of a Stream signing key. If present, the `pem` field is also required."}).option(`nbf`,{type:`number`,description:`The optional unix epoch timestamp that specifies the time before a the token is not accepted. If this field is not set, the default is one hour before issuing.`}).option(`pem`,{type:`string`,description:"The optional base64 encoded private key in PEM format associated with a Stream signing key. If present, the `id` field is also required."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const tt={command:`create <identifier>`,describe:`Creates a signed URL token for a video. If a body is not provided in the request, a token is created with default values.`,builder:et,handler:async n=>{if(n.dryRun){c({command:`cf stream token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/token`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`json`,body:n.body===void 0?o({downloadable:n.downloadable,exp:n.exp,flags:{original:n[`flags-original`]},id:u(n.id,`id`,`text`),nbf:n.nbf,pem:u(n.pem,`pem`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.stream.token.create({...e,account_id:d,identifier:n.identifier})),{successLabel:`Created`});return}let p=o({downloadable:n.downloadable,exp:n.exp,flags:{original:n[`flags-original`]},id:u(n.id,`id`,`text`),nbf:n.nbf,pem:u(n.pem,`pem`,`text`)});s(await l(`Creating`,async()=>a.stream.token.create({...p,account_id:d,identifier:n.identifier})),{successLabel:`Created`})}},nt={command:`token`,describe:`Operations for token`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rt(e){return e.positional(`download-type`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const it={command:`create <download-type>`,describe:`Creates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.`,builder:h(rt),handler:async n=>{if(n.dryRun){c({command:`cf stream typed-downloads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads/${n[`download-type`]==null?`<download-type>`:encodeURIComponent(String(n[`download-type`]))}`,pathParams:{identifier:String(n.identifier??``),"download-type":String(n[`download-type`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Creating`,async()=>i.stream.typedDownloads.create({account_id:a,identifier:n.identifier,download_type:n[`download-type`]})),{successLabel:`Created`})}};function at(e){return e.positional(`download-type`,{type:`string`,description:"The type of downloads available are: `default`, `audio`.",demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ot={command:`delete <download-type>`,describe:`Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.`,builder:h(at),handler:async n=>{if(n.dryRun){c({command:`cf stream typed-downloads delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}/downloads/${n[`download-type`]==null?`<download-type>`:encodeURIComponent(String(n[`download-type`]))}`,pathParams:{identifier:String(n.identifier??``),"download-type":String(n[`download-type`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
12
- `);return}s(await l(`Deleting`,async()=>i.stream.typedDownloads.delete({account_id:a,identifier:n.identifier,download_type:n[`download-type`]})),{successLabel:`Deleted`})}},st={command:`typed-downloads`,describe:`Operations for typed-downloads`,builder:e=>e.command(it).command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ct(e){return e.option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lt={command:`storage-usage`,describe:`Returns information about an account's storage use.`,builder:ct,handler:async n=>{let i={creator:n.creator};if(n.dryRun){c({command:`cf stream videos storage-usage`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/storage-usage`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?f:await e();n.accountId=o,s(await l(`Loading`,async()=>a.stream.videos.storageUsage({account_id:o,...i})),{successLabel:`Loaded`})}},ut={command:`videos`,describe:`Operations for videos`,builder:e=>e.command(lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dt(e){return e.option(`name`,{type:`string`,description:`A short description of the watermark profile.`,default:``}).option(`opacity`,{type:`number`,description:"The translucency of the image. A value of `0.0` makes the image completely transparent, and `1.0` makes the image completely opaque. Note that if the image is already semi-transparent, setting this to `1.0` will not make the image completely opaque.",default:1}).option(`padding`,{type:`number`,description:"The whitespace between the adjacent edges (determined by position) of the video and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded video width or length, as determined by the algorithm.",default:.05}).option(`position`,{type:`string`,description:"The location of the image. Valid positions are: `upperRight`, `upperLeft`, `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the `padding` parameter.",default:`upperRight`}).option(`scale`,{type:`number`,description:"The size of the image relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. `0.0` indicates no scaling (use the size of the image as-is), and `1.0 `fills the entire video.",default:.15}).option(`url`,{type:`string`,description:`URL of the watermark image to copy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const ft={command:`create`,describe:"Creates watermark profiles using a single `HTTP POST multipart/form-data` request.",builder:dt,handler:async o=>{if(o.dryRun){c({command:`cf stream watermarks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`multipart`,body:{name:o.name,opacity:o.opacity,padding:o.padding,position:o.position,scale:o.scale,url:o.url,body:o.body,file:o.file}});return}let p=await r(o),m=o.local?f:await e();if(o.accountId=m,o.file!==void 0||o.body!==void 0||o.name!==void 0||o.opacity!==void 0||o.padding!==void 0||o.position!==void 0||o.scale!==void 0){let e=new FormData;if(o.file){let t=d(o.file);e.append(`file`,new Blob([t]),o.file.split(/[\\/]/).filter(Boolean).pop())}else o.body!==void 0&&e.append(`file`,o.body);o.name!==void 0&&e.append(`name`,String(u(o.name,`name`,`text`)??``)),o.opacity!==void 0&&e.append(`opacity`,String(o.opacity)),o.padding!==void 0&&e.append(`padding`,String(o.padding)),o.position!==void 0&&e.append(`position`,String(u(o.position,`position`,`text`)??``)),o.scale!==void 0&&e.append(`scale`,String(o.scale)),s(await l(`Creating`,async()=>n(p,`POST`,`/accounts/${m}/stream/watermarks`,{body:e})),{successLabel:`Created`});return}if(o.body){let e=i(o.body);s(await l(`Creating`,async()=>n(p,`POST`,`/accounts/${m}/stream/watermarks`,{body:e})),{successLabel:`Created`});return}let h={};o.name!==void 0&&a(h,[`name`],u(o.name,`name`,`text`)),o.opacity!==void 0&&a(h,[`opacity`],o.opacity),o.padding!==void 0&&a(h,[`padding`],o.padding),o.position!==void 0&&a(h,[`position`],u(o.position,`position`,`text`)),o.scale!==void 0&&a(h,[`scale`],o.scale),o.url!==void 0&&a(h,[`url`],u(o.url,`url`,`text`)),s(await l(`Creating`,async()=>n(p,`POST`,`/accounts/${m}/stream/watermarks`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function $(e){return e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const pt={command:`delete <identifier>`,describe:`Deletes a watermark profile.`,builder:$,handler:async n=>{if(n.dryRun){c({command:`cf stream watermarks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
13
- `);return}s(await l(`Deleting`,async()=>i.stream.watermarks.delete({account_id:a,identifier:n.identifier})),{successLabel:`Deleted`})}};function mt(e){return e.positional(`identifier`,{type:`string`,description:`The unique identifier for a watermark profile.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ht={command:`get <identifier>`,describe:`Retrieves details for a single watermark profile.`,builder:mt,handler:async n=>{if(n.dryRun){c({command:`cf stream watermarks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks/${n.identifier==null?`<identifier>`:encodeURIComponent(String(n.identifier))}`,pathParams:{identifier:String(n.identifier??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.watermarks.get({account_id:a,identifier:n.identifier})),{successLabel:`Loaded`})}};function gt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`list`,describe:`Lists all watermark profiles for an account.`,builder:gt,handler:async n=>{if(n.dryRun){c({command:`cf stream watermarks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/watermarks`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.watermarks.list({account_id:a})),{successLabel:`Loaded`})}},vt={command:`watermarks`,describe:`Operations for watermarks`,builder:e=>e.command(ft).command(pt).command(ht).command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const bt={command:`delete`,describe:`Deletes a webhook.`,builder:yt,handler:async n=>{if(n.dryRun){c({command:`cf stream webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
14
- `);return}s(await l(`Deleting`,async()=>i.stream.webhooks.delete({account_id:a})),{successLabel:`Deleted`})}};function xt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const St={command:`get`,describe:`Retrieves a list of webhooks.`,builder:xt,handler:async n=>{if(n.dryRun){c({command:`cf stream webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?f:await e();n.accountId=a,s(await l(`Loading`,async()=>i.stream.webhooks.get({account_id:a})),{successLabel:`Loaded`})}};function Ct(e){return e.option(`notification-url`,{type:`string`,description:`The URL where webhooks will be sent.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const wt={command:`update`,describe:`Creates a webhook notification.`,builder:Ct,handler:async n=>{if(n.dryRun){c({command:`cf stream webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/stream/webhook`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({notificationUrl:u(n[`notification-url`],`notification-url`,`text`)}):i(n.body)});return}let a=await r(n),d=n.local?f:await e();if(n.accountId=d,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.stream.webhooks.update({...e,account_id:d})),{successLabel:`Updated`});return}let p=o({notificationUrl:u(n[`notification-url`],`notification-url`,`text`)});s(await l(`Updating`,async()=>a.stream.webhooks.update({...p,account_id:d})),{successLabel:`Updated`})}},Tt={command:`webhooks`,describe:`Operations for webhooks`,builder:e=>e.command(bt).command(St).command(wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Et={command:`stream`,describe:`stream`,builder:e=>e.command(q).command(Y).command(ue).command(he).command(we).command(w).command(z).command(H).command(G).command(Q).command(ce).command(pe).command(Se).command($e).command(nt).command(st).command(ut).command(vt).command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Et as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e}from"./auth-DX9KnJ0P.mjs";import{t}from"./output-B6fBFRqe.mjs";import{n,t as r}from"./progress-CL8I-7YK.mjs";function i(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={command:`get <tenant-id>`,describe:`List of account types available for the Tenant to provision accounts.`,builder:i,handler:async i=>{if(i.dryRun){n({command:`cf tenants account-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/account_types`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.accountTypes.get({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},o={command:`account-types`,describe:`Operations for account-types`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function s(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`list`,describe:`List of accounts for the Tenant.`,builder:s,handler:async i=>{if(i.dryRun){n({command:`cf tenants accounts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/accounts`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.accounts.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},l={command:`accounts`,describe:`Operations for accounts`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`List of innate entitlements available for the Tenant.`,builder:u,handler:async i=>{if(i.dryRun){n({command:`cf tenants entitlements list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/entitlements`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.entitlements.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},f={command:`entitlements`,describe:`Operations for entitlements`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <tenant-id>`,describe:`Retrieves a Tenant by Tenant ID.`,builder:p,handler:async i=>{if(i.dryRun){n({command:`cf tenants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.get({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}};function h(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List of active members (Cloudflare users) for the Tenant.`,builder:h,handler:async i=>{if(i.dryRun){n({command:`cf tenants memberships list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/memberships`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenants.memberships.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},_={command:`memberships`,describe:`Operations for memberships`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`tenants`,describe:`Multi-tenant account management — manage tenant accounts, entitlements, and memberships`,builder:e=>e.command(m).command(o).command(l).command(f).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env node
2
- import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{n as u,r as d,t as f}from"./prompt-q3B7sM2A.mjs";import{t as p}from"./cli-types-DGgEbf8K.mjs";function m(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
3
- expensive challenges in response to malicious bots (ENT only).
4
- `}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
5
- this setting can determine the clearance level to be set
6
- `,choices:[`no_clearance`,`jschallenge`,`managed`,`interactive`]}).option(`domains`,{type:`string`,array:!0,description:`The domains field`}).option(`ephemeral-id`,{type:`boolean`,description:`Return the Ephemeral ID in /siteverify (ENT only).
7
- `}).option(`mode`,{type:`string`,description:`Widget Mode`,choices:[`non-interactive`,`invisible`,`managed`]}).option(`name`,{type:`string`,description:`Human readable widget name. Not unique. Cloudflare suggests that you
8
- set this to a meaningful string to make it easier to identify your
9
- widget, and where it is used.
10
- `}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only).
11
- `}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation.
12
- `,choices:[`world`,`china`],default:`world`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`create`,describe:`Lists challenge widgets.`,builder:p(m),handler:async f=>{let p={page:f.page,per_page:f[`per-page`],order:f.order,direction:f.direction,filter:f.filter};if(f.dryRun){o({command:`cf turnstile widgets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets`,pathParams:{},query:p,bodyKind:`json`,body:f.body===void 0?i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)}):r(f.body)});return}let m=await n(f),h=f.local?l:await e();if(f.accountId=h,f.body){let e=r(f.body);new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>m.turnstile.widgets.create({...e,account_id:h,...p})),{successLabel:`Created`});return}if(f.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);f.mode===void 0&&(f.mode=await u(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),f.name===void 0&&(f.name=await d(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let g=i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)});new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>m.turnstile.widgets.create({...g,account_id:h,...p})),{successLabel:`Created`})}};function g(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <sitekey>`,describe:`Destroy a Turnstile Widget.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf turnstile widgets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${r.sitekey==null?`<sitekey>`:encodeURIComponent(String(r.sitekey))}`,pathParams:{sitekey:String(r.sitekey??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await f({force:!!r.force})){process.stderr.write(`Aborted.
13
- `);return}a(await s(`Deleting`,async()=>i.turnstile.widgets.delete({account_id:c,sitekey:r.sitekey})),{successLabel:`Deleted`})}};function v(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <sitekey>`,describe:`Show a single challenge widget configuration.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf turnstile widgets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${r.sitekey==null?`<sitekey>`:encodeURIComponent(String(r.sitekey))}`,pathParams:{sitekey:String(r.sitekey??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.turnstile.widgets.get({account_id:c,sitekey:r.sitekey})),{successLabel:`Loaded`})}};function b(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all turnstile widgets of an account.`,builder:p(b),handler:async r=>{let i={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction,filter:r.filter};if(r.dryRun){o({command:`cf turnstile widgets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.turnstile.widgets.list({account_id:u,...i})),{successLabel:`Loaded`})}};function S(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`invalidate-immediately`,{type:`boolean`,description:"If `invalidate_immediately` is set to `false`, the previous secret will\nremain valid for two hours. Otherwise, the secret is immediately\ninvalidated, and requests using it will be rejected.\n",default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`rotate-secret <sitekey>`,describe:"Generate a new secret key for this widget. If `invalidate_immediately` is set to `false`, the previous secret remains valid for 2 hours. Note that secrets cannot be rotated again during the grace period.",builder:S,handler:async c=>{if(c.dryRun){o({command:`cf turnstile widgets rotate-secret`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${c.sitekey==null?`<sitekey>`:encodeURIComponent(String(c.sitekey))}/rotate_secret`,pathParams:{sitekey:String(c.sitekey??``)},bodyKind:`json`,body:c.body===void 0?i({invalidate_immediately:c[`invalidate-immediately`]}):r(c.body)});return}let u=await n(c),d=c.local?l:await e();if(c.accountId=d,c.body){let e=r(c.body);a(await s(`Creating`,async()=>u.turnstile.widgets.rotateSecret({...e,account_id:d,sitekey:c.sitekey})),{successLabel:`Created`});return}let f=i({invalidate_immediately:c[`invalidate-immediately`]});a(await s(`Creating`,async()=>u.turnstile.widgets.rotateSecret({...f,account_id:d,sitekey:c.sitekey})),{successLabel:`Created`})}};function w(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
14
- expensive challenges in response to malicious bots (ENT only).
15
- `}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
16
- this setting can determine the clearance level to be set
17
- `,choices:[`no_clearance`,`jschallenge`,`managed`,`interactive`]}).option(`domains`,{type:`string`,array:!0,description:`The domains field`}).option(`ephemeral-id`,{type:`boolean`,description:`Return the Ephemeral ID in /siteverify (ENT only).
18
- `}).option(`mode`,{type:`string`,description:`Widget Mode`,choices:[`non-interactive`,`invisible`,`managed`]}).option(`name`,{type:`string`,description:`Human readable widget name. Not unique. Cloudflare suggests that you
19
- set this to a meaningful string to make it easier to identify your
20
- widget, and where it is used.
21
- `}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only).
22
- `}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation.
23
- `,choices:[`world`,`china`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`update <sitekey>`,describe:`Update the configuration of a widget.`,builder:w,handler:async f=>{if(f.dryRun){o({command:`cf turnstile widgets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${f.sitekey==null?`<sitekey>`:encodeURIComponent(String(f.sitekey))}`,pathParams:{sitekey:String(f.sitekey??``)},bodyKind:`json`,body:f.body===void 0?i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)}):r(f.body)});return}let p=await n(f),m=f.local?l:await e();if(f.accountId=m,f.body){let e=r(f.body);a(await s(`Updating`,async()=>p.turnstile.widgets.update({...e,account_id:m,sitekey:f.sitekey})),{successLabel:`Updated`});return}if(f.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);f.mode===void 0&&(f.mode=await u(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),f.name===void 0&&(f.name=await d(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let h=i({bot_fight_mode:f[`bot-fight-mode`],clearance_level:c(f[`clearance-level`],`clearance-level`,`text`),domains:f.domains,ephemeral_id:f[`ephemeral-id`],mode:c(f.mode,`mode`,`text`),name:c(f.name,`name`,`text`),offlabel:f.offlabel,region:c(f.region,`region`,`text`)});a(await s(`Updating`,async()=>p.turnstile.widgets.update({...h,account_id:m,sitekey:f.sitekey})),{successLabel:`Updated`})}},E={command:`widgets`,describe:`Operations for widgets`,builder:e=>e.command(h).command(_).command(y).command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`turnstile`,describe:`turnstile`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{D as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{n as c,t as l}from"./prompt-q3B7sM2A.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const d={command:`delete`,describe:`Deletes the URL Normalization settings.`,builder:u,handler:async n=>{if(n.dryRun){a({command:`cf url-normalization delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>r.urlNormalization.delete({zone_id:s})),{successLabel:`Deleted`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Fetches the current URL Normalization settings.`,builder:f,handler:async n=>{if(n.dryRun){a({command:`cf url-normalization get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.urlNormalization.get({zone_id:s})),{successLabel:`Loaded`})}};function m(e){return e.option(`scope`,{type:`string`,description:`The scope of the URL normalization.`,choices:[`incoming`,`both`,`none`]}).option(`type`,{type:`string`,description:`The type of URL normalization performed by Cloudflare.`,choices:[`cloudflare`,`rfc3986`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A URL Normalization object.`})}const h={command:`update`,describe:`Updates the URL Normalization settings.`,builder:m,handler:async l=>{if(l.dryRun){a({command:`cf url-normalization update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({scope:s(l.scope,`scope`,`text`),type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.urlNormalization.update({body:e,zone_id:d})),{successLabel:`Updated`});return}l.scope===void 0&&(l.scope=await c(`scope`,`The scope of the URL normalization.`,[`incoming`,`both`,`none`])),l.type===void 0&&(l.type=await c(`type`,`The type of URL normalization performed by Cloudflare.`,[`cloudflare`,`rfc3986`]));let f=r({scope:s(l.scope,`scope`,`text`),type:s(l.type,`type`,`text`)});i(await o(`Updating`,async()=>u.urlNormalization.update({body:f,zone_id:d})),{successLabel:`Updated`})}},g={command:`url-normalization`,describe:`Normalize incoming request URLs to a consistent format before rule evaluation and caching`,builder:e=>e.command(d).command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{r as u}from"./prompt-q3B7sM2A.mjs";import{n as d,t as f}from"./raw-fetch-bIXC9D1m.mjs";function p(e){return e.positional(`response-id`,{type:`string`,description:`Response hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <response-id>`,describe:"Returns the raw response of the network request. Find the `response_id` in the `data.requests.response.hash`.",builder:p,handler:async r=>{if(r.dryRun){o({command:`cf url-scanner responses get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/responses/${r[`response-id`]==null?`<response-id>`:encodeURIComponent(String(r[`response-id`]))}`,pathParams:{"response-id":String(r[`response-id`]??``)},bodyKind:`none`});return}await n(r);let i=r.local?l:await e();r.accountId=i,d((await s(`Loading`,async()=>f(`/accounts/${i}/urlscanner/v2/responses/${encodeURIComponent(String(r[`response-id`]))}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}))).toString(`utf-8`))}},h={command:`responses`,describe:`Operations for responses`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`List of urls to scan (up to a 100).`})}const _={command:`bulk-create`,describe:`Submit URLs to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/ and take into account scans submitted in bulk have lower priority and may take longer to finish.`,builder:g,handler:async i=>{if(i.dryRun){o({command:`cf url-scanner scans bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/bulk`,pathParams:{},bodyKind:`json`,body:i.body===void 0?void 0:r(i.body)});return}let c=await n(i),u=i.local?l:await e();if(i.accountId=u,i.body){let e=r(i.body);a(await s(`Creating`,async()=>c.urlScanner.scans.bulkCreate({body:e,account_id:u})),{successLabel:`Created`});return}if(i.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.option(`agent-readiness`,{type:`boolean`,description:`Enable agent readiness checks.`}).option(`country`,{type:`string`,description:`Country to geo egress from`,choices:`AF.AL.DZ.AD.AO.AG.AR.AM.AU.AT.AZ.BH.BD.BB.BY.BE.BZ.BJ.BM.BT.BO.BA.BW.BR.BN.BG.BF.BI.KH.CM.CA.CV.KY.CF.TD.CL.CN.CO.KM.CG.CR.CI.HR.CU.CY.CZ.CD.DK.DJ.DM.DO.EC.EG.SV.GQ.ER.EE.SZ.ET.FJ.FI.FR.GA.GE.DE.GH.GR.GL.GD.GT.GN.GW.GY.HT.HN.HU.IS.IN.ID.IR.IQ.IE.IL.IT.JM.JP.JO.KZ.KE.KI.KW.KG.LA.LV.LB.LS.LR.LY.LI.LT.LU.MO.MG.MW.MY.MV.ML.MR.MU.MX.FM.MD.MC.MN.MS.MA.MZ.MM.NA.NR.NP.NL.NZ.NI.NE.NG.KP.MK.NO.OM.PK.PS.PA.PG.PY.PE.PH.PL.PT.QA.RO.RU.RW.SH.KN.LC.VC.WS.SM.ST.SA.SN.RS.SC.SL.SK.SI.SB.SO.ZA.KR.SS.ES.LK.SD.SR.SE.CH.SY.TW.TJ.TZ.TH.BS.GM.TL.TG.TO.TT.TN.TR.TM.UG.UA.AE.GB.US.UY.UZ.VU.VE.VN.YE.ZM.ZW`.split(`.`)}).option(`customagent`,{type:`string`,description:`The customagent field`}).option(`referer`,{type:`string`,description:`The referer field`}).option(`screenshots-resolutions`,{type:`string`,array:!0,description:`Take multiple screenshots targeting different device types.`}).option(`url`,{type:`string`,description:`The url field`}).option(`visibility`,{type:`string`,description:"The option `Public` means it will be included in listings like recent scans and search results. `Unlisted` means it will not be included in the aforementioned listings, users will need to have the scan's ID to access it. A a scan will be automatically marked as unlisted if it fails, if it contains potential PII or other sensitive material.",choices:[`Public`,`Unlisted`],default:`Public`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`create`,describe:`Submit a URL to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/.`,builder:v,handler:async d=>{if(d.dryRun){o({command:`cf url-scanner scans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/scan`,pathParams:{},bodyKind:`json`,body:d.body===void 0?i({agentReadiness:d[`agent-readiness`],country:c(d.country,`country`,`text`),customagent:c(d.customagent,`customagent`,`text`),referer:c(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:c(d.url,`url`,`text`),visibility:c(d.visibility,`visibility`,`text`)}):r(d.body)});return}let f=await n(d),p=d.local?l:await e();if(d.accountId=p,d.body){let e=r(d.body);a(await s(`Creating`,async()=>f.urlScanner.scans.create({...e,account_id:p})),{successLabel:`Created`});return}d.url===void 0&&(d.url=await u(`url`,`The url field`));let m=i({agentReadiness:d[`agent-readiness`],country:c(d.country,`country`,`text`),customagent:c(d.customagent,`customagent`,`text`),referer:c(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:c(d.url,`url`,`text`),visibility:c(d.visibility,`visibility`,`text`)});a(await s(`Creating`,async()=>f.urlScanner.scans.create({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`dom <scan-id>`,describe:`Returns a plain text response, with the scan's DOM content as rendered by Chrome.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf url-scanner scans dom`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/dom/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}`,pathParams:{"scan-id":String(r[`scan-id`]??``)},bodyKind:`none`});return}await n(r);let i=r.local?l:await e();r.accountId=i,d((await s(`Loading`,async()=>f(`/accounts/${i}/urlscanner/v2/dom/${encodeURIComponent(String(r[`scan-id`]))}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}))).toString(`utf-8`))}};function S(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <scan-id>`,describe:`Get URL scan by uuid`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf url-scanner scans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/result/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}`,pathParams:{"scan-id":String(r[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.urlScanner.scans.get({account_id:c,scan_id:r[`scan-id`]})),{successLabel:`Loaded`})}};function w(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`har <scan-id>`,describe:`Get a URL scan's HAR file. See HAR spec at http://www.softwareishard.com/blog/har-12-spec/.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf url-scanner scans har`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/har/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}`,pathParams:{"scan-id":String(r[`scan-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.urlScanner.scans.har({account_id:c,scan_id:r[`scan-id`]})),{successLabel:`Loaded`})}};function E(e){return e.option(`size`,{type:`number`,description:`Limit the number of objects in the response.`}).option(`q`,{type:`string`,description:`Filter scans`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`Use a subset of ElasticSearch Query syntax to filter scans. Some example queries:<br/> <br/>- 'path:"/bundles/jquery.js"': Searches for scans who requested resources with the given path.<br/>- 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940 where a resource with the given hash was downloaded.<br/>- 'page.domain:microsoft* AND verdicts.malicious:true AND NOT page.domain:microsoft.com': malicious scans whose hostname starts with "microsoft".<br/>- 'apikey:me AND date:[2025-01 TO 2025-02]': my scans from 2025 January to 2025 February.`,builder:E,handler:async r=>{let i={size:r.size,q:r.q};if(r.dryRun){o({command:`cf url-scanner scans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/search`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.urlScanner.scans.list({account_id:u,...i})),{successLabel:`Loaded`})}};function O(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`resolution`,{type:`string`,description:`Target device type.`,choices:[`desktop`,`mobile`,`tablet`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`screenshot <scan-id>`,describe:`Get scan's screenshot by resolution (desktop/mobile/tablet).`,builder:O,handler:async r=>{let i={resolution:r.resolution};if(r.dryRun){o({command:`cf url-scanner scans screenshot`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/screenshots/${r[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(r[`scan-id`]))}.png`,pathParams:{"scan-id":String(r[`scan-id`]??``)},query:i,bodyKind:`none`});return}await n(r);let a=r.local?l:await e();r.accountId=a;let c=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),u=await s(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/screenshots/${encodeURIComponent(String(r[`scan-id`]))}.png${c?`?`+c:``}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}));d(r.text===!0?u.toString(`utf-8`):u)}},A={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(_).command(y).command(x).command(C).command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`url-scanner`,describe:`Scan URLs for phishing, malware, and other threats — submit scans and retrieve detailed results`,builder:e=>e.command(h).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{j as default};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import{i as e,n as t}from"./auth-DX9KnJ0P.mjs";import{n,r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{n as l,r as u,t as d}from"./prompt-q3B7sM2A.mjs";import{t as f}from"./cli-types-DGgEbf8K.mjs";function ee(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`list`,describe:`Gets a list of audit logs for a user account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:f(ee),handler:async e=>{let n={id:e.id,export:e.export,"action.type":e[`action-type`],"actor.ip":e[`actor-ip`],"actor.email":e[`actor-email`],since:e.since,before:e.before,"zone.name":e[`zone-name`],direction:e.direction,per_page:e[`per-page`],page:e.page,hide_user_logs:e[`hide-user-logs`]};if(e.dryRun){o({command:`cf user audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/audit_logs`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.auditLogs.list(n)),{successLabel:`Loaded`})}},p={command:`audit-logs`,describe:`Review a chronological record of actions performed by or on behalf of your user`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order billing history by.`,choices:[`type`,`occurred_at`,`action`]}).option(`occurred-at`,{type:`string`,description:`When the billing item was created.`}).option(`type`,{type:`string`,description:`The billing item type.`}).option(`action`,{type:`string`,description:`The billing item action.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`list`,describe:`Accesses your billing history object.`,builder:f(m),handler:async e=>{let n={page:e.page,per_page:e[`per-page`],order:e.order,occurred_at:e[`occurred-at`],type:e.type,action:e.action};if(e.dryRun){o({command:`cf user billing history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/billing/history`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.billing.history.list(n)),{successLabel:`Loaded`})}},g={command:`history`,describe:`View billing history and payment profile for your user (deprecated — prefer account-level billing)`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Accesses your billing profile object.`,builder:_,handler:async e=>{if(e.dryRun){o({command:`cf user billing profile get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/billing/profile`,pathParams:{},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.billing.profile.get()),{successLabel:`Loaded`})}},y={command:`profile`,describe:`View billing history and payment profile for your user (deprecated — prefer account-level billing)`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`billing`,describe:`Operations for billing`,builder:e=>e.command(g).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`country`,{type:`string`,description:`The country in which the user lives.`}).option(`first-name`,{type:`string`,description:`User's first name`}).option(`last-name`,{type:`string`,description:`User's last name`}).option(`telephone`,{type:`string`,description:`User's telephone number`}).option(`zipcode`,{type:`string`,description:`The zipcode or postal code where the user lives.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit`,describe:`Edit part of your user details.`,builder:x,handler:async e=>{if(e.dryRun){o({command:`cf user edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user`,pathParams:{},bodyKind:`json`,body:e.body===void 0?i({country:c(e.country,`country`,`text`),first_name:c(e[`first-name`],`first-name`,`text`),last_name:c(e[`last-name`],`last-name`,`text`),telephone:c(e.telephone,`telephone`,`text`),zipcode:c(e.zipcode,`zipcode`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.edit({...t})),{successLabel:`Updated`});return}let l=i({country:c(e.country,`country`,`text`),first_name:c(e[`first-name`],`first-name`,`text`),last_name:c(e[`last-name`],`last-name`,`text`),telephone:c(e.telephone,`telephone`,`text`),zipcode:c(e.zipcode,`zipcode`,`text`)});a(await s(`Updating`,async()=>r.user.edit({...l})),{successLabel:`Updated`})}};function C(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`create`,describe:`Creates a new IP Access rule for all zones owned by the current user. Note: To create an IP Access rule that applies to a specific zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:C,handler:async e=>{if(e.dryRun){o({command:`cf user firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:e.body===void 0?i({configuration:{target:c(e[`configuration-target`],`configuration-target`,`text`),value:c(e[`configuration-value`],`configuration-value`,`text`)},mode:c(e.mode,`mode`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Creating`,async()=>r.user.firewall.accessRules.create({...t})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await l(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let u=i({configuration:{target:c(e[`configuration-target`],`configuration-target`,`text`),value:c(e[`configuration-value`],`configuration-value`,`text`)},mode:c(e.mode,`mode`,`text`)});a(await s(`Creating`,async()=>r.user.firewall.accessRules.create({...u})),{successLabel:`Created`})}};function T(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const E={command:`delete <rule-id>`,describe:`Deletes an IP Access rule at the user level. Note: Deleting a user-level rule will affect all zones owned by the user.`,builder:T,handler:async e=>{if(e.dryRun){o({command:`cf user firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let n=await t(e);if(!await d({force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>n.user.firewall.accessRules.delete({rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the user level. You can only update the rule action (`mode` parameter) and notes.",builder:D,handler:async e=>{if(e.dryRun){o({command:`cf user firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({mode:c(e.mode,`mode`,`text`),notes:c(e.notes,`notes`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.firewall.accessRules.edit({...t,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let l=i({mode:c(e.mode,`mode`,`text`),notes:c(e.notes,`notes`,`text`)});a(await s(`Updating`,async()=>r.user.firewall.accessRules.edit({...l,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function k(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
4
- Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Fetches IP Access rules of the user. You can filter the results using several optional parameters.`,builder:f(k),handler:async e=>{let n={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){o({command:`cf user firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.firewall.accessRules.list(n)),{successLabel:`Loaded`})}},j={command:`access-rules`,describe:`Firewall operations`,builder:e=>e.command(w).command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`firewall`,describe:`Operations for firewall`,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})}const P={command:`get`,describe:`Retrieves detailed information about the currently authenticated user, including email, name, and account memberships.`,builder:N,handler:async e=>{if(e.dryRun){o({command:`cf user get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user`,pathParams:{},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.get()),{successLabel:`Loaded`})}};function F(e){return e.option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`create`,describe:`Create a configured monitor.`,builder:F,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors`,pathParams:{},bodyKind:`json`,body:e.body===void 0?i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Creating`,async()=>r.user.loadBalancers.monitors.create({...t})),{successLabel:`Created`});return}let l=i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)});a(await s(`Creating`,async()=>r.user.loadBalancers.monitors.create({...l})),{successLabel:`Created`})}};function L(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const R={command:`delete <monitor-id>`,describe:`Delete a configured monitor.`,builder:L,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let n=await t(e);if(!await d({force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}a(await s(`Deleting`,async()=>n.user.loadBalancers.monitors.delete({monitor_id:e[`monitor-id`]})),{successLabel:`Deleted`})}};function z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`edit <monitor-id>`,describe:`Apply changes to an existing monitor, overwriting the supplied properties.`,builder:z,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.loadBalancers.monitors.edit({body:t,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`});return}let l=i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)});a(await s(`Updating`,async()=>r.user.loadBalancers.monitors.edit({body:l,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`})}};function V(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <monitor-id>`,describe:`List a single configured monitor for a user.`,builder:V,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.monitors.get({monitor_id:e[`monitor-id`]})),{successLabel:`Loaded`})}};function U(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`List configured monitors for a user.`,builder:U,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors`,pathParams:{},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.monitors.list()),{successLabel:`Loaded`})}};function G(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`create <monitor-id>`,describe:`Preview pools using the specified monitor with provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:G,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}/preview`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Creating`,async()=>r.user.loadBalancers.monitors.preview.create({body:t,monitor_id:e[`monitor-id`]})),{successLabel:`Created`});return}let l=i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)});a(await s(`Creating`,async()=>r.user.loadBalancers.monitors.preview.create({body:l,monitor_id:e[`monitor-id`]})),{successLabel:`Created`})}},q={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`list`,describe:`Get the list of resources that reference the provided monitor.`,builder:J,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors references list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}/references`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.monitors.references.list({monitor_id:e[`monitor-id`]})),{successLabel:`Loaded`})}},X={command:`references`,describe:`Load Balancers operations`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).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:`update <monitor-id>`,describe:`Modify a configured monitor.`,builder:Z,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers monitors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.loadBalancers.monitors.update({body:t,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`});return}let l=i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)});a(await s(`Updating`,async()=>r.user.loadBalancers.monitors.update({body:l,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`})}},ne={command:`monitors`,describe:`Load Balancers operations`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).command(Q).command(q).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`,default:``}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`,default:!0}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`,default:0}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`hash`}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`,default:1}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`,default:``}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`],default:`random`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`create`,describe:`Create a new pool.`,builder:re,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:e.body===void 0?i({check_regions:e[`check-regions`],description:c(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:c(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:c(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:c(e.monitor,`monitor`,`text`),monitor_group:c(e[`monitor-group`],`monitor-group`,`text`),name:c(e.name,`name`,`text`),networks:e.networks,notification_email:c(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:c(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Creating`,async()=>r.user.loadBalancers.pools.create({...t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await u(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let l=i({check_regions:e[`check-regions`],description:c(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:c(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:c(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:c(e.monitor,`monitor`,`text`),monitor_group:c(e[`monitor-group`],`monitor-group`,`text`),name:c(e.name,`name`,`text`),networks:e.networks,notification_email:c(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:c(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}});a(await s(`Creating`,async()=>r.user.loadBalancers.pools.create({...l})),{successLabel:`Created`})}};function ae(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const oe={command:`delete <pool-id>`,describe:`Delete a configured pool.`,builder:ae,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let n=await t(e);if(!await d({force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}a(await s(`Deleting`,async()=>n.user.loadBalancers.pools.delete({pool_id:e[`pool-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`pool <pool-id>`,describe:`Apply changes to an existing pool, overwriting the supplied properties.`,builder:se,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools edit pools pool`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({check_regions:e[`check-regions`],description:c(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:c(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:c(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:c(e.monitor,`monitor`,`text`),monitor_group:c(e[`monitor-group`],`monitor-group`,`text`),name:c(e.name,`name`,`text`),notification_email:c(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:c(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.loadBalancers.pools.edit.pools.pool({...t,pool_id:e[`pool-id`]})),{successLabel:`Updated`});return}let l=i({check_regions:e[`check-regions`],description:c(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:c(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:c(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:c(e.monitor,`monitor`,`text`),monitor_group:c(e[`monitor-group`],`monitor-group`,`text`),name:c(e.name,`name`,`text`),notification_email:c(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:c(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}});a(await s(`Updating`,async()=>r.user.loadBalancers.pools.edit.pools.pool({...l,pool_id:e[`pool-id`]})),{successLabel:`Updated`})}};function le(e){return e.option(`notification-email`,{type:`string`,description:'The email address to send health status notifications to. This field is now deprecated in favor of Cloudflare Notifications for Load Balancing, so only resetting this field with an empty string `""` is accepted.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`pools`,describe:"Apply changes to a number of existing pools, overwriting the supplied properties. Pools are ordered by ascending `name`. Returns the list of affected pools. Supports the standard pagination query parameters, either `limit`/`offset` or `per_page`/`page`.",builder:le,handler:async l=>{if(l.dryRun){o({command:`cf user load-balancers pools edit pools pools`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:l.body===void 0?i({notification_email:c(l[`notification-email`],`notification-email`,`text`)}):n(l.body)});return}let u=await t(l);if(l.body){let t=n(l.body);a(await s(`Updating`,async()=>e(u,`PATCH`,`/user/load_balancers/pools`,{body:t})),{successLabel:`Updated`});return}let d={};l[`notification-email`]!==void 0&&r(d,[`notification_email`],c(l[`notification-email`],`notification-email`,`text`)),a(await s(`Updating`,async()=>e(u,`PATCH`,`/user/load_balancers/pools`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},de={command:`pools`,describe:`Load Balancers operations`,builder:e=>e.command(ce).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`edit`,describe:`Operations for load-balancers.pools.edit`,builder:e=>e.command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`get <pool-id>`,describe:`Fetch a single configured pool.`,builder:pe,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.pools.get({pool_id:e[`pool-id`]})),{successLabel:`Loaded`})}};function he(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <pool-id>`,describe:`Fetch the latest pool health status for a single pool.`,builder:he,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools health get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}/health`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.pools.health.get({pool_id:e[`pool-id`]})),{successLabel:`Loaded`})}},_e={command:`health`,describe:`Load Balancers operations`,builder:e=>e.command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return e.option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`list`,describe:`List configured pools.`,builder:ve,handler:async e=>{let n={monitor:e.monitor};if(e.dryRun){o({command:`cf user load-balancers pools list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.loadBalancers.pools.list(n)),{successLabel:`Loaded`})}};function be(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const xe={command:`create <pool-id>`,describe:`Preview pool health using provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:be,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}/preview`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Creating`,async()=>r.user.loadBalancers.pools.preview.create({body:t,pool_id:e[`pool-id`]})),{successLabel:`Created`});return}let l=i({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:c(e.description,`description`,`text`),expected_body:c(e[`expected-body`],`expected-body`,`text`),expected_codes:c(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:c(e.method,`method`,`text`),path:c(e.path,`path`,`text`),port:e.port,probe_zone:c(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:c(e.type,`type`,`text`)});a(await s(`Creating`,async()=>r.user.loadBalancers.pools.preview.create({body:l,pool_id:e[`pool-id`]})),{successLabel:`Created`})}},Se={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.option(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`list`,describe:`Get the list of resources that reference the provided pool.`,builder:Ce,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools references list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}/references`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.pools.references.list({pool_id:e[`pool-id`]})),{successLabel:`Loaded`})}},Te={command:`references`,describe:`Load Balancers operations`,builder:e=>e.command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).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 De={command:`update <pool-id>`,describe:`Modify a configured pool.`,builder:Ee,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers pools update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({check_regions:e[`check-regions`],description:c(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:c(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:c(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:c(e.monitor,`monitor`,`text`),monitor_group:c(e[`monitor-group`],`monitor-group`,`text`),name:c(e.name,`name`,`text`),networks:e.networks,notification_email:c(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:c(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.loadBalancers.pools.update({...t,pool_id:e[`pool-id`]})),{successLabel:`Updated`});return}e.name===void 0&&(e.name=await u(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let l=i({check_regions:e[`check-regions`],description:c(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:c(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:c(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:c(e.monitor,`monitor`,`text`),monitor_group:c(e[`monitor-group`],`monitor-group`,`text`),name:c(e.name,`name`,`text`),networks:e.networks,notification_email:c(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:c(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}});a(await s(`Updating`,async()=>r.user.loadBalancers.pools.update({...l,pool_id:e[`pool-id`]})),{successLabel:`Updated`})}},Oe={command:`pools`,describe:`Load Balancers operations`,builder:e=>e.command(ie).command(oe).command(me).command(ye).command(De).command(fe).command(_e).command(Se).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`preview-id`,{type:`string`,description:`Preview ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <preview-id>`,describe:`Get the result of a previous preview operation using the provided preview_id.`,builder:ke,handler:async e=>{if(e.dryRun){o({command:`cf user load-balancers preview get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/preview/${e[`preview-id`]==null?`<preview-id>`:encodeURIComponent(String(e[`preview-id`]))}`,pathParams:{"preview-id":String(e[`preview-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.loadBalancers.preview.get({preview_id:e[`preview-id`]})),{successLabel:`Loaded`})}},je={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Me={command:`load-balancers`,describe:`Operations for load-balancers`,builder:e=>e.command(ne).command(Oe).command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ne(e){return e.option(`until`,{type:`string`,description:`End date and time of requesting data period in the ISO8601 format.`}).option(`pool-name`,{type:`string`,description:`The name for the pool to filter.`}).option(`origin-healthy`,{type:`boolean`,description:`If true, filter events where the origin status is healthy. If false, filter events where the origin status is unhealthy.`}).option(`pool-id`,{type:`string`,description:`Pool ID`}).option(`since`,{type:`string`,description:`Start date and time of requesting data period in the ISO8601 format.`}).option(`origin-name`,{type:`string`,description:`The name for the origin to filter.`}).option(`pool-healthy`,{type:`boolean`,description:`If true, filter events where the pool status is healthy. If false, filter events where the pool status is unhealthy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:`List origin health changes.`,builder:Ne,handler:async e=>{let n={until:e.until,pool_name:e[`pool-name`],origin_healthy:e[`origin-healthy`],pool_id:e[`pool-id`],since:e.since,origin_name:e[`origin-name`],pool_healthy:e[`pool-healthy`]};if(e.dryRun){o({command:`cf user load-balancing-analytics events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancing_analytics/events`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.loadBalancingAnalytics.events.list(n)),{successLabel:`Loaded`})}},Fe={command:`events`,describe:`Load Balancing Analytics operations`,builder:e=>e.command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ie={command:`load-balancing-analytics`,describe:`Operations for load-balancing-analytics`,builder:e=>e.command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Le(e){return e.positional(`identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Re={command:`delete <identifier>`,describe:`Deletes a user's subscription.`,builder:Le,handler:async e=>{if(e.dryRun){o({command:`cf user subscriptions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/subscriptions/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`none`});return}let n=await t(e);if(!await d({force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}a(await s(`Deleting`,async()=>n.user.subscriptions.delete({identifier:e.identifier})),{successLabel:`Deleted`})}};function ze(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Be={command:`get`,describe:`Lists all of a user's subscriptions.`,builder:ze,handler:async e=>{if(e.dryRun){o({command:`cf user subscriptions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/subscriptions`,pathParams:{},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.subscriptions.get()),{successLabel:`Loaded`})}};function Ve(e){return e.positional(`identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`app-install-id`,{type:`string`,description:`app install id.`}).option(`frequency`,{type:`string`,description:`How often the subscription is renewed automatically.`,choices:[`weekly`,`monthly`,`quarterly`,`yearly`]}).option(`rate-plan-currency`,{type:`string`,description:`The currency applied to the rate plan subscription.`}).option(`rate-plan-externally-managed`,{type:`boolean`,description:`Whether this rate plan is managed externally from Cloudflare.`}).option(`rate-plan-id`,{type:`string`,description:`The ID of the rate plan.`}).option(`rate-plan-is-contract`,{type:`boolean`,description:`Whether a rate plan is enterprise-based (or newly adopted term contract).`}).option(`rate-plan-public-name`,{type:`string`,description:`The full name of the rate plan.`}).option(`rate-plan-scope`,{type:`string`,description:`The scope that this rate plan applies to.`}).option(`rate-plan-sets`,{type:`string`,array:!0,description:`The list of sets this rate plan applies to. Returns array of strings.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const He={command:`update <identifier>`,describe:`Updates a user's subscriptions.`,builder:Ve,handler:async e=>{if(e.dryRun){o({command:`cf user subscriptions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/subscriptions/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``)},bodyKind:`json`,body:e.body===void 0?i({app:{install_id:c(e[`app-install-id`],`app-install-id`,`text`)},frequency:c(e.frequency,`frequency`,`text`),rate_plan:{currency:c(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:c(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:c(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:c(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.subscriptions.update({body:t,identifier:e.identifier})),{successLabel:`Updated`});return}let l=i({app:{install_id:c(e[`app-install-id`],`app-install-id`,`text`)},frequency:c(e.frequency,`frequency`,`text`),rate_plan:{currency:c(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:c(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:c(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:c(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}});a(await s(`Updating`,async()=>r.user.subscriptions.update({body:l,identifier:e.identifier})),{successLabel:`Updated`})}},Ue={command:`subscriptions`,describe:`View and manage zone-level plan subscriptions owned by your user`,builder:e=>e.command(Re).command(Be).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ge={command:`list`,describe:`Retrieves list of tenants the authenticated user / method has access to.`,builder:We,handler:async e=>{if(e.dryRun){o({command:`cf user tenants list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/tenants`,pathParams:{},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.tenants.list()),{successLabel:`Loaded`})}},Ke={command:`tenants`,describe:`Operations for tenants`,builder:e=>e.command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qe(e){return e.option(`condition-request-ip-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`condition-request-ip-not-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`expires-on`,{type:`string`,description:`The expiration time on or after which the JWT MUST NOT be accepted for processing.`}).option(`name`,{type:`string`,description:`Token name.`}).option(`not-before`,{type:`string`,description:`The time before which the token MUST NOT be accepted for processing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Je={command:`create`,describe:`Create a new access token.`,builder:qe,handler:async e=>{if(e.dryRun){o({command:`cf user tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/tokens`,pathParams:{},bodyKind:`json`,body:e.body===void 0?i({condition:{request_ip:{in:e[`condition-request-ip-in`],not_in:e[`condition-request-ip-not-in`]}},expires_on:c(e[`expires-on`],`expires-on`,`text`),name:c(e.name,`name`,`text`),not_before:c(e[`not-before`],`not-before`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Creating`,async()=>r.user.tokens.create({...t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await u(`name`,`Token name.`));let l=i({condition:{request_ip:{in:e[`condition-request-ip-in`],not_in:e[`condition-request-ip-not-in`]}},expires_on:c(e[`expires-on`],`expires-on`,`text`),name:c(e.name,`name`,`text`),not_before:c(e[`not-before`],`not-before`,`text`)});a(await s(`Creating`,async()=>r.user.tokens.create({...l})),{successLabel:`Created`})}};function Ye(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Xe={command:`delete <token-id>`,describe:`Destroy a token.`,builder:Ye,handler:async e=>{if(e.dryRun){o({command:`cf user tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let n=await t(e);if(!await d({force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}a(await s(`Deleting`,async()=>n.user.tokens.delete({token_id:e[`token-id`]})),{successLabel:`Deleted`})}};function Ze(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qe={command:`get <token-id>`,describe:`Get information about a specific token.`,builder:Ze,handler:async e=>{if(e.dryRun){o({command:`cf user tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.tokens.get({token_id:e[`token-id`]})),{successLabel:`Loaded`})}};function $e(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`include-expired`,{type:`boolean`,description:`When true, includes recently-expired tokens in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const et={command:`list`,describe:`List all access tokens you created. Results include active, disabled, and recently-expired tokens when include_expired is set to true.`,builder:f($e),handler:async e=>{let n={page:e.page,per_page:e[`per-page`],direction:e.direction,include_expired:e[`include-expired`]};if(e.dryRun){o({command:`cf user tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.tokens.list(n)),{successLabel:`Loaded`})}};function tt(e){return e.option(`name`,{type:`string`,description:`Filter by the name of the permission group.
9
- The value must be URL-encoded.`}).option(`scope`,{type:`string`,description:`Filter by the scope of the permission group.
10
- The value must be URL-encoded.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Find all available permission groups for API Tokens.`,builder:tt,handler:async e=>{let n={name:e.name,scope:e.scope};if(e.dryRun){o({command:`cf user tokens permission-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/tokens/permission_groups`,pathParams:{},query:n,bodyKind:`none`});return}let r=await t(e);a(await s(`Loading`,async()=>r.user.tokens.permissionGroups.list(n)),{successLabel:`Loaded`})}},nt={command:`permission-groups`,describe:`Create and manage personal API tokens scoped to your user for programmatic API access`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rt(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`condition-request-ip-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`condition-request-ip-not-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`expires-on`,{type:`string`,description:`The expiration time on or after which the JWT MUST NOT be accepted for processing.`}).option(`name`,{type:`string`,description:`Token name.`}).option(`not-before`,{type:`string`,description:`The time before which the token MUST NOT be accepted for processing.`}).option(`status`,{type:`string`,description:`Status of the token.`,choices:[`active`,`disabled`,`expired`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const it={command:`update <token-id>`,describe:`Update an existing token.`,builder:rt,handler:async e=>{if(e.dryRun){o({command:`cf user tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({condition:{request_ip:{in:e[`condition-request-ip-in`],not_in:e[`condition-request-ip-not-in`]}},expires_on:c(e[`expires-on`],`expires-on`,`text`),name:c(e.name,`name`,`text`),not_before:c(e[`not-before`],`not-before`,`text`),status:c(e.status,`status`,`text`)}):n(e.body)});return}let r=await t(e);if(e.body){let t=n(e.body);a(await s(`Updating`,async()=>r.user.tokens.update({body:t,token_id:e[`token-id`]})),{successLabel:`Updated`});return}e.name===void 0&&(e.name=await u(`name`,`Token name.`));let l=i({condition:{request_ip:{in:e[`condition-request-ip-in`],not_in:e[`condition-request-ip-not-in`]}},expires_on:c(e[`expires-on`],`expires-on`,`text`),name:c(e.name,`name`,`text`),not_before:c(e[`not-before`],`not-before`,`text`),status:c(e.status,`status`,`text`)});a(await s(`Updating`,async()=>r.user.tokens.update({body:l,token_id:e[`token-id`]})),{successLabel:`Updated`})}};function at(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ot={command:`update <token-id>`,describe:`Roll the token secret.`,builder:at,handler:async e=>{if(e.dryRun){o({command:`cf user tokens value update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}/value`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let n=await t(e);a(await s(`Updating`,async()=>n.user.tokens.value.update({token_id:e[`token-id`]})),{successLabel:`Updated`})}},st={command:`value`,describe:`Create and manage personal API tokens scoped to your user for programmatic API access`,builder:e=>e.command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ct(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lt={command:`verify`,describe:`Test whether a token works.`,builder:ct,handler:async e=>{if(e.dryRun){o({command:`cf user tokens verify`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/tokens/verify`,pathParams:{},bodyKind:`none`});return}let n=await t(e);a(await s(`Loading`,async()=>n.user.tokens.verify()),{successLabel:`Loaded`})}},ut={command:`tokens`,describe:`Create and manage personal API tokens scoped to your user for programmatic API access`,builder:e=>e.command(Je).command(Xe).command(Qe).command(et).command(it).command(lt).command(nt).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},dt={command:`user`,describe:`Your Cloudflare user profile, invitations, organizations, billing, and personal API tokens`,builder:e=>e.command(S).command(P).command(p).command(b).command(M).command(Me).command(Ie).command(Ue).command(Ke).command(ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{dt as default};