cf 0.0.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r,r as i}from"./input-validation-BpVQi9rR.mjs";import{n as a,t as o}from"./body-parser-iA3vRFmh.mjs";import{t as s}from"./output-CqGQp2r6.mjs";import{t as c}from"./dry-run-FV0pZwdg.mjs";import{t as l}from"./progress-5sHFvwez.mjs";const u={command:`create`,describe:`Creates a new rate limit for a zone. Refer to the object definition for a list of required attributes.`,builder:e=>e.option(`match-request-methods`,{type:`string`,array:!0,description:"The HTTP methods to match. You can specify a subset (for example, `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when creating a rate limit."}).option(`match-request-schemes`,{type:`string`,array:!0,description:"The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is optional."}).option(`match-request-url`,{type:`string`,description:"The URL pattern to match, composed of a host and a path such as `example.org/path*`. Normalization is applied before the pattern is matched. `*` wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to `*` to match all traffic to your zone."}).option(`match-response-origin-traffic`,{type:`boolean`,description:`When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origin_traffic" to "false" to avoid legacy behaviour interacting with the "response_headers" property.`}).option(`period`,{type:`number`,description:`The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.`}).option(`threshold`,{type:`number`,description:"The threshold that will trigger the configured mitigation action. Configure this value along with the `period` property to establish a threshold per period."}).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)`}),handler:async e=>{if(e.dryRun){c({command:`cf rate-limits create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rate_limits`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{matchRequestMethods:e.matchRequestMethods,matchRequestSchemes:e.matchRequestSchemes,matchRequestUrl:e.matchRequestUrl,matchResponseOriginTraffic:e.matchResponseOriginTraffic,period:e.period,threshold:e.threshold,body:e.body},validation:`passed`});return}let i=await t(e);if(e.zoneId=await n({zone:e.zone},i,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Creating rate limit`,async()=>i.post(`/zones/${e.zoneId}/rate_limits`,{body:t})),{successLabel:`Created rate limit`});return}if(e.period===void 0)throw Error(`--period is required (or pass --body with this field set).`);if(e.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let u={};e.matchRequestMethods!==void 0&&a(u,[`match`,`request`,`methods`],e.matchRequestMethods),e.matchRequestSchemes!==void 0&&a(u,[`match`,`request`,`schemes`],e.matchRequestSchemes),e.matchRequestUrl!==void 0&&a(u,[`match`,`request`,`url`],r(e.matchRequestUrl,`matchRequestUrl`,`text`)),e.matchResponseOriginTraffic!==void 0&&a(u,[`match`,`response`,`origin_traffic`],e.matchResponseOriginTraffic),e.period!==void 0&&a(u,[`period`],e.period),e.threshold!==void 0&&a(u,[`threshold`],e.threshold),s(await l(`Creating rate limit`,async()=>i.post(`/zones/${e.zoneId}/rate_limits`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created rate limit`})}},d={command:`delete <rateLimitId>`,describe:`Deletes an existing rate limit.`,builder:e=>e.positional(`rateLimitId`,{type:`string`,description:`Defines the unique identifier of the rate limit.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(i(r.rateLimitId,`rateLimitId`),r.dryRun){c({command:`cf rate-limits delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/rate_limits/${r.rateLimitId??`<rateLimitId>`}`,pathParams:{rateLimitId:String(r.rateLimitId??``),zoneId:String(r.zoneId??``)},bodyKind:`json`,body:{body:r.body},validation:`passed`});return}let a=await t(r),u=await n({zone:r.zone},a,{quiet:r.quiet});if(r.zoneId=u,!await e(`rate limit`,String(r.rateLimitId??``),{force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}if(r.body){let e=o(r.body);s(await l(`Deleting rate limit`,async()=>a.delete(`/zones/${r.zoneId}/rate_limits/${r.rateLimitId}`,{body:e})),{successLabel:`Deleted rate limit`});return}s(await l(`Deleting rate limit`,async()=>a.rateLimits.delete(r.rateLimitId,u)),{successLabel:`Deleted rate limit`})}},f={command:`edit <rateLimitId>`,describe:`Updates an existing rate limit.`,builder:e=>e.positional(`rateLimitId`,{type:`string`,description:`Defines the unique identifier of the rate limit.`,demandOption:!0}).option(`match-request-methods`,{type:`string`,array:!0,description:"The HTTP methods to match. You can specify a subset (for example, `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when creating a rate limit."}).option(`match-request-schemes`,{type:`string`,array:!0,description:"The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is optional."}).option(`match-request-url`,{type:`string`,description:"The URL pattern to match, composed of a host and a path such as `example.org/path*`. Normalization is applied before the pattern is matched. `*` wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to `*` to match all traffic to your zone."}).option(`match-response-origin-traffic`,{type:`boolean`,description:`When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origin_traffic" to "false" to avoid legacy behaviour interacting with the "response_headers" property.`}).option(`period`,{type:`number`,description:`The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.`}).option(`threshold`,{type:`number`,description:"The threshold that will trigger the configured mitigation action. Configure this value along with the `period` property to establish a threshold per period."}).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)`}),handler:async e=>{if(i(e.rateLimitId,`rateLimitId`),e.dryRun){c({command:`cf rate-limits edit`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rate_limits/${e.rateLimitId??`<rateLimitId>`}`,pathParams:{rateLimitId:String(e.rateLimitId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{matchRequestMethods:e.matchRequestMethods,matchRequestSchemes:e.matchRequestSchemes,matchRequestUrl:e.matchRequestUrl,matchResponseOriginTraffic:e.matchResponseOriginTraffic,period:e.period,threshold:e.threshold,body:e.body},validation:`passed`});return}let u=await t(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Updating rate limit`,async()=>u.put(`/zones/${e.zoneId}/rate_limits/${e.rateLimitId}`,{body:t})),{successLabel:`Updated rate limit`});return}if(e.period===void 0)throw Error(`--period is required (or pass --body with this field set).`);if(e.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let d={};e.matchRequestMethods!==void 0&&a(d,[`match`,`request`,`methods`],e.matchRequestMethods),e.matchRequestSchemes!==void 0&&a(d,[`match`,`request`,`schemes`],e.matchRequestSchemes),e.matchRequestUrl!==void 0&&a(d,[`match`,`request`,`url`],r(e.matchRequestUrl,`matchRequestUrl`,`text`)),e.matchResponseOriginTraffic!==void 0&&a(d,[`match`,`response`,`origin_traffic`],e.matchResponseOriginTraffic),e.period!==void 0&&a(d,[`period`],e.period),e.threshold!==void 0&&a(d,[`threshold`],e.threshold),s(await l(`Updating rate limit`,async()=>u.put(`/zones/${e.zoneId}/rate_limits/${e.rateLimitId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated rate limit`})}},p={command:`get <rateLimitId>`,describe:`Fetches the details of a rate limit.`,builder:e=>e.positional(`rateLimitId`,{type:`string`,description:`Defines the unique identifier of the rate limit.`,demandOption:!0}),handler:async e=>{i(e.rateLimitId,`rateLimitId`);let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading rate limit`,async()=>r.rateLimits.get(e.rateLimitId,a)),{successLabel:`Loaded rate limit`})}},m={command:`list`,describe:`Fetches the rate limits for a zone.`,builder:e=>e.option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:"Defines the maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage);let i=await t(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading rate limits`,async()=>i.rateLimits.list(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded rate limits`})}},h={command:`rate-limits`,describe:`Legacy per-zone rate limiting rules — prefer Advanced Rate Limiting in Rulesets for new configurations`,builder:e=>e.command(u).command(d).command(f).command(p).command(m).demandCommand(1),handler:()=>{}};export{h as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{i as e}from"./session-Dxi_LbAk.mjs";import{E as t,n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./local-OqhVQbv0.mjs";async function i(i,a=`GET`,o){let s=`${process.env.CLOUDFLARE_BASE_URL??`https://api.cloudflare.com/client/v4`}${i}`,c={...t()},l=globalThis.fetch;o===void 0?c.Authorization=`Bearer ${await n()}`:l=r({endpoint:o});let u=await l(s,{method:a,headers:c});if(!u.ok){let t=u.headers.get(`content-type`)??``,n;try{n=t.includes(`application/json`)?await u.json():await u.text()}catch{n=null}throw new e(`API request failed with status ${u.status}`,u.status,n,{method:a,url:s})}let d=await u.arrayBuffer();return Buffer.from(d)}function a(e){process.stdout.write(e)}export{a as n,i as t};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create-poll <meetingId>`,describe:`Creates a new poll in an active session for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a new poll`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit active-session create-poll`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-session/poll`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating active session`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/poll`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created active session`});return}u(await p(`Creating active session`,async()=>n.realtimeKit.activeSession.createPoll(i,t.appId,t.meetingId)),{successLabel:`Created active session`})}},h={command:`get-active-session <meetingId>`,describe:`Returns details of an ongoing active session for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}),handler:async e=>{s(e.meetingId,`meetingId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading active session`,async()=>t.realtimeKit.activeSession.getActiveSession(e.meetingId,n,e.appId)),{successLabel:`Loaded active session`})}},ee={command:`kick-all-participants <meetingId>`,describe:`Kicks all participants from an active session for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit active-session kick-all-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-session/kick-all`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating active session`,async()=>n.realtimeKit.activeSession.kickAllParticipants(i,t.appId,t.meetingId)),{successLabel:`Created active session`})}},te={command:`kick-participants <meetingId>`,describe:`Kicks one or more participants from an active session using user ID or custom participant ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for kicking participants from an active session. Only one of `participant_id` or `custom_participant_id` is required."}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit active-session kick-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-session/kick`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating active session`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/kick`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created active session`});return}u(await p(`Creating active session`,async()=>n.realtimeKit.activeSession.kickParticipants(i,t.appId,t.meetingId)),{successLabel:`Created active session`})}},g={command:`active-session`,describe:`Currently active meeting sessions with live participant counts and controls`,builder:e=>e.command(m).command(h).command(ee).command(te).demandCommand(1),handler:()=>{}},_={command:`get-org-analytics <appId>`,describe:`Returns day-wise session and recording analytics data of an App for the specified time range start_date to end_date. If start_date and end_date are not provided, the default time range is set from 30 days ago to the current date.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-date`,{type:`string`,description:`start date in YYYY-MM-DD format`}).option(`end-date`,{type:`string`,description:`end date in YYYY-MM-DD format`}),handler:async e=>{s(e.appId,`appId`);let t={};e.startDate!==void 0&&(t.start_date=e.startDate),e.endDate!==void 0&&(t.end_date=e.endDate);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading analytic`,async()=>n.realtimeKit.analytics.getOrgAnalytics(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded analytic`})}},v={command:`analytics`,describe:`Usage analytics — meeting minutes, participant counts, and bandwidth consumption`,builder:e=>e.command(_).demandCommand(1),handler:()=>{}},y={command:`get`,describe:`Fetch all apps for your account`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading app`,async()=>t.realtimeKit.apps.get(n)),{successLabel:`Loaded app`})}},b={command:`post`,describe:`Create new app for your account`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit apps post`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/apps`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating app`,async()=>n.post(`/accounts/${i}/realtime/kit/apps`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created app`});return}u(await p(`Creating app`,async()=>n.realtimeKit.apps.post(i)),{successLabel:`Created app`})}},x={command:`apps`,describe:`Realtime Kit applications that group meetings, sessions, and configuration together`,builder:e=>e.command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`create <meetingId>`,describe:`Mutes all participants of an active session for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for muting all participants in an active session.`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit kit meetings active-session mute-all create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-session/mute-all`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating mute all`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/mute-all`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created mute all`});return}u(await p(`Creating mute all`,async()=>n.realtimeKit.kit.meetings.activeSession.muteAll.create(i,t.appId,t.meetingId)),{successLabel:`Created mute all`})}},C={command:`mute-all`,describe:`Kit operations`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`create <meetingId>`,describe:`Mutes one or more participants from an active session using user ID or custom participant ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for kicking participants from an active session. Only one of `participant_id` or `custom_participant_id` is required."}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit kit meetings active-session mute create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-session/mute`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating mute`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/mute`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created mute`});return}u(await p(`Creating mute`,async()=>n.realtimeKit.kit.meetings.activeSession.mute.create(i,t.appId,t.meetingId)),{successLabel:`Created mute`})}},T={command:`mute`,describe:`Kit operations`,builder:e=>e.command(w).demandCommand(1),handler:()=>{}},E={command:`active-session`,describe:`Operations for kit.meetings.active-session`,builder:e=>e.command(T).command(C).demandCommand(1),handler:()=>{}},D={command:`get <meetingId>`,describe:"Returns livestream session details for the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}),handler:async e=>{s(e.meetingId,`meetingId`);let t={};e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading livestream`,async()=>n.realtimeKit.kit.meetings.livestream.get(e.meetingId,i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded livestream`})}},O={command:`livestream`,describe:`Kit operations`,builder:e=>e.command(D).demandCommand(1),handler:()=>{}},k={command:`meetings`,describe:`Operations for kit.meetings`,builder:e=>e.command(E).command(O).demandCommand(1),handler:()=>{}},A={command:`get <sessionId>`,describe:"Returns livestream session details for the given session ID. Retreive the session ID using the `Fetch all sessions of an App` API.",builder:e=>e.positional(`sessionId`,{type:`string`,description:`Session ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}),handler:async e=>{s(e.sessionId,`sessionId`);let t={};e.perPage!==void 0&&(t.per_page=e.perPage),e.pageNo!==void 0&&(t.page_no=e.pageNo);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading session`,async()=>n.realtimeKit.kit.sessions.livestream.sessions.get(i,e.appId,e.sessionId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded session`})}},j={command:`sessions`,describe:`Kit operations`,builder:e=>e.command(A).demandCommand(1),handler:()=>{}},M={command:`livestream`,describe:`Operations for kit.sessions.livestream`,builder:e=>e.command(j).demandCommand(1),handler:()=>{}},N={command:`sessions`,describe:`Operations for kit.sessions`,builder:e=>e.command(M).demandCommand(1),handler:()=>{}},P={command:`kit`,describe:`Operations for kit`,builder:e=>e.command(k).command(N).demandCommand(1),handler:()=>{}},F={command:`get-active-livestreams-for-livestream-id <livestreamId>`,describe:"Returns details of all active livestreams for the given livestream ID. Retreive the livestream ID using the `Start livestreaming a meeting` API.",builder:e=>e.positional(`livestreamId`,{type:`string`,description:`Livestream ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.livestreamId,`livestreamId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading livestream`,async()=>t.realtimeKit.livestreams.getActiveLivestreamsForLivestreamId(n,e.appId,e.livestreamId)),{successLabel:`Loaded livestream`})}},I={command:`get-all-livestreams`,describe:"Returns details of livestreams associated with the given App ID. It includes livestreams created by your App and RealtimeKit meetings that are livestreamed by your App. If you only want details of livestreams created by your App and not RealtimeKit meetings, you can use the `exclude_meetings` query parameter.",builder:e=>e.option(`exclude-meetings`,{type:`boolean`,description:`Exclude the RealtimeKit meetings that are livestreamed.`,default:!1}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`status`,{type:`string`,description:`Specifies the status of the operation.`,choices:[`LIVE`,`IDLE`,`ERRORED`,`INVOKED`]}).option(`start-time`,{type:`string`,description:`Specify the start time range in ISO format to access the live stream.`}).option(`end-time`,{type:`string`,description:`Specify the end time range in ISO format to access the live stream.`}).option(`sort-order`,{type:`string`,description:`Specifies the sorting order for the results.`,choices:[`ASC`,`DSC`]}),handler:async e=>{let t={};e.excludeMeetings!==void 0&&(t.exclude_meetings=e.excludeMeetings),e.perPage!==void 0&&(t.per_page=e.perPage),e.pageNo!==void 0&&(t.page_no=e.pageNo),e.status!==void 0&&(t.status=e.status),e.startTime!==void 0&&(t.start_time=e.startTime),e.endTime!==void 0&&(t.end_time=e.endTime),e.sortOrder!==void 0&&(t.sort_order=e.sortOrder);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading livestream`,async()=>n.realtimeKit.livestreams.getAllLivestreams(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded livestream`})}},L={command:`get-livestream-analytics-complete <appId>`,describe:`Returns livestream analytics for the specified time range.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-time`,{type:`string`,description:`Specify the start time range in ISO format to access the livestream analytics.`}).option(`end-time`,{type:`string`,description:`Specify the end time range in ISO format to access the livestream analytics.`}),handler:async e=>{s(e.appId,`appId`);let t={};e.startTime!==void 0&&(t.start_time=e.startTime),e.endTime!==void 0&&(t.end_time=e.endTime);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading livestream`,async()=>n.realtimeKit.livestreams.getLivestreamAnalyticsComplete(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded livestream`})}},R={command:`get-livestream-session-details-for-session-id <livestreamSessionId>`,describe:"Returns livestream session details for the given livestream session ID. Retrieve the `livestream_session_id`using the `Fetch livestream session details using a session ID` API.",builder:e=>e.positional(`livestreamSessionId`,{type:`string`,description:`Livestream-session-id`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.livestreamSessionId,`livestreamSessionId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading livestream`,async()=>t.realtimeKit.livestreams.getLivestreamSessionDetailsForSessionId(n,e.appId,e.livestreamSessionId)),{successLabel:`Loaded livestream`})}},z={command:`get-livestream-session-for-livestream-id <livestreamId>`,describe:"Returns details of a livestream with sessions for the given livestream ID. Retreive the livestream ID using the `Start livestreaming a meeting` API.",builder:e=>e.positional(`livestreamId`,{type:`string`,description:`Livestream ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}),handler:async e=>{s(e.livestreamId,`livestreamId`);let t={};e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading livestream`,async()=>n.realtimeKit.livestreams.getLivestreamSessionForLivestreamId(i,e.appId,e.livestreamId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded livestream`})}},B={command:`get-meeting-active-livestreams <meetingId>`,describe:`Returns details of all active livestreams for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}),handler:async e=>{s(e.meetingId,`meetingId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading livestream`,async()=>t.realtimeKit.livestreams.getMeetingActiveLivestreams(e.meetingId,n,e.appId)),{successLabel:`Loaded livestream`})}},V={command:`get-org-analytics <appId>`,describe:`Returns day-wise session and recording analytics data of an App for the specified time range start_date to end_date. If start_date and end_date are not provided, the default time range is set from 30 days ago to the current date.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-date`,{type:`string`,description:`start date in YYYY-MM-DD format`}).option(`end-date`,{type:`string`,description:`end date in YYYY-MM-DD format`}),handler:async e=>{s(e.appId,`appId`);let t={};e.startDate!==void 0&&(t.start_date=e.startDate),e.endDate!==void 0&&(t.end_date=e.endDate);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading livestream`,async()=>n.realtimeKit.livestreams.getOrgAnalytics(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded livestream`})}},H={command:`start-livestreaming-a-meeting <meetingId>`,describe:"Starts livestream of a meeting associated with the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`video-config-height`,{type:`number`,description:`Height of the livestreaming video in pixels`}).option(`video-config-width`,{type:`number`,description:`Width of the livestreaming video in pixels`}).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)`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit livestreams start-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/livestreams`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},bodyKind:`json`,body:{name:t.name,videoConfigHeight:t.videoConfigHeight,videoConfigWidth:t.videoConfigWidth,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating livestream`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/livestreams`,{body:e})),{successLabel:`Created livestream`});return}let m={};t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.videoConfigHeight!==void 0&&c(m,[`video_config`,`height`],t.videoConfigHeight),t.videoConfigWidth!==void 0&&c(m,[`video_config`,`width`],t.videoConfigWidth),u(await p(`Creating livestream`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/livestreams`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created livestream`})}},U={command:`stop-livestreaming-a-meeting <meetingId>`,describe:"Stops the active livestream of a meeting associated with the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit livestreams stop-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-livestream/stop`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),c=t.local?f:await r(n);if(t.accountId=c,!await i(`livestream`,String(t.meetingId??``),{force:!!t.force,message:`This operation halts an active live-stream. Viewers lose the broadcast immediately.`})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Deleting livestream`,async()=>n.post(`/accounts/${c}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-livestream/stop`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Deleted livestream`});return}u(await p(`Deleting livestream`,async()=>n.realtimeKit.livestreams.stopLivestreamingAMeeting(t.meetingId,c,t.appId)),{successLabel:`Deleted livestream`})}},W={command:`livestreams`,describe:`Live streaming from meetings to external platforms with stream key management`,builder:e=>e.command(F).command(I).command(L).command(R).command(z).command(B).command(V).command(H).command(U).demandCommand(1),handler:()=>{}},G={command:`add-participant <meetingId>`,describe:`Adds a participant to the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting. Fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,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)`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings add-participant`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/participants`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating meeting`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/participants`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created meeting`});return}u(await p(`Creating meeting`,async()=>n.realtimeKit.meetings.addParticipant(i,t.appId,t.meetingId)),{successLabel:`Created meeting`})}},K={command:`create <appId>`,describe:`Create a meeting for the given App ID.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create meeting body`}),handler:async t=>{if(s(t.appId,`appId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating meeting`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/meetings`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created meeting`});return}u(await p(`Creating meeting`,async()=>n.realtimeKit.meetings.create(i,t.appId)),{successLabel:`Created meeting`})}},q={command:`delete-meeting-participant <participantId>`,describe:`Deletes a participant for the given meeting and participant ID.`,builder:e=>e.positional(`participantId`,{type:`string`,description:`ID of the participant. You can fetch the participant ID using the add a participant API.`,demandOption:!0}).option(`meeting-id`,{type:`string`,description:`ID of the meeting. You can fetch the meeting ID using the create a meeting API.`,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}),handler:async t=>{if(s(t.participantId,`participantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings delete-meeting-participant`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/participants/${t.participantId??`<participantId>`}`,pathParams:{meetingId:String(t.meetingId??``),participantId:String(t.participantId??``),appId:String(t.appId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`meeting`,String(t.participantId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting meeting`,async()=>n.realtimeKit.meetings.deleteMeetingParticipant(t.meetingId,t.participantId,o,t.appId)),{successLabel:`Deleted meeting`})}},J={command:`edit-participant <participantId>`,describe:`Updates a participant's details for the given meeting and participant ID.`,builder:e=>e.positional(`participantId`,{type:`string`,description:`ID of the participant. You can fetch the participant ID using the add a participant API.`,demandOption:!0}).option(`meeting-id`,{type:`string`,description:`ID of the meeting. You can fetch the meeting ID using the create a meeting API.`,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)`}),handler:async t=>{if(s(t.participantId,`participantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings edit-participant`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/participants/${t.participantId??`<participantId>`}`,pathParams:{meetingId:String(t.meetingId??``),participantId:String(t.participantId??``),appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Updating meeting`,async()=>n.patch(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}/participants/${t.participantId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated meeting`});return}u(await p(`Updating meeting`,async()=>n.realtimeKit.meetings.editParticipant(t.meetingId,t.participantId,i,t.appId)),{successLabel:`Updated meeting`})}},Y={command:`get-meeting-by-id <meetingId>`,describe:`Returns a meeting details in an App for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting. Fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name`}),handler:async e=>{s(e.meetingId,`meetingId`);let t={};e.name!==void 0&&(t.name=e.name);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading meeting`,async()=>n.realtimeKit.meetings.getMeetingById(e.meetingId,i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded meeting`})}},X={command:`get-meeting-participant <participantId>`,describe:`Returns a participant details for the given meeting and participant ID.`,builder:e=>e.positional(`participantId`,{type:`string`,description:`ID of the participant. You can fetch the participant ID using the add a participant API.`,demandOption:!0}).option(`meeting-id`,{type:`string`,description:`ID of the meeting. You can fetch the meeting ID using the create a meeting API.`,demandOption:!0}),handler:async e=>{s(e.participantId,`participantId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading meeting`,async()=>t.realtimeKit.meetings.getMeetingParticipant(e.meetingId,e.participantId,n,e.appId)),{successLabel:`Loaded meeting`})}},Z={command:`get-meeting-participants <meetingId>`,describe:`Returns all participants detail for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting. Fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page`}),handler:async e=>{s(e.meetingId,`meetingId`);let t={};e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading meeting`,async()=>n.realtimeKit.meetings.getMeetingParticipants(i,e.appId,e.meetingId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded meeting`})}},Q={command:`get <appId>`,describe:`Returns all meetings for the given App ID.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page`}).option(`start-time`,{type:`string`,description:`The start time range for which you want to retrieve the meetings. The time must be specified in ISO format.`}).option(`end-time`,{type:`string`,description:`The end time range for which you want to retrieve the meetings. The time must be specified in ISO format.`}).option(`search`,{type:`string`,description:`The search query string. You can search using the meeting ID or title.`}),handler:async e=>{s(e.appId,`appId`);let t={};e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage),e.startTime!==void 0&&(t.start_time=e.startTime),e.endTime!==void 0&&(t.end_time=e.endTime),e.search!==void 0&&(t.search=e.search);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading meeting`,async()=>n.realtimeKit.meetings.get(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded meeting`})}},ne={command:`refresh-participant-token <participantId>`,describe:`Regenerates participant's authentication token for the given meeting and participant ID.`,builder:e=>e.positional(`participantId`,{type:`string`,description:`ID of the participant. You can fetch the participant ID using the add a participant API.`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`meeting-id`,{type:`string`,description:`ID of the meeting. You can fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.participantId,`participantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings refresh-participant-token`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/participants/${t.participantId??`<participantId>`}/token`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``),participantId:String(t.participantId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating meeting`,async()=>n.realtimeKit.meetings.refreshParticipantToken(i,t.appId,t.meetingId,t.participantId)),{successLabel:`Created meeting`})}},re={command:`replace-meeting-by-id <meetingId>`,describe:`Replaces all the details for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting. Fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create meeting body`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings replace-meeting-by-id`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Updating meeting`,async()=>n.put(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated meeting`});return}u(await p(`Updating meeting`,async()=>n.realtimeKit.meetings.replaceMeetingById(t.meetingId,i,t.appId)),{successLabel:`Updated meeting`})}},ie={command:`update-meeting-by-id <meetingId>`,describe:`Updates a meeting in an App for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting. Fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create meeting body`}),handler:async t=>{if(s(t.meetingId,`meetingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit meetings update-meeting-by-id`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Updating meeting`,async()=>n.patch(`/accounts/${i}/realtime/kit/${t.appId}/meetings/${t.meetingId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated meeting`});return}u(await p(`Updating meeting`,async()=>n.realtimeKit.meetings.updateMeetingById(t.meetingId,i,t.appId)),{successLabel:`Updated meeting`})}},ae={command:`meetings`,describe:`Video meetings with participant management, access tokens, and recording controls`,builder:e=>e.command(G).command(K).command(q).command(J).command(Q).command(Y).command(X).command(Z).command(ne).command(re).command(ie).demandCommand(1),handler:()=>{}},oe={command:`create <appId>`,describe:`Creates a preset belonging to the current App`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,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)`}),handler:async t=>{if(s(t.appId,`appId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit presets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/presets`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating preset`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/presets`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created preset`});return}u(await p(`Creating preset`,async()=>n.realtimeKit.presets.create(i,t.appId)),{successLabel:`Created preset`})}},se={command:`delete <presetId>`,describe:`Deletes a preset using the provided preset ID`,builder:e=>e.positional(`presetId`,{type:`string`,description:`ID of the preset to fetch`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app 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}),handler:async t=>{if(s(t.presetId,`presetId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit presets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/presets/${t.presetId??`<presetId>`}`,pathParams:{appId:String(t.appId??``),presetId:String(t.presetId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`preset`,String(t.presetId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}u(await p(`Deleting preset`,async()=>n.realtimeKit.presets.delete(o,t.appId,t.presetId)),{successLabel:`Deleted preset`})}},ce={command:`get-preset-by-id <presetId>`,describe:`Fetches details of a preset using the provided preset ID`,builder:e=>e.positional(`presetId`,{type:`string`,description:`ID of the preset to fetch`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.presetId,`presetId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading preset`,async()=>t.realtimeKit.presets.getPresetById(n,e.appId,e.presetId)),{successLabel:`Loaded preset`})}},le={command:`get <appId>`,describe:`Fetches all the presets belonging to an App.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}),handler:async e=>{s(e.appId,`appId`);let t={};e.perPage!==void 0&&(t.per_page=e.perPage),e.pageNo!==void 0&&(t.page_no=e.pageNo);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading preset`,async()=>n.realtimeKit.presets.get(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded preset`})}},ue={command:`update <presetId>`,describe:`Update a preset by the provided preset ID`,builder:e=>e.positional(`presetId`,{type:`string`,description:`ID of the preset to fetch`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,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)`}),handler:async t=>{if(s(t.presetId,`presetId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit presets update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/presets/${t.presetId??`<presetId>`}`,pathParams:{appId:String(t.appId??``),presetId:String(t.presetId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Updating preset`,async()=>n.patch(`/accounts/${i}/realtime/kit/${t.appId}/presets/${t.presetId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated preset`});return}u(await p(`Updating preset`,async()=>n.realtimeKit.presets.update(i,t.appId,t.presetId)),{successLabel:`Updated preset`})}},de={command:`presets`,describe:`Reusable meeting configuration presets for resolution, layout, and recording defaults`,builder:e=>e.command(oe).command(se).command(le).command(ce).command(ue).demandCommand(1),handler:()=>{}},fe={command:`get-active-recordings <meetingId>`,describe:`Returns the active recording details for the given meeting ID.`,builder:e=>e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.meetingId,`meetingId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading recording`,async()=>t.realtimeKit.recordings.getActiveRecordings(n,e.appId,e.meetingId)),{successLabel:`Loaded recording`})}},pe={command:`get-one-recording <recordingId>`,describe:`Returns details of a recording for the given recording ID.`,builder:e=>e.positional(`recordingId`,{type:`string`,description:`ID of the recording`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.recordingId,`recordingId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading recording`,async()=>t.realtimeKit.recordings.getOneRecording(n,e.appId,e.recordingId)),{successLabel:`Loaded recording`})}},me={command:`get-recordings <appId>`,describe:"Returns all recordings for an App. If the `meeting_id` parameter is passed, returns all recordings for the given meeting ID.",builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`meeting-id`,{type:`string`,description:`ID of a meeting. Optional. Will limit results to only this meeting if passed.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page`}).option(`expired`,{type:`boolean`,description:`If passed, only shows expired/non-expired recordings on RealtimeKit's bucket`,default:!1}).option(`search`,{type:`string`,description:`The search query string. You can search using the meeting ID or title.`}).option(`sort-by`,{type:`string`,description:`Sort by`,choices:[`invokedTime`]}).option(`sort-order`,{type:`string`,description:`Sort order`,choices:[`ASC`,`DESC`]}).option(`start-time`,{type:`string`,description:`The start time range for which you want to retrieve the meetings. The time must be specified in ISO format.`}).option(`end-time`,{type:`string`,description:`The end time range for which you want to retrieve the meetings. The time must be specified in ISO format.`}).option(`status`,{type:`string`,description:`Filter by one or more recording status`}),handler:async e=>{s(e.appId,`appId`);let t={};e.meetingId!==void 0&&(t.meeting_id=e.meetingId),e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage),e.expired!==void 0&&(t.expired=e.expired),e.search!==void 0&&(t.search=e.search),e.sortBy!==void 0&&(t.sort_by=e.sortBy),e.sortOrder!==void 0&&(t.sort_order=e.sortOrder),e.startTime!==void 0&&(t.start_time=e.startTime),e.endTime!==void 0&&(t.end_time=e.endTime),e.status!==void 0&&(t.status=e.status);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading recording`,async()=>n.realtimeKit.recordings.getRecordings(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded recording`})}},he={command:`pause-resume-stop-recording <recordingId>`,describe:`Pause/Resume/Stop a given recording ID.`,builder:e=>e.positional(`recordingId`,{type:`string`,description:`ID of the recording`,demandOption:!0}).option(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for an item.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`stop`,`pause`,`resume`]}).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)`}),handler:async t=>{if(s(t.recordingId,`recordingId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit recordings pause-resume-stop-recording`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings/${t.recordingId??`<recordingId>`}`,pathParams:{appId:String(t.appId??``),recordingId:String(t.recordingId??``)},bodyKind:`json`,body:{action:t.action,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Updating recording`,async()=>i.put(`/accounts/${m}/realtime/kit/${t.appId}/recordings/${t.recordingId}`,{body:e})),{successLabel:`Updated recording`});return}t.action===void 0&&(t.action=await n(`action`,``,[`stop`,`pause`,`resume`]));let h={};t.action!==void 0&&c(h,[`action`],o(t.action,`action`,`text`)),u(await p(`Updating recording`,async()=>i.put(`/accounts/${m}/realtime/kit/${t.appId}/recordings/${t.recordingId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated recording`})}},ge={command:`start-recordings <appId>`,describe:`Starts recording a meeting. The meeting can be started by an App admin directly, or a participant with permissions to start a recording, based on the type of authorization used.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,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)`}),handler:async t=>{if(s(t.appId,`appId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit recordings start-recordings`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating recording`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/recordings`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created recording`});return}u(await p(`Creating recording`,async()=>n.realtimeKit.recordings.startRecordings(i,t.appId)),{successLabel:`Created recording`})}},_e={command:`start-track-recording <appId>`,describe:`Starts a track recording in a meeting. Track recordings consist of "layers". Layers are used to map audio/video tracks in a meeting to output destinations. More information about track recordings is available in the [Track Recordings Guide Page](https://docs.realtime.cloudflare.com/guides/capabilities/recording/recording-overview).`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`For now only "default" layer key is supported.`}),handler:async t=>{if(s(t.appId,`appId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit recordings start-track-recording`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings/track`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating recording`,async()=>n.post(`/accounts/${i}/realtime/kit/${t.appId}/recordings/track`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created recording`});return}u(await p(`Creating recording`,async()=>n.realtimeKit.recordings.startTrackRecording(i,t.appId)),{successLabel:`Created recording`})}},ve={command:`recordings`,describe:`Meeting recordings — list, download, and manage recorded video and audio files`,builder:e=>e.command(fe).command(pe).command(me).command(he).command(ge).command(_e).demandCommand(1),handler:()=>{}},ye={command:`generate-summary-of-transcripts <sessionId>`,describe:`Trigger Summary generation of Transcripts for the session ID.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Session ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.sessionId,`sessionId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit sessions generate-summary-of-transcripts`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/summary`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating session`,async()=>n.realtimeKit.sessions.generateSummaryOfTranscripts(i,t.appId,t.sessionId)),{successLabel:`Created session`})}},be={command:`get-participant-data-from-peer-id <peerId>`,describe:`Returns details of the given peer ID along with call statistics for the given session ID.`,builder:e=>e.positional(`peerId`,{type:`string`,description:`ID of the peer`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`filters`,{type:`string`,description:`Comma separated list of filters to apply. Note that there must be no spaces between the filters.`,choices:[`device_info`,`ip_information`,`precall_network_information`,`events`,`quality_stats`]}),handler:async e=>{s(e.peerId,`peerId`);let t={};e.filters!==void 0&&(t.filters=e.filters);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading session`,async()=>n.realtimeKit.sessions.getParticipantDataFromPeerId(i,e.appId,e.peerId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded session`})}},xe={command:`get-session-chat <sessionId>`,describe:`Returns a URL to download all chat messages of the session ID in CSV format.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`ID of the session`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.sessionId,`sessionId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading session`,async()=>t.realtimeKit.sessions.getSessionChat(n,e.appId,e.sessionId)),{successLabel:`Loaded session`})}},Se={command:`get-session-details <sessionId>`,describe:`Returns data of the given session ID including recording details.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`ID of the session`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`include-breakout-rooms`,{type:`boolean`,description:`List all breakout rooms`,default:!1}),handler:async e=>{s(e.sessionId,`sessionId`);let t={};e.includeBreakoutRooms!==void 0&&(t.include_breakout_rooms=e.includeBreakoutRooms);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading session`,async()=>n.realtimeKit.sessions.getSessionDetails(i,e.appId,e.sessionId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded session`})}},Ce={command:`get-session-participant-details <participantId>`,describe:`Returns details of the given participant ID along with call statistics for the given session ID.`,builder:e=>e.positional(`participantId`,{type:`string`,description:`ID of the participant`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`ID of the session`,demandOption:!0}).option(`filters`,{type:`string`,description:`Comma separated list of filters to apply. Note that there must be no spaces between the filters.`,choices:[`device_info`,`ip_information`,`precall_network_information`,`events`,`quality_stats`]}).option(`include-peer-events`,{type:`boolean`,description:`if true, response includes all the peer events of participant.`,default:!1}),handler:async e=>{s(e.participantId,`participantId`);let t={};e.filters!==void 0&&(t.filters=e.filters),e.includePeerEvents!==void 0&&(t.include_peer_events=e.includePeerEvents);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading session`,async()=>n.realtimeKit.sessions.getSessionParticipantDetails(i,e.appId,e.participantId,e.sessionId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded session`})}},we={command:`get-session-participants <sessionId>`,describe:`Returns a list of participants for the given session ID.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`ID of the session`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`search`,{type:`string`,description:`The search query string. You can search using the meeting ID or title.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page`}).option(`sort-order`,{type:`string`,description:`Sort order`,choices:[`ASC`,`DESC`]}).option(`sort-by`,{type:`string`,description:`Sort by`,choices:[`joinedAt`,`duration`]}).option(`include-peer-events`,{type:`boolean`,description:`if true, response includes all the peer events of participants.`,default:!1}).option(`view`,{type:`string`,description:"In breakout room sessions, the view parameter can be set to `raw` for session specific duration for participants or `consolidated` to accumulate breakout room durations.",choices:[`raw`,`consolidated`]}),handler:async e=>{s(e.sessionId,`sessionId`);let t={};e.search!==void 0&&(t.search=e.search),e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage),e.sortOrder!==void 0&&(t.sort_order=e.sortOrder),e.sortBy!==void 0&&(t.sort_by=e.sortBy),e.includePeerEvents!==void 0&&(t.include_peer_events=e.includePeerEvents),e.view!==void 0&&(t.view=e.view);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading session`,async()=>n.realtimeKit.sessions.getSessionParticipants(i,e.appId,e.sessionId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded session`})}},Te={command:`get-session-summary <sessionId>`,describe:`Returns a Summary URL to download the Summary of Transcripts for the session ID as plain text.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Session ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.sessionId,`sessionId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading session`,async()=>t.realtimeKit.sessions.getSessionSummary(n,e.appId,e.sessionId)),{successLabel:`Loaded session`})}},Ee={command:`get-session-transcripts <sessionId>`,describe:`Returns a URL to download the transcript for the session ID in CSV format.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`ID of the session`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.sessionId,`sessionId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading session`,async()=>t.realtimeKit.sessions.getSessionTranscripts(n,e.appId,e.sessionId)),{successLabel:`Loaded session`})}},De={command:`get-sessions <appId>`,describe:`Returns details of all sessions of an App.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page`}).option(`sort-by`,{type:`string`,description:`Sort by`,choices:[`minutesConsumed`,`createdAt`]}).option(`sort-order`,{type:`string`,description:`Sort order`,choices:[`ASC`,`DESC`]}).option(`start-time`,{type:`string`,description:`The start time range for which you want to retrieve the meetings. The time must be specified in ISO format.`}).option(`end-time`,{type:`string`,description:`The end time range for which you want to retrieve the meetings. The time must be specified in ISO format.`}).option(`participants`,{type:`string`,description:`Participants`}).option(`status`,{type:`string`,description:`Status`,choices:[`LIVE`,`ENDED`]}).option(`search`,{type:`string`,description:`Search string that matches sessions based on meeting title, meeting ID, and session ID`}).option(`associated-id`,{type:`string`,description:`ID of the meeting that sessions should be associated with`}),handler:async e=>{s(e.appId,`appId`);let t={};e.pageNo!==void 0&&(t.page_no=e.pageNo),e.perPage!==void 0&&(t.per_page=e.perPage),e.sortBy!==void 0&&(t.sort_by=e.sortBy),e.sortOrder!==void 0&&(t.sort_order=e.sortOrder),e.startTime!==void 0&&(t.start_time=e.startTime),e.endTime!==void 0&&(t.end_time=e.endTime),e.participants!==void 0&&(t.participants=e.participants),e.status!==void 0&&(t.status=e.status),e.search!==void 0&&(t.search=e.search),e.associatedId!==void 0&&(t.associated_id=e.associatedId);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading session`,async()=>n.realtimeKit.sessions.getSessions(i,e.appId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded session`})}},$={command:`sessions`,describe:`Active and historical meeting sessions with participant details and duration tracking`,builder:e=>e.command(ye).command(be).command(xe).command(Se).command(Ce).command(we).command(Te).command(Ee).command(De).demandCommand(1),handler:()=>{}},Oe={command:`create-webhook <appId>`,describe:`Adds a new webhook to an App.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Set whether or not the webhook should be active when created`,default:!0}).option(`events`,{type:`string`,array:!0,description:`Events that this webhook will get triggered by`}).option(`name`,{type:`string`,description:`Name of the webhook`}).option(`url`,{type:`string`,description:`URL this webhook will send events to`}).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)`}),handler:async n=>{if(s(n.appId,`appId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf realtime-kit webhooks create-webhook`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/realtime/kit/${n.appId??`<appId>`}/webhooks`,pathParams:{appId:String(n.appId??``)},bodyKind:`json`,body:{enabled:n.enabled,events:n.events,name:n.name,url:n.url,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating webhook`,async()=>i.post(`/accounts/${m}/realtime/kit/${n.appId}/webhooks`,{body:e})),{successLabel:`Created webhook`});return}if(n.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`Name of the webhook`)),n.url===void 0&&(n.url=await t(`url`,`URL this webhook will send events to`));let h={};n.enabled!==void 0&&c(h,[`enabled`],n.enabled),n.events!==void 0&&c(h,[`events`],n.events),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.url!==void 0&&c(h,[`url`],o(n.url,`url`,`text`)),u(await p(`Creating webhook`,async()=>i.post(`/accounts/${m}/realtime/kit/${n.appId}/webhooks`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created webhook`})}},ke={command:`delete-webhook <webhookId>`,describe:`Removes a webhook for the given webhook ID.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`ID of the webhook`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app 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}),handler:async t=>{if(s(t.webhookId,`webhookId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit webhooks delete-webhook`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/webhooks/${t.webhookId??`<webhookId>`}`,pathParams:{appId:String(t.appId??``),webhookId:String(t.webhookId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`webhook`,String(t.webhookId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting webhook`,async()=>n.realtimeKit.webhooks.deleteWebhook(o,t.appId,t.webhookId)),{successLabel:`Deleted webhook`})}},Ae={command:`edit-webhook <webhookId>`,describe:`Edits the webhook details for the given webhook ID.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`ID of the webhook`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`The enabled field`,default:!0}).option(`events`,{type:`string`,array:!0,description:`Events that the webhook will get triggered by`}).option(`name`,{type:`string`,description:`Name of the webhook`}).option(`url`,{type:`string`,description:`URL the webhook will send events to`}).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)`}),handler:async t=>{if(s(t.webhookId,`webhookId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf realtime-kit webhooks edit-webhook`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/webhooks/${t.webhookId??`<webhookId>`}`,pathParams:{appId:String(t.appId??``),webhookId:String(t.webhookId??``)},bodyKind:`json`,body:{enabled:t.enabled,events:t.events,name:t.name,url:t.url,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating webhook`,async()=>n.patch(`/accounts/${i}/realtime/kit/${t.appId}/webhooks/${t.webhookId}`,{body:e})),{successLabel:`Updated webhook`});return}let m={};t.enabled!==void 0&&c(m,[`enabled`],t.enabled),t.events!==void 0&&c(m,[`events`],t.events),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.url!==void 0&&c(m,[`url`],o(t.url,`url`,`text`)),u(await p(`Updating webhook`,async()=>n.patch(`/accounts/${i}/realtime/kit/${t.appId}/webhooks/${t.webhookId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated webhook`})}},je={command:`get-webhook-by-id <webhookId>`,describe:`Returns webhook details for the given webhook ID.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`ID of the webhook`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.webhookId,`webhookId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading webhook`,async()=>t.realtimeKit.webhooks.getWebhookById(n,e.appId,e.webhookId)),{successLabel:`Loaded webhook`})}},Me={command:`get-webhooks <appId>`,describe:`Returns details of all webhooks for an App.`,builder:e=>e.positional(`appId`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}),handler:async e=>{s(e.appId,`appId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading webhook`,async()=>t.realtimeKit.webhooks.getWebhooks(n,e.appId)),{successLabel:`Loaded webhook`})}},Ne={command:`replace-webhook <webhookId>`,describe:`Replace all details for the given webhook ID.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`ID of the webhook`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Set whether or not the webhook should be active when created`,default:!0}).option(`events`,{type:`string`,array:!0,description:`Events that this webhook will get triggered by`}).option(`name`,{type:`string`,description:`Name of the webhook`}).option(`url`,{type:`string`,description:`URL this webhook will send events to`}).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)`}),handler:async n=>{if(s(n.webhookId,`webhookId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf realtime-kit webhooks replace-webhook`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/realtime/kit/${n.appId??`<appId>`}/webhooks/${n.webhookId??`<webhookId>`}`,pathParams:{appId:String(n.appId??``),webhookId:String(n.webhookId??``)},bodyKind:`json`,body:{enabled:n.enabled,events:n.events,name:n.name,url:n.url,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating webhook`,async()=>i.put(`/accounts/${m}/realtime/kit/${n.appId}/webhooks/${n.webhookId}`,{body:e})),{successLabel:`Updated webhook`});return}if(n.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`Name of the webhook`)),n.url===void 0&&(n.url=await t(`url`,`URL this webhook will send events to`));let h={};n.enabled!==void 0&&c(h,[`enabled`],n.enabled),n.events!==void 0&&c(h,[`events`],n.events),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.url!==void 0&&c(h,[`url`],o(n.url,`url`,`text`)),u(await p(`Updating webhook`,async()=>i.put(`/accounts/${m}/realtime/kit/${n.appId}/webhooks/${n.webhookId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated webhook`})}},Pe={command:`webhooks`,describe:`Webhook endpoints for real-time event notifications (meeting started, participant joined, etc.)`,builder:e=>e.command(Oe).command(ke).command(Ae).command(je).command(Me).command(Ne).demandCommand(1),handler:()=>{}},Fe={command:`realtime-kit`,describe:`Real-time video and audio — meetings, livestreams, recordings, and session management via Cloudflare Calls`,builder:e=>e.command(g).command(v).command(x).command(P).command(W).command(ae).command(de).command(ve).command($).command(Pe).demandCommand(1),handler:()=>{}};export{Fe as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";const f={command:`domain-check`,describe:"Performs real-time, authoritative availability checks directly against domain registries. Use this endpoint to verify a domain is available before attempting registration via `POST /registrations`. **Important:** Unlike the Search endpoint, these results are authoritative and reflect current registry status. Always check availability immediately before registration as domain status can change rapidly. **Note:** This endpoint uses POST to accept a list of domains in the request body. It is a read-only operation — it does not create, modify, or reserve any domains. ### Extension support Only domains on extensions supported for programmatic registration by this API can be registered. If you check a domain on an unsupported extension, the response will include `registrable: false` with a `reason` field explaining why: - `extension_not_supported_via_api` — Cloudflare Registrar supports this extension in the dashboard, but it is not yet available for programmatic registration via this API. Register via `https://dash.cloudflare.com/{account_id}/domains/registrations` instead. - `extension_not_supported` — This extension is not supported by Cloudflare Registrar. - `extension_disallows_registration` — The extension's registry has temporarily or permanently frozen new registrations. No registrar can register domains on this extension at this time. - `domain_premium` — The domain is premium priced. Premium registration is not currently supported by this API. - `domain_unavailable` — The domain is already registered, reserved, or otherwise not available for registration on a supported extension. The `reason` field is only present when `registrable` is `false`. ### Behavior - Maximum 20 domains per request - Pricing is only returned for domains where `registrable: true` - Results are not cached; each request queries the registry ### Workflow 1. Call this endpoint with domains the user wants to register. 2. For each domain where `registrable: true`, present pricing to the user. 3. If `tier: premium`, note that premium registration is not currently supported by this API and do not proceed to `POST /registrations`. 4. Proceed to `POST /registrations` only for supported non-premium domains.",builder:e=>e.option(`domains`,{type:`string`,array:!0,description:"List of fully qualified domain names (FQDNs) to check for availability. Each domain must include the extension. - Minimum: 1 domain - Maximum: 20 domains per request - Domains on unsupported extensions are returned with `registrable: false` and a `reason` field - Malformed domain names (e.g., missing extension) may be omitted from the response "}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`List of fully qualified domain names (FQDNs) to check. Each domain must include the extension (e.g., "example.com", not "example").`}),handler:async t=>{if(t.dryRun){let n=e();n&&a(n,`accountId`),l({command:`cf registrar domain-check`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/registrar/domain-check`,pathParams:{},bodyKind:`json`,body:{domains:t.domains,body:t.body},validation:`passed`});return}let i=await r(t),f=t.local?u:await n(i);if(t.accountId=f,t.body){let e=s(t.body);c(await d(`Creating check`,async()=>i.post(`/accounts/${f}/registrar/domain-check`,{body:e})),{successLabel:`Created check`});return}if(t.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);let p={};t.domains!==void 0&&o(p,[`domains`],t.domains),c(await d(`Creating check`,async()=>i.post(`/accounts/${f}/registrar/domain-check`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created check`})}},p={command:`domain-search`,describe:'Searches for domain name suggestions based on a keyword, phrase, or partial domain name. Returns a list of potentially available domains with pricing information. **Important:** Results are non-authoritative and based on cached data. Always use the `/domain-check` endpoint to verify real-time availability before attempting registration. Suggestions are scoped to extensions supported for programmatic registration via this API (`POST /registrations`). Domains on unsupported extensions will not appear in results, even if they are available at the registry level. ### Use cases - Brand name discovery (e.g., "acme corp" → acmecorp.com, acmecorp.dev) - Keyword-based suggestions (e.g., "coffee shop" → coffeeshop.com, mycoffeeshop.net) - Alternative extension discovery (e.g., "example.com" → example.com, example.app, example.xyz) ### Workflow 1. Call this endpoint with a keyword or domain name. 2. Present suggestions to the user. 3. Call `/domain-check` with the user\'s chosen domains to confirm real-time availability and pricing. 4. Proceed to `POST /registrations` only for supported non-premium domains where the Check response returns `registrable: true`. **Note:** Searching with just a domain extension (e.g., "com" or ".app") is not supported. Provide a keyword or domain name.',builder:e=>e.option(`q`,{type:`string`,description:`The search term to find domain suggestions. Accepts keywords, phrases, or full domain names. - Phrases: "coffee shop" returns coffeeshop.com, mycoffeeshop.net, etc. - Domain names: "example.com" returns example.com and variations across extensions`,demandOption:!0}).option(`extensions`,{type:`string`,description:`Limits results to specific domain extensions from the supported set. If not specified, returns results across all supported extensions. Extensions not in the supported set are silently ignored.`}).option(`limit`,{type:`number`,description:`Maximum number of domain suggestions to return. Defaults to 20 if not specified.`}),handler:async e=>{let t={};e.q!==void 0&&(t.q=e.q),e.extensions!==void 0&&(t.extensions=e.extensions),e.limit!==void 0&&(t.limit=e.limit);let i=await r(e),a=e.local?u:await n(i);e.accountId=a,c(await d(`Loading search`,async()=>i.registrar.domainSearch(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded search`})}},m={command:`create`,describe:"Starts a domain registration workflow. This is a billable operation — successful registration charges the account's default payment method. All successful domain registrations are non-refundable — once the workflow completes with `state: succeeded`, the charge cannot be reversed. ### Prerequisites - The account must have a billing profile with a valid default payment method. Set this up at `https://dash.cloudflare.com/{account_id}/billing/payment-info`. - The account must not already be at the maximum supported domain limit. A single account may own up to 100 domains in total across registrations created through either the dashboard or this API. - The domain must be on a supported extension for programmatic registration. - Use `POST /domain-check` immediately before calling this endpoint to confirm real-time availability and pricing. ### Supported extensions In this API, \"extension\" means the full registrable suffix after the domain label. For example, in `example.co.uk`, the extension is `co.uk`. Programmatic registration is currently supported for: `com`, `org`, `net`, `app`, `dev`, `cc`, `xyz`, `info`, `cloud`, `studio`, `live`, `link`, `pro`, `tech`, `fyi`, `shop`, `online`, `tools`, `run`, `games`, `build`, `systems`, `world`, `news`, `site`, `network`, `chat`, `space`, `family`, `page`, `life`, `group`, `email`, `solutions`, `day`, `blog`, `ing`, `icu`, `academy`, `today` Cloudflare Registrar supports 400+ extensions in the dashboard. Extensions not listed above can still be registered at `https://dash.cloudflare.com/{account_id}/domains/registrations`. ### Express mode The only required field is `domain_name`. If `contacts` is omitted, the system uses the account's default address book entry as the registrant. If no default exists and no contact is provided, the request fails. Set up a default address book entry and accept the required agreement at `https://dash.cloudflare.com/{account_id}/domains/registrations`. ### Defaults - `years`: defaults to the extension's minimum registration period (1 year for most extensions, but varies — for example, `.ai` (if supported) requires a minimum of 2 years). - `auto_renew`: defaults to `false`. Setting it to `true` is an explicit opt-in authorizing Cloudflare to charge the account's default payment method up to 30 days before domain expiry to renew the registration. Renewal pricing may change over time based on registry pricing. - `privacy_mode`: defaults to `redaction`. ### Premium domains Premium domain registration is not currently supported by this API. If `POST /domain-check` returns `tier: premium`, do not call this endpoint for that domain. ### Response behavior By default, the server holds the connection for a bounded, server-defined amount of time while the registration completes. Most registrations finish within this window and return `201 Created` with a completed workflow status. If the registration is still processing after this synchronous wait window, the server returns `202 Accepted`. Poll the URL in `links.self` to track progress. To skip the wait and receive an immediate `202`, send `Prefer: respond-async`.",builder:e=>e.option(`prefer`,{type:`string`,description:"Set to `respond-async` to receive an immediate `202 Accepted` without waiting for the operation to complete (RFC 7240). The header may be combined with other preferences using standard comma-separated syntax."}).option(`auto-renew`,{type:`boolean`,description:"Enable or disable automatic renewal. Defaults to `false` if omitted. Setting this field to `true` is an explicit opt-in authorizing Cloudflare to charge the account's default payment method up to 30 days before domain expiry to renew the domain automatically. Renewal pricing may change over time based on registry pricing. ",default:!1}).option(`contacts-registrant-email`,{type:`string`,description:`Email address for the registrant. Used for domain-related communications from the registry, including ownership verification and renewal notices. `}).option(`contacts-registrant-fax`,{type:`string`,description:"Fax number in E.164 format (e.g., `+1.5555555555`). Optional. Most registrations do not require a fax number. "}).option(`contacts-registrant-phone`,{type:`string`,description:"Phone number in E.164 format: `+{country_code}.{number}` with no spaces or dashes. Examples: `+1.5555555555` (US), `+44.2071234567` (UK), `+81.312345678` (Japan). "}).option(`contacts-registrant-postal-info-name`,{type:`string`,description:`Full legal name of the registrant (individual or authorized representative).`}).option(`contacts-registrant-postal-info-organization`,{type:`string`,description:`Organization or company name. Optional for individual registrants.`}).option(`domain-name`,{type:`string`,description:"Fully qualified domain name (FQDN) including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration — the same domain cannot be registered twice, making it a natural idempotency key for registration requests. "}).option(`privacy-mode`,{type:`string`,description:"WHOIS privacy mode for the registration. Defaults to `redaction`. - `off`: Do not request WHOIS privacy. - `redaction`: Request WHOIS redaction where supported by the extension. Some extensions do not support privacy/redaction. ",choices:[`redaction`],default:`redaction`}).option(`years`,{type:`number`,description:"Number of years to register (1–10). If omitted, defaults to the minimum registration period required by the registry for this extension. For most extensions this is 1 year, but some extensions require longer minimum terms (e.g., `.ai` requires a minimum of 2 years). The registry for each extension may also enforce its own maximum registration term. If the requested value exceeds the registry's maximum, the registration will be rejected. When in doubt, use the default by omitting this field. "}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`contacts-registrant-email`,`contacts-registrant-fax`,`contacts-registrant-phone`,`contacts-registrant-postal-info-name`,`contacts-registrant-postal-info-organization`].some(t=>e[t]!==void 0)){let t=[`contacts-registrant-email`,`contacts-registrant-phone`,`contacts-registrant-postal-info-name`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --contacts-* flag is set`)}return!0}),handler:async f=>{let p={};if(f.prefer!==void 0&&(p.Prefer=String(f.prefer)),f.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf registrar registrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations`,pathParams:{},bodyKind:`json`,body:{autoRenew:f.autoRenew,contactsRegistrantEmail:f.contactsRegistrantEmail,contactsRegistrantFax:f.contactsRegistrantFax,contactsRegistrantPhone:f.contactsRegistrantPhone,contactsRegistrantPostalInfoName:f.contactsRegistrantPostalInfoName,contactsRegistrantPostalInfoOrganization:f.contactsRegistrantPostalInfoOrganization,domainName:f.domainName,privacyMode:f.privacyMode,years:f.years,body:f.body},validation:`passed`});return}let m=await r(f),h=f.local?u:await n(m);if(f.accountId=h,f.body){let e=s(f.body);c(await d(`Creating registration`,async()=>m.post(`/accounts/${h}/registrar/registrations`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created registration`});return}f.domainName===void 0&&(f.domainName=await t(`domain-name`,"Fully qualified domain name (FQDN) including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration — the same domain cannot be registered twice, making it a natural idempotency key for registration requests. "));let g={};f.autoRenew!==void 0&&o(g,[`auto_renew`],f.autoRenew),f.contactsRegistrantEmail!==void 0&&o(g,[`contacts`,`registrant`,`email`],i(f.contactsRegistrantEmail,`contactsRegistrantEmail`,`text`)),f.contactsRegistrantFax!==void 0&&o(g,[`contacts`,`registrant`,`fax`],i(f.contactsRegistrantFax,`contactsRegistrantFax`,`text`)),f.contactsRegistrantPhone!==void 0&&o(g,[`contacts`,`registrant`,`phone`],i(f.contactsRegistrantPhone,`contactsRegistrantPhone`,`text`)),f.contactsRegistrantPostalInfoName!==void 0&&o(g,[`contacts`,`registrant`,`postal_info`,`name`],i(f.contactsRegistrantPostalInfoName,`contactsRegistrantPostalInfoName`,`text`)),f.contactsRegistrantPostalInfoOrganization!==void 0&&o(g,[`contacts`,`registrant`,`postal_info`,`organization`],i(f.contactsRegistrantPostalInfoOrganization,`contactsRegistrantPostalInfoOrganization`,`text`)),f.domainName!==void 0&&o(g,[`domain_name`],i(f.domainName,`domainName`,`text`)),f.privacyMode!==void 0&&o(g,[`privacy_mode`],i(f.privacyMode,`privacyMode`,`text`)),f.years!==void 0&&o(g,[`years`],f.years),c(await d(`Creating registration`,async()=>m.post(`/accounts/${h}/registrar/registrations`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created registration`})}},h={command:`get-status <domainName>`,describe:"Returns the current status of a domain registration workflow. Use this endpoint to poll for completion when the POST response returned `202 Accepted`. The URL is provided in the `links.self` field of the workflow status response. Poll this endpoint until the workflow reaches a terminal state or a state that requires user attention. **Terminal states:** `succeeded` and `failed` are terminal and always have `completed: true`. **Non-terminal states:** - `action_required` has `completed: false` and will not resolve on its own. The workflow is paused pending user intervention. - `blocked` has `completed: false` and indicates the workflow is waiting on a third party such as the extension registry or losing registrar. Continue polling while informing the user of the delay. Use increasing backoff between polls. When `state: blocked`, use a longer polling interval and do not poll indefinitely. A naive polling loop that only checks `completed` can run indefinitely when `state: action_required`. Break explicitly on `action_required`: ```js let status; do { await new Promise(r => setTimeout(r, 2000)); status = await cloudflare.request({ method: 'GET', path: reg.result.links.self, }); } while ( !status.result.completed && status.result.state !== 'action_required' ); if (status.result.state === 'action_required') { // Surface context.action and context.confirmation_sent_to to the user. // Do not re-submit the registration request. } ```",builder:e=>e.positional(`domainName`,{type:`string`,description:"Fully qualified domain name (FQDN) including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration — the same domain cannot be registered twice, making it a natural idempotency key for registration requests.",demandOption:!0}),handler:async e=>{a(e.domainName,`domainName`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,c(await d(`Loading registration`,async()=>t.registrar.registrations.getStatus(i,e.domainName)),{successLabel:`Loaded registration`})}},g={command:`get-update-status <domainName>`,describe:"Returns the current status of a domain update workflow. Use this endpoint to poll for completion when the PATCH response returned `202 Accepted`. The URL is provided in the `links.self` field of the workflow status response. Poll this endpoint until the workflow reaches a terminal state or a state that requires user attention. Use increasing backoff between polls. When the workflow remains blocked on a third party, use a longer polling interval and do not poll indefinitely.",builder:e=>e.positional(`domainName`,{type:`string`,description:"Fully qualified domain name (FQDN) including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration — the same domain cannot be registered twice, making it a natural idempotency key for registration requests.",demandOption:!0}),handler:async e=>{a(e.domainName,`domainName`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,c(await d(`Loading registration`,async()=>t.registrar.registrations.getUpdateStatus(i,e.domainName)),{successLabel:`Loaded registration`})}},_={command:`get <domainName>`,describe:"Returns the current state of a domain registration. This is the canonical read endpoint for a domain you own. It returns the full registration resource including current settings and expiration. When the registration resource is ready, both `created_at` and `expires_at` are present in the response.",builder:e=>e.positional(`domainName`,{type:`string`,description:`Domain name to retrieve.`,demandOption:!0}),handler:async e=>{a(e.domainName,`domainName`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,c(await d(`Loading registration`,async()=>t.registrar.registrations.get(i,e.domainName)),{successLabel:`Loaded registration`})}},v={command:`list`,describe:"Returns a paginated list of domain registrations owned by the account. This endpoint uses cursor-based pagination. Results are ordered by registration date by default. To fetch the next page, pass the `cursor` value from the `result_info` object in the response as the `cursor` query parameter in your next request. An empty `cursor` string indicates there are no more pages.",builder:e=>e.option(`cursor`,{type:`string`,description:"Opaque token from a previous response's `result_info.cursor`. Pass this value to fetch the next page of results. Omit (or pass an empty string) for the first page."}).option(`per-page`,{type:`number`,description:`Number of items to return per page.`}).option(`direction`,{type:`string`,description:`Sort direction for results. Defaults to ascending order.`,choices:[`asc`,`desc`]}).option(`sort-by`,{type:`string`,description:"Column to sort results by. Defaults to registration date (`registry_created_at`) when omitted.",choices:[`registry_created_at`,`registry_expires_at`,`name`]}),handler:async e=>{let t={};e.cursor!==void 0&&(t.cursor=e.cursor),e.perPage!==void 0&&(t.per_page=e.perPage),e.direction!==void 0&&(t.direction=e.direction),e.sortBy!==void 0&&(t.sort_by=e.sortBy);let i=await r(e),a=e.local?u:await n(i);e.accountId=a,c(await d(`Loading registrations`,async()=>i.registrar.registrations.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded registrations`})}},y={command:`update <domainName>`,describe:"Updates an existing domain registration. By default, the server holds the connection for a bounded, server-defined amount of time while the update completes. Most updates finish within this window and return `200 OK` with a completed workflow status. If the update is still processing after this synchronous wait window, the server returns `202 Accepted`. Poll the URL in `links.self` to track progress. To skip the wait and receive an immediate `202`, send `Prefer: respond-async`. This endpoint currently supports updating `auto_renew` only.",builder:e=>e.positional(`domainName`,{type:`string`,description:`Domain name to update.`,demandOption:!0}).option(`prefer`,{type:`string`,description:"Set to `respond-async` to receive an immediate `202 Accepted` without waiting for the operation to complete (RFC 7240)."}).option(`auto-renew`,{type:`boolean`,description:"Enable or disable automatic renewal. Setting this field to `true` authorizes Cloudflare to charge the account's default payment method up to 30 days before domain expiry to renew the domain automatically. Renewal pricing may change over time based on registry pricing. "}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request to update an existing domain registration. This endpoint currently supports updating `auto_renew` only. "}),handler:async t=>{a(t.domainName,`domainName`);let i={};if(t.prefer!==void 0&&(i.Prefer=String(t.prefer)),t.dryRun){let n=e();n&&a(n,`accountId`),l({command:`cf registrar registrations update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/registrar/registrations/${t.domainName??`<domainName>`}`,pathParams:{domainName:String(t.domainName??``)},bodyKind:`json`,body:{autoRenew:t.autoRenew,body:t.body},validation:`passed`});return}let f=await r(t),p=t.local?u:await n(f);if(t.accountId=p,t.body){let e=s(t.body);c(await d(`Updating registration`,async()=>f.patch(`/accounts/${p}/registrar/registrations/${t.domainName}`,{body:e,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated registration`});return}let m={};t.autoRenew!==void 0&&o(m,[`auto_renew`],t.autoRenew),c(await d(`Updating registration`,async()=>f.patch(`/accounts/${p}/registrar/registrations/${t.domainName}`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated registration`})}},b={command:`registrations`,describe:`Domain registrations — purchase, view, update, and inspect registration status`,builder:e=>e.command(m).command(_).command(h).command(g).command(v).command(y).demandCommand(1),handler:()=>{}},x={command:`registrar`,describe:`Domain registration and transfer management through Cloudflare Registrar`,builder:e=>e.command(f).command(p).command(b).demandCommand(1),handler:()=>{}};export{x as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";const f={command:`create`,describe:`Traces a simulated HTTP request through Cloudflare's edge to analyze how rules, settings, and configurations would process the request. Useful for debugging firewall rules, page rules, and other request transformations without sending actual traffic. Supports custom headers, cookies, body content, and geolocation context.`,builder:e=>e.option(`body-base64`,{type:`string`,description:`Base64 encoded request body`}).option(`body-plain-text`,{type:`string`,description:`Request body as plain text`}).option(`context-bot-score`,{type:`number`,description:`Bot score used for evaluating tracing request processing`}).option(`context-geoloc-city`,{type:`string`,description:`The context.geoloc.city field`}).option(`context-geoloc-continent`,{type:`string`,description:`The context.geoloc.continent field`}).option(`context-geoloc-is-eu-country`,{type:`boolean`,description:`The context.geoloc.is_eu_country field`}).option(`context-geoloc-iso-code`,{type:`string`,description:`The context.geoloc.iso_code field`}).option(`context-geoloc-latitude`,{type:`number`,description:`The context.geoloc.latitude field`}).option(`context-geoloc-longitude`,{type:`number`,description:`The context.geoloc.longitude field`}).option(`context-geoloc-postal-code`,{type:`string`,description:`The context.geoloc.postal_code field`}).option(`context-geoloc-region-code`,{type:`string`,description:`The context.geoloc.region_code field`}).option(`context-geoloc-subdivision-2-iso-code`,{type:`string`,description:`The context.geoloc.subdivision_2_iso_code field`}).option(`context-geoloc-timezone`,{type:`string`,description:`The context.geoloc.timezone field`}).option(`context-skip-challenge`,{type:`boolean`,description:`Whether to skip any challenges for tracing request (e.g.: captcha)`}).option(`context-threat-score`,{type:`number`,description:`Threat score used for evaluating tracing request processing`}).option(`method`,{type:`string`,description:`HTTP Method of tracing request`}).option(`protocol`,{type:`string`,description:`HTTP Protocol of tracing request`}).option(`skip-response`,{type:`boolean`,description:`Skip sending the request to the Origin server after all rules evaluation`}).option(`url`,{type:`string`,description:`URL to which perform tracing request`}).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)`}),handler:async f=>{if(f.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf request-tracers traces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/request-tracer/trace`,pathParams:{},bodyKind:`json`,body:{bodyBase64:f.bodyBase64,bodyPlainText:f.bodyPlainText,contextBotScore:f.contextBotScore,contextGeolocCity:f.contextGeolocCity,contextGeolocContinent:f.contextGeolocContinent,contextGeolocIsEuCountry:f.contextGeolocIsEuCountry,contextGeolocIsoCode:f.contextGeolocIsoCode,contextGeolocLatitude:f.contextGeolocLatitude,contextGeolocLongitude:f.contextGeolocLongitude,contextGeolocPostalCode:f.contextGeolocPostalCode,contextGeolocRegionCode:f.contextGeolocRegionCode,contextGeolocSubdivision2IsoCode:f.contextGeolocSubdivision2IsoCode,contextGeolocTimezone:f.contextGeolocTimezone,contextSkipChallenge:f.contextSkipChallenge,contextThreatScore:f.contextThreatScore,method:f.method,protocol:f.protocol,skipResponse:f.skipResponse,url:f.url,body:f.body},validation:`passed`});return}let p=await r(f),m=f.local?u:await n(p);if(f.accountId=m,f.body){let e=s(f.body);c(await d(`Creating trace`,async()=>p.post(`/accounts/${m}/request-tracer/trace`,{body:e})),{successLabel:`Created trace`});return}f.method===void 0&&(f.method=await t(`method`,`HTTP Method of tracing request`)),f.url===void 0&&(f.url=await t(`url`,`URL to which perform tracing request`));let h={};f.bodyBase64!==void 0&&o(h,[`body`,`base64`],i(f.bodyBase64,`bodyBase64`,`text`)),f.bodyPlainText!==void 0&&o(h,[`body`,`plain_text`],i(f.bodyPlainText,`bodyPlainText`,`text`)),f.contextBotScore!==void 0&&o(h,[`context`,`bot_score`],f.contextBotScore),f.contextGeolocCity!==void 0&&o(h,[`context`,`geoloc`,`city`],i(f.contextGeolocCity,`contextGeolocCity`,`text`)),f.contextGeolocContinent!==void 0&&o(h,[`context`,`geoloc`,`continent`],i(f.contextGeolocContinent,`contextGeolocContinent`,`text`)),f.contextGeolocIsEuCountry!==void 0&&o(h,[`context`,`geoloc`,`is_eu_country`],f.contextGeolocIsEuCountry),f.contextGeolocIsoCode!==void 0&&o(h,[`context`,`geoloc`,`iso_code`],i(f.contextGeolocIsoCode,`contextGeolocIsoCode`,`text`)),f.contextGeolocLatitude!==void 0&&o(h,[`context`,`geoloc`,`latitude`],f.contextGeolocLatitude),f.contextGeolocLongitude!==void 0&&o(h,[`context`,`geoloc`,`longitude`],f.contextGeolocLongitude),f.contextGeolocPostalCode!==void 0&&o(h,[`context`,`geoloc`,`postal_code`],i(f.contextGeolocPostalCode,`contextGeolocPostalCode`,`text`)),f.contextGeolocRegionCode!==void 0&&o(h,[`context`,`geoloc`,`region_code`],i(f.contextGeolocRegionCode,`contextGeolocRegionCode`,`text`)),f.contextGeolocSubdivision2IsoCode!==void 0&&o(h,[`context`,`geoloc`,`subdivision_2_iso_code`],i(f.contextGeolocSubdivision2IsoCode,`contextGeolocSubdivision2IsoCode`,`text`)),f.contextGeolocTimezone!==void 0&&o(h,[`context`,`geoloc`,`timezone`],i(f.contextGeolocTimezone,`contextGeolocTimezone`,`text`)),f.contextSkipChallenge!==void 0&&o(h,[`context`,`skip_challenge`],f.contextSkipChallenge),f.contextThreatScore!==void 0&&o(h,[`context`,`threat_score`],f.contextThreatScore),f.method!==void 0&&o(h,[`method`],i(f.method,`method`,`text`)),f.protocol!==void 0&&o(h,[`protocol`],i(f.protocol,`protocol`,`text`)),f.skipResponse!==void 0&&o(h,[`skip_response`],f.skipResponse),f.url!==void 0&&o(h,[`url`],i(f.url,`url`,`text`)),c(await d(`Creating trace`,async()=>p.post(`/accounts/${m}/request-tracer/trace`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created trace`})}},p={command:`traces`,describe:`Simulate request processing to debug rule matches, transforms, and routing decisions`,builder:e=>e.command(f).demandCommand(1),handler:()=>{}},m={command:`request-tracers`,describe:`Trace how a request would be processed through Cloudflare's rules and configuration pipeline`,builder:e=>e.command(p).demandCommand(1),handler:()=>{}};export{m as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e}from"./rolldown-runtime-CR7SCCRW.mjs";var t=e({isCloudflareId:()=>a,isId:()=>o,isUUID:()=>i,isValidDomainName:()=>s,resolveZoneId:()=>c});const n=new Map;async function r(e,t,r=6e4){let i=n.get(e),a=Date.now();if(i&&i.expires>a)return i.data;let o=await t();return n.set(e,{data:o,expires:a+r}),o}function i(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function a(e){return/^[0-9a-f]{32}$/i.test(e)}function o(e){return i(e)||a(e)}function s(e){if(!e||e.length>253||!e.includes(`.`))return!1;let t=e.split(`.`);for(let e of t)if(e.length===0||e.length>63||!/^[a-zA-Z0-9]/.test(e)||!/[a-zA-Z0-9]$/.test(e)||!/^[a-zA-Z0-9-]+$/.test(e))return!1;return!0}async function c(e,t,n){if(o(n))return n;if(!s(n))throw Error(`Invalid zone identifier: "${n}". Must be a zone ID or valid domain name.`);let i=(await r(`zones:${t}`,async()=>e.zones.list(t))).find(e=>e.name===n||e.name===n.toLowerCase());if(!i)throw Error(`Zone not found: ${n}`);return i.id}export{s as n,t as r,o as t};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`,builder:e=>e.option(`name`,{type:`string`,description:`The name of the share.`}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf resource-sharing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:{name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating resource sharing`,async()=>i.post(`/accounts/${m}/shares`,{body:e})),{successLabel:`Created resource sharing`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the share.`));let h={};n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Creating resource sharing`,async()=>i.post(`/accounts/${m}/shares`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created resource sharing`})}},h={command:`delete <shareId>`,describe:`Deletion is not immediate, an updated share object with a new status will be returned.`,builder:e=>e.positional(`shareId`,{type:`string`,description:`Share 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}),handler:async t=>{if(s(t.shareId,`shareId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf resource-sharing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/shares/${t.shareId??`<shareId>`}`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`resource sharing`,String(t.shareId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting resource sharing`,async()=>n.resourceSharing.delete(o,t.shareId)),{successLabel:`Deleted resource sharing`})}},g={command:`get <shareId>`,describe:`Fetches share by ID.`,builder:e=>e.positional(`shareId`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`,default:!1}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`,default:!1}),handler:async e=>{s(e.shareId,`shareId`);let t={};e.includeResources!==void 0&&(t.include_resources=e.includeResources),e.includeRecipientCounts!==void 0&&(t.include_recipient_counts=e.includeRecipientCounts);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading resource sharing`,async()=>n.resourceSharing.get(i,e.shareId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resource sharing`})}},_={command:`list`,describe:`Lists all account shares.`,builder:e=>e.option(`status`,{type:`string`,description:`Filter shares by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`kind`,{type:`string`,description:`Filter shares by kind.`,choices:[`sent`,`received`]}).option(`target-type`,{type:`string`,description:`Filter shares by target_type.`,choices:[`account`,`organization`]}).option(`resource-types`,{type:`string`,description:`Filter share resources by resource_types.`}).option(`order`,{type:`string`,description:`Order shares by values in the given field.`,choices:[`name`,`created`]}).option(`direction`,{type:`string`,description:`Direction to sort objects.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page.`}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`,default:!1}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`,default:!1}),handler:async e=>{let t={};e.status!==void 0&&(t.status=e.status),e.kind!==void 0&&(t.kind=e.kind),e.targetType!==void 0&&(t.target_type=e.targetType),e.resourceTypes!==void 0&&(t.resource_types=e.resourceTypes),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.includeResources!==void 0&&(t.include_resources=e.includeResources),e.includeRecipientCounts!==void 0&&(t.include_recipient_counts=e.includeRecipientCounts);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading resource sharing`,async()=>n.resourceSharing.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resource sharing`})}},v={command:`create <shareId>`,describe:`Adds a recipient to a resource share, granting them access to the shared resources.`,builder:e=>e.positional(`shareId`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Account or organization ID must be provided.`}),handler:async t=>{if(s(t.shareId,`shareId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf resource-sharing recipients create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`json`,body:{organizationId:t.organizationId,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating recipient`,async()=>n.post(`/accounts/${i}/shares/${t.shareId}/recipients`,{body:e})),{successLabel:`Created recipient`});return}let m={};t.organizationId!==void 0&&c(m,[`organization_id`],o(t.organizationId,`organizationId`,`text`)),u(await p(`Creating recipient`,async()=>n.post(`/accounts/${i}/shares/${t.shareId}/recipients`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created recipient`})}},y={command:`delete <recipientId>`,describe:`Deletion is not immediate, an updated share recipient object with a new status will be returned.`,builder:e=>e.positional(`recipientId`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share 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}),handler:async t=>{if(s(t.recipientId,`recipientId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf resource-sharing recipients delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients/${t.recipientId??`<recipientId>`}`,pathParams:{shareId:String(t.shareId??``),recipientId:String(t.recipientId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`recipient`,String(t.recipientId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting recipient`,async()=>n.resourceSharing.recipients.delete(o,t.shareId,t.recipientId)),{successLabel:`Deleted recipient`})}},b={command:`get <recipientId>`,describe:`Get share recipient by ID.`,builder:e=>e.positional(`recipientId`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`,default:!1}),handler:async e=>{s(e.recipientId,`recipientId`);let t={};e.includeResources!==void 0&&(t.include_resources=e.includeResources);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading recipient`,async()=>n.resourceSharing.recipients.get(i,e.shareId,e.recipientId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded recipient`})}},x={command:`list`,describe:`List share recipients by share ID.`,builder:e=>e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`,default:!1}).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page.`}),handler:async e=>{let t={};e.includeResources!==void 0&&(t.include_resources=e.includeResources),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading recipients`,async()=>n.resourceSharing.recipients.list(i,e.shareId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded recipients`})}},S={command:`update <shareId>`,describe:`Changes a share's recipients to match the given list. Returns an error if the share targets an organization.`,builder:e=>e.positional(`shareId`,{type:`string`,description:`Share identifier tag.`,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)`}),handler:async t=>{if(s(t.shareId,`shareId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf resource-sharing recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating recipient`,async()=>n.put(`/accounts/${i}/shares/${t.shareId}/recipients`,{body:e})),{successLabel:`Updated recipient`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},C={command:`recipients`,describe:`Organizations and accounts that have been granted access to shared resources`,builder:e=>e.command(v).command(y).command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`create <shareId>`,describe:`Adds a resource to an existing share, making it available to share recipients.`,builder:e=>e.positional(`shareId`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`resource-account-id`,{type:`string`,description:`Account identifier.`}).option(`resource-id`,{type:`string`,description:`Share Resource identifier.`}).option(`resource-type`,{type:`string`,description:`Resource Type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`]}).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)`}),handler:async i=>{if(s(i.shareId,`shareId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf resource-sharing resources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${i.shareId??`<shareId>`}/resources`,pathParams:{shareId:String(i.shareId??``)},bodyKind:`json`,body:{resourceAccountId:i.resourceAccountId,resourceId:i.resourceId,resourceType:i.resourceType,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating resource`,async()=>m.post(`/accounts/${h}/shares/${i.shareId}/resources`,{body:e})),{successLabel:`Created resource`});return}i.resourceAccountId===void 0&&(i.resourceAccountId=await t(`resource-account-id`,`Account identifier.`)),i.resourceId===void 0&&(i.resourceId=await t(`resource-id`,`Share Resource identifier.`)),i.resourceType===void 0&&(i.resourceType=await n(`resource-type`,`Resource Type.`,[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`]));let g={};i.resourceAccountId!==void 0&&c(g,[`resource_account_id`],o(i.resourceAccountId,`resourceAccountId`,`text`)),i.resourceId!==void 0&&c(g,[`resource_id`],o(i.resourceId,`resourceId`,`text`)),i.resourceType!==void 0&&c(g,[`resource_type`],o(i.resourceType,`resourceType`,`text`)),u(await p(`Creating resource`,async()=>m.post(`/accounts/${h}/shares/${i.shareId}/resources`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created resource`})}},T={command:`delete <resourceId>`,describe:`Deletion is not immediate, an updated share resource object with a new status will be returned.`,builder:e=>e.positional(`resourceId`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share 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}),handler:async t=>{if(s(t.resourceId,`resourceId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf resource-sharing resources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/shares/${t.shareId??`<shareId>`}/resources/${t.resourceId??`<resourceId>`}`,pathParams:{shareId:String(t.shareId??``),resourceId:String(t.resourceId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`resource`,String(t.resourceId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}u(await p(`Deleting resource`,async()=>n.resourceSharing.resources.delete(o,t.shareId,t.resourceId)),{successLabel:`Deleted resource`})}},E={command:`get <resourceId>`,describe:`Get share resource by ID.`,builder:e=>e.positional(`resourceId`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}),handler:async e=>{s(e.resourceId,`resourceId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading resource`,async()=>t.resourceSharing.resources.get(n,e.shareId,e.resourceId)),{successLabel:`Loaded resource`})}},D={command:`list`,describe:`List share resources by share ID.`,builder:e=>e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter share resources by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`resource-type`,{type:`string`,description:`Filter share resources by resource_type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`]}).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page.`}),handler:async e=>{let t={};e.status!==void 0&&(t.status=e.status),e.resourceType!==void 0&&(t.resource_type=e.resourceType),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading resources`,async()=>n.resourceSharing.resources.list(i,e.shareId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resources`})}},O={command:`update <resourceId>`,describe:`Update is not immediate, an updated share resource object with a new status will be returned.`,builder:e=>e.positional(`resourceId`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,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)`}),handler:async t=>{if(s(t.resourceId,`resourceId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf resource-sharing resources update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/shares/${t.shareId??`<shareId>`}/resources/${t.resourceId??`<resourceId>`}`,pathParams:{shareId:String(t.shareId??``),resourceId:String(t.resourceId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating resource`,async()=>n.put(`/accounts/${i}/shares/${t.shareId}/resources/${t.resourceId}`,{body:e})),{successLabel:`Updated resource`});return}u(await p(`Updating resource`,async()=>n.resourceSharing.resources.update(i,t.shareId,t.resourceId)),{successLabel:`Updated resource`})}},k={command:`resources`,describe:`Individual resources (zones, configs) that have been shared with recipients`,builder:e=>e.command(w).command(T).command(E).command(D).command(O).demandCommand(1),handler:()=>{}},A={command:`update <shareId>`,describe:`Updating is not immediate, an updated share object with a new status will be returned.`,builder:e=>e.positional(`shareId`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the share.`}).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)`}),handler:async n=>{if(s(n.shareId,`shareId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf resource-sharing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${n.shareId??`<shareId>`}`,pathParams:{shareId:String(n.shareId??``)},bodyKind:`json`,body:{name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating resource sharing`,async()=>i.put(`/accounts/${m}/shares/${n.shareId}`,{body:e})),{successLabel:`Updated resource sharing`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the share.`));let h={};n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Updating resource sharing`,async()=>i.put(`/accounts/${m}/shares/${n.shareId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated resource sharing`})}},j={command:`resource-sharing`,describe:`Share Cloudflare resources (zones, accounts) across organizations with granular access controls`,builder:e=>e.command(m).command(h).command(g).command(_).command(A).command(C).command(k).demandCommand(1),handler:()=>{}};export{j as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a,u as o}from"./auth-BHD_B2p9.mjs";import{n as s,r as c}from"./input-validation-BpVQi9rR.mjs";import{n as l,t as u}from"./body-parser-iA3vRFmh.mjs";import{t as d}from"./output-CqGQp2r6.mjs";import{t as f}from"./dry-run-FV0pZwdg.mjs";import{t as p}from"./local-OqhVQbv0.mjs";import{t as m}from"./progress-5sHFvwez.mjs";const h={command:`delete`,describe:`Removes all tags from a specific account-level resource.`,builder:e=>e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will verify the current resource ETag matches before applying the write. Returns 412 Precondition Failed if the resource has been modified since the ETag was obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for worker_version resource type.`,choices:[`worker_version`]}).option(`worker-id`,{type:`string`,description:`Worker ID is required only for worker_version resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for deleting tags from account-level resources. Use /zones/{zone_id}/tags for zone-level resources.`}),handler:async o=>{let h={};if(o.ifMatch!==void 0&&(h[`If-Match`]=String(o.ifMatch)),o.dryRun){let t=e();t&&c(t,`accountId`),f({command:`cf resource-tagging account-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:{resourceId:o.resourceId,resourceType:o.resourceType,workerId:o.workerId,body:o.body},validation:`passed`});return}let g=await a(o),_=o.local?p:await r(g);if(o.accountId=_,!await i(`account tag`,``,{force:!!o.force})){process.stderr.write(`Aborted.
3
- `);return}if(o.body){let e=u(o.body);d(await m(`Deleting account tag`,async()=>g.delete(`/accounts/${_}/tags`,{body:e,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Deleted account tag`});return}o.resourceId===void 0&&(o.resourceId=await t(`resource-id`,`Identifies the unique resource.`)),o.resourceType===void 0&&(o.resourceType=await n(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let v={};o.resourceId!==void 0&&l(v,[`resource_id`],s(o.resourceId,`resourceId`,`text`)),o.resourceType!==void 0&&l(v,[`resource_type`],s(o.resourceType,`resourceType`,`text`)),o.workerId!==void 0&&l(v,[`worker_id`],s(o.workerId,`workerId`,`text`)),d(await m(`Deleting account tag`,async()=>g.delete(`/accounts/${_}/tags`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Deleted account tag`})}},g={command:`get`,describe:`Retrieves tags for a specific account-level resource.`,builder:e=>e.option(`resource-id`,{type:`string`,description:`The ID of the resource to retrieve tags for.`,demandOption:!0}).option(`resource-type`,{type:`string`,description:`The type of the resource.`,choices:[`access_application`,`access_group`,`account`,`ai_gateway`,`alerting_policy`,`alerting_webhook`,`cloudflared_tunnel`,`d1_database`,`durable_object_namespace`,`gateway_list`,`gateway_rule`,`image`,`kv_namespace`,`queue`,`r2_bucket`,`resource_share`,`stream_live_input`,`stream_video`,`worker`,`worker_version`],demandOption:!0}).option(`worker-id`,{type:`string`,description:`Worker identifier. Required for worker_version resources.`}),handler:async e=>{let t={};e.resourceId!==void 0&&(t.resource_id=e.resourceId),e.resourceType!==void 0&&(t.resource_type=e.resourceType),e.workerId!==void 0&&(t.worker_id=e.workerId);let n=await a(e),i=e.local?p:await r(n);e.accountId=i,d(await m(`Loading account tag`,async()=>n.resourceTagging.accountTags.get(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded account tag`})}},_={command:`update`,describe:`Creates or updates tags for a specific account-level resource.`,builder:e=>e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will verify the current resource ETag matches before applying the write. Returns 412 Precondition Failed if the resource has been modified since the ETag was obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for worker_version resource type.`,choices:[`worker_version`]}).option(`worker-id`,{type:`string`,description:`Worker ID is required only for worker_version resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for setting tags on account-level resources.`}),handler:async i=>{let o={};if(i.ifMatch!==void 0&&(o[`If-Match`]=String(i.ifMatch)),i.dryRun){let t=e();t&&c(t,`accountId`),f({command:`cf resource-tagging account-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:{resourceId:i.resourceId,resourceType:i.resourceType,workerId:i.workerId,body:i.body},validation:`passed`});return}let h=await a(i),g=i.local?p:await r(h);if(i.accountId=g,i.body){let e=u(i.body);d(await m(`Updating account tag`,async()=>h.put(`/accounts/${g}/tags`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated account tag`});return}i.resourceId===void 0&&(i.resourceId=await t(`resource-id`,`Identifies the unique resource.`)),i.resourceType===void 0&&(i.resourceType=await n(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let _={};i.resourceId!==void 0&&l(_,[`resource_id`],s(i.resourceId,`resourceId`,`text`)),i.resourceType!==void 0&&l(_,[`resource_type`],s(i.resourceType,`resourceType`,`text`)),i.workerId!==void 0&&l(_,[`worker_id`],s(i.workerId,`workerId`,`text`)),d(await m(`Updating account tag`,async()=>h.put(`/accounts/${g}/tags`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated account tag`})}},v={command:`account-tags`,describe:`Tags applied to the account for organizational grouping and policy targeting`,builder:e=>e.command(h).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`list`,describe:`Lists all distinct tag keys used across resources in an account.`,builder:e=>e.option(`cursor`,{type:`string`,description:`Cursor for pagination.`}),handler:async e=>{let t={};e.cursor!==void 0&&(t.cursor=e.cursor);let n=await a(e),i=e.local?p:await r(n);e.accountId=i,d(await m(`Loading keys`,async()=>n.resourceTagging.keys.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded keys`})}},b={command:`keys`,describe:`Tag key definitions that establish the vocabulary for tagging resources`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`list`,describe:`Lists all tagged resources for an account.`,builder:e=>e.option(`type`,{type:`string`,description:`Filter by resource type. Can be repeated to filter by multiple types (OR logic). Example: ?type=zone&type=worker`}).option(`tag`,{type:`string`,description:"Filter resources by tag criteria. This parameter can be repeated multiple times, with AND logic between parameters. Supported syntax: - **Key-only**: `tag=<key>` - Resource must have the tag key (e.g., `tag=production`) - **Key-value**: `tag=<key>=<value>` - Resource must have the tag with specific value (e.g., `tag=env=prod`) - **Multiple values (OR)**: `tag=<key>=<v1>,<v2>` - Resource must have tag with any of the values (e.g., `tag=env=prod,staging`) - **Negate key-only**: `tag=!<key>` - Resource must not have the tag key (e.g., `tag=!archived`) - **Negate key-value**: `tag=<key>!=<value>` - Resource must not have the tag with specific value (e.g., `tag=region!=us-west-1`) Multiple tag parameters are combined with AND logic."}).option(`cursor`,{type:`string`,description:`Cursor for pagination.`}),handler:async e=>{let t={};e.type!==void 0&&(t.type=e.type),e.tag!==void 0&&(t.tag=e.tag),e.cursor!==void 0&&(t.cursor=e.cursor);let n=await a(e),i=e.local?p:await r(n);e.accountId=i,d(await m(`Loading resource tagging`,async()=>n.resourceTagging.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resource tagging`})}},S={command:`list`,describe:`Lists all distinct values for a given tag key, optionally filtered by resource type.`,builder:e=>e.option(`tag-key`,{type:`string`,description:`The tag key to retrieve values for.`,demandOption:!0}).option(`type`,{type:`string`,description:`Filter by resource type.`,choices:`access_application.access_application_policy.access_group.account.ai_gateway.alerting_policy.alerting_webhook.api_gateway_operation.cloudflared_tunnel.custom_certificate.custom_hostname.d1_database.dns_record.durable_object_namespace.gateway_list.gateway_rule.image.kv_namespace.managed_client_certificate.queue.r2_bucket.resource_share.stream_live_input.stream_video.worker.worker_version.zone`.split(`.`)}).option(`cursor`,{type:`string`,description:`Cursor for pagination.`}),handler:async e=>{let t={};e.type!==void 0&&(t.type=e.type),e.cursor!==void 0&&(t.cursor=e.cursor);let n=await a(e),i=e.local?p:await r(n);e.accountId=i,d(await m(`Loading values`,async()=>n.resourceTagging.values.list(i,e.tagKey,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded values`})}},C={command:`values`,describe:`Allowed values for tag keys — constrain tagging to a defined set of options`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`delete`,describe:`Removes all tags from a specific zone-level resource.`,builder:e=>e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will verify the current resource ETag matches before applying the write. Returns 412 Precondition Failed if the resource has been modified since the ETag was obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for base zone-level resource types (those with no extra required fields).`,choices:[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]}).option(`access-application-id`,{type:`string`,description:`Access application ID is required only for access_application_policy resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for deleting tags from zone-level resources.`}),handler:async e=>{let r={};if(e.ifMatch!==void 0&&(r[`If-Match`]=String(e.ifMatch)),e.dryRun){f({command:`cf resource-tagging zone-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/tags`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{resourceId:e.resourceId,resourceType:e.resourceType,accessApplicationId:e.accessApplicationId,body:e.body},validation:`passed`});return}let c=await a(e),p=await o({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=p,!await i(`zone tag`,String(p??``),{force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}if(e.body){let t=u(e.body);d(await m(`Deleting zone tag`,async()=>c.delete(`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Deleted zone tag`});return}e.resourceId===void 0&&(e.resourceId=await t(`resource-id`,`Identifies the unique resource.`)),e.resourceType===void 0&&(e.resourceType=await n(`resource-type`,`Enum for base zone-level resource types (those with no extra required fields).`,[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]));let h={};e.resourceId!==void 0&&l(h,[`resource_id`],s(e.resourceId,`resourceId`,`text`)),e.resourceType!==void 0&&l(h,[`resource_type`],s(e.resourceType,`resourceType`,`text`)),e.accessApplicationId!==void 0&&l(h,[`access_application_id`],s(e.accessApplicationId,`accessApplicationId`,`text`)),d(await m(`Deleting zone tag`,async()=>c.delete(`/zones/${e.zoneId}/tags`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Deleted zone tag`})}},T={command:`get`,describe:`Retrieves tags for a specific zone-level resource.`,builder:e=>e.option(`resource-id`,{type:`string`,description:`The ID of the resource to retrieve tags for.`,demandOption:!0}).option(`resource-type`,{type:`string`,description:`The type of the resource.`,choices:[`access_application_policy`,`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`],demandOption:!0}).option(`access-application-id`,{type:`string`,description:`Access application ID identifier. Required for access_application_policy resources.`}),handler:async e=>{let t={};e.resourceId!==void 0&&(t.resource_id=e.resourceId),e.resourceType!==void 0&&(t.resource_type=e.resourceType),e.accessApplicationId!==void 0&&(t.access_application_id=e.accessApplicationId);let n=await a(e),r=await o({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,d(await m(`Loading zone tag`,async()=>n.resourceTagging.zoneTags.get(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded zone tag`})}},E={command:`update`,describe:`Creates or updates tags for a specific zone-level resource. Replaces all existing tags for the resource.`,builder:e=>e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will verify the current resource ETag matches before applying the write. Returns 412 Precondition Failed if the resource has been modified since the ETag was obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for base zone-level resource types (those with no extra required fields).`,choices:[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]}).option(`access-application-id`,{type:`string`,description:`Access application ID is required only for access_application_policy resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for setting tags on zone-level resources.`}),handler:async e=>{let r={};if(e.ifMatch!==void 0&&(r[`If-Match`]=String(e.ifMatch)),e.dryRun){f({command:`cf resource-tagging zone-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/tags`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{resourceId:e.resourceId,resourceType:e.resourceType,accessApplicationId:e.accessApplicationId,body:e.body},validation:`passed`});return}let i=await a(e);if(e.zoneId=await o({zone:e.zone},i,{quiet:e.quiet}),e.body){let t=u(e.body);d(await m(`Updating zone tag`,async()=>i.put(`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated zone tag`});return}e.resourceId===void 0&&(e.resourceId=await t(`resource-id`,`Identifies the unique resource.`)),e.resourceType===void 0&&(e.resourceType=await n(`resource-type`,`Enum for base zone-level resource types (those with no extra required fields).`,[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]));let c={};e.resourceId!==void 0&&l(c,[`resource_id`],s(e.resourceId,`resourceId`,`text`)),e.resourceType!==void 0&&l(c,[`resource_type`],s(e.resourceType,`resourceType`,`text`)),e.accessApplicationId!==void 0&&l(c,[`access_application_id`],s(e.accessApplicationId,`accessApplicationId`,`text`)),d(await m(`Updating zone tag`,async()=>i.put(`/zones/${e.zoneId}/tags`,{body:Object.keys(c).length>0?c:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated zone tag`})}},D={command:`zone-tags`,describe:`Tags applied to individual zones for categorization and bulk management`,builder:e=>e.command(w).command(T).command(E).demandCommand(1),handler:()=>{}},O={command:`resource-tagging`,describe:`Tag accounts and zones with key-value metadata for organization, filtering, and policy targeting`,builder:e=>e.command(x).command(v).command(b).command(C).command(D).demandCommand(1),handler:()=>{}};export{O as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),d=e(import.meta.url);export{u as i,c as n,d as r,s as t};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`get <operationId>`,describe:"Gets the current status of an asynchronous operation on a list. The `status` property can have one of the following values: `pending`, `running`, `completed`, or `failed`. If the status is `failed`, the `error` property will contain a message describing the error.",builder:e=>e.positional(`operationId`,{type:`string`,description:`The unique operation ID of the asynchronous action.`,demandOption:!0}),handler:async e=>{o(e.operationId,`operationId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading bulk operation`,async()=>t.rules.lists.bulkOperations.get(e.operationId,r)),{successLabel:`Loaded bulk operation`})}},m={command:`bulk-operations`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(p).demandCommand(1),handler:()=>{}},h={command:`create`,describe:`Creates a new list of the specified kind.`,builder:e=>e.option(`description`,{type:`string`,description:`An informative summary of the list.`}).option(`name`,{type:`string`,description:`An informative name for the list. Use this name in filter and rule expressions.`}).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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf rules lists create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`json`,body:{description:r.description,name:r.name,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating list`,async()=>p.post(`/accounts/${m}/rules/lists`,{body:e})),{successLabel:`Created list`});return}r.name===void 0&&(r.name=await t(`name`,`An informative name for the list. Use this name in filter and rule expressions.`));let h={};r.description!==void 0&&s(h,[`description`],a(r.description,`description`,`text`)),r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),l(await f(`Creating list`,async()=>p.post(`/accounts/${m}/rules/lists`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created list`})}},g={command:`delete <listId>`,describe:`Deletes a specific list and all its items.`,builder:e=>e.positional(`listId`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.listId,`listId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf rules lists delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/rules/lists/${t.listId??`<listId>`}`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`list`,String(t.listId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=c(t.body);l(await f(`Deleting list`,async()=>a.delete(`/accounts/${s}/rules/lists/${t.listId}`,{body:e})),{successLabel:`Deleted list`});return}l(await f(`Deleting list`,async()=>a.rules.lists.delete(t.listId,s)),{successLabel:`Deleted list`})}},_={command:`get <listId>`,describe:`Fetches the details of a list.`,builder:e=>e.positional(`listId`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}),handler:async e=>{o(e.listId,`listId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading list`,async()=>t.rules.lists.get(e.listId,r)),{successLabel:`Loaded list`})}},v={command:`create <listId>`,describe:"Appends new items to the list. This operation is asynchronous. To get current the operation status, invoke the `Get bulk operation status` endpoint with the returned `operation_id`. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.",builder:e=>e.positional(`listId`,{type:`string`,description:`The unique ID of the list.`,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)`}),handler:async t=>{if(o(t.listId,`listId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf rules lists items create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Creating item`,async()=>r.post(`/accounts/${a}/rules/lists/${t.listId}/items`,{body:e})),{successLabel:`Created item`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},y={command:`delete <listId>`,describe:"Removes one or more items from a list. This operation is asynchronous. To get current the operation status, invoke the `Get bulk operation status` endpoint with the returned `operation_id`. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.",builder:e=>e.positional(`listId`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.listId,`listId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf rules lists items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`item`,String(t.listId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}if(t.body){let e=c(t.body);l(await f(`Deleting item`,async()=>a.delete(`/accounts/${s}/rules/lists/${t.listId}/items`,{body:e})),{successLabel:`Deleted item`});return}l(await f(`Deleting item`,async()=>a.rules.lists.items.delete(t.listId,s)),{successLabel:`Deleted item`})}},b={command:`get <itemId>`,describe:`Fetches a list item in the list.`,builder:e=>e.positional(`itemId`,{type:`string`,description:`Defines the unique ID of the item in the List.`,demandOption:!0}).option(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}),handler:async e=>{o(e.itemId,`itemId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading item`,async()=>t.rules.lists.items.get(e.itemId,e.listId,r)),{successLabel:`Loaded item`})}},x={command:`list`,describe:`Fetches all the items in the list.`,builder:e=>e.option(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`cursor`,{type:`string`,description:"The pagination cursor. An opaque string token indicating the position from which to continue when requesting the next/previous set of records. Cursor values are provided under `result_info.cursors` in the response. You should make no assumptions about a cursor's content or length."}).option(`per-page`,{type:`number`,description:`Amount of results to include in each paginated response. A non-negative 32 bit integer.`}).option(`search`,{type:`string`,description:`A search query to filter returned items. Its meaning depends on the list type: IP addresses must start with the provided string, hostnames and bulk redirects must contain the string, and ASNs must match the string exactly.`}),handler:async e=>{let t={};e.cursor!==void 0&&(t.cursor=e.cursor),e.perPage!==void 0&&(t.per_page=e.perPage),e.search!==void 0&&(t.search=e.search);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading items`,async()=>r.rules.lists.items.list(e.listId,a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded items`})}},S={command:`update <listId>`,describe:"Removes all existing items from the list and adds the provided items to the list. This operation is asynchronous. To get current the operation status, invoke the `Get bulk operation status` endpoint with the returned `operation_id`. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.",builder:e=>e.positional(`listId`,{type:`string`,description:`The unique ID of the list.`,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)`}),handler:async t=>{if(o(t.listId,`listId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf rules lists items update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Updating item`,async()=>r.put(`/accounts/${a}/rules/lists/${t.listId}/items`,{body:e})),{successLabel:`Updated item`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},C={command:`items`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(v).command(y).command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`list`,describe:`Fetches all lists in the account.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading lists`,async()=>t.rules.lists.list(r)),{successLabel:`Loaded lists`})}},T={command:`update <listId>`,describe:`Updates the description of a list.`,builder:e=>e.positional(`listId`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative summary of the list.`}).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)`}),handler:async t=>{if(o(t.listId,`listId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf rules lists update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/rules/lists/${t.listId??`<listId>`}`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{description:t.description,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating list`,async()=>r.put(`/accounts/${p}/rules/lists/${t.listId}`,{body:e})),{successLabel:`Updated list`});return}let m={};t.description!==void 0&&s(m,[`description`],a(t.description,`description`,`text`)),l(await f(`Updating list`,async()=>r.put(`/accounts/${p}/rules/lists/${t.listId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated list`})}},E={command:`lists`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(h).command(g).command(_).command(w).command(T).command(m).command(C).demandCommand(1),handler:()=>{}},D={command:`rules`,describe:`Account-level IP lists, hostname lists, and other reusable lists referenced by firewall rules and rulesets`,builder:e=>e.command(E).demandCommand(1),handler:()=>{}};export{D as default};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,o as t,p as n,t as r,u as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{t as s}from"./output-CqGQp2r6.mjs";import{t as c}from"./dry-run-FV0pZwdg.mjs";import{t as l}from"./local-OqhVQbv0.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Creates a ruleset at the account level.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets`,pathParams:{},bodyKind:`json`,body:{body:n.body},validation:`passed`});return}let i=await r(n),d=n.local?l:await t(i);if(n.accountId=d,n.body){let e=a(n.body,`body`,`binary`);s(await u(`Creating account ruleset`,async()=>i.post(`/accounts/${d}/rulesets`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created account ruleset`});return}s(await u(`Creating account ruleset`,async()=>i.rulesets.accountRulesets.create(d)),{successLabel:`Created account ruleset`})}},f={command:`delete <rulesetId>`,describe:`Deletes all versions of an existing account ruleset.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,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}),handler:async i=>{if(o(i.rulesetId,`rulesetId`),i.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/${i.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(i.rulesetId??``)},bodyKind:`none`,validation:`passed`});return}let a=await r(i),d=i.local?l:await t(a);if(i.accountId=d,!await n(`account ruleset`,String(i.rulesetId??``),{force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}s(await u(`Deleting account ruleset`,async()=>a.rulesets.accountRulesets.delete(i.rulesetId,d)),{successLabel:`Deleted account ruleset`})}},p={command:`get <rulesetId>`,describe:`Fetches the latest version of an account ruleset.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetId,`rulesetId`);let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading account ruleset`,async()=>n.rulesets.accountRulesets.get(e.rulesetId,i)),{successLabel:`Loaded account ruleset`})}},m={command:`list`,describe:`Fetches all rulesets at the account level.`,builder:e=>e.option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`string`,description:`The number of rulesets to return per page.`}),handler:async e=>{let n={};e.cursor!==void 0&&(n.cursor=e.cursor),e.perPage!==void 0&&(n.per_page=e.perPage);let i=await r(e),a=e.local?l:await t(i);e.accountId=a,s(await u(`Loading account rulesets`,async()=>i.rulesets.accountRulesets.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded account rulesets`})}},h={command:`get <rulesetPhase>`,describe:`Fetches the latest version of the account entry point ruleset for a given phase.`,builder:e=>e.positional(`rulesetPhase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetPhase,`rulesetPhase`);let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading phase`,async()=>n.rulesets.accountRulesets.phases.get(e.rulesetPhase,i)),{successLabel:`Loaded phase`})}},g={command:`update <rulesetPhase>`,describe:`Updates an account entry point ruleset, creating a new version.`,builder:e=>e.positional(`rulesetPhase`,{type:`string`,description:`The phase of the ruleset.`,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)`}),handler:async n=>{if(o(n.rulesetPhase,`rulesetPhase`),n.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/phases/${n.rulesetPhase??`<rulesetPhase>`}/entrypoint`,pathParams:{rulesetPhase:String(n.rulesetPhase??``)},bodyKind:`json`,body:{body:n.body},validation:`passed`});return}let i=await r(n),d=n.local?l:await t(i);if(n.accountId=d,n.body){let e=a(n.body,`body`,`binary`);s(await u(`Updating phase`,async()=>i.put(`/accounts/${d}/rulesets/phases/${n.rulesetPhase}/entrypoint`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated phase`});return}s(await u(`Updating phase`,async()=>i.rulesets.accountRulesets.phases.update(n.rulesetPhase,d)),{successLabel:`Updated phase`})}},_={command:`get <rulesetVersion>`,describe:`Fetches a specific version of an account entry point ruleset.`,builder:e=>e.positional(`rulesetVersion`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetVersion,`rulesetVersion`);let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading version`,async()=>n.rulesets.accountRulesets.phases.versions.get(e.rulesetVersion,e.rulesetPhase,i)),{successLabel:`Loaded version`})}},v={command:`list`,describe:`Fetches the versions of an account entry point ruleset.`,builder:e=>e.option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}),handler:async e=>{let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading versions`,async()=>n.rulesets.accountRulesets.phases.versions.list(e.rulesetPhase,i)),{successLabel:`Loaded versions`})}},y={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(_).command(v).demandCommand(1),handler:()=>{}},b={command:`phases`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(h).command(g).command(y).demandCommand(1),handler:()=>{}},x={command:`create <rulesetId>`,describe:`Adds a new rule to an account ruleset. The rule will be added to the end of the existing list of rules in the ruleset by default.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,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)`}),handler:async n=>{if(o(n.rulesetId,`rulesetId`),n.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/${n.rulesetId??`<rulesetId>`}/rules`,pathParams:{rulesetId:String(n.rulesetId??``)},bodyKind:`json`,body:{body:n.body},validation:`passed`});return}let i=await r(n),d=n.local?l:await t(i);if(n.accountId=d,n.body){let e=a(n.body,`body`,`binary`);s(await u(`Creating rule`,async()=>i.post(`/accounts/${d}/rulesets/${n.rulesetId}/rules`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created rule`});return}s(await u(`Creating rule`,async()=>i.rulesets.accountRulesets.rules.create(n.rulesetId,d)),{successLabel:`Created rule`})}},S={command:`delete <ruleId>`,describe:`Deletes an existing rule from an account ruleset.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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}),handler:async i=>{if(o(i.ruleId,`ruleId`),i.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/${i.rulesetId??`<rulesetId>`}/rules/${i.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(i.ruleId??``),rulesetId:String(i.rulesetId??``)},bodyKind:`none`,validation:`passed`});return}let a=await r(i),d=i.local?l:await t(a);if(i.accountId=d,!await n(`rule`,String(i.ruleId??``),{force:!!i.force})){process.stderr.write(`Aborted.
4
- `);return}s(await u(`Deleting rule`,async()=>a.rulesets.accountRulesets.rules.delete(i.ruleId,i.rulesetId,d)),{successLabel:`Deleted rule`})}},C={command:`update <ruleId>`,describe:`Updates an existing rule in an account ruleset.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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)`}),handler:async n=>{if(o(n.ruleId,`ruleId`),n.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/${n.rulesetId??`<rulesetId>`}/rules/${n.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(n.ruleId??``),rulesetId:String(n.rulesetId??``)},bodyKind:`json`,body:{body:n.body},validation:`passed`});return}let i=await r(n),d=n.local?l:await t(i);if(n.accountId=d,n.body){let e=a(n.body,`body`,`binary`);s(await u(`Updating rule`,async()=>i.patch(`/accounts/${d}/rulesets/${n.rulesetId}/rules/${n.ruleId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated rule`});return}s(await u(`Updating rule`,async()=>i.rulesets.accountRulesets.rules.update(n.ruleId,n.rulesetId,d)),{successLabel:`Updated rule`})}},w={command:`rules`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(x).command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`update <rulesetId>`,describe:`Updates an account ruleset, creating a new version.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,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)`}),handler:async n=>{if(o(n.rulesetId,`rulesetId`),n.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/${n.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(n.rulesetId??``)},bodyKind:`json`,body:{body:n.body},validation:`passed`});return}let i=await r(n),d=n.local?l:await t(i);if(n.accountId=d,n.body){let e=a(n.body,`body`,`binary`);s(await u(`Updating account ruleset`,async()=>i.put(`/accounts/${d}/rulesets/${n.rulesetId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated account ruleset`});return}s(await u(`Updating account ruleset`,async()=>i.rulesets.accountRulesets.update(n.rulesetId,d)),{successLabel:`Updated account ruleset`})}},E={command:`tag <ruleTag>`,describe:`Fetches the rules of a managed account ruleset version for a given tag.`,builder:e=>e.positional(`ruleTag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.ruleTag,`ruleTag`);let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading by tag`,async()=>n.rulesets.accountRulesets.versions.byTag.tag(e.ruleTag,e.rulesetVersion,e.rulesetId,i)),{successLabel:`Loaded by tag`})}},D={command:`by-tag`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(E).demandCommand(1),handler:()=>{}},O={command:`delete <rulesetVersion>`,describe:`Deletes an existing version of an account ruleset.`,builder:e=>e.positional(`rulesetVersion`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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}),handler:async i=>{if(o(i.rulesetVersion,`rulesetVersion`),i.dryRun){let t=e();t&&o(t,`accountId`),c({command:`cf rulesets account-rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rulesets/${i.rulesetId??`<rulesetId>`}/versions/${i.rulesetVersion??`<rulesetVersion>`}`,pathParams:{rulesetVersion:String(i.rulesetVersion??``),rulesetId:String(i.rulesetId??``)},bodyKind:`none`,validation:`passed`});return}let a=await r(i),d=i.local?l:await t(a);if(i.accountId=d,!await n(`version`,String(i.rulesetVersion??``),{force:!!i.force})){process.stderr.write(`Aborted.
5
- `);return}s(await u(`Deleting version`,async()=>a.rulesets.accountRulesets.versions.delete(i.rulesetVersion,i.rulesetId,d)),{successLabel:`Deleted version`})}},k={command:`get <rulesetVersion>`,describe:`Fetches a specific version of an account ruleset.`,builder:e=>e.positional(`rulesetVersion`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetVersion,`rulesetVersion`);let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading version`,async()=>n.rulesets.accountRulesets.versions.get(e.rulesetVersion,e.rulesetId,i)),{successLabel:`Loaded version`})}},A={command:`list`,describe:`Fetches the versions of an account ruleset.`,builder:e=>e.option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{let n=await r(e),i=e.local?l:await t(n);e.accountId=i,s(await u(`Loading versions`,async()=>n.rulesets.accountRulesets.versions.list(e.rulesetId,i)),{successLabel:`Loaded versions`})}},j={command:`tag <ruleTag>`,describe:`Fetches the rules of a managed zone ruleset version for a given tag.`,builder:e=>e.positional(`ruleTag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.ruleTag,`ruleTag`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading zone by tag`,async()=>t.rulesets.accountRulesets.versions.zoneByTag.tag(e.ruleTag,e.rulesetVersion,e.rulesetId,n)),{successLabel:`Loaded zone by tag`})}},M={command:`zone-by-tag`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(j).demandCommand(1),handler:()=>{}},ee={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(O).command(k).command(A).command(D).command(M).demandCommand(1),handler:()=>{}},N={command:`account-rulesets`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(d).command(f).command(p).command(m).command(T).command(b).command(w).command(ee).demandCommand(1),handler:()=>{}},P={command:`create`,describe:`Creates a ruleset at the zone level.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){c({command:`cf rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=a(e.body,`body`,`binary`);s(await u(`Creating ruleset`,async()=>t.post(`/zones/${e.zoneId}/rulesets`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created ruleset`});return}s(await u(`Creating ruleset`,async()=>t.rulesets.create(n)),{successLabel:`Created ruleset`})}},F={command:`delete <rulesetId>`,describe:`Deletes all versions of an existing zone ruleset.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,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}),handler:async e=>{if(o(e.rulesetId,`rulesetId`),e.dryRun){c({command:`cf rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`ruleset`,String(e.rulesetId??``),{force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}s(await u(`Deleting ruleset`,async()=>t.rulesets.delete(e.rulesetId,a)),{successLabel:`Deleted ruleset`})}},I={command:`get <rulesetId>`,describe:`Fetches the latest version of a zone ruleset.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetId,`rulesetId`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading ruleset`,async()=>t.rulesets.get(e.rulesetId,n)),{successLabel:`Loaded ruleset`})}},L={command:`list`,describe:`Fetches all rulesets at the zone level.`,builder:e=>e.option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`string`,description:`The number of rulesets to return per page.`}),handler:async e=>{let t={};e.cursor!==void 0&&(t.cursor=e.cursor),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,s(await u(`Loading rulesets`,async()=>n.rulesets.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded rulesets`})}},R={command:`get <rulesetPhase>`,describe:`Fetches the latest version of the zone entry point ruleset for a given phase.`,builder:e=>e.positional(`rulesetPhase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetPhase,`rulesetPhase`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading phase`,async()=>t.rulesets.phases.get(e.rulesetPhase,n)),{successLabel:`Loaded phase`})}},z={command:`update <rulesetPhase>`,describe:`Updates a zone entry point ruleset, creating a new version.`,builder:e=>e.positional(`rulesetPhase`,{type:`string`,description:`The phase of the ruleset.`,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)`}),handler:async e=>{if(o(e.rulesetPhase,`rulesetPhase`),e.dryRun){c({command:`cf rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/phases/${e.rulesetPhase??`<rulesetPhase>`}/entrypoint`,pathParams:{rulesetPhase:String(e.rulesetPhase??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=a(e.body,`body`,`binary`);s(await u(`Updating phase`,async()=>t.put(`/zones/${e.zoneId}/rulesets/phases/${e.rulesetPhase}/entrypoint`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated phase`});return}s(await u(`Updating phase`,async()=>t.rulesets.phases.update(e.rulesetPhase,n)),{successLabel:`Updated phase`})}},B={command:`get <rulesetVersion>`,describe:`Fetches a specific version of a zone entry point ruleset.`,builder:e=>e.positional(`rulesetVersion`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetVersion,`rulesetVersion`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading version`,async()=>t.rulesets.phases.versions.get(e.rulesetVersion,e.rulesetPhase,n)),{successLabel:`Loaded version`})}},V={command:`list`,describe:`Fetches the versions of a zone entry point ruleset.`,builder:e=>e.option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}),handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading versions`,async()=>t.rulesets.phases.versions.list(e.rulesetPhase,n)),{successLabel:`Loaded versions`})}},H={command:`versions`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(B).command(V).demandCommand(1),handler:()=>{}},U={command:`phases`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(R).command(z).command(H).demandCommand(1),handler:()=>{}},W={command:`create <rulesetId>`,describe:`Adds a new rule to a zone ruleset. The rule will be added to the end of the existing list of rules in the ruleset by default.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,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)`}),handler:async e=>{if(o(e.rulesetId,`rulesetId`),e.dryRun){c({command:`cf rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}/rules`,pathParams:{rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=a(e.body,`body`,`binary`);s(await u(`Creating rule`,async()=>t.post(`/zones/${e.zoneId}/rulesets/${e.rulesetId}/rules`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created rule`});return}s(await u(`Creating rule`,async()=>t.rulesets.rules.create(e.rulesetId,n)),{successLabel:`Created rule`})}},G={command:`delete <ruleId>`,describe:`Deletes an existing rule from a zone ruleset.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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}),handler:async e=>{if(o(e.ruleId,`ruleId`),e.dryRun){c({command:`cf rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``),rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`rule`,String(e.ruleId??``),{force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}s(await u(`Deleting rule`,async()=>t.rulesets.rules.delete(e.ruleId,e.rulesetId,a)),{successLabel:`Deleted rule`})}},K={command:`edit <ruleId>`,describe:`Updates an existing rule in a zone ruleset.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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)`}),handler:async e=>{if(o(e.ruleId,`ruleId`),e.dryRun){c({command:`cf rulesets rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``),rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=a(e.body,`body`,`binary`);s(await u(`Updating rule`,async()=>t.patch(`/zones/${e.zoneId}/rulesets/${e.rulesetId}/rules/${e.ruleId}`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated rule`});return}s(await u(`Updating rule`,async()=>t.rulesets.rules.edit(e.ruleId,e.rulesetId,n)),{successLabel:`Updated rule`})}},q={command:`rules`,describe:`Individual rules within a ruleset — each with an expression, action, and priority`,builder:e=>e.command(W).command(G).command(K).demandCommand(1),handler:()=>{}},J={command:`update <rulesetId>`,describe:`Updates a zone ruleset, creating a new version.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The unique ID of the ruleset.`,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)`}),handler:async e=>{if(o(e.rulesetId,`rulesetId`),e.dryRun){c({command:`cf rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=a(e.body,`body`,`binary`);s(await u(`Updating ruleset`,async()=>t.put(`/zones/${e.zoneId}/rulesets/${e.rulesetId}`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated ruleset`});return}s(await u(`Updating ruleset`,async()=>t.rulesets.update(e.rulesetId,n)),{successLabel:`Updated ruleset`})}},Y={command:`delete <rulesetVersion>`,describe:`Deletes an existing version of a zone ruleset.`,builder:e=>e.positional(`rulesetVersion`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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}),handler:async e=>{if(o(e.rulesetVersion,`rulesetVersion`),e.dryRun){c({command:`cf rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}/versions/${e.rulesetVersion??`<rulesetVersion>`}`,pathParams:{rulesetVersion:String(e.rulesetVersion??``),rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`version`,String(e.rulesetVersion??``),{force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}s(await u(`Deleting version`,async()=>t.rulesets.versions.delete(e.rulesetVersion,e.rulesetId,a)),{successLabel:`Deleted version`})}},X={command:`get <rulesetVersion>`,describe:`Fetches a specific version of a zone ruleset.`,builder:e=>e.positional(`rulesetVersion`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{o(e.rulesetVersion,`rulesetVersion`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading version`,async()=>t.rulesets.versions.get(e.rulesetVersion,e.rulesetId,n)),{successLabel:`Loaded version`})}},Z={command:`list`,describe:`Fetches the versions of a zone ruleset.`,builder:e=>e.option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}),handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await u(`Loading versions`,async()=>t.rulesets.versions.list(e.rulesetId,n)),{successLabel:`Loaded versions`})}},Q={command:`versions`,describe:`Immutable snapshots of a ruleset, allowing rollback and audit of rule changes`,builder:e=>e.command(Y).command(X).command(Z).demandCommand(1),handler:()=>{}},$={command:`rulesets`,describe:`Versioned collections of rules that control how Cloudflare processes traffic — WAF, transform, redirect, and more`,builder:e=>e.command(P).command(F).command(I).command(L).command(J).command(N).command(U).command(q).command(Q).demandCommand(1),handler:()=>{}};export{$ as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";const f={command:`bulk-create`,describe:`Modifies one or more rules in a Web Analytics ruleset with a single request.`,builder:e=>e.option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`delete-rules`,{type:`string`,array:!0,description:`A list of rule identifiers to delete.`}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/v2/${n.rulesetId??`<rulesetId>`}/rules`,pathParams:{rulesetId:String(n.rulesetId??``)},bodyKind:`json`,body:{deleteRules:n.deleteRules,body:n.body},validation:`passed`});return}let i=await r(n),f=n.local?u:await t(i);if(n.accountId=f,n.body){let e=s(n.body);c(await d(`Creating rules`,async()=>i.post(`/accounts/${f}/rum/v2/${n.rulesetId}/rules`,{body:e})),{successLabel:`Created rules`});return}let p={};n.deleteRules!==void 0&&o(p,[`delete_rules`],n.deleteRules),c(await d(`Creating rules`,async()=>i.post(`/accounts/${f}/rum/v2/${n.rulesetId}/rules`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created rules`})}},p={command:`create <rulesetId>`,describe:`Creates a new rule in a Web Analytics ruleset.`,builder:e=>e.positional(`rulesetId`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`host`,{type:`string`,description:`The host field`}).option(`inclusive`,{type:`boolean`,description:`Whether the rule includes or excludes traffic from being measured.`}).option(`is-paused`,{type:`boolean`,description:`Whether the rule is paused or not.`}).option(`paths`,{type:`string`,array:!0,description:`The paths field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(a(n.rulesetId,`rulesetId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/v2/${n.rulesetId??`<rulesetId>`}/rule`,pathParams:{rulesetId:String(n.rulesetId??``)},bodyKind:`json`,body:{host:n.host,inclusive:n.inclusive,isPaused:n.isPaused,paths:n.paths,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating rule`,async()=>f.post(`/accounts/${p}/rum/v2/${n.rulesetId}/rule`,{body:e})),{successLabel:`Created rule`});return}let m={};n.host!==void 0&&o(m,[`host`],i(n.host,`host`,`text`)),n.inclusive!==void 0&&o(m,[`inclusive`],n.inclusive),n.isPaused!==void 0&&o(m,[`is_paused`],n.isPaused),n.paths!==void 0&&o(m,[`paths`],n.paths),c(await d(`Creating rule`,async()=>f.post(`/accounts/${p}/rum/v2/${n.rulesetId}/rule`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created rule`})}},m={command:`delete <ruleId>`,describe:`Deletes an existing rule from a Web Analytics ruleset.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The Web Analytics rule identifier.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset 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}),handler:async i=>{if(a(i.ruleId,`ruleId`),i.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/v2/${i.rulesetId??`<rulesetId>`}/rule/${i.ruleId??`<ruleId>`}`,pathParams:{rulesetId:String(i.rulesetId??``),ruleId:String(i.ruleId??``)},bodyKind:`none`,validation:`passed`});return}let o=await r(i),s=i.local?u:await t(o);if(i.accountId=s,!await n(`rule`,String(i.ruleId??``),{force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}c(await d(`Deleting rule`,async()=>o.rum.rules.delete(s,i.rulesetId,i.ruleId)),{successLabel:`Deleted rule`})}},h={command:`list`,describe:`Lists all the rules in a Web Analytics ruleset.`,builder:e=>e.option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}),handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading rules`,async()=>n.rum.rules.list(i,e.rulesetId)),{successLabel:`Loaded rules`})}},g={command:`update <ruleId>`,describe:`Updates a rule in a Web Analytics ruleset.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The Web Analytics rule identifier.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`host`,{type:`string`,description:`The host field`}).option(`inclusive`,{type:`boolean`,description:`Whether the rule includes or excludes traffic from being measured.`}).option(`is-paused`,{type:`boolean`,description:`Whether the rule is paused or not.`}).option(`paths`,{type:`string`,array:!0,description:`The paths field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(a(n.ruleId,`ruleId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/v2/${n.rulesetId??`<rulesetId>`}/rule/${n.ruleId??`<ruleId>`}`,pathParams:{rulesetId:String(n.rulesetId??``),ruleId:String(n.ruleId??``)},bodyKind:`json`,body:{host:n.host,inclusive:n.inclusive,isPaused:n.isPaused,paths:n.paths,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating rule`,async()=>f.put(`/accounts/${p}/rum/v2/${n.rulesetId}/rule/${n.ruleId}`,{body:e})),{successLabel:`Updated rule`});return}let m={};n.host!==void 0&&o(m,[`host`],i(n.host,`host`,`text`)),n.inclusive!==void 0&&o(m,[`inclusive`],n.inclusive),n.isPaused!==void 0&&o(m,[`is_paused`],n.isPaused),n.paths!==void 0&&o(m,[`paths`],n.paths),c(await d(`Updating rule`,async()=>f.put(`/accounts/${p}/rum/v2/${n.rulesetId}/rule/${n.ruleId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated rule`})}},_={command:`rules`,describe:`Rules that control which pages and paths are tracked by Web Analytics`,builder:e=>e.command(f).command(p).command(m).command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`create`,describe:`Creates a new Web Analytics site.`,builder:e=>e.option(`auto-install`,{type:`boolean`,description:`If enabled, the JavaScript snippet is automatically injected for orange-clouded sites.`}).option(`host`,{type:`string`,description:`The hostname to use for gray-clouded sites.`}).option(`zone-tag`,{type:`string`,description:`The zone identifier.`}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum site-info create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/site_info`,pathParams:{},bodyKind:`json`,body:{autoInstall:n.autoInstall,host:n.host,zoneTag:n.zoneTag,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating site info`,async()=>f.post(`/accounts/${p}/rum/site_info`,{body:e})),{successLabel:`Created site info`});return}let m={};n.autoInstall!==void 0&&o(m,[`auto_install`],n.autoInstall),n.host!==void 0&&o(m,[`host`],i(n.host,`host`,`text`)),n.zoneTag!==void 0&&o(m,[`zone_tag`],i(n.zoneTag,`zoneTag`,`text`)),c(await d(`Creating site info`,async()=>f.post(`/accounts/${p}/rum/site_info`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created site info`})}},y={command:`delete <siteId>`,describe:`Deletes an existing Web Analytics site.`,builder:e=>e.positional(`siteId`,{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}),handler:async i=>{if(a(i.siteId,`siteId`),i.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum site-info delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/site_info/${i.siteId??`<siteId>`}`,pathParams:{siteId:String(i.siteId??``)},bodyKind:`none`,validation:`passed`});return}let o=await r(i),s=i.local?u:await t(o);if(i.accountId=s,!await n(`site info`,String(i.siteId??``),{force:!!i.force})){process.stderr.write(`Aborted.
4
- `);return}c(await d(`Deleting site info`,async()=>o.rum.siteInfo.delete(s,i.siteId)),{successLabel:`Deleted site info`})}},b={command:`get <siteId>`,describe:`Retrieves a Web Analytics site.`,builder:e=>e.positional(`siteId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.siteId,`siteId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading site info`,async()=>n.rum.siteInfo.get(i,e.siteId)),{successLabel:`Loaded site info`})}},x={command:`list`,describe:`Lists all Web Analytics sites of an account.`,builder:e=>e.option(`per-page`,{type:`string`,description:`Number of items to return per page of results.`}).option(`page`,{type:`string`,description:`Current page within the paginated list of results.`}).option(`order-by`,{type:`string`,description:`The property used to sort the list of results.`,choices:[`host`,`created`]}),handler:async e=>{let n={};e.perPage!==void 0&&(n.per_page=e.perPage),e.page!==void 0&&(n.page=e.page),e.orderBy!==void 0&&(n.order_by=e.orderBy);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading site info`,async()=>i.rum.siteInfo.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded site info`})}},S={command:`update <siteId>`,describe:`Updates an existing Web Analytics site.`,builder:e=>e.positional(`siteId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`auto-install`,{type:`boolean`,description:`If enabled, the JavaScript snippet is automatically injected for orange-clouded sites.`}).option(`enabled`,{type:`boolean`,description:`Enables or disables RUM. This option can be used only when auto_install is set to true.`}).option(`host`,{type:`string`,description:`The hostname to use for gray-clouded sites.`}).option(`lite`,{type:`boolean`,description:`If enabled, the JavaScript snippet will not be injected for visitors from the EU.`}).option(`zone-tag`,{type:`string`,description:`The zone identifier.`}).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)`}),handler:async n=>{if(a(n.siteId,`siteId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf rum site-info update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/rum/site_info/${n.siteId??`<siteId>`}`,pathParams:{siteId:String(n.siteId??``)},bodyKind:`json`,body:{autoInstall:n.autoInstall,enabled:n.enabled,host:n.host,lite:n.lite,zoneTag:n.zoneTag,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating site info`,async()=>f.put(`/accounts/${p}/rum/site_info/${n.siteId}`,{body:e})),{successLabel:`Updated site info`});return}let m={};n.autoInstall!==void 0&&o(m,[`auto_install`],n.autoInstall),n.enabled!==void 0&&o(m,[`enabled`],n.enabled),n.host!==void 0&&o(m,[`host`],i(n.host,`host`,`text`)),n.lite!==void 0&&o(m,[`lite`],n.lite),n.zoneTag!==void 0&&o(m,[`zone_tag`],i(n.zoneTag,`zoneTag`,`text`)),c(await d(`Updating site info`,async()=>f.put(`/accounts/${p}/rum/site_info/${n.siteId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated site info`})}},C={command:`site-info`,describe:`Web Analytics sites — register domains and get the JavaScript beacon snippet`,builder:e=>e.command(v).command(y).command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`rum`,describe:`Real User Measurement (Web Analytics) — track page loads, Core Web Vitals, and visitor metrics`,builder:e=>e.command(_).command(C).demandCommand(1),handler:()=>{}};export{w as default};