cf 0.1.0 → 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 (248) hide show
  1. package/dist/_meta/agent-context.json +88 -88
  2. package/dist/_meta/commands.json +5268 -5350
  3. package/dist/_meta/schemas.json +33572 -1148
  4. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  5. package/dist/accounts-BopMfODC.mjs +21 -0
  6. package/dist/acm-BT4vlnEJ.mjs +3 -0
  7. package/dist/addressing-B3uFxHst.mjs +13 -0
  8. package/dist/ai-DWHqwMap.mjs +2 -0
  9. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  10. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  11. package/dist/alerting-BmmgIlIO.mjs +6 -0
  12. package/dist/analytics-isY03taL.mjs +20 -0
  13. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  14. package/dist/argo-B02BL_hp.mjs +2 -0
  15. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  16. package/dist/auth-CQcAgnOy.mjs +135 -0
  17. package/dist/{auth-DQ8miey6.mjs → auth-DenWm_X0.mjs} +3 -3
  18. package/dist/autorag-CmrwnGVj.mjs +2 -0
  19. package/dist/{billing-lwBHNTXC.mjs → billing-CaW1ZAB1.mjs} +1 -1
  20. package/dist/bot-management-CeBsFx68.mjs +5 -0
  21. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  22. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  23. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  24. package/dist/build-5jmmOZhm.mjs +1054 -0
  25. package/dist/cache-DmXizSMi.mjs +5 -0
  26. package/dist/calls-x4KQpTB4.mjs +4 -0
  27. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  28. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  29. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  30. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  31. package/dist/{config-BIfdEY0E.mjs → config-DYzlVxcB.mjs} +1 -1
  32. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  33. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  34. package/dist/context-CC0Rhkhy.mjs +2 -0
  35. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  36. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  37. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  38. package/dist/custom-pages-D-oErw57.mjs +4 -0
  39. package/dist/d1-C95ckPKI.mjs +3 -0
  40. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  41. package/dist/delegate.mjs +1 -1
  42. package/dist/deploy-DbkiIzUr.mjs +2 -0
  43. package/dist/{dev-BfKYB-R_.mjs → dev-C6iSuQZm.mjs} +1 -1
  44. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  45. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  46. package/dist/{dist-C_bu5HwZ.mjs → dist-CnSubA1Z.mjs} +1 -1
  47. package/dist/dist-DNBSHor6.mjs +301 -0
  48. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  49. package/dist/dns-qW-3TZOT.mjs +29 -0
  50. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  51. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  52. package/dist/email-security-DTVHNr2h.mjs +60 -0
  53. package/dist/email-sending-DsFTvE31.mjs +3 -0
  54. package/dist/filters-DO1Is_tI.mjs +4 -0
  55. package/dist/firewall-DbUhVTCg.mjs +11 -0
  56. package/dist/fraud-Bzr4njYb.mjs +8 -0
  57. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  58. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  59. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  60. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  61. package/dist/iam-CJM8gHpG.mjs +6 -0
  62. package/dist/images-DEoBmtFS.mjs +5 -0
  63. package/dist/index.mjs +1 -1
  64. package/dist/intel-BM6xkZ0C.mjs +3 -0
  65. package/dist/{ips-B0cK7D0_.mjs → ips-B8fwxKZD.mjs} +1 -1
  66. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  67. package/dist/kv-BTceLtWZ.mjs +5 -0
  68. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  69. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  70. package/dist/logpush-CSYhgevA.mjs +4 -0
  71. package/dist/logs-DlIwmMpt.mjs +3 -0
  72. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  73. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  74. package/dist/magic-transit-qQmA-981.mjs +89 -0
  75. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  76. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  77. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  78. package/dist/organizations-DyEAiGiR.mjs +41 -0
  79. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  80. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  81. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  82. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  83. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  84. package/dist/pages-D0Y_XRqW.mjs +10 -0
  85. package/dist/pipelines-C-SPESAk.mjs +6 -0
  86. package/dist/{progress-DZfTxbrx.mjs → progress-CjcQ6ato.mjs} +1 -1
  87. package/dist/queues-wv6CZsi8.mjs +6 -0
  88. package/dist/r2-DuXjp9n5.mjs +21 -0
  89. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  90. package/dist/radar-BW_ZHP8X.mjs +2 -0
  91. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  92. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  93. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  94. package/dist/{registrar-7Qy50zbW.mjs → registrar-DIIv6fWd.mjs} +6 -6
  95. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  96. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  97. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  98. package/dist/rules-DLJpOYbC.mjs +4 -0
  99. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  100. package/dist/rum-DBVmdPkp.mjs +4 -0
  101. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  102. package/dist/scim-DZA3VXog.mjs +3 -0
  103. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  104. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  105. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  106. package/dist/{session-mW-s8ghP.mjs → session-H7IV2BrM.mjs} +1 -1
  107. package/dist/shared-DEzmTsEC.mjs +2 -0
  108. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  109. package/dist/snippets-B4M3MMb8.mjs +4 -0
  110. package/dist/{spawn-D_cjG87Z.mjs → spawn-13QQ0IwO.mjs} +1 -1
  111. package/dist/spectrum-B0adfSRI.mjs +59 -0
  112. package/dist/speed-BVcUtkAz.mjs +4 -0
  113. package/dist/{src-C5qivNKH.mjs → src-B9cKsgsg.mjs} +8 -8
  114. package/dist/ssl-BAa91gsc.mjs +15 -0
  115. package/dist/stream-D53sxKb3.mjs +14 -0
  116. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  117. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  118. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  119. package/dist/{ui-mP_arYIg.mjs → ui-BXjU1dX1.mjs} +1 -1
  120. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  121. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  122. package/dist/user-DbXlVReB.mjs +10 -0
  123. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  124. package/dist/versions-DzyrlUAi.mjs +2 -0
  125. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  126. package/dist/web3-DueyOQtx.mjs +4 -0
  127. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  128. package/dist/workers-nV_vBCfV.mjs +16 -0
  129. package/dist/workflows-CQITmo-s.mjs +4 -0
  130. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  131. package/dist/zero-trust-CKp8j512.mjs +119 -0
  132. package/dist/zones-BZ5tZDbH.mjs +28 -0
  133. package/package.json +4 -4
  134. package/dist/abuse-reports-ChV_yD7f.mjs +0 -8
  135. package/dist/accounts-BCYecXFh.mjs +0 -21
  136. package/dist/acm-DD8zSds2.mjs +0 -3
  137. package/dist/addressing-D4Eqw5Bi.mjs +0 -13
  138. package/dist/ai-DfXMOMx_.mjs +0 -2
  139. package/dist/ai-gateway-DdRFthMo.mjs +0 -8
  140. package/dist/ai-search-C_68CDj1.mjs +0 -7
  141. package/dist/alerting-DbhqhVCp.mjs +0 -6
  142. package/dist/analytics-BSBBc7ep.mjs +0 -20
  143. package/dist/api-gateway-CZ4swbkQ.mjs +0 -33
  144. package/dist/argo-tms9ZwHO.mjs +0 -2
  145. package/dist/audit-logs-24qyW8cl.mjs +0 -2
  146. package/dist/auth-BlSmtIKd.mjs +0 -112
  147. package/dist/autorag-kgNt06GD.mjs +0 -2
  148. package/dist/bot-management-LKf7BqUr.mjs +0 -5
  149. package/dist/botnet-feed-nQ-gErTS.mjs +0 -3
  150. package/dist/brand-protection-DOKv9GRr.mjs +0 -3
  151. package/dist/browser-rendering-CBExtgGt.mjs +0 -4
  152. package/dist/build-C_48VvoK.mjs +0 -1056
  153. package/dist/cache-BBiiNZHP.mjs +0 -5
  154. package/dist/calls-DA5Xzwev.mjs +0 -4
  155. package/dist/certificate-authorities-sXyR_yGp.mjs +0 -2
  156. package/dist/client-certificates-tV0aCLQJ.mjs +0 -3
  157. package/dist/cloud-connector-DZfHcSso.mjs +0 -2
  158. package/dist/cloudforce-one-y1PgQmI9.mjs +0 -21
  159. package/dist/connectivity-8SOqaFDn.mjs +0 -3
  160. package/dist/content-scanning-B9y6K_G5.mjs +0 -4
  161. package/dist/context-DTIbtQn5.mjs +0 -2
  162. package/dist/custom-certificates-sWksR8Ys.mjs +0 -5
  163. package/dist/custom-hostnames-91QZkdqN.mjs +0 -5
  164. package/dist/custom-nameservers-DajZaZvE.mjs +0 -3
  165. package/dist/custom-pages-Cu7gmwzT.mjs +0 -4
  166. package/dist/d1-H_VRsVmF.mjs +0 -3
  167. package/dist/dcv-delegation-C-qhEYEZ.mjs +0 -2
  168. package/dist/deploy--9wYOkHg.mjs +0 -2
  169. package/dist/diagnostics-D2B2LPZZ.mjs +0 -3
  170. package/dist/dispatch-namespaces-CyrXBU_w.mjs +0 -7
  171. package/dist/dist-DvKjT2TT.mjs +0 -303
  172. package/dist/dns-Bn9Uz_Nj.mjs +0 -29
  173. package/dist/dns-firewall-BslP4p-j.mjs +0 -57
  174. package/dist/durable-objects-BN1ZnHhm.mjs +0 -2
  175. package/dist/email-routing-n2TnTaRR.mjs +0 -10
  176. package/dist/email-security-C9SEx0kh.mjs +0 -60
  177. package/dist/email-sending-DayZ7u3I.mjs +0 -3
  178. package/dist/filters-CI_XTgfQ.mjs +0 -4
  179. package/dist/firewall-CcaayGig.mjs +0 -11
  180. package/dist/fraud-Cr7aPCV8.mjs +0 -8
  181. package/dist/google-tag-gateway-B3GpYgQ4.mjs +0 -2
  182. package/dist/healthchecks-CVTsR_OC.mjs +0 -4
  183. package/dist/hostnames-Bd_Wa5l6.mjs +0 -3
  184. package/dist/hyperdrive-BBJhEDZd.mjs +0 -18
  185. package/dist/iam-D_FN0pDF.mjs +0 -6
  186. package/dist/images-CAP2hAlZ.mjs +0 -5
  187. package/dist/intel-CkxfzqmJ.mjs +0 -3
  188. package/dist/keyless-certificates-LcLmHZsX.mjs +0 -3
  189. package/dist/kv-_TkUQ6fs.mjs +0 -5
  190. package/dist/leaked-credential-checks-Dhvaen22.mjs +0 -3
  191. package/dist/load-balancers-Ckr0UIpk.mjs +0 -6
  192. package/dist/logpush-Cj946hxT.mjs +0 -4
  193. package/dist/logs-DgC9hjvJ.mjs +0 -3
  194. package/dist/magic-cloud-networking-WbDvPzuG.mjs +0 -5
  195. package/dist/magic-network-monitoring-BcHShvGQ.mjs +0 -4
  196. package/dist/magic-transit-B8sCOkt_.mjs +0 -89
  197. package/dist/managed-transforms-BpOr-8HY.mjs +0 -3
  198. package/dist/mtls-certificates-fOul8D5g.mjs +0 -3
  199. package/dist/network-interconnects-BSW65xlh.mjs +0 -36
  200. package/dist/organizations-T4vKGFAb.mjs +0 -41
  201. package/dist/origin-ca-certificates-ChM0lZ64.mjs +0 -3
  202. package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +0 -2
  203. package/dist/origin-tls-client-auth-D32dpZk_.mjs +0 -5
  204. package/dist/page-rules-RFoj8CjN.mjs +0 -18
  205. package/dist/page-shield-VTktzKDN.mjs +0 -37
  206. package/dist/pages-L1ITjXDZ.mjs +0 -10
  207. package/dist/pipelines-BPO0Lnil.mjs +0 -6
  208. package/dist/queues-B0C06L9r.mjs +0 -6
  209. package/dist/r2-DP020Tmq.mjs +0 -21
  210. package/dist/r2-data-catalog-Dmipvz5F.mjs +0 -14
  211. package/dist/radar-DR3VMknH.mjs +0 -2
  212. package/dist/rate-limits-DnHPBPgU.mjs +0 -5
  213. package/dist/raw-fetch-DlXYwVA8.mjs +0 -2
  214. package/dist/realtime-kit-C430aq2d.mjs +0 -6
  215. package/dist/request-tracers-sv99NDIl.mjs +0 -2
  216. package/dist/resource-sharing-uEjC7lnQ.mjs +0 -5
  217. package/dist/resource-tagging-CiODdP3N.mjs +0 -16
  218. package/dist/rules-FXAyTrwk.mjs +0 -4
  219. package/dist/rulesets-B6aUsFFB.mjs +0 -8
  220. package/dist/rum-CyyGJhp5.mjs +0 -4
  221. package/dist/schema-validation-ByU49h--.mjs +0 -4
  222. package/dist/scim-DdTS65_C.mjs +0 -3
  223. package/dist/secrets-store-ClOUVhBJ.mjs +0 -18
  224. package/dist/security-center-4iSBqTrf.mjs +0 -2
  225. package/dist/security-txt-kGxdkDY6.mjs +0 -3
  226. package/dist/smart-shield-B-SQd2Qp.mjs +0 -3
  227. package/dist/snippets-Aq58ojqw.mjs +0 -4
  228. package/dist/spectrum-0gFvGI6y.mjs +0 -59
  229. package/dist/speed-DAZU8w3T.mjs +0 -4
  230. package/dist/ssl-BRlXa-5w.mjs +0 -15
  231. package/dist/stream-BAxsVeBX.mjs +0 -14
  232. package/dist/tenants-Df6xDqoA.mjs +0 -2
  233. package/dist/token-validation-pO4dCjCy.mjs +0 -4
  234. package/dist/turnstile-B1dmO8wE.mjs +0 -23
  235. package/dist/url-normalization-sUDVmrUt.mjs +0 -3
  236. package/dist/url-scanner-CwOKRkYo.mjs +0 -2
  237. package/dist/user-D_UrIdNq.mjs +0 -10
  238. package/dist/vectorize-BEbBn9G9.mjs +0 -4
  239. package/dist/waiting-rooms-BQC-urV4.mjs +0 -11
  240. package/dist/web3-CIH2iQeX.mjs +0 -4
  241. package/dist/workers-B9EvrpH3.mjs +0 -16
  242. package/dist/workers-builds-DzWSiRd2.mjs +0 -7
  243. package/dist/workflows-aD81gA4k.mjs +0 -4
  244. package/dist/zaraz-Cg1dsvrZ.mjs +0 -2
  245. package/dist/zero-trust-D-xQXWcy.mjs +0 -119
  246. package/dist/zones-DQzucJDd.mjs +0 -28
  247. /package/dist/{schema-D0_cbcDt.mjs → schema-CHBfkARI.mjs} +0 -0
  248. /package/dist/{tools-CtKbk6VS.mjs → tools-B7QiNu-d.mjs} +0 -0
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{f as e,l as t,t as n}from"./auth-BlSmtIKd.mjs";import{n as r,t as i}from"./body-parser-Br-BoYk-.mjs";import{t as a}from"./output-D7_yAFVR.mjs";import{n as o,t as s}from"./progress-DZfTxbrx.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(e){return 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.
3
- 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)`})}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:l,handler:async e=>{if(e.dryRun){o({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}});return}let l=await n(e);if(e.zoneId=await t({zone:e.zone},l,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Creating`,async()=>l.post(`/zones/${e.zoneId}/rate_limits`,{body:t})),{successLabel:`Created`});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&&r(u,[`match`,`request`,`methods`],e.matchRequestMethods),e.matchRequestSchemes!==void 0&&r(u,[`match`,`request`,`schemes`],e.matchRequestSchemes),e.matchRequestUrl!==void 0&&r(u,[`match`,`request`,`url`],c(e.matchRequestUrl,`matchRequestUrl`,`text`)),e.matchResponseOriginTraffic!==void 0&&r(u,[`match`,`response`,`origin_traffic`],e.matchResponseOriginTraffic),e.period!==void 0&&r(u,[`period`],e.period),e.threshold!==void 0&&r(u,[`threshold`],e.threshold),a(await s(`Creating`,async()=>l.post(`/zones/${e.zoneId}/rate_limits`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created`})}};function d(e){return 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)`})}const f={command:`delete <rateLimitId>`,describe:`Deletes an existing rate limit.`,builder:d,handler:async r=>{if(r.dryRun){o({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}});return}let c=await n(r),l=await t({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await e({force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}if(r.body){let e=i(r.body);a(await s(`Deleting`,async()=>c.delete(`/zones/${r.zoneId}/rate_limits/${r.rateLimitId}`,{body:e})),{successLabel:`Deleted`});return}a(await s(`Deleting`,async()=>c.rateLimits.delete(r.rateLimitId,l)),{successLabel:`Deleted`})}};function p(e){return 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.
5
- 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)`})}const m={command:`edit <rateLimitId>`,describe:`Updates an existing rate limit.`,builder:p,handler:async e=>{if(e.dryRun){o({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}});return}let l=await n(e);if(e.zoneId=await t({zone:e.zone},l,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Updating`,async()=>l.put(`/zones/${e.zoneId}/rate_limits/${e.rateLimitId}`,{body:t})),{successLabel:`Updated`});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&&r(u,[`match`,`request`,`methods`],e.matchRequestMethods),e.matchRequestSchemes!==void 0&&r(u,[`match`,`request`,`schemes`],e.matchRequestSchemes),e.matchRequestUrl!==void 0&&r(u,[`match`,`request`,`url`],c(e.matchRequestUrl,`matchRequestUrl`,`text`)),e.matchResponseOriginTraffic!==void 0&&r(u,[`match`,`response`,`origin_traffic`],e.matchResponseOriginTraffic),e.period!==void 0&&r(u,[`period`],e.period),e.threshold!==void 0&&r(u,[`threshold`],e.threshold),a(await s(`Updating`,async()=>l.put(`/zones/${e.zoneId}/rate_limits/${e.rateLimitId}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function h(e){return 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})}const g={command:`get <rateLimitId>`,describe:`Fetches the details of a rate limit.`,builder:h,handler:async e=>{if(e.dryRun){o({command:`cf rate-limits get`,method:`GET`,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:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.rateLimits.get(e.rateLimitId,i)),{successLabel:`Loaded`})}};function _(e){return 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`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Fetches the rate limits for a zone.`,builder:_,handler:async e=>{let r={page:e.page,per_page:e.perPage};if(e.dryRun){o({command:`cf rate-limits list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rate_limits`,pathParams:{zoneId:String(e.zoneId??``)},query:r,bodyKind:`none`});return}let i=await n(e),c=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>i.rateLimits.list(c,r)),{successLabel:`Loaded`})}},y={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(f).command(m).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e}from"./session-mW-s8ghP.mjs";import{h as t,n}from"./auth-BlSmtIKd.mjs";import{n as r}from"./local-VJaJ3BZ1.mjs";async function i(i,a={}){let{method:o=`GET`,localEndpoint:s}=a,c=`${process.env.CLOUDFLARE_BASE_URL??`https://api.cloudflare.com/client/v4`}${i}`,l={...t()};a.headers&&Object.assign(l,a.headers);let u=globalThis.fetch;s===void 0?l.Authorization=`Bearer ${await n()}`:u=r({endpoint:s});let d,f=a.body;f!=null&&(f instanceof FormData?d=f:Buffer.isBuffer(f)||f instanceof Uint8Array||f instanceof ArrayBuffer?(d=f,l[`Content-Type`]??=a.contentType??`application/octet-stream`):typeof f==`string`?(d=f,a.contentType&&(l[`Content-Type`]??=a.contentType)):(d=JSON.stringify(f),l[`Content-Type`]??=a.contentType??`application/json`));let p=await u(c,{method:o,headers:l,...d===void 0?{}:{body:d}});if(!p.ok){let t=p.headers.get(`content-type`)??``,n;try{n=t.includes(`application/json`)?await p.json():await p.text()}catch{n=null}throw new e(`API request failed with status ${p.status}`,p.status,n,{method:o,url:c})}let m=await p.arrayBuffer();return Buffer.from(m)}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{a as e,f as t,m as n,p as r,t as i,u as a}from"./auth-BlSmtIKd.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-DZfTxbrx.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return 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`})}const m={command:`create-poll <meetingId>`,describe:`Creates a new poll in an active session for the given meeting ID.`,builder:p,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session create-poll`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/poll`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.activeSession.createPoll(r,t.appId,t.meetingId)),{successLabel:`Created`})}};function ee(e){return e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`App ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`get-active-session <meetingId>`,describe:`Returns details of an ongoing active session for the given meeting ID.`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session get-active-session`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-session`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.activeSession.getActiveSession(t.meetingId,r,t.appId)),{successLabel:`Loaded`})}};function h(e){return 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})}const g={command:`kick-all-participants <meetingId>`,describe:`Kicks all participants from an active session for the given meeting ID.`,builder:h,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session kick-all-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickAllParticipants(r,t.appId,t.meetingId)),{successLabel:`Created`})}};function _(e){return 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."})}const v={command:`kick-participants <meetingId>`,describe:`Kicks one or more participants from an active session using user ID or custom participant ID.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session kick-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/kick`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickParticipants(r,t.appId,t.meetingId)),{successLabel:`Created`})}},y={command:`active-session`,describe:`Currently active meeting sessions with live participant counts and controls`,builder:e=>e.command(m).command(te).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return 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`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={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:b,handler:async t=>{let n={start_date:t.startDate,end_date:t.endDate};if(t.dryRun){l({command:`cf realtime-kit analytics get-org-analytics`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/analytics/daywise`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.analytics.getOrgAnalytics(o,t.appId,n)),{successLabel:`Loaded`})}},S={command:`analytics`,describe:`Usage analytics — meeting minutes, participant counts, and bandwidth consumption`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get`,describe:`Fetch all apps for your account`,builder:C,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit apps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/apps`,pathParams:{},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.apps.get(r)),{successLabel:`Loaded`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const E={command:`post`,describe:`Create new app for your account`,builder:T,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit apps post`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/apps`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/apps`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.apps.post(r)),{successLabel:`Created`})}},D={command:`apps`,describe:`Realtime Kit applications that group meetings, sessions, and configuration together`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return 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.`})}const k={command:`create <meetingId>`,describe:`Mutes all participants of an active session for the given meeting ID.`,builder:O,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit kit meetings active-session mute-all create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/mute-all`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.muteAll.create(r,t.appId,t.meetingId)),{successLabel:`Created`})}},A={command:`mute-all`,describe:`Kit operations`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return 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."})}const M={command:`create <meetingId>`,describe:`Mutes one or more participants from an active session using user ID or custom participant ID.`,builder:j,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit kit meetings active-session mute create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/active-session/mute`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.mute.create(r,t.appId,t.meetingId)),{successLabel:`Created`})}},N={command:`mute`,describe:`Kit operations`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`active-session`,describe:`Operations for kit.meetings.active-session`,builder:e=>e.command(N).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`App ID`,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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <meetingId>`,describe:"Returns livestream session details for the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:F,handler:async t=>{let n={page_no:t.pageNo,per_page:t.perPage};if(t.dryRun){l({command:`cf realtime-kit kit meetings livestream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/livestream`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.kit.meetings.livestream.get(t.meetingId,o,t.appId,n)),{successLabel:`Loaded`})}},L={command:`livestream`,describe:`Kit operations`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`meetings`,describe:`Operations for kit.meetings`,builder:e=>e.command(P).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={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:z,handler:async t=>{let n={per_page:t.perPage,page_no:t.pageNo};if(t.dryRun){l({command:`cf realtime-kit kit sessions livestream sessions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/livestream-sessions`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.kit.sessions.livestream.sessions.get(o,t.appId,t.sessionId,n)),{successLabel:`Loaded`})}},V={command:`sessions`,describe:`Kit operations`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},H={command:`livestream`,describe:`Operations for kit.sessions.livestream`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`sessions`,describe:`Operations for kit.sessions`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`kit`,describe:`Operations for kit`,builder:e=>e.command(R).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.positional(`livestreamId`,{type:`string`,description:`Livestream 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})}const K={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:G,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-active-livestreams-for-livestream-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/livestreams/${t.livestreamId??`<livestreamId>`}/active-livestream-session`,pathParams:{appId:String(t.appId??``),livestreamId:String(t.livestreamId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getActiveLivestreamsForLivestreamId(r,t.appId,t.livestreamId)),{successLabel:`Loaded`})}};function q(e){return e.positional(`appId`,{type:`string`,description:`App ID`,demandOption:!0}).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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get-all-livestreams <appId>`,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:q,handler:async t=>{let n={exclude_meetings:t.excludeMeetings,per_page:t.perPage,page_no:t.pageNo,status:t.status,start_time:t.startTime,end_time:t.endTime,sort_order:t.sortOrder};if(t.dryRun){l({command:`cf realtime-kit livestreams get-all-livestreams`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/livestreams`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getAllLivestreams(o,t.appId,n)),{successLabel:`Loaded`})}};function Y(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`get-livestream-analytics-complete <appId>`,describe:`Returns livestream analytics for the specified time range.`,builder:Y,handler:async t=>{let n={start_time:t.startTime,end_time:t.endTime};if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-analytics-complete`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/analytics/livestreams/overall`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getLivestreamAnalyticsComplete(o,t.appId,n)),{successLabel:`Loaded`})}};function Z(e){return e.positional(`livestreamSessionId`,{type:`string`,description:`Livestream-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})}const Q={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:Z,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-session-details-for-session-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/livestreams/sessions/${t.livestreamSessionId??`<livestreamSessionId>`}`,pathParams:{appId:String(t.appId??``),livestreamSessionId:String(t.livestreamSessionId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getLivestreamSessionDetailsForSessionId(r,t.appId,t.livestreamSessionId)),{successLabel:`Loaded`})}};function ne(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={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:ne,handler:async t=>{let n={page_no:t.pageNo,per_page:t.perPage};if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-session-for-livestream-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/livestreams/${t.livestreamId??`<livestreamId>`}`,pathParams:{appId:String(t.appId??``),livestreamId:String(t.livestreamId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getLivestreamSessionForLivestreamId(o,t.appId,t.livestreamId,n)),{successLabel:`Loaded`})}};function ie(e){return e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`App ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`get-meeting-active-livestreams <meetingId>`,describe:`Returns details of all active livestreams for the given meeting ID.`,builder:ie,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-meeting-active-livestreams`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/active-livestream`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getMeetingActiveLivestreams(t.meetingId,r,t.appId)),{successLabel:`Loaded`})}};function oe(e){return 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`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={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:oe,handler:async t=>{let n={start_date:t.startDate,end_date:t.endDate};if(t.dryRun){l({command:`cf realtime-kit livestreams get-org-analytics`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/analytics/daywise`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getOrgAnalytics(o,t.appId,n)),{successLabel:`Loaded`})}};function ce(e){return e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`App ID`,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)`})}const le={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:ce,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams start-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/livestreams`,{body:e})),{successLabel:`Created`});return}let p={};t.name!==void 0&&o(p,[`name`],d(t.name,`name`,`text`)),t.videoConfigHeight!==void 0&&o(p,[`video_config`,`height`],t.videoConfigHeight),t.videoConfigWidth!==void 0&&o(p,[`video_config`,`width`],t.videoConfigWidth),c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/livestreams`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function ue(e){return e.positional(`meetingId`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`App ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const de={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:ue,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit livestreams stop-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${n.appId??`<appId>`}/meetings/${n.meetingId??`<meetingId>`}/active-livestream/stop`,pathParams:{meetingId:String(n.meetingId??``),appId:String(n.appId??``)},bodyKind:`json`,body:{body:n.body}});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force,message:`This operation halts an active live-stream. Viewers lose the broadcast immediately.`})){process.stderr.write(`Aborted.
3
- `);return}if(n.body){let e=d(n.body,`body`,`binary`);c(await u(`Deleting`,async()=>r.post(`/accounts/${o}/realtime/kit/${n.appId}/meetings/${n.meetingId}/active-livestream/stop`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>r.realtimeKit.livestreams.stopLivestreamingAMeeting(n.meetingId,o,n.appId)),{successLabel:`Deleted`})}},fe={command:`livestreams`,describe:`Live streaming from meetings to external platforms with stream key management`,builder:e=>e.command(K).command(J).command(X).command(Q).command(re).command(ae).command(se).command(le).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return 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)`})}const me={command:`add-participant <meetingId>`,describe:`Adds a participant to the given meeting ID.`,builder:pe,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings add-participant`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/participants`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.meetings.addParticipant(r,t.appId,t.meetingId)),{successLabel:`Created`})}};function he(e){return 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`})}const ge={command:`create <appId>`,describe:`Create a meeting for the given App ID.`,builder:he,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/meetings`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.meetings.create(r,t.appId)),{successLabel:`Created`})}};function _e(e){return 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:`App ID`,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})}const ve={command:`delete-meeting-participant <participantId>`,describe:`Deletes a participant for the given meeting and participant ID.`,builder:_e,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit meetings delete-meeting-participant`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${n.appId??`<appId>`}/meetings/${n.meetingId??`<meetingId>`}/participants/${n.participantId??`<participantId>`}`,pathParams:{meetingId:String(n.meetingId??``),participantId:String(n.participantId??``),appId:String(n.appId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting`,async()=>r.realtimeKit.meetings.deleteMeetingParticipant(n.meetingId,n.participantId,o,n.appId)),{successLabel:`Deleted`})}};function ye(e){return 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:`App ID`,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)`})}const be={command:`edit-participant <participantId>`,describe:`Updates a participant's details for the given meeting and participant ID.`,builder:ye,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings edit-participant`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}/participants/${t.participantId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.realtimeKit.meetings.editParticipant(t.meetingId,t.participantId,r,t.appId)),{successLabel:`Updated`})}};function xe(e){return 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:`App ID`,demandOption:!0}).option(`name`,{type:`string`,description:`Name`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`get-meeting-by-id <meetingId>`,describe:`Returns a meeting details in an App for the given meeting ID.`,builder:xe,handler:async t=>{let n={name:t.name};if(t.dryRun){l({command:`cf realtime-kit meetings get-meeting-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}`,pathParams:{meetingId:String(t.meetingId??``),appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.meetings.getMeetingById(t.meetingId,o,t.appId,n)),{successLabel:`Loaded`})}};function Ce(e){return 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:`App ID`,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})}const we={command:`get-meeting-participant <participantId>`,describe:`Returns a participant details for the given meeting and participant ID.`,builder:Ce,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings get-meeting-participant`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.meetings.getMeetingParticipant(t.meetingId,t.participantId,r,t.appId)),{successLabel:`Loaded`})}};function Te(e){return 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`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get-meeting-participants <meetingId>`,describe:`Returns all participants detail for the given meeting ID.`,builder:Te,handler:async t=>{let n={page_no:t.pageNo,per_page:t.perPage};if(t.dryRun){l({command:`cf realtime-kit meetings get-meeting-participants`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings/${t.meetingId??`<meetingId>`}/participants`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.meetings.getMeetingParticipants(o,t.appId,t.meetingId,n)),{successLabel:`Loaded`})}};function De(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Oe={command:`get <appId>`,describe:`Returns all meetings for the given App ID.`,builder:De,handler:async t=>{let n={page_no:t.pageNo,per_page:t.perPage,start_time:t.startTime,end_time:t.endTime,search:t.search};if(t.dryRun){l({command:`cf realtime-kit meetings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/meetings`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.meetings.get(o,t.appId,n)),{successLabel:`Loaded`})}};function ke(e){return 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})}const Ae={command:`refresh-participant-token <participantId>`,describe:`Regenerates participant's authentication token for the given meeting and participant ID.`,builder:ke,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings refresh-participant-token`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Creating`,async()=>n.realtimeKit.meetings.refreshParticipantToken(r,t.appId,t.meetingId,t.participantId)),{successLabel:`Created`})}};function je(e){return 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:`App ID`,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`})}const Me={command:`replace-meeting-by-id <meetingId>`,describe:`Replaces all the details for the given meeting ID.`,builder:je,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings replace-meeting-by-id`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Updating`,async()=>n.put(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.realtimeKit.meetings.replaceMeetingById(t.meetingId,r,t.appId)),{successLabel:`Updated`})}};function Ne(e){return 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:`App ID`,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`})}const Pe={command:`update-meeting-by-id <meetingId>`,describe:`Updates a meeting in an App for the given meeting ID.`,builder:Ne,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit meetings update-meeting-by-id`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/realtime/kit/${t.appId}/meetings/${t.meetingId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.realtimeKit.meetings.updateMeetingById(t.meetingId,r,t.appId)),{successLabel:`Updated`})}},Fe={command:`meetings`,describe:`Video meetings with participant management, access tokens, and recording controls`,builder:e=>e.command(me).command(ge).command(ve).command(be).command(Oe).command(Se).command(we).command(Ee).command(Ae).command(Me).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(e){return 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)`})}const Le={command:`create <appId>`,describe:`Creates a preset belonging to the current App`,builder:Ie,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit presets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/presets`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/presets`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.presets.create(r,t.appId)),{successLabel:`Created`})}};function Re(e){return 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})}const ze={command:`delete <presetId>`,describe:`Deletes a preset using the provided preset ID`,builder:Re,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit presets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${n.appId??`<appId>`}/presets/${n.presetId??`<presetId>`}`,pathParams:{appId:String(n.appId??``),presetId:String(n.presetId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
5
- `);return}c(await u(`Deleting`,async()=>r.realtimeKit.presets.delete(o,n.appId,n.presetId)),{successLabel:`Deleted`})}};function Be(e){return 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})}const Ve={command:`get-preset-by-id <presetId>`,describe:`Fetches details of a preset using the provided preset ID`,builder:Be,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit presets get-preset-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/presets/${t.presetId??`<presetId>`}`,pathParams:{appId:String(t.appId??``),presetId:String(t.presetId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.presets.getPresetById(r,t.appId,t.presetId)),{successLabel:`Loaded`})}};function He(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ue={command:`get <appId>`,describe:`Fetches all the presets belonging to an App.`,builder:He,handler:async t=>{let n={per_page:t.perPage,page_no:t.pageNo};if(t.dryRun){l({command:`cf realtime-kit presets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/presets`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.presets.get(o,t.appId,n)),{successLabel:`Loaded`})}};function We(e){return 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)`})}const Ge={command:`update <presetId>`,describe:`Update a preset by the provided preset ID`,builder:We,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit presets update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/realtime/kit/${t.appId}/presets/${t.presetId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.realtimeKit.presets.update(r,t.appId,t.presetId)),{successLabel:`Updated`})}},Ke={command:`presets`,describe:`Reusable meeting configuration presets for resolution, layout, and recording defaults`,builder:e=>e.command(Le).command(ze).command(Ue).command(Ve).command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qe(e){return 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})}const Je={command:`get-active-recordings <meetingId>`,describe:`Returns the active recording details for the given meeting ID.`,builder:qe,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit recordings get-active-recordings`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings/active-recording/${t.meetingId??`<meetingId>`}`,pathParams:{appId:String(t.appId??``),meetingId:String(t.meetingId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.recordings.getActiveRecordings(r,t.appId,t.meetingId)),{successLabel:`Loaded`})}};function Ye(e){return e.positional(`recordingId`,{type:`string`,description:`ID of the recording`,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})}const Xe={command:`get-one-recording <recordingId>`,describe:`Returns details of a recording for the given recording ID.`,builder:Ye,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit recordings get-one-recording`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings/${t.recordingId??`<recordingId>`}`,pathParams:{appId:String(t.appId??``),recordingId:String(t.recordingId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.recordings.getOneRecording(r,t.appId,t.recordingId)),{successLabel:`Loaded`})}};function Ze(e){return 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`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qe={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:Ze,handler:async t=>{let n={meeting_id:t.meetingId,page_no:t.pageNo,per_page:t.perPage,expired:t.expired,search:t.search,sort_by:t.sortBy,sort_order:t.sortOrder,start_time:t.startTime,end_time:t.endTime,status:t.status};if(t.dryRun){l({command:`cf realtime-kit recordings get-recordings`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.recordings.getRecordings(o,t.appId,n)),{successLabel:`Loaded`})}};function $e(e){return 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)`})}const et={command:`pause-resume-stop-recording <recordingId>`,describe:`Pause/Resume/Stop a given recording ID.`,builder:$e,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit recordings pause-resume-stop-recording`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),p=t.local?f:await e(n);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.put(`/accounts/${p}/realtime/kit/${t.appId}/recordings/${t.recordingId}`,{body:e})),{successLabel:`Updated`});return}t.action===void 0&&(t.action=await r(`action`,``,[`stop`,`pause`,`resume`]));let m={};t.action!==void 0&&o(m,[`action`],d(t.action,`action`,`text`)),c(await u(`Updating`,async()=>n.put(`/accounts/${p}/realtime/kit/${t.appId}/recordings/${t.recordingId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}};function tt(e){return 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)`})}const nt={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:tt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit recordings start-recordings`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/recordings`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.recordings.startRecordings(r,t.appId)),{successLabel:`Created`})}};function rt(e){return 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.`})}const it={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:rt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit recordings start-track-recording`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/recordings/track`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=d(t.body,`body`,`binary`);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/realtime/kit/${t.appId}/recordings/track`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.realtimeKit.recordings.startTrackRecording(r,t.appId)),{successLabel:`Created`})}},at={command:`recordings`,describe:`Meeting recordings — list, download, and manage recorded video and audio files`,builder:e=>e.command(Je).command(Xe).command(Qe).command(et).command(nt).command(it).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ot(e){return 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})}const st={command:`generate-summary-of-transcripts <sessionId>`,describe:`Trigger Summary generation of Transcripts for the session ID.`,builder:ot,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit sessions generate-summary-of-transcripts`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/summary`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Creating`,async()=>n.realtimeKit.sessions.generateSummaryOfTranscripts(r,t.appId,t.sessionId)),{successLabel:`Created`})}};function ct(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lt={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:ct,handler:async t=>{let n={filters:t.filters};if(t.dryRun){l({command:`cf realtime-kit sessions get-participant-data-from-peer-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/peer-report/${t.peerId??`<peerId>`}`,pathParams:{appId:String(t.appId??``),peerId:String(t.peerId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.sessions.getParticipantDataFromPeerId(o,t.appId,t.peerId,n)),{successLabel:`Loaded`})}};function ut(e){return 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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dt={command:`get-session-chat <sessionId>`,describe:`Returns a URL to download all chat messages of the session ID in CSV format.`,builder:ut,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit sessions get-session-chat`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/chat`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.sessions.getSessionChat(r,t.appId,t.sessionId)),{successLabel:`Loaded`})}};function ft(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pt={command:`get-session-details <sessionId>`,describe:`Returns data of the given session ID including recording details.`,builder:ft,handler:async t=>{let n={include_breakout_rooms:t.includeBreakoutRooms};if(t.dryRun){l({command:`cf realtime-kit sessions get-session-details`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.sessions.getSessionDetails(o,t.appId,t.sessionId,n)),{successLabel:`Loaded`})}};function mt(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ht={command:`get-session-participant-details <participantId>`,describe:`Returns details of the given participant ID along with call statistics for the given session ID.`,builder:mt,handler:async t=>{let n={filters:t.filters,include_peer_events:t.includePeerEvents};if(t.dryRun){l({command:`cf realtime-kit sessions get-session-participant-details`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/participants/${t.participantId??`<participantId>`}`,pathParams:{appId:String(t.appId??``),participantId:String(t.participantId??``),sessionId:String(t.sessionId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.sessions.getSessionParticipantDetails(o,t.appId,t.participantId,t.sessionId,n)),{successLabel:`Loaded`})}};function gt(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`get-session-participants <sessionId>`,describe:`Returns a list of participants for the given session ID.`,builder:gt,handler:async t=>{let n={search:t.search,page_no:t.pageNo,per_page:t.perPage,sort_order:t.sortOrder,sort_by:t.sortBy,include_peer_events:t.includePeerEvents,view:t.view};if(t.dryRun){l({command:`cf realtime-kit sessions get-session-participants`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/participants`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.sessions.getSessionParticipants(o,t.appId,t.sessionId,n)),{successLabel:`Loaded`})}};function vt(e){return 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})}const yt={command:`get-session-summary <sessionId>`,describe:`Returns a Summary URL to download the Summary of Transcripts for the session ID as plain text.`,builder:vt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit sessions get-session-summary`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/summary`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.sessions.getSessionSummary(r,t.appId,t.sessionId)),{successLabel:`Loaded`})}};function bt(e){return 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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xt={command:`get-session-transcripts <sessionId>`,describe:`Returns a URL to download the transcript for the session ID in CSV format.`,builder:bt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit sessions get-session-transcripts`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions/${t.sessionId??`<sessionId>`}/transcript`,pathParams:{appId:String(t.appId??``),sessionId:String(t.sessionId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.sessions.getSessionTranscripts(r,t.appId,t.sessionId)),{successLabel:`Loaded`})}};function St(e){return 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`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ct={command:`get-sessions <appId>`,describe:`Returns details of all sessions of an App.`,builder:St,handler:async t=>{let n={page_no:t.pageNo,per_page:t.perPage,sort_by:t.sortBy,sort_order:t.sortOrder,start_time:t.startTime,end_time:t.endTime,participants:t.participants,status:t.status,search:t.search,associated_id:t.associatedId};if(t.dryRun){l({command:`cf realtime-kit sessions get-sessions`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/sessions`,pathParams:{appId:String(t.appId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.sessions.getSessions(o,t.appId,n)),{successLabel:`Loaded`})}},wt={command:`sessions`,describe:`Active and historical meeting sessions with participant details and duration tracking`,builder:e=>e.command(st).command(lt).command(dt).command(pt).command(ht).command(_t).command(yt).command(xt).command(Ct).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Tt(e){return 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)`})}const Et={command:`create-webhook <appId>`,describe:`Adds a new webhook to an App.`,builder:Tt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit webhooks create-webhook`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/webhooks`,pathParams:{appId:String(t.appId??``)},bodyKind:`json`,body:{enabled:t.enabled,events:t.events,name:t.name,url:t.url,body:t.body}});return}let r=await i(t),p=t.local?f:await e(r);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Creating`,async()=>r.post(`/accounts/${p}/realtime/kit/${t.appId}/webhooks`,{body:e})),{successLabel:`Created`});return}if(t.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);t.name===void 0&&(t.name=await n(`name`,`Name of the webhook`)),t.url===void 0&&(t.url=await n(`url`,`URL this webhook will send events to`));let m={};t.enabled!==void 0&&o(m,[`enabled`],t.enabled),t.events!==void 0&&o(m,[`events`],t.events),t.name!==void 0&&o(m,[`name`],d(t.name,`name`,`text`)),t.url!==void 0&&o(m,[`url`],d(t.url,`url`,`text`)),c(await u(`Creating`,async()=>r.post(`/accounts/${p}/realtime/kit/${t.appId}/webhooks`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function $(e){return 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})}const Dt={command:`delete-webhook <webhookId>`,describe:`Removes a webhook for the given webhook ID.`,builder:$,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit webhooks delete-webhook`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${n.appId??`<appId>`}/webhooks/${n.webhookId??`<webhookId>`}`,pathParams:{appId:String(n.appId??``),webhookId:String(n.webhookId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
6
- `);return}c(await u(`Deleting`,async()=>r.realtimeKit.webhooks.deleteWebhook(o,n.appId,n.webhookId)),{successLabel:`Deleted`})}};function Ot(e){return 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)`})}const kt={command:`edit-webhook <webhookId>`,describe:`Edits the webhook details for the given webhook ID.`,builder:Ot,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit webhooks edit-webhook`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/realtime/kit/${t.appId}/webhooks/${t.webhookId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.enabled!==void 0&&o(p,[`enabled`],t.enabled),t.events!==void 0&&o(p,[`events`],t.events),t.name!==void 0&&o(p,[`name`],d(t.name,`name`,`text`)),t.url!==void 0&&o(p,[`url`],d(t.url,`url`,`text`)),c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/realtime/kit/${t.appId}/webhooks/${t.webhookId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function At(e){return 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})}const jt={command:`get-webhook-by-id <webhookId>`,describe:`Returns webhook details for the given webhook ID.`,builder:At,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit webhooks get-webhook-by-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/webhooks/${t.webhookId??`<webhookId>`}`,pathParams:{appId:String(t.appId??``),webhookId:String(t.webhookId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.webhooks.getWebhookById(r,t.appId,t.webhookId)),{successLabel:`Loaded`})}};function Mt(e){return 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})}const Nt={command:`get-webhooks <appId>`,describe:`Returns details of all webhooks for an App.`,builder:Mt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit webhooks get-webhooks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/realtime/kit/${t.appId??`<appId>`}/webhooks`,pathParams:{appId:String(t.appId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.webhooks.getWebhooks(r,t.appId)),{successLabel:`Loaded`})}};function Pt(e){return 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)`})}const Ft={command:`replace-webhook <webhookId>`,describe:`Replace all details for the given webhook ID.`,builder:Pt,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit webhooks replace-webhook`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let r=await i(t),p=t.local?f:await e(r);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Updating`,async()=>r.put(`/accounts/${p}/realtime/kit/${t.appId}/webhooks/${t.webhookId}`,{body:e})),{successLabel:`Updated`});return}if(t.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);t.name===void 0&&(t.name=await n(`name`,`Name of the webhook`)),t.url===void 0&&(t.url=await n(`url`,`URL this webhook will send events to`));let m={};t.enabled!==void 0&&o(m,[`enabled`],t.enabled),t.events!==void 0&&o(m,[`events`],t.events),t.name!==void 0&&o(m,[`name`],d(t.name,`name`,`text`)),t.url!==void 0&&o(m,[`url`],d(t.url,`url`,`text`)),c(await u(`Updating`,async()=>r.put(`/accounts/${p}/realtime/kit/${t.appId}/webhooks/${t.webhookId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},It={command:`webhooks`,describe:`Webhook endpoints for real-time event notifications (meeting started, participant joined, etc.)`,builder:e=>e.command(Et).command(Dt).command(kt).command(jt).command(Nt).command(Ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Lt={command:`realtime-kit`,describe:`Real-time video and audio — meetings, livestreams, recordings, and session management via Cloudflare Calls`,builder:e=>e.command(y).command(S).command(D).command(W).command(fe).command(Fe).command(Ke).command(at).command(wt).command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Lt as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e,m as t,t as n,u as r}from"./auth-BlSmtIKd.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-DZfTxbrx.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./local-VJaJ3BZ1.mjs";function d(e){return 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)`})}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:d,handler:async d=>{if(d.dryRun){s({command:`cf request-tracers traces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/request-tracer/trace`,pathParams:{},bodyKind:`json`,body:{bodyBase64:d.bodyBase64,bodyPlainText:d.bodyPlainText,contextBotScore:d.contextBotScore,contextGeolocCity:d.contextGeolocCity,contextGeolocContinent:d.contextGeolocContinent,contextGeolocIsEuCountry:d.contextGeolocIsEuCountry,contextGeolocIsoCode:d.contextGeolocIsoCode,contextGeolocLatitude:d.contextGeolocLatitude,contextGeolocLongitude:d.contextGeolocLongitude,contextGeolocPostalCode:d.contextGeolocPostalCode,contextGeolocRegionCode:d.contextGeolocRegionCode,contextGeolocSubdivision2IsoCode:d.contextGeolocSubdivision2IsoCode,contextGeolocTimezone:d.contextGeolocTimezone,contextSkipChallenge:d.contextSkipChallenge,contextThreatScore:d.contextThreatScore,method:d.method,protocol:d.protocol,skipResponse:d.skipResponse,url:d.url,body:d.body}});return}let f=await n(d),p=d.local?u:await e(f);if(d.accountId=p,d.body){let e=a(d.body);o(await c(`Creating`,async()=>f.post(`/accounts/${p}/request-tracer/trace`,{body:e})),{successLabel:`Created`});return}d.method===void 0&&(d.method=await t(`method`,`HTTP Method of tracing request`)),d.url===void 0&&(d.url=await t(`url`,`URL to which perform tracing request`));let m={};d.bodyBase64!==void 0&&i(m,[`body`,`base64`],l(d.bodyBase64,`bodyBase64`,`text`)),d.bodyPlainText!==void 0&&i(m,[`body`,`plain_text`],l(d.bodyPlainText,`bodyPlainText`,`text`)),d.contextBotScore!==void 0&&i(m,[`context`,`bot_score`],d.contextBotScore),d.contextGeolocCity!==void 0&&i(m,[`context`,`geoloc`,`city`],l(d.contextGeolocCity,`contextGeolocCity`,`text`)),d.contextGeolocContinent!==void 0&&i(m,[`context`,`geoloc`,`continent`],l(d.contextGeolocContinent,`contextGeolocContinent`,`text`)),d.contextGeolocIsEuCountry!==void 0&&i(m,[`context`,`geoloc`,`is_eu_country`],d.contextGeolocIsEuCountry),d.contextGeolocIsoCode!==void 0&&i(m,[`context`,`geoloc`,`iso_code`],l(d.contextGeolocIsoCode,`contextGeolocIsoCode`,`text`)),d.contextGeolocLatitude!==void 0&&i(m,[`context`,`geoloc`,`latitude`],d.contextGeolocLatitude),d.contextGeolocLongitude!==void 0&&i(m,[`context`,`geoloc`,`longitude`],d.contextGeolocLongitude),d.contextGeolocPostalCode!==void 0&&i(m,[`context`,`geoloc`,`postal_code`],l(d.contextGeolocPostalCode,`contextGeolocPostalCode`,`text`)),d.contextGeolocRegionCode!==void 0&&i(m,[`context`,`geoloc`,`region_code`],l(d.contextGeolocRegionCode,`contextGeolocRegionCode`,`text`)),d.contextGeolocSubdivision2IsoCode!==void 0&&i(m,[`context`,`geoloc`,`subdivision_2_iso_code`],l(d.contextGeolocSubdivision2IsoCode,`contextGeolocSubdivision2IsoCode`,`text`)),d.contextGeolocTimezone!==void 0&&i(m,[`context`,`geoloc`,`timezone`],l(d.contextGeolocTimezone,`contextGeolocTimezone`,`text`)),d.contextSkipChallenge!==void 0&&i(m,[`context`,`skip_challenge`],d.contextSkipChallenge),d.contextThreatScore!==void 0&&i(m,[`context`,`threat_score`],d.contextThreatScore),d.method!==void 0&&i(m,[`method`],l(d.method,`method`,`text`)),d.protocol!==void 0&&i(m,[`protocol`],l(d.protocol,`protocol`,`text`)),d.skipResponse!==void 0&&i(m,[`skip_response`],d.skipResponse),d.url!==void 0&&i(m,[`url`],l(d.url,`url`,`text`)),o(await c(`Creating`,async()=>f.post(`/accounts/${p}/request-tracer/trace`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},p={command:`traces`,describe:`Simulate request processing to debug rule matches, transforms, and routing decisions`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),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,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e,f as t,m as n,p as r,t as i,u as a}from"./auth-BlSmtIKd.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-DZfTxbrx.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return 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)`})}const m={command:`create`,describe:`Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`,builder:p,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:{name:t.name,body:t.body}});return}let r=await i(t),p=t.local?f:await e(r);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Creating`,async()=>r.post(`/accounts/${p}/shares`,{body:e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await n(`name`,`The name of the share.`));let m={};t.name!==void 0&&o(m,[`name`],d(t.name,`name`,`text`)),c(await u(`Creating`,async()=>r.post(`/accounts/${p}/shares`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function h(e){return 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})}const g={command:`delete <shareId>`,describe:`Deletion is not immediate, an updated share object with a new status will be returned.`,builder:h,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${n.shareId??`<shareId>`}`,pathParams:{shareId:String(n.shareId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting`,async()=>r.resourceSharing.delete(o,n.shareId)),{successLabel:`Deleted`})}};function _(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <shareId>`,describe:`Fetches share by ID.`,builder:_,handler:async t=>{let n={include_resources:t.includeResources,include_recipient_counts:t.includeRecipientCounts};if(t.dryRun){l({command:`cf resource-sharing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}`,pathParams:{shareId:String(t.shareId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.get(o,t.shareId,n)),{successLabel:`Loaded`})}};function y(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Lists all account shares.`,builder:y,handler:async t=>{let n={status:t.status,kind:t.kind,target_type:t.targetType,resource_types:t.resourceTypes,order:t.order,direction:t.direction,page:t.page,per_page:t.perPage,include_resources:t.includeResources,include_recipient_counts:t.includeRecipientCounts};if(t.dryRun){l({command:`cf resource-sharing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares`,pathParams:{},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.list(o,n)),{successLabel:`Loaded`})}};function x(e){return 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.`})}const S={command:`create <shareId>`,describe:`Adds a recipient to a resource share, granting them access to the shared resources.`,builder:x,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`json`,body:{organizationId:t.organizationId,body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/shares/${t.shareId}/recipients`,{body:e})),{successLabel:`Created`});return}let p={};t.organizationId!==void 0&&o(p,[`organization_id`],d(t.organizationId,`organizationId`,`text`)),c(await u(`Creating`,async()=>n.post(`/accounts/${r}/shares/${t.shareId}/recipients`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function C(e){return 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})}const w={command:`delete <recipientId>`,describe:`Deletion is not immediate, an updated share recipient object with a new status will be returned.`,builder:C,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing recipients delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${n.shareId??`<shareId>`}/recipients/${n.recipientId??`<recipientId>`}`,pathParams:{shareId:String(n.shareId??``),recipientId:String(n.recipientId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting`,async()=>r.resourceSharing.recipients.delete(o,n.shareId,n.recipientId)),{successLabel:`Deleted`})}};function T(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <recipientId>`,describe:`Get share recipient by ID.`,builder:T,handler:async t=>{let n={include_resources:t.includeResources};if(t.dryRun){l({command:`cf resource-sharing recipients get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients/${t.recipientId??`<recipientId>`}`,pathParams:{shareId:String(t.shareId??``),recipientId:String(t.recipientId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.get(o,t.shareId,t.recipientId,n)),{successLabel:`Loaded`})}};function D(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`list`,describe:`List share recipients by share ID.`,builder:D,handler:async t=>{let n={include_resources:t.includeResources,page:t.page,per_page:t.perPage};if(t.dryRun){l({command:`cf resource-sharing recipients list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients`,pathParams:{shareId:String(t.shareId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.list(o,t.shareId,n)),{successLabel:`Loaded`})}};function k(e){return 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)`})}const A={command:`update <shareId>`,describe:`Changes a share's recipients to match the given list. Returns an error if the share targets an organization.`,builder:k,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/recipients`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.put(`/accounts/${r}/shares/${t.shareId}/recipients`,{body:e})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},j={command:`recipients`,describe:`Organizations and accounts that have been granted access to shared resources`,builder:e=>e.command(S).command(w).command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return 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)`})}const N={command:`create <shareId>`,describe:`Adds a resource to an existing share, making it available to share recipients.`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/resources`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`json`,body:{resourceAccountId:t.resourceAccountId,resourceId:t.resourceId,resourceType:t.resourceType,body:t.body}});return}let p=await i(t),m=t.local?f:await e(p);if(t.accountId=m,t.body){let e=s(t.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/shares/${t.shareId}/resources`,{body:e})),{successLabel:`Created`});return}t.resourceAccountId===void 0&&(t.resourceAccountId=await n(`resource-account-id`,`Account identifier.`)),t.resourceId===void 0&&(t.resourceId=await n(`resource-id`,`Share Resource identifier.`)),t.resourceType===void 0&&(t.resourceType=await r(`resource-type`,`Resource Type.`,[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`]));let h={};t.resourceAccountId!==void 0&&o(h,[`resource_account_id`],d(t.resourceAccountId,`resourceAccountId`,`text`)),t.resourceId!==void 0&&o(h,[`resource_id`],d(t.resourceId,`resourceId`,`text`)),t.resourceType!==void 0&&o(h,[`resource_type`],d(t.resourceType,`resourceType`,`text`)),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/shares/${t.shareId}/resources`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function P(e){return 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})}const F={command:`delete <resourceId>`,describe:`Deletion is not immediate, an updated share resource object with a new status will be returned.`,builder:P,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing resources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${n.shareId??`<shareId>`}/resources/${n.resourceId??`<resourceId>`}`,pathParams:{shareId:String(n.shareId??``),resourceId:String(n.resourceId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
5
- `);return}c(await u(`Deleting`,async()=>r.resourceSharing.resources.delete(o,n.shareId,n.resourceId)),{successLabel:`Deleted`})}};function I(e){return 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})}const L={command:`get <resourceId>`,describe:`Get share resource by ID.`,builder:I,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/resources/${t.resourceId??`<resourceId>`}`,pathParams:{shareId:String(t.shareId??``),resourceId:String(t.resourceId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.resourceSharing.resources.get(r,t.shareId,t.resourceId)),{successLabel:`Loaded`})}};function R(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`List share resources by share ID.`,builder:R,handler:async t=>{let n={status:t.status,resource_type:t.resourceType,page:t.page,per_page:t.perPage};if(t.dryRun){l({command:`cf resource-sharing resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}/resources`,pathParams:{shareId:String(t.shareId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.resources.list(o,t.shareId,n)),{successLabel:`Loaded`})}};function B(e){return 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)`})}const V={command:`update <resourceId>`,describe:`Update is not immediate, an updated share resource object with a new status will be returned.`,builder:B,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<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}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.put(`/accounts/${r}/shares/${t.shareId}/resources/${t.resourceId}`,{body:e})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.resourceSharing.resources.update(r,t.shareId,t.resourceId)),{successLabel:`Updated`})}},H={command:`resources`,describe:`Individual resources (zones, configs) that have been shared with recipients`,builder:e=>e.command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return 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)`})}const W={command:`update <shareId>`,describe:`Updating is not immediate, an updated share object with a new status will be returned.`,builder:U,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/shares/${t.shareId??`<shareId>`}`,pathParams:{shareId:String(t.shareId??``)},bodyKind:`json`,body:{name:t.name,body:t.body}});return}let r=await i(t),p=t.local?f:await e(r);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Updating`,async()=>r.put(`/accounts/${p}/shares/${t.shareId}`,{body:e})),{successLabel:`Updated`});return}t.name===void 0&&(t.name=await n(`name`,`The name of the share.`));let m={};t.name!==void 0&&o(m,[`name`],d(t.name,`name`,`text`)),c(await u(`Updating`,async()=>r.put(`/accounts/${p}/shares/${t.shareId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},G={command:`resource-sharing`,describe:`Share Cloudflare resources (zones, accounts) across organizations with granular access controls`,builder:e=>e.command(m).command(g).command(v).command(b).command(W).command(j).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{G as default};
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e,f as t,l as n,m as r,p as i,t as a,u as o}from"./auth-BlSmtIKd.mjs";import{n as s,t as c}from"./body-parser-Br-BoYk-.mjs";import{t as l}from"./output-D7_yAFVR.mjs";import{n as u,t as d}from"./progress-DZfTxbrx.mjs";import{n as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";function m(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
3
- verify the current resource ETag matches before applying the write. Returns
4
- 412 Precondition Failed if the resource has been modified since the ETag was
5
- 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.`})}const h={command:`delete`,describe:`Removes all tags from a specific account-level resource.`,builder:m,handler:async n=>{let m={};if(n.ifMatch!==void 0&&(m[`If-Match`]=String(n.ifMatch)),n.dryRun){u({command:`cf resource-tagging account-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${o()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:{resourceId:n.resourceId,resourceType:n.resourceType,workerId:n.workerId,body:n.body}});return}let h=await a(n),g=n.local?p:await e(h);if(n.accountId=g,!await t({force:!!n.force})){process.stderr.write(`Aborted.
6
- `);return}if(n.body){let e=c(n.body);l(await d(`Deleting`,async()=>h.delete(`/accounts/${g}/tags`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted`});return}n.resourceId===void 0&&(n.resourceId=await r(`resource-id`,`Identifies the unique resource.`)),n.resourceType===void 0&&(n.resourceType=await i(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let _={};n.resourceId!==void 0&&s(_,[`resource_id`],f(n.resourceId,`resourceId`,`text`)),n.resourceType!==void 0&&s(_,[`resource_type`],f(n.resourceType,`resourceType`,`text`)),n.workerId!==void 0&&s(_,[`worker_id`],f(n.workerId,`workerId`,`text`)),l(await d(`Deleting`,async()=>h.delete(`/accounts/${g}/tags`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted`})}};function g(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Retrieves tags for a specific account-level resource.`,builder:g,handler:async t=>{let n={resource_id:t.resourceId,resource_type:t.resourceType,worker_id:t.workerId};if(t.dryRun){u({command:`cf resource-tagging account-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${o()??`<account-id>`}/tags`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),i=t.local?p:await e(r);t.accountId=i,l(await d(`Loading`,async()=>r.resourceTagging.accountTags.get(i,n)),{successLabel:`Loaded`})}};function v(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
7
- verify the current resource ETag matches before applying the write. Returns
8
- 412 Precondition Failed if the resource has been modified since the ETag was
9
- 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.`})}const y={command:`update`,describe:`Creates or updates tags for a specific account-level resource.`,builder:v,handler:async t=>{let n={};if(t.ifMatch!==void 0&&(n[`If-Match`]=String(t.ifMatch)),t.dryRun){u({command:`cf resource-tagging account-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${o()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:{resourceId:t.resourceId,resourceType:t.resourceType,workerId:t.workerId,body:t.body}});return}let m=await a(t),h=t.local?p:await e(m);if(t.accountId=h,t.body){let e=c(t.body);l(await d(`Updating`,async()=>m.put(`/accounts/${h}/tags`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}t.resourceId===void 0&&(t.resourceId=await r(`resource-id`,`Identifies the unique resource.`)),t.resourceType===void 0&&(t.resourceType=await i(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let g={};t.resourceId!==void 0&&s(g,[`resource_id`],f(t.resourceId,`resourceId`,`text`)),t.resourceType!==void 0&&s(g,[`resource_type`],f(t.resourceType,`resourceType`,`text`)),t.workerId!==void 0&&s(g,[`worker_id`],f(t.workerId,`workerId`,`text`)),l(await d(`Updating`,async()=>m.put(`/accounts/${h}/tags`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}},b={command:`account-tags`,describe:`Tags applied to the account for organizational grouping and policy targeting`,builder:e=>e.command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Lists all distinct tag keys used across resources in an account.`,builder:x,handler:async t=>{let n={cursor:t.cursor};if(t.dryRun){u({command:`cf resource-tagging keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${o()??`<account-id>`}/tags/keys`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),i=t.local?p:await e(r);t.accountId=i,l(await d(`Loading`,async()=>r.resourceTagging.keys.list(i,n)),{successLabel:`Loaded`})}},C={command:`keys`,describe:`Tag key definitions that establish the vocabulary for tagging resources`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return 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.\n\nSupported syntax:\n- **Key-only**: `tag=<key>` - Resource must have the tag key (e.g., `tag=production`)\n- **Key-value**: `tag=<key>=<value>` - Resource must have the tag with specific value (e.g., `tag=env=prod`)\n- **Multiple values (OR)**: `tag=<key>=<v1>,<v2>` - Resource must have tag with any of the values (e.g., `tag=env=prod,staging`)\n- **Negate key-only**: `tag=!<key>` - Resource must not have the tag key (e.g., `tag=!archived`)\n- **Negate key-value**: `tag=<key>!=<value>` - Resource must not have the tag with specific value (e.g., `tag=region!=us-west-1`)\n\nMultiple tag parameters are combined with AND logic."}).option(`cursor`,{type:`string`,description:`Cursor for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Lists all tagged resources for an account.`,builder:w,handler:async t=>{let n={type:t.type,tag:t.tag,cursor:t.cursor};if(t.dryRun){u({command:`cf resource-tagging list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${o()??`<account-id>`}/tags/resources`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),i=t.local?p:await e(r);t.accountId=i,l(await d(`Loading`,async()=>r.resourceTagging.list(i,n)),{successLabel:`Loaded`})}};function E(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`Lists all distinct values for a given tag key, optionally filtered by resource type.`,builder:E,handler:async t=>{let n={type:t.type,cursor:t.cursor};if(t.dryRun){u({command:`cf resource-tagging values list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${o()??`<account-id>`}/tags/values/${t.tagKey??`<tagKey>`}`,pathParams:{tagKey:String(t.tagKey??``)},query:n,bodyKind:`none`});return}let r=await a(t),i=t.local?p:await e(r);t.accountId=i,l(await d(`Loading`,async()=>r.resourceTagging.values.list(i,t.tagKey,n)),{successLabel:`Loaded`})}},O={command:`values`,describe:`Allowed values for tag keys — constrain tagging to a defined set of options`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
10
- verify the current resource ETag matches before applying the write. Returns
11
- 412 Precondition Failed if the resource has been modified since the ETag was
12
- 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.`})}const A={command:`delete`,describe:`Removes all tags from a specific zone-level resource.`,builder:k,handler:async e=>{let o={};if(e.ifMatch!==void 0&&(o[`If-Match`]=String(e.ifMatch)),e.dryRun){u({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}});return}let p=await a(e);if(e.zoneId=await n({zone:e.zone},p,{quiet:e.quiet}),!await t({force:!!e.force})){process.stderr.write(`Aborted.
13
- `);return}if(e.body){let t=c(e.body);l(await d(`Deleting`,async()=>p.delete(`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Deleted`});return}e.resourceId===void 0&&(e.resourceId=await r(`resource-id`,`Identifies the unique resource.`)),e.resourceType===void 0&&(e.resourceType=await i(`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 m={};e.resourceId!==void 0&&s(m,[`resource_id`],f(e.resourceId,`resourceId`,`text`)),e.resourceType!==void 0&&s(m,[`resource_type`],f(e.resourceType,`resourceType`,`text`)),e.accessApplicationId!==void 0&&s(m,[`access_application_id`],f(e.accessApplicationId,`accessApplicationId`,`text`)),l(await d(`Deleting`,async()=>p.delete(`/zones/${e.zoneId}/tags`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Deleted`})}};function j(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get`,describe:`Retrieves tags for a specific zone-level resource.`,builder:j,handler:async e=>{let t={resource_id:e.resourceId,resource_type:e.resourceType,access_application_id:e.accessApplicationId};if(e.dryRun){u({command:`cf resource-tagging zone-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/tags`,pathParams:{zoneId:String(e.zoneId??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.resourceTagging.zoneTags.get(i,t)),{successLabel:`Loaded`})}};function N(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
14
- verify the current resource ETag matches before applying the write. Returns
15
- 412 Precondition Failed if the resource has been modified since the ETag was
16
- 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.`})}const P={command:`update`,describe:`Creates or updates tags for a specific zone-level resource. Replaces all existing tags for the resource.`,builder:N,handler:async e=>{let t={};if(e.ifMatch!==void 0&&(t[`If-Match`]=String(e.ifMatch)),e.dryRun){u({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}});return}let o=await a(e);if(e.zoneId=await n({zone:e.zone},o,{quiet:e.quiet}),e.body){let n=c(e.body);l(await d(`Updating`,async()=>o.put(`/zones/${e.zoneId}/tags`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}e.resourceId===void 0&&(e.resourceId=await r(`resource-id`,`Identifies the unique resource.`)),e.resourceType===void 0&&(e.resourceType=await i(`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 p={};e.resourceId!==void 0&&s(p,[`resource_id`],f(e.resourceId,`resourceId`,`text`)),e.resourceType!==void 0&&s(p,[`resource_type`],f(e.resourceType,`resourceType`,`text`)),e.accessApplicationId!==void 0&&s(p,[`access_application_id`],f(e.accessApplicationId,`accessApplicationId`,`text`)),l(await d(`Updating`,async()=>o.put(`/zones/${e.zoneId}/tags`,{body:Object.keys(p).length>0?p:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},F={command:`zone-tags`,describe:`Tags applied to individual zones for categorization and bulk management`,builder:e=>e.command(A).command(M).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},I={command:`resource-tagging`,describe:`Tag accounts and zones with key-value metadata for organization, filtering, and policy targeting`,builder:e=>e.command(T).command(b).command(C).command(O).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{I as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e,f as t,m as n,t as r,u as i}from"./auth-BlSmtIKd.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-DZfTxbrx.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";function f(e){return e.positional(`operationId`,{type:`string`,description:`The unique operation ID of the asynchronous action.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}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:f,handler:async t=>{if(t.dryRun){c({command:`cf rules lists bulk-operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/bulk_operations/${t.operationId??`<operationId>`}`,pathParams:{operationId:String(t.operationId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.bulkOperations.get(t.operationId,a)),{successLabel:`Loaded`})}},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,`Please specify a subcommand`),handler:()=>{}};function h(e){return 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)`})}const g={command:`create`,describe:`Creates a new list of the specified kind.`,builder:h,handler:async t=>{if(t.dryRun){c({command:`cf rules lists create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`json`,body:{description:t.description,name:t.name,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/rules/lists`,{body:e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await n(`name`,`An informative name for the list. Use this name in filter and rule expressions.`));let m={};t.description!==void 0&&a(m,[`description`],u(t.description,`description`,`text`)),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/rules/lists`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function _(e){return 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)`})}const v={command:`delete <listId>`,describe:`Deletes a specific list and all its items.`,builder:_,handler:async n=>{if(n.dryRun){c({command:`cf rules lists delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${n.listId??`<listId>`}`,pathParams:{listId:String(n.listId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/rules/lists/${n.listId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.rules.lists.delete(n.listId,u)),{successLabel:`Deleted`})}};function y(e){return 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})}const b={command:`get <listId>`,describe:`Fetches the details of a list.`,builder:y,handler:async t=>{if(t.dryRun){c({command:`cf rules lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${t.listId??`<listId>`}`,pathParams:{listId:String(t.listId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.get(t.listId,a)),{successLabel:`Loaded`})}};function x(e){return 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)`})}const S={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:x,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),a=t.local?d:await e(n);if(t.accountId=a,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${a}/rules/lists/${t.listId}/items`,{body:e})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function C(e){return 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)`})}const w={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:C,handler:async n=>{if(n.dryRun){c({command:`cf rules lists items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${n.listId??`<listId>`}/items`,pathParams:{listId:String(n.listId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
4
- `);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/rules/lists/${n.listId}/items`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.rules.lists.items.delete(n.listId,u)),{successLabel:`Deleted`})}};function T(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <itemId>`,describe:`Fetches a list item in the list.`,builder:T,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items/${t.itemId??`<itemId>`}`,pathParams:{itemId:String(t.itemId??``),listId:String(t.listId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.items.get(t.itemId,t.listId,a)),{successLabel:`Loaded`})}};function D(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`list`,describe:`Fetches all the items in the list.`,builder:D,handler:async t=>{let n={cursor:t.cursor,per_page:t.perPage,search:t.search};if(t.dryRun){c({command:`cf rules lists items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items`,pathParams:{listId:String(t.listId??``)},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.rules.lists.items.list(t.listId,o,n)),{successLabel:`Loaded`})}};function k(e){return 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)`})}const A={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:k,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${t.listId??`<listId>`}/items`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),a=t.local?d:await e(n);if(t.accountId=a,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${a}/rules/lists/${t.listId}/items`,{body:e})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},j={command:`items`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(S).command(w).command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Fetches all lists in the account.`,builder:M,handler:async t=>{if(t.dryRun){c({command:`cf rules lists list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.list(a)),{successLabel:`Loaded`})}};function P(e){return 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)`})}const F={command:`update <listId>`,describe:`Updates the description of a list.`,builder:P,handler:async t=>{if(t.dryRun){c({command:`cf rules lists update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rules/lists/${t.listId??`<listId>`}`,pathParams:{listId:String(t.listId??``)},bodyKind:`json`,body:{description:t.description,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/rules/lists/${t.listId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.description!==void 0&&a(p,[`description`],u(t.description,`description`,`text`)),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/rules/lists/${t.listId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},I={command:`lists`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(g).command(v).command(b).command(N).command(F).command(m).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`rules`,describe:`Account-level IP lists, hostname lists, and other reusable lists referenced by firewall rules and rulesets`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{L as default};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e,f as t,l as n,t as r,u as i}from"./auth-BlSmtIKd.mjs";import{t as a}from"./output-D7_yAFVR.mjs";import{n as o,t as s}from"./progress-DZfTxbrx.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";import{t as l}from"./local-VJaJ3BZ1.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`create`,describe:`Creates a ruleset at the account level.`,builder:u,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),u=t.local?l:await e(n);if(t.accountId=u,t.body){let e=c(t.body,`body`,`binary`);a(await s(`Creating`,async()=>n.post(`/accounts/${u}/rulesets`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>n.rulesets.accountRulesets.create(u)),{successLabel:`Created`})}};function d(e){return 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})}const f={command:`delete <rulesetId>`,describe:`Deletes all versions of an existing account ruleset.`,builder:d,handler:async n=>{if(n.dryRun){o({command:`cf rulesets account-rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${n.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(n.rulesetId??``)},bodyKind:`none`});return}let c=await r(n),u=n.local?l:await e(c);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>c.rulesets.accountRulesets.delete(n.rulesetId,u)),{successLabel:`Deleted`})}};function p(e){return 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})}const m={command:`get <rulesetId>`,describe:`Fetches the latest version of an account ruleset.`,builder:p,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.get(t.rulesetId,c)),{successLabel:`Loaded`})}};function h(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`Fetches all rulesets at the account level.`,builder:h,handler:async t=>{let n={cursor:t.cursor,per_page:t.perPage};if(t.dryRun){o({command:`cf rulesets account-rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets`,pathParams:{},query:n,bodyKind:`none`});return}let c=await r(t),u=t.local?l:await e(c);t.accountId=u,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.list(u,n)),{successLabel:`Loaded`})}};function _(e){return 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})}const v={command:`get <rulesetPhase>`,describe:`Fetches the latest version of the account entry point ruleset for a given phase.`,builder:_,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets phases get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/phases/${t.rulesetPhase??`<rulesetPhase>`}/entrypoint`,pathParams:{rulesetPhase:String(t.rulesetPhase??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.phases.get(t.rulesetPhase,c)),{successLabel:`Loaded`})}};function y(e){return 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)`})}const b={command:`update <rulesetPhase>`,describe:`Updates an account entry point ruleset, creating a new version.`,builder:y,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/phases/${t.rulesetPhase??`<rulesetPhase>`}/entrypoint`,pathParams:{rulesetPhase:String(t.rulesetPhase??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),u=t.local?l:await e(n);if(t.accountId=u,t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>n.put(`/accounts/${u}/rulesets/phases/${t.rulesetPhase}/entrypoint`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n.rulesets.accountRulesets.phases.update(t.rulesetPhase,u)),{successLabel:`Updated`})}};function x(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <rulesetVersion>`,describe:`Fetches a specific version of an account entry point ruleset.`,builder:x,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/phases/${t.rulesetPhase??`<rulesetPhase>`}/entrypoint/versions/${t.rulesetVersion??`<rulesetVersion>`}`,pathParams:{rulesetVersion:String(t.rulesetVersion??``),rulesetPhase:String(t.rulesetPhase??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.phases.versions.get(t.rulesetVersion,t.rulesetPhase,c)),{successLabel:`Loaded`})}};function C(e){return e.option(`ruleset-phase`,{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})}const w={command:`list`,describe:`Fetches the versions of an account entry point ruleset.`,builder:C,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/phases/${t.rulesetPhase??`<rulesetPhase>`}/entrypoint/versions`,pathParams:{rulesetPhase:String(t.rulesetPhase??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.phases.versions.list(t.rulesetPhase,c)),{successLabel:`Loaded`})}},T={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},E={command:`phases`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(v).command(b).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return 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)`})}const O={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:D,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}/rules`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),u=t.local?l:await e(n);if(t.accountId=u,t.body){let e=c(t.body,`body`,`binary`);a(await s(`Creating`,async()=>n.post(`/accounts/${u}/rulesets/${t.rulesetId}/rules`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>n.rulesets.accountRulesets.rules.create(t.rulesetId,u)),{successLabel:`Created`})}};function k(e){return 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})}const A={command:`delete <ruleId>`,describe:`Deletes an existing rule from an account ruleset.`,builder:k,handler:async n=>{if(n.dryRun){o({command:`cf rulesets account-rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${n.rulesetId??`<rulesetId>`}/rules/${n.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(n.ruleId??``),rulesetId:String(n.rulesetId??``)},bodyKind:`none`});return}let c=await r(n),u=n.local?l:await e(c);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>c.rulesets.accountRulesets.rules.delete(n.ruleId,n.rulesetId,u)),{successLabel:`Deleted`})}};function j(e){return 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)`})}const M={command:`update <ruleId>`,describe:`Updates an existing rule in an account ruleset.`,builder:j,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``),rulesetId:String(t.rulesetId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),u=t.local?l:await e(n);if(t.accountId=u,t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>n.patch(`/accounts/${u}/rulesets/${t.rulesetId}/rules/${t.ruleId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n.rulesets.accountRulesets.rules.update(t.ruleId,t.rulesetId,u)),{successLabel:`Updated`})}},N={command:`rules`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return 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)`})}const F={command:`update <rulesetId>`,describe:`Updates an account ruleset, creating a new version.`,builder:P,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),u=t.local?l:await e(n);if(t.accountId=u,t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>n.put(`/accounts/${u}/rulesets/${t.rulesetId}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n.rulesets.accountRulesets.update(t.rulesetId,u)),{successLabel:`Updated`})}};function I(e){return e.positional(`ruleTag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`tag <ruleTag>`,describe:`Fetches the rules of a managed account ruleset version for a given tag.`,builder:I,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets versions by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}/versions/${t.rulesetVersion??`<rulesetVersion>`}/by_tag/${t.ruleTag??`<ruleTag>`}`,pathParams:{ruleTag:String(t.ruleTag??``),rulesetVersion:String(t.rulesetVersion??``),rulesetId:String(t.rulesetId??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.versions.byTag.tag(t.ruleTag,t.rulesetVersion,t.rulesetId,c)),{successLabel:`Loaded`})}},R={command:`by-tag`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return 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})}const B={command:`delete <rulesetVersion>`,describe:`Deletes an existing version of an account ruleset.`,builder:z,handler:async n=>{if(n.dryRun){o({command:`cf rulesets account-rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${n.rulesetId??`<rulesetId>`}/versions/${n.rulesetVersion??`<rulesetVersion>`}`,pathParams:{rulesetVersion:String(n.rulesetVersion??``),rulesetId:String(n.rulesetId??``)},bodyKind:`none`});return}let c=await r(n),u=n.local?l:await e(c);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
5
- `);return}a(await s(`Deleting`,async()=>c.rulesets.accountRulesets.versions.delete(n.rulesetVersion,n.rulesetId,u)),{successLabel:`Deleted`})}};function V(e){return 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})}const H={command:`get <rulesetVersion>`,describe:`Fetches a specific version of an account ruleset.`,builder:V,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}/versions/${t.rulesetVersion??`<rulesetVersion>`}`,pathParams:{rulesetVersion:String(t.rulesetVersion??``),rulesetId:String(t.rulesetId??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.versions.get(t.rulesetVersion,t.rulesetId,c)),{successLabel:`Loaded`})}};function U(e){return e.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})}const W={command:`list`,describe:`Fetches the versions of an account ruleset.`,builder:U,handler:async t=>{if(t.dryRun){o({command:`cf rulesets account-rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/rulesets/${t.rulesetId??`<rulesetId>`}/versions`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`none`});return}let n=await r(t),c=t.local?l:await e(n);t.accountId=c,a(await s(`Loading`,async()=>n.rulesets.accountRulesets.versions.list(t.rulesetId,c)),{successLabel:`Loaded`})}};function G(e){return e.positional(`ruleTag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`tag <ruleTag>`,describe:`Fetches the rules of a managed zone ruleset version for a given tag.`,builder:G,handler:async e=>{if(e.dryRun){o({command:`cf rulesets account-rulesets versions zone-by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}/versions/${e.rulesetVersion??`<rulesetVersion>`}/by_tag/${e.ruleTag??`<ruleTag>`}`,pathParams:{ruleTag:String(e.ruleTag??``),rulesetVersion:String(e.rulesetVersion??``),rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.accountRulesets.versions.zoneByTag.tag(e.ruleTag,e.rulesetVersion,e.rulesetId,i)),{successLabel:`Loaded`})}},q={command:`zone-by-tag`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(B).command(H).command(W).command(R).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Y={command:`account-rulesets`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(ee).command(f).command(m).command(g).command(F).command(E).command(N).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`create`,describe:`Creates a ruleset at the zone level.`,builder:X,handler:async e=>{if(e.dryRun){o({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}});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=c(e.body,`body`,`binary`);a(await s(`Creating`,async()=>t.post(`/zones/${e.zoneId}/rulesets`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>t.rulesets.create(i)),{successLabel:`Created`})}};function Z(e){return 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})}const Q={command:`delete <rulesetId>`,describe:`Deletes all versions of an existing zone ruleset.`,builder:Z,handler:async e=>{if(e.dryRun){o({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`});return}let i=await r(e),c=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=c,!await t({force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}a(await s(`Deleting`,async()=>i.rulesets.delete(e.rulesetId,c)),{successLabel:`Deleted`})}};function ne(e){return 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})}const re={command:`get <rulesetId>`,describe:`Fetches the latest version of a zone ruleset.`,builder:ne,handler:async e=>{if(e.dryRun){o({command:`cf rulesets get`,method:`GET`,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`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.get(e.rulesetId,i)),{successLabel:`Loaded`})}};function ie(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`list`,describe:`Fetches all rulesets at the zone level.`,builder:ie,handler:async e=>{let t={cursor:e.cursor,per_page:e.perPage};if(e.dryRun){o({command:`cf rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets`,pathParams:{zoneId:String(e.zoneId??``)},query:t,bodyKind:`none`});return}let i=await r(e),c=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>i.rulesets.list(c,t)),{successLabel:`Loaded`})}};function oe(e){return 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})}const se={command:`get <rulesetPhase>`,describe:`Fetches the latest version of the zone entry point ruleset for a given phase.`,builder:oe,handler:async e=>{if(e.dryRun){o({command:`cf rulesets phases get`,method:`GET`,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:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.phases.get(e.rulesetPhase,i)),{successLabel:`Loaded`})}};function ce(e){return 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)`})}const le={command:`update <rulesetPhase>`,describe:`Updates a zone entry point ruleset, creating a new version.`,builder:ce,handler:async e=>{if(e.dryRun){o({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}});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=c(e.body,`body`,`binary`);a(await s(`Updating`,async()=>t.put(`/zones/${e.zoneId}/rulesets/phases/${e.rulesetPhase}/entrypoint`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>t.rulesets.phases.update(e.rulesetPhase,i)),{successLabel:`Updated`})}};function ue(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`get <rulesetVersion>`,describe:`Fetches a specific version of a zone entry point ruleset.`,builder:ue,handler:async e=>{if(e.dryRun){o({command:`cf rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/phases/${e.rulesetPhase??`<rulesetPhase>`}/entrypoint/versions/${e.rulesetVersion??`<rulesetVersion>`}`,pathParams:{rulesetVersion:String(e.rulesetVersion??``),rulesetPhase:String(e.rulesetPhase??``),zoneId:String(e.zoneId??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.phases.versions.get(e.rulesetVersion,e.rulesetPhase,i)),{successLabel:`Loaded`})}};function fe(e){return e.option(`ruleset-phase`,{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})}const pe={command:`list`,describe:`Fetches the versions of a zone entry point ruleset.`,builder:fe,handler:async e=>{if(e.dryRun){o({command:`cf rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/phases/${e.rulesetPhase??`<rulesetPhase>`}/entrypoint/versions`,pathParams:{rulesetPhase:String(e.rulesetPhase??``),zoneId:String(e.zoneId??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.phases.versions.list(e.rulesetPhase,i)),{successLabel:`Loaded`})}},me={command:`versions`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(de).command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},he={command:`phases`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(se).command(le).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ge(e){return 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)`})}const _e={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:ge,handler:async e=>{if(e.dryRun){o({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}});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=c(e.body,`body`,`binary`);a(await s(`Creating`,async()=>t.post(`/zones/${e.zoneId}/rulesets/${e.rulesetId}/rules`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>t.rulesets.rules.create(e.rulesetId,i)),{successLabel:`Created`})}};function ve(e){return 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})}const ye={command:`delete <ruleId>`,describe:`Deletes an existing rule from a zone ruleset.`,builder:ve,handler:async e=>{if(e.dryRun){o({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`});return}let i=await r(e),c=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=c,!await t({force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}a(await s(`Deleting`,async()=>i.rulesets.rules.delete(e.ruleId,e.rulesetId,c)),{successLabel:`Deleted`})}};function be(e){return 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)`})}const $={command:`edit <ruleId>`,describe:`Updates an existing rule in a zone ruleset.`,builder:be,handler:async e=>{if(e.dryRun){o({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}});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=c(e.body,`body`,`binary`);a(await s(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/rulesets/${e.rulesetId}/rules/${e.ruleId}`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>t.rulesets.rules.edit(e.ruleId,e.rulesetId,i)),{successLabel:`Updated`})}},xe={command:`rules`,describe:`Individual rules within a ruleset — each with an expression, action, and priority`,builder:e=>e.command(_e).command(ye).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return 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)`})}const Ce={command:`update <rulesetId>`,describe:`Updates a zone ruleset, creating a new version.`,builder:Se,handler:async e=>{if(e.dryRun){o({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}});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=c(e.body,`body`,`binary`);a(await s(`Updating`,async()=>t.put(`/zones/${e.zoneId}/rulesets/${e.rulesetId}`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>t.rulesets.update(e.rulesetId,i)),{successLabel:`Updated`})}};function we(e){return 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})}const Te={command:`delete <rulesetVersion>`,describe:`Deletes an existing version of a zone ruleset.`,builder:we,handler:async e=>{if(e.dryRun){o({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`});return}let i=await r(e),c=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=c,!await t({force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}a(await s(`Deleting`,async()=>i.rulesets.versions.delete(e.rulesetVersion,e.rulesetId,c)),{successLabel:`Deleted`})}};function Ee(e){return 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})}const De={command:`get <rulesetVersion>`,describe:`Fetches a specific version of a zone ruleset.`,builder:Ee,handler:async e=>{if(e.dryRun){o({command:`cf rulesets versions get`,method:`GET`,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`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.versions.get(e.rulesetVersion,e.rulesetId,i)),{successLabel:`Loaded`})}};function Oe(e){return e.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})}const ke={command:`list`,describe:`Fetches the versions of a zone ruleset.`,builder:Oe,handler:async e=>{if(e.dryRun){o({command:`cf rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/rulesets/${e.rulesetId??`<rulesetId>`}/versions`,pathParams:{rulesetId:String(e.rulesetId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>t.rulesets.versions.list(e.rulesetId,i)),{successLabel:`Loaded`})}},Ae={command:`versions`,describe:`Immutable snapshots of a ruleset, allowing rollback and audit of rule changes`,builder:e=>e.command(Te).command(De).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},je={command:`rulesets`,describe:`Versioned collections of rules that control how Cloudflare processes traffic — WAF, transform, redirect, and more`,builder:e=>e.command(te).command(Q).command(re).command(ae).command(Ce).command(Y).command(he).command(xe).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{je as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e,f as t,t as n,u as r}from"./auth-BlSmtIKd.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-DZfTxbrx.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./local-VJaJ3BZ1.mjs";function d(e){return 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)`})}const f={command:`bulk-create`,describe:`Modifies one or more rules in a Web Analytics ruleset with a single request.`,builder:d,handler:async t=>{if(t.dryRun){s({command:`cf rum rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/v2/${t.rulesetId??`<rulesetId>`}/rules`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`json`,body:{deleteRules:t.deleteRules,body:t.body}});return}let l=await n(t),d=t.local?u:await e(l);if(t.accountId=d,t.body){let e=a(t.body);o(await c(`Creating`,async()=>l.post(`/accounts/${d}/rum/v2/${t.rulesetId}/rules`,{body:e})),{successLabel:`Created`});return}let f={};t.deleteRules!==void 0&&i(f,[`delete_rules`],t.deleteRules),o(await c(`Creating`,async()=>l.post(`/accounts/${d}/rum/v2/${t.rulesetId}/rules`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function p(e){return 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)`})}const m={command:`create <rulesetId>`,describe:`Creates a new rule in a Web Analytics ruleset.`,builder:p,handler:async t=>{if(t.dryRun){s({command:`cf rum rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/v2/${t.rulesetId??`<rulesetId>`}/rule`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`json`,body:{host:t.host,inclusive:t.inclusive,isPaused:t.isPaused,paths:t.paths,body:t.body}});return}let d=await n(t),f=t.local?u:await e(d);if(t.accountId=f,t.body){let e=a(t.body);o(await c(`Creating`,async()=>d.post(`/accounts/${f}/rum/v2/${t.rulesetId}/rule`,{body:e})),{successLabel:`Created`});return}let p={};t.host!==void 0&&i(p,[`host`],l(t.host,`host`,`text`)),t.inclusive!==void 0&&i(p,[`inclusive`],t.inclusive),t.isPaused!==void 0&&i(p,[`is_paused`],t.isPaused),t.paths!==void 0&&i(p,[`paths`],t.paths),o(await c(`Creating`,async()=>d.post(`/accounts/${f}/rum/v2/${t.rulesetId}/rule`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function h(e){return 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})}const g={command:`delete <ruleId>`,describe:`Deletes an existing rule from a Web Analytics ruleset.`,builder:h,handler:async i=>{if(i.dryRun){s({command:`cf rum rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/v2/${i.rulesetId??`<rulesetId>`}/rule/${i.ruleId??`<ruleId>`}`,pathParams:{rulesetId:String(i.rulesetId??``),ruleId:String(i.ruleId??``)},bodyKind:`none`});return}let a=await n(i),l=i.local?u:await e(a);if(i.accountId=l,!await t({force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting`,async()=>a.rum.rules.delete(l,i.rulesetId,i.ruleId)),{successLabel:`Deleted`})}};function _(e){return e.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})}const v={command:`list`,describe:`Lists all the rules in a Web Analytics ruleset.`,builder:_,handler:async t=>{if(t.dryRun){s({command:`cf rum rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/v2/${t.rulesetId??`<rulesetId>`}/rules`,pathParams:{rulesetId:String(t.rulesetId??``)},bodyKind:`none`});return}let i=await n(t),a=t.local?u:await e(i);t.accountId=a,o(await c(`Loading`,async()=>i.rum.rules.list(a,t.rulesetId)),{successLabel:`Loaded`})}};function y(e){return 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)`})}const b={command:`update <ruleId>`,describe:`Updates a rule in a Web Analytics ruleset.`,builder:y,handler:async t=>{if(t.dryRun){s({command:`cf rum rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/v2/${t.rulesetId??`<rulesetId>`}/rule/${t.ruleId??`<ruleId>`}`,pathParams:{rulesetId:String(t.rulesetId??``),ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{host:t.host,inclusive:t.inclusive,isPaused:t.isPaused,paths:t.paths,body:t.body}});return}let d=await n(t),f=t.local?u:await e(d);if(t.accountId=f,t.body){let e=a(t.body);o(await c(`Updating`,async()=>d.put(`/accounts/${f}/rum/v2/${t.rulesetId}/rule/${t.ruleId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.host!==void 0&&i(p,[`host`],l(t.host,`host`,`text`)),t.inclusive!==void 0&&i(p,[`inclusive`],t.inclusive),t.isPaused!==void 0&&i(p,[`is_paused`],t.isPaused),t.paths!==void 0&&i(p,[`paths`],t.paths),o(await c(`Updating`,async()=>d.put(`/accounts/${f}/rum/v2/${t.rulesetId}/rule/${t.ruleId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},x={command:`rules`,describe:`Rules that control which pages and paths are tracked by Web Analytics`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return 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)`})}const C={command:`create`,describe:`Creates a new Web Analytics site.`,builder:S,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/site_info`,pathParams:{},bodyKind:`json`,body:{autoInstall:t.autoInstall,host:t.host,zoneTag:t.zoneTag,body:t.body}});return}let d=await n(t),f=t.local?u:await e(d);if(t.accountId=f,t.body){let e=a(t.body);o(await c(`Creating`,async()=>d.post(`/accounts/${f}/rum/site_info`,{body:e})),{successLabel:`Created`});return}let p={};t.autoInstall!==void 0&&i(p,[`auto_install`],t.autoInstall),t.host!==void 0&&i(p,[`host`],l(t.host,`host`,`text`)),t.zoneTag!==void 0&&i(p,[`zone_tag`],l(t.zoneTag,`zoneTag`,`text`)),o(await c(`Creating`,async()=>d.post(`/accounts/${f}/rum/site_info`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function w(e){return 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})}const T={command:`delete <siteId>`,describe:`Deletes an existing Web Analytics site.`,builder:w,handler:async i=>{if(i.dryRun){s({command:`cf rum site-info delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/site_info/${i.siteId??`<siteId>`}`,pathParams:{siteId:String(i.siteId??``)},bodyKind:`none`});return}let a=await n(i),l=i.local?u:await e(a);if(i.accountId=l,!await t({force:!!i.force})){process.stderr.write(`Aborted.
4
- `);return}o(await c(`Deleting`,async()=>a.rum.siteInfo.delete(l,i.siteId)),{successLabel:`Deleted`})}};function E(e){return 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})}const D={command:`get <siteId>`,describe:`Retrieves a Web Analytics site.`,builder:E,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/site_info/${t.siteId??`<siteId>`}`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let i=await n(t),a=t.local?u:await e(i);t.accountId=a,o(await c(`Loading`,async()=>i.rum.siteInfo.get(a,t.siteId)),{successLabel:`Loaded`})}};function O(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all Web Analytics sites of an account.`,builder:O,handler:async t=>{let i={per_page:t.perPage,page:t.page,order_by:t.orderBy};if(t.dryRun){s({command:`cf rum site-info list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/site_info/list`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(t),l=t.local?u:await e(a);t.accountId=l,o(await c(`Loading`,async()=>a.rum.siteInfo.list(l,i)),{successLabel:`Loaded`})}};function A(e){return 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)`})}const j={command:`update <siteId>`,describe:`Updates an existing Web Analytics site.`,builder:A,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/rum/site_info/${t.siteId??`<siteId>`}`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{autoInstall:t.autoInstall,enabled:t.enabled,host:t.host,lite:t.lite,zoneTag:t.zoneTag,body:t.body}});return}let d=await n(t),f=t.local?u:await e(d);if(t.accountId=f,t.body){let e=a(t.body);o(await c(`Updating`,async()=>d.put(`/accounts/${f}/rum/site_info/${t.siteId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.autoInstall!==void 0&&i(p,[`auto_install`],t.autoInstall),t.enabled!==void 0&&i(p,[`enabled`],t.enabled),t.host!==void 0&&i(p,[`host`],l(t.host,`host`,`text`)),t.lite!==void 0&&i(p,[`lite`],t.lite),t.zoneTag!==void 0&&i(p,[`zone_tag`],l(t.zoneTag,`zoneTag`,`text`)),o(await c(`Updating`,async()=>d.put(`/accounts/${f}/rum/site_info/${t.siteId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},M={command:`site-info`,describe:`Web Analytics sites — register domains and get the JavaScript beacon snippet`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`rum`,describe:`Real User Measurement (Web Analytics) — track page loads, Core Web Vitals, and visitor metrics`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};