cf 0.2.0 → 0.4.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 (278) hide show
  1. package/dist/_meta/agent-context.json +76 -70
  2. package/dist/_meta/commands.json +47761 -55490
  3. package/dist/_meta/schemas.json +31106 -34818
  4. package/dist/abuse-reports-Dy76QPNP.mjs +8 -0
  5. package/dist/accounts-CjtZ8x1z.mjs +22 -0
  6. package/dist/acm-C2lYIWs1.mjs +3 -0
  7. package/dist/addressing-CHFK6uxW.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-CgGCT0xU.mjs} +1 -1
  9. package/dist/ai-DS3i-I1a.mjs +2 -0
  10. package/dist/ai-gateway-RIsegO2x.mjs +8 -0
  11. package/dist/ai-search-Dcj4BauG.mjs +7 -0
  12. package/dist/ai_gateway-w7YwfcPE.mjs +4 -0
  13. package/dist/alerting-Bk85NNf5.mjs +6 -0
  14. package/dist/analytics-CkhhhZWZ.mjs +20 -0
  15. package/dist/analytics_engine-B7qgDJCA.mjs +2 -0
  16. package/dist/api-gateway-CWdR4Ne7.mjs +33 -0
  17. package/dist/argo-DnJRVnGX.mjs +2 -0
  18. package/dist/artifacts-BVWKiJUl.mjs +4 -0
  19. package/dist/audit-logs-DjTstbzL.mjs +2 -0
  20. package/dist/auth-BqDOIrKX.mjs +150 -0
  21. package/dist/auth-DKkSwnxh.mjs +5 -0
  22. package/dist/billing-3rEqF83h.mjs +2 -0
  23. package/dist/body-parser-CBpeIUns.mjs +2 -0
  24. package/dist/bot-management-CJxD1pqi.mjs +5 -0
  25. package/dist/botnet-feed-MG91D7BR.mjs +3 -0
  26. package/dist/brand-protection-CK7gJi06.mjs +3 -0
  27. package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
  28. package/dist/{build-5jmmOZhm.mjs → build-BE4o4imx.mjs} +131 -131
  29. package/dist/cache-B7pRbpTy.mjs +5 -0
  30. package/dist/calls-DXRWsZ8n.mjs +4 -0
  31. package/dist/certificate-authorities-BR3gXBLs.mjs +2 -0
  32. package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
  33. package/dist/cli-types-CMNMD1V7.mjs +2 -0
  34. package/dist/client-certificates-B0ebLJdk.mjs +3 -0
  35. package/dist/cloud-connector-BOjaggJk.mjs +2 -0
  36. package/dist/cloudforce-one-B6HYfk5Z.mjs +21 -0
  37. package/dist/{completions-BKrxcfhN.mjs → completions-D_9WsLG7.mjs} +1 -1
  38. package/dist/config-7CBz8Xm0.mjs +2 -0
  39. package/dist/connectivity-welFvZ7X.mjs +3 -0
  40. package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
  41. package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
  42. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
  43. package/dist/connectors-3vjrdFLB.mjs +3 -0
  44. package/dist/content-scanning-CnW2A0pv.mjs +4 -0
  45. package/dist/context-CONbNKO-.mjs +2 -0
  46. package/dist/custom-certificates-CnYh6Yi-.mjs +5 -0
  47. package/dist/custom-hostnames-C2upqZso.mjs +5 -0
  48. package/dist/custom-nameservers-BGkAD_PZ.mjs +3 -0
  49. package/dist/custom-pages-5fCSP8in.mjs +4 -0
  50. package/dist/d1-CyiRbZZn.mjs +4 -0
  51. package/dist/data-security-Casx4OS_.mjs +6 -0
  52. package/dist/dcv-delegation-DVYO10oA.mjs +2 -0
  53. package/dist/{deploy-DbkiIzUr.mjs → deploy-KBRFIatG.mjs} +1 -1
  54. package/dist/{dev-C6iSuQZm.mjs → dev-pPazzZvt.mjs} +1 -1
  55. package/dist/diagnostics-BqYDoDfw.mjs +3 -0
  56. package/dist/dispatch-namespaces-Cz2rajnP.mjs +7 -0
  57. package/dist/{dist-CnSubA1Z.mjs → dist-DA54ZQu0.mjs} +1 -1
  58. package/dist/dist-DpDjsWWn.mjs +306 -0
  59. package/dist/dns-62t95Xif.mjs +29 -0
  60. package/dist/dns-firewall-Coy8d47t.mjs +57 -0
  61. package/dist/durable-objects-BSuRERkw.mjs +2 -0
  62. package/dist/email-routing-BDUYYeV3.mjs +10 -0
  63. package/dist/email-security-ChHA6eqQ.mjs +8 -0
  64. package/dist/email-sending-CVrRqn6S.mjs +3 -0
  65. package/dist/filters-qJpU9uAS.mjs +4 -0
  66. package/dist/firewall-C3DDwfwh.mjs +11 -0
  67. package/dist/fraud-DY3YXFVf.mjs +20 -0
  68. package/dist/google-tag-gateway-B00MHDfB.mjs +2 -0
  69. package/dist/healthchecks-Drvb79v0.mjs +4 -0
  70. package/dist/hostnames-BdAQo1Mr.mjs +3 -0
  71. package/dist/hyperdrive-99OJV9nl.mjs +18 -0
  72. package/dist/iam-BRbpg3lN.mjs +6 -0
  73. package/dist/images-D1jI3r3O.mjs +7 -0
  74. package/dist/index.mjs +1 -1
  75. package/dist/intel-C3ajLpXd.mjs +3 -0
  76. package/dist/{ips-B8fwxKZD.mjs → ips-B6JETVOY.mjs} +1 -1
  77. package/dist/keyless-certificates-C4MZ4xnf.mjs +3 -0
  78. package/dist/kv-CSWoD9ks.mjs +5 -0
  79. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +3 -0
  80. package/dist/load-balancers-Du1tNuUt.mjs +6 -0
  81. package/dist/logpush-SuJyO-uX.mjs +4 -0
  82. package/dist/logs-DcDNRPRl.mjs +3 -0
  83. package/dist/magic-cloud-networking-D-T0RCvi.mjs +5 -0
  84. package/dist/magic-network-monitoring-CqtvOePQ.mjs +4 -0
  85. package/dist/magic-transit-BTbkhBtF.mjs +89 -0
  86. package/dist/managed-transforms-CfUBSz9p.mjs +3 -0
  87. package/dist/mtls-certificates-Cf1O8c2E.mjs +3 -0
  88. package/dist/network-interconnects-DsiNytOU.mjs +36 -0
  89. package/dist/observability-CLqZ7OSi.mjs +4 -0
  90. package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
  91. package/dist/organizations-aRi1bhFC.mjs +41 -0
  92. package/dist/origin-ca-certificates-BB4H89a_.mjs +3 -0
  93. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +2 -0
  94. package/dist/origin-tls-client-auth-CnQNy9-l.mjs +4 -0
  95. package/dist/output-CUxZRM5A.mjs +2 -0
  96. package/dist/page-rules-CYqtPU1p.mjs +18 -0
  97. package/dist/page-shield-D8l9ZMUl.mjs +37 -0
  98. package/dist/pages-ChurJ2H7.mjs +11 -0
  99. package/dist/pipelines-CeyujvRf.mjs +6 -0
  100. package/dist/{progress-CjcQ6ato.mjs → progress-Cent9Lsg.mjs} +1 -1
  101. package/dist/queues-Rf_n11Cx.mjs +6 -0
  102. package/dist/r2-BtuTO3vQ.mjs +21 -0
  103. package/dist/r2-data-catalog-Debz38kv.mjs +14 -0
  104. package/dist/radar-CzGM92uM.mjs +2 -0
  105. package/dist/rate-limits-Bbk7HxP7.mjs +5 -0
  106. package/dist/raw-fetch-DnbAMFBp.mjs +2 -0
  107. package/dist/realtime-kit-CivLpkpg.mjs +18 -0
  108. package/dist/registrar-8IeA5DKd.mjs +46 -0
  109. package/dist/request-tracers-D1aH4NmL.mjs +2 -0
  110. package/dist/{resolve-BuJRWSk0.mjs → resolve-D1mG0REg.mjs} +1 -1
  111. package/dist/resource-sharing-B-Pcto7-.mjs +5 -0
  112. package/dist/resource-tagging-Bpb6Qq1M.mjs +16 -0
  113. package/dist/rules-B10XWY10.mjs +4 -0
  114. package/dist/rulesets-lYczEcJp.mjs +8 -0
  115. package/dist/rum-B5GUKa4I.mjs +4 -0
  116. package/dist/{schema-CHBfkARI.mjs → schema-hefO-tzo.mjs} +1 -1
  117. package/dist/schema-validation-DTq517Em.mjs +24 -0
  118. package/dist/scim-BiLfOQ89.mjs +3 -0
  119. package/dist/secrets-store-CBX0dvHL.mjs +25 -0
  120. package/dist/security-center-AVpTOBK3.mjs +2 -0
  121. package/dist/security-txt-DVlh8y9l.mjs +3 -0
  122. package/dist/session-CsvPYFj8.mjs +5 -0
  123. package/dist/shared-0bwWVDLo.mjs +2 -0
  124. package/dist/smart-shield-DblHIce0.mjs +3 -0
  125. package/dist/snippets-DrpqSXYC.mjs +4 -0
  126. package/dist/{spawn-13QQ0IwO.mjs → spawn-DK7pott_.mjs} +1 -1
  127. package/dist/spectrum-CnrG0jIC.mjs +63 -0
  128. package/dist/speed-BzRY3Xlh.mjs +4 -0
  129. package/dist/{src-B9cKsgsg.mjs → src-D9_Gq68b.mjs} +12 -12
  130. package/dist/ssl-Cp6tQkZH.mjs +15 -0
  131. package/dist/stream-CGTRN4ZN.mjs +14 -0
  132. package/dist/tenants-o_M62Y1n.mjs +2 -0
  133. package/dist/token-validation-Ca5AGEns.mjs +10 -0
  134. package/dist/{tools-B7QiNu-d.mjs → tools-DtNNmO6l.mjs} +1 -1
  135. package/dist/turnstile-l7mo9BWL.mjs +23 -0
  136. package/dist/{ui-BXjU1dX1.mjs → ui-B97lRnOv.mjs} +1 -1
  137. package/dist/url-normalization-D1CogSIG.mjs +3 -0
  138. package/dist/url-scanner-BnJHJqcz.mjs +2 -0
  139. package/dist/user-CiyYZ69X.mjs +10 -0
  140. package/dist/vectorize-D3LgMLOn.mjs +4 -0
  141. package/dist/{versions-DzyrlUAi.mjs → versions-B6E8WQyA.mjs} +1 -1
  142. package/dist/waiting-rooms-Bhy_nuV3.mjs +11 -0
  143. package/dist/web3-DlHE0CZc.mjs +4 -0
  144. package/dist/workers-DRAkU6YR.mjs +18 -0
  145. package/dist/workers-builds-BmNjiHDZ.mjs +7 -0
  146. package/dist/workflows-z6oapEJs.mjs +4 -0
  147. package/dist/zaraz-CyzfYOEU.mjs +2 -0
  148. package/dist/zero-trust-fyyIelWx.mjs +118 -0
  149. package/dist/zero_trust-BAhlNkjo.mjs +3 -0
  150. package/dist/zones-MSULnDwW.mjs +21 -0
  151. package/package.json +7 -6
  152. package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
  153. package/dist/accounts-BopMfODC.mjs +0 -21
  154. package/dist/acm-BT4vlnEJ.mjs +0 -3
  155. package/dist/addressing-B3uFxHst.mjs +0 -13
  156. package/dist/ai-DWHqwMap.mjs +0 -2
  157. package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
  158. package/dist/ai-search-VnOQ5n--.mjs +0 -7
  159. package/dist/alerting-BmmgIlIO.mjs +0 -6
  160. package/dist/analytics-isY03taL.mjs +0 -20
  161. package/dist/api-gateway-DXurEbA-.mjs +0 -33
  162. package/dist/argo-B02BL_hp.mjs +0 -2
  163. package/dist/audit-logs-DcgR9xUc.mjs +0 -2
  164. package/dist/auth-CQcAgnOy.mjs +0 -135
  165. package/dist/auth-DenWm_X0.mjs +0 -6
  166. package/dist/autorag-CmrwnGVj.mjs +0 -2
  167. package/dist/billing-CaW1ZAB1.mjs +0 -2
  168. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  169. package/dist/bot-management-CeBsFx68.mjs +0 -5
  170. package/dist/botnet-feed-B396vQeQ.mjs +0 -3
  171. package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
  172. package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
  173. package/dist/builds-C_ySULja.mjs +0 -2
  174. package/dist/cache-DmXizSMi.mjs +0 -5
  175. package/dist/calls-x4KQpTB4.mjs +0 -4
  176. package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
  177. package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
  178. package/dist/cloud-connector-BClQpEzI.mjs +0 -2
  179. package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
  180. package/dist/config-DYzlVxcB.mjs +0 -2
  181. package/dist/connectivity-G0NP6LtW.mjs +0 -3
  182. package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
  183. package/dist/context-CC0Rhkhy.mjs +0 -2
  184. package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
  185. package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
  186. package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
  187. package/dist/custom-pages-D-oErw57.mjs +0 -4
  188. package/dist/d1-C95ckPKI.mjs +0 -3
  189. package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
  190. package/dist/diagnostics-DEEhPnXj.mjs +0 -3
  191. package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
  192. package/dist/dist-DNBSHor6.mjs +0 -301
  193. package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
  194. package/dist/dns-qW-3TZOT.mjs +0 -29
  195. package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
  196. package/dist/email-routing-tdNJaCpJ.mjs +0 -10
  197. package/dist/email-security-DTVHNr2h.mjs +0 -60
  198. package/dist/email-sending-DsFTvE31.mjs +0 -3
  199. package/dist/filters-DO1Is_tI.mjs +0 -4
  200. package/dist/firewall-DbUhVTCg.mjs +0 -11
  201. package/dist/fraud-Bzr4njYb.mjs +0 -8
  202. package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
  203. package/dist/healthchecks-BBAs-lS_.mjs +0 -4
  204. package/dist/hostnames-Dz9PEUKS.mjs +0 -3
  205. package/dist/hyperdrive-B1iUJddG.mjs +0 -18
  206. package/dist/iam-CJM8gHpG.mjs +0 -6
  207. package/dist/images-DEoBmtFS.mjs +0 -5
  208. package/dist/intel-BM6xkZ0C.mjs +0 -3
  209. package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
  210. package/dist/kv-BTceLtWZ.mjs +0 -5
  211. package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
  212. package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
  213. package/dist/logpush-CSYhgevA.mjs +0 -4
  214. package/dist/logs-DlIwmMpt.mjs +0 -3
  215. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
  216. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
  217. package/dist/magic-transit-qQmA-981.mjs +0 -89
  218. package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
  219. package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
  220. package/dist/network-interconnects-CxG2deY0.mjs +0 -36
  221. package/dist/organizations-DyEAiGiR.mjs +0 -41
  222. package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
  223. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
  224. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
  225. package/dist/output-D7_yAFVR.mjs +0 -2
  226. package/dist/page-rules-DP-w6TAm.mjs +0 -18
  227. package/dist/page-shield-Bf7kFp8c.mjs +0 -37
  228. package/dist/pages-D0Y_XRqW.mjs +0 -10
  229. package/dist/pipelines-C-SPESAk.mjs +0 -6
  230. package/dist/queues-wv6CZsi8.mjs +0 -6
  231. package/dist/r2-DuXjp9n5.mjs +0 -21
  232. package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
  233. package/dist/radar-BW_ZHP8X.mjs +0 -2
  234. package/dist/rate-limits-DLTkIvwr.mjs +0 -5
  235. package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
  236. package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
  237. package/dist/registrar-DIIv6fWd.mjs +0 -46
  238. package/dist/request-tracers-DMej0Drs.mjs +0 -2
  239. package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
  240. package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
  241. package/dist/rules-DLJpOYbC.mjs +0 -4
  242. package/dist/rulesets-D9nqEJT5.mjs +0 -8
  243. package/dist/rum-DBVmdPkp.mjs +0 -4
  244. package/dist/schema-validation-MCd3xdtX.mjs +0 -4
  245. package/dist/scim-DZA3VXog.mjs +0 -3
  246. package/dist/scm-CilfPOue.mjs +0 -2
  247. package/dist/secrets-store-BrvcZSOM.mjs +0 -21
  248. package/dist/security-center-BU6f3Cm1.mjs +0 -2
  249. package/dist/security-txt-BPIbP3dG.mjs +0 -3
  250. package/dist/session-H7IV2BrM.mjs +0 -2
  251. package/dist/shared-DEzmTsEC.mjs +0 -2
  252. package/dist/smart-shield-e8XFBkiF.mjs +0 -3
  253. package/dist/snippets-B4M3MMb8.mjs +0 -4
  254. package/dist/spectrum-B0adfSRI.mjs +0 -59
  255. package/dist/speed-BVcUtkAz.mjs +0 -4
  256. package/dist/ssl-BAa91gsc.mjs +0 -15
  257. package/dist/stream-D53sxKb3.mjs +0 -14
  258. package/dist/tenants-bH5pt3dJ.mjs +0 -2
  259. package/dist/token-validation-M61Vx_Tw.mjs +0 -4
  260. package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
  261. package/dist/url-normalization-DZrWDgB5.mjs +0 -3
  262. package/dist/url-scanner-Zo49edNp.mjs +0 -2
  263. package/dist/user-DbXlVReB.mjs +0 -10
  264. package/dist/vectorize-CUnTM0DT.mjs +0 -4
  265. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  266. package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
  267. package/dist/web3-DueyOQtx.mjs +0 -4
  268. package/dist/workers-builds-BM_aoeUR.mjs +0 -7
  269. package/dist/workers-nV_vBCfV.mjs +0 -16
  270. package/dist/workflows-CQITmo-s.mjs +0 -4
  271. package/dist/zaraz-DIbpF5Op.mjs +0 -2
  272. package/dist/zero-trust-CKp8j512.mjs +0 -119
  273. package/dist/zones-BZ5tZDbH.mjs +0 -28
  274. /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
  275. /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
  276. /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
  277. /package/dist/{metadata-DGdCpUxn.mjs → metadata-jh2EIan8.mjs} +0 -0
  278. /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,_ as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./local-D8bhHUMK.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/${e()??`<account-id>`}/request-tracer/trace`,pathParams:{},bodyKind:`json`,body:d.body===void 0?a({body:{base64:l(d[`body-base64`],`body-base64`,`text`),plain_text:l(d[`body-plain-text`],`body-plain-text`,`text`)},context:{bot_score:d[`context-bot-score`],geoloc:{city:l(d[`context-geoloc-city`],`context-geoloc-city`,`text`),continent:l(d[`context-geoloc-continent`],`context-geoloc-continent`,`text`),is_eu_country:d[`context-geoloc-is-eu-country`],iso_code:l(d[`context-geoloc-iso-code`],`context-geoloc-iso-code`,`text`),latitude:d[`context-geoloc-latitude`],longitude:d[`context-geoloc-longitude`],postal_code:l(d[`context-geoloc-postal-code`],`context-geoloc-postal-code`,`text`),region_code:l(d[`context-geoloc-region-code`],`context-geoloc-region-code`,`text`),subdivision_2_iso_code:l(d[`context-geoloc-subdivision-2-iso-code`],`context-geoloc-subdivision-2-iso-code`,`text`),timezone:l(d[`context-geoloc-timezone`],`context-geoloc-timezone`,`text`)},skip_challenge:d[`context-skip-challenge`],threat_score:d[`context-threat-score`]},method:l(d.method,`method`,`text`),protocol:l(d.protocol,`protocol`,`text`),skip_response:d[`skip-response`],url:l(d.url,`url`,`text`)}):i(d.body)});return}let f=await r(d),p=d.local?u:await n(f);if(d.accountId=p,d.body){let e=i(d.body);o(await c(`Creating`,async()=>f.requestTracers.traces.create({...e,account_id:p})),{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=a({body:{base64:l(d[`body-base64`],`body-base64`,`text`),plain_text:l(d[`body-plain-text`],`body-plain-text`,`text`)},context:{bot_score:d[`context-bot-score`],geoloc:{city:l(d[`context-geoloc-city`],`context-geoloc-city`,`text`),continent:l(d[`context-geoloc-continent`],`context-geoloc-continent`,`text`),is_eu_country:d[`context-geoloc-is-eu-country`],iso_code:l(d[`context-geoloc-iso-code`],`context-geoloc-iso-code`,`text`),latitude:d[`context-geoloc-latitude`],longitude:d[`context-geoloc-longitude`],postal_code:l(d[`context-geoloc-postal-code`],`context-geoloc-postal-code`,`text`),region_code:l(d[`context-geoloc-region-code`],`context-geoloc-region-code`,`text`),subdivision_2_iso_code:l(d[`context-geoloc-subdivision-2-iso-code`],`context-geoloc-subdivision-2-iso-code`,`text`),timezone:l(d[`context-geoloc-timezone`],`context-geoloc-timezone`,`text`)},skip_challenge:d[`context-skip-challenge`],threat_score:d[`context-threat-score`]},method:l(d.method,`method`,`text`),protocol:l(d.protocol,`protocol`,`text`),skip_response:d[`skip-response`],url:l(d.url,`url`,`text`)});o(await c(`Creating`,async()=>f.requestTracers.traces.create({...m,account_id:p})),{successLabel:`Created`})}},p={command:`traces`,describe:`Operations for traces`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`request-tracers`,describe:`request-tracers`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{r as e}from"./chunk-DH-VkVmc.mjs";var t=e({isCloudflareId:()=>a,isId:()=>o,isUUID:()=>i,isValidDomainName:()=>s,resolveZoneId:()=>c});const n=new Map;async function r(e,t,r=6e4){let i=n.get(e),a=Date.now();if(i&&i.expires>a)return i.data;let o=await t();return n.set(e,{data:o,expires:a+r}),o}function i(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function a(e){return/^[0-9a-f]{32}$/i.test(e)}function o(e){return i(e)||a(e)}function s(e){if(!e||e.length>253||!e.includes(`.`))return!1;let t=e.split(`.`);for(let e of t)if(e.length===0||e.length>63||!/^[a-zA-Z0-9]/.test(e)||!/[a-zA-Z0-9]$/.test(e)||!/^[a-zA-Z0-9-]+$/.test(e))return!1;return!0}async function c(e,t,n){if(o(n))return n;if(!s(n))throw Error(`Invalid zone identifier: "${n}". Must be a zone ID or valid domain name.`);let i=(await r(`zones:${t}`,async()=>e.zones.list(t))).find(e=>e.name===n||e.name===n.toLowerCase());if(!i)throw Error(`Zone not found: ${n}`);return i.id}export{s as n,t as r,o as t};
2
+ import{r as e}from"./chunk-DH-VkVmc.mjs";var t=e({isCloudflareId:()=>a,isId:()=>o,isUUID:()=>i,isValidDomainName:()=>s,resolveZoneId:()=>c});const n=new Map;async function r(e,t,r=6e4){let i=n.get(e),a=Date.now();if(i&&i.expires>a)return i.data;let o=await t();return n.set(e,{data:o,expires:a+r}),o}function i(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function a(e){return/^[0-9a-f]{32}$/i.test(e)}function o(e){return i(e)||a(e)}function s(e){if(!e||e.length>253||!e.includes(`.`))return!1;let t=e.split(`.`);for(let e of t)if(e.length===0||e.length>63||!/^[a-zA-Z0-9]/.test(e)||!/[a-zA-Z0-9]$/.test(e)||!/^[a-zA-Z0-9-]+$/.test(e))return!1;return!0}async function c(e,t,n){if(o(n))return n;if(!s(n))throw Error(`Invalid zone identifier: "${n}". Must be a zone ID or valid domain name.`);let i=(await r(`zones:${t}`,async()=>(await e.zones.list({"account.id":t})).result)).find(e=>e.name===n||e.name===n.toLowerCase());if(!i)throw Error(`Zone not found: ${n}`);return i.id}export{s as n,t as r,o as t};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./local-D8bhHUMK.mjs";import{t as p}from"./cli-types-CMNMD1V7.mjs";function m(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 h={command:`create`,describe:`Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`,builder:m,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.resourceSharing.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the share.`));let m=s({name:d(n.name,`name`,`text`)});c(await u(`Creating`,async()=>r.resourceSharing.create({...m,account_id:p})),{successLabel:`Created`})}};function g(e){return e.positional(`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 _={command:`delete <share-id>`,describe:`Deletion is not immediate, an updated share object with a new status will be returned.`,builder:g,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>n.resourceSharing.delete({account_id:o,share_id:t[`share-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <share-id>`,describe:`Fetches share by ID.`,builder:v,handler:async t=>{let n={include_resources:t[`include-resources`],include_recipient_counts:t[`include-recipient-counts`]};if(t.dryRun){l({command:`cf resource-sharing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.get({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function b(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. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`tag`,{type:`string`,description:"Filter shares by tag. Each value is either `key=value` (matches shares whose tags contain that key/value pair) or `key` alone (matches shares that have any value for that key). May be repeated; multiple `tag` parameters are ANDed together. Maximum 20 `tag` parameters per request."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all account shares.`,builder:p(b),handler:async t=>{let n={status:t.status,kind:t.kind,target_type:t[`target-type`],resource_types:t[`resource-types`],order:t.order,direction:t.direction,page:t.page,per_page:t[`per-page`],include_resources:t[`include-resources`],include_recipient_counts:t[`include-recipient-counts`],tag:t.tag};if(t.dryRun){l({command:`cf resource-sharing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.list({account_id:o,...n})),{successLabel:`Loaded`})}};function S(e){return e.positional(`share-id`,{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:"Optionally specify `recipient_account_id` to target a specific account, or `organization_id` to target the caller's whole organization. If neither is provided, the caller's organization is used. The legacy field `account_id` is accepted as a synonym for `recipient_account_id` during the deprecation period (see `x-sunset` on that field). "})}const C={command:`create <share-id>`,describe:`Adds a recipient to a resource share, granting them access to the shared resources.`,builder:S,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({organization_id:d(t[`organization-id`],`organization-id`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.resourceSharing.recipients.create({body:e,account_id:r,share_id:t[`share-id`]})),{successLabel:`Created`});return}let p=s({organization_id:d(t[`organization-id`],`organization-id`,`text`)});c(await u(`Creating`,async()=>n.resourceSharing.recipients.create({body:p,account_id:r,share_id:t[`share-id`]})),{successLabel:`Created`})}};function w(e){return e.positional(`recipient-id`,{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 T={command:`delete <recipient-id>`,describe:`Deletion is not immediate, an updated share recipient object with a new status will be returned.`,builder:w,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients/${t[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(t[`recipient-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"recipient-id":String(t[`recipient-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>n.resourceSharing.recipients.delete({account_id:o,share_id:t[`share-id`],recipient_id:t[`recipient-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`recipient-id`,{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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <recipient-id>`,describe:`Get share recipient by ID.`,builder:E,handler:async t=>{let n={include_resources:t[`include-resources`]};if(t.dryRun){l({command:`cf resource-sharing recipients get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients/${t[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(t[`recipient-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"recipient-id":String(t[`recipient-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.get({account_id:o,share_id:t[`share-id`],recipient_id:t[`recipient-id`],...n})),{successLabel:`Loaded`})}};function O(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.`}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`List share recipients by share ID.`,builder:O,handler:async t=>{let n={include_resources:t[`include-resources`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf resource-sharing recipients list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.list({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function A(e){return e.positional(`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 j={command:`update <share-id>`,describe:`Changes a share's recipients to match the given list. Returns an error if the share targets an organization.`,builder:A,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.resourceSharing.recipients.update({body:e,account_id:r,share_id:t[`share-id`]})),{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.`)}},M={command:`recipients`,describe:`Operations for recipients`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`share-id`,{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`,`idp-federation-grant`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`create <share-id>`,describe:`Adds a resource to an existing share, making it available to share recipients.`,builder:N,handler:async r=>{if(r.dryRun){l({command:`cf resource-sharing resources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${r[`share-id`]==null?`<share-id>`:encodeURIComponent(String(r[`share-id`]))}/resources`,pathParams:{"share-id":String(r[`share-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({resource_account_id:d(r[`resource-account-id`],`resource-account-id`,`text`),resource_id:d(r[`resource-id`],`resource-id`,`text`),resource_type:d(r[`resource-type`],`resource-type`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.resourceSharing.resources.create({body:e,account_id:m,share_id:r[`share-id`]})),{successLabel:`Created`});return}r[`resource-account-id`]===void 0&&(r[`resource-account-id`]=await t(`resource-account-id`,`Account identifier.`)),r[`resource-id`]===void 0&&(r[`resource-id`]=await t(`resource-id`,`Share Resource identifier.`)),r[`resource-type`]===void 0&&(r[`resource-type`]=await n(`resource-type`,`Resource Type.`,[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]));let h=s({resource_account_id:d(r[`resource-account-id`],`resource-account-id`,`text`),resource_id:d(r[`resource-id`],`resource-id`,`text`),resource_type:d(r[`resource-type`],`resource-type`,`text`)});c(await u(`Creating`,async()=>p.resourceSharing.resources.create({body:h,account_id:m,share_id:r[`share-id`]})),{successLabel:`Created`})}};function F(e){return e.positional(`share-resource-id`,{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 I={command:`delete <share-resource-id>`,describe:`Deletion is not immediate, an updated share resource object with a new status will be returned.`,builder:F,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}c(await u(`Deleting`,async()=>n.resourceSharing.resources.delete({account_id:o,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{successLabel:`Deleted`})}};function L(e){return e.positional(`share-resource-id`,{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 R={command:`get <share-resource-id>`,describe:`Get share resource by ID.`,builder:L,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.resourceSharing.resources.get({account_id:r,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{successLabel:`Loaded`})}};function z(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`,`idp-federation-grant`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:`List share resources by share ID.`,builder:p(z),handler:async t=>{let n={status:t.status,resource_type:t[`resource-type`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf resource-sharing resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.resources.list({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function V(e){return e.positional(`share-resource-id`,{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 H={command:`update <share-resource-id>`,describe:`Update is not immediate, an updated share resource object with a new status will be returned.`,builder:V,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.resourceSharing.resources.update({...e,account_id:r,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{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.`)}},U={command:`resources`,describe:`Operations for resources`,builder:e=>e.command(P).command(I).command(R).command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.positional(`share-id`,{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 G={command:`update <share-id>`,describe:`Updating is not immediate, an updated share object with a new status will be returned.`,builder:W,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${n[`share-id`]==null?`<share-id>`:encodeURIComponent(String(n[`share-id`]))}`,pathParams:{"share-id":String(n[`share-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.resourceSharing.update({...e,account_id:p,share_id:n[`share-id`]})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the share.`));let m=s({name:d(n.name,`name`,`text`)});c(await u(`Updating`,async()=>r.resourceSharing.update({...m,account_id:p,share_id:n[`share-id`]})),{successLabel:`Updated`})}},K={command:`resource-sharing`,describe:`resource-sharing`,builder:e=>e.command(h).command(_).command(y).command(x).command(G).command(M).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,S as r,T as i,_ as a,i as o,n as s}from"./auth-BqDOIrKX.mjs";import{n as c,r as l,t as u}from"./body-parser-CBpeIUns.mjs";import{t as d}from"./output-CUxZRM5A.mjs";import{n as f,t as p}from"./progress-Cent9Lsg.mjs";import{n as m}from"./input-validation-CTqtyiY9.mjs";import{t as h}from"./local-D8bhHUMK.mjs";import{t as g}from"./cli-types-CMNMD1V7.mjs";function _(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 v={command:`delete`,describe:`Removes all tags from a specific account-level resource.`,builder:_,handler:async r=>{let g={};if(r[`if-match`]!==void 0&&(g[`If-Match`]=String(r[`if-match`])),r.dryRun){f({command:`cf resource-tagging account-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({resource_id:m(r[`resource-id`],`resource-id`,`text`),resource_type:m(r[`resource-type`],`resource-type`,`text`),worker_id:m(r[`worker-id`],`worker-id`,`text`)}):c(r.body)});return}let _=await s(r),v=r.local?h:await a(_);if(r.accountId=v,!await i({force:!!r.force})){process.stderr.write(`Aborted.
6
+ `);return}if(r.body){let e=c(r.body);d(await p(`Deleting`,async()=>o(_,`DELETE`,`/accounts/${v}/tags`,{body:e,headers:Object.keys(g).length>0?g:void 0})),{successLabel:`Deleted`});return}r[`resource-id`]===void 0&&(r[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),r[`resource-type`]===void 0&&(r[`resource-type`]=await n(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let y={};r[`resource-id`]!==void 0&&l(y,[`resource_id`],m(r[`resource-id`],`resource-id`,`text`)),r[`resource-type`]!==void 0&&l(y,[`resource_type`],m(r[`resource-type`],`resource-type`,`text`)),r[`worker-id`]!==void 0&&l(y,[`worker_id`],m(r[`worker-id`],`worker-id`,`text`)),d(await p(`Deleting`,async()=>o(_,`DELETE`,`/accounts/${v}/tags`,{body:Object.keys(y).length>0?y:void 0,headers:Object.keys(g).length>0?g:void 0})),{successLabel:`Deleted`})}};function y(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 b={command:`get`,describe:`Retrieves tags for a specific account-level resource.`,builder:g(y),handler:async t=>{let n={resource_id:t[`resource-id`],resource_type:t[`resource-type`],worker_id:t[`worker-id`]};if(t.dryRun){f({command:`cf resource-tagging account-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.accountTags.get({account_id:i,...n})),{successLabel:`Loaded`})}};function x(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 S={command:`update`,describe:`Creates or updates tags for a specific account-level resource.`,builder:x,handler:async r=>{let i={};if(r[`if-match`]!==void 0&&(i[`If-Match`]=String(r[`if-match`])),r.dryRun){f({command:`cf resource-tagging account-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({resource_id:m(r[`resource-id`],`resource-id`,`text`),resource_type:m(r[`resource-type`],`resource-type`,`text`),worker_id:m(r[`worker-id`],`worker-id`,`text`)}):c(r.body)});return}let g=await s(r),_=r.local?h:await a(g);if(r.accountId=_,r.body){let e=c(r.body);d(await p(`Updating`,async()=>o(g,`PUT`,`/accounts/${_}/tags`,{body:e,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`});return}r[`resource-id`]===void 0&&(r[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),r[`resource-type`]===void 0&&(r[`resource-type`]=await n(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let v={};r[`resource-id`]!==void 0&&l(v,[`resource_id`],m(r[`resource-id`],`resource-id`,`text`)),r[`resource-type`]!==void 0&&l(v,[`resource_type`],m(r[`resource-type`],`resource-type`,`text`)),r[`worker-id`]!==void 0&&l(v,[`worker_id`],m(r[`worker-id`],`worker-id`,`text`)),d(await p(`Updating`,async()=>o(g,`PUT`,`/accounts/${_}/tags`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},C={command:`account-tags`,describe:`Tags applied to the account for organizational grouping and policy targeting`,builder:e=>e.command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(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 T={command:`list`,describe:`Lists all distinct tag keys used across resources in an account.`,builder:w,handler:async t=>{let n={cursor:t.cursor};if(t.dryRun){f({command:`cf resource-tagging keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags/keys`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.keys.list({account_id:i,...n})),{successLabel:`Loaded`})}},E={command:`keys`,describe:`Tag key definitions that establish the vocabulary for tagging resources`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(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 O={command:`list`,describe:`Lists all tagged resources for an account.`,builder:g(D),handler:async t=>{let n={type:t.type,tag:t.tag,cursor:t.cursor};if(t.dryRun){f({command:`cf resource-tagging list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags/resources`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.list({account_id:i,...n})),{successLabel:`Loaded`})}};function k(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 A={command:`list`,describe:`Lists all distinct values for a given tag key, optionally filtered by resource type.`,builder:g(k),handler:async t=>{let n={type:t.type,cursor:t.cursor};if(t.dryRun){f({command:`cf resource-tagging values list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags/values/${t[`tag-key`]==null?`<tag-key>`:encodeURIComponent(String(t[`tag-key`]))}`,pathParams:{"tag-key":String(t[`tag-key`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.values.list({account_id:i,tag_key:t[`tag-key`],...n})),{successLabel:`Loaded`})}},j={command:`values`,describe:`Allowed values for tag keys — constrain tagging to a defined set of options`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(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 N={command:`delete`,describe:`Removes all tags from a specific zone-level resource.`,builder:M,handler:async e=>{let a={};if(e[`if-match`]!==void 0&&(a[`If-Match`]=String(e[`if-match`])),e.dryRun){f({command:`cf resource-tagging zone-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/tags`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({resource_id:m(e[`resource-id`],`resource-id`,`text`),resource_type:m(e[`resource-type`],`resource-type`,`text`),access_application_id:m(e[`access-application-id`],`access-application-id`,`text`)}):c(e.body)});return}let h=await s(e);if(e.zoneId=await r({zone:e.zone},h,{quiet:e.quiet}),!await i({force:!!e.force})){process.stderr.write(`Aborted.
13
+ `);return}if(e.body){let t=c(e.body);d(await p(`Deleting`,async()=>o(h,`DELETE`,`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`});return}e[`resource-id`]===void 0&&(e[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),e[`resource-type`]===void 0&&(e[`resource-type`]=await n(`resource-type`,`Enum for base zone-level resource types (those with no extra required fields).`,[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]));let g={};e[`resource-id`]!==void 0&&l(g,[`resource_id`],m(e[`resource-id`],`resource-id`,`text`)),e[`resource-type`]!==void 0&&l(g,[`resource_type`],m(e[`resource-type`],`resource-type`,`text`)),e[`access-application-id`]!==void 0&&l(g,[`access_application_id`],m(e[`access-application-id`],`access-application-id`,`text`)),d(await p(`Deleting`,async()=>o(h,`DELETE`,`/zones/${e.zoneId}/tags`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function P(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 F={command:`get`,describe:`Retrieves tags for a specific zone-level resource.`,builder:g(P),handler:async e=>{let t={resource_id:e[`resource-id`],resource_type:e[`resource-type`],access_application_id:e[`access-application-id`]};if(e.dryRun){f({command:`cf resource-tagging zone-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/tags`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await s(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,d(await p(`Loading`,async()=>n.resourceTagging.zoneTags.get({zone_id:i,...t})),{successLabel:`Loaded`})}};function I(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 L={command:`update`,describe:`Creates or updates tags for a specific zone-level resource. Replaces all existing tags for the resource.`,builder:I,handler:async e=>{let i={};if(e[`if-match`]!==void 0&&(i[`If-Match`]=String(e[`if-match`])),e.dryRun){f({command:`cf resource-tagging zone-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/tags`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({resource_id:m(e[`resource-id`],`resource-id`,`text`),resource_type:m(e[`resource-type`],`resource-type`,`text`),access_application_id:m(e[`access-application-id`],`access-application-id`,`text`)}):c(e.body)});return}let a=await s(e);if(e.zoneId=await r({zone:e.zone},a,{quiet:e.quiet}),e.body){let t=c(e.body);d(await p(`Updating`,async()=>o(a,`PUT`,`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`});return}e[`resource-id`]===void 0&&(e[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),e[`resource-type`]===void 0&&(e[`resource-type`]=await n(`resource-type`,`Enum for base zone-level resource types (those with no extra required fields).`,[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]));let h={};e[`resource-id`]!==void 0&&l(h,[`resource_id`],m(e[`resource-id`],`resource-id`,`text`)),e[`resource-type`]!==void 0&&l(h,[`resource_type`],m(e[`resource-type`],`resource-type`,`text`)),e[`access-application-id`]!==void 0&&l(h,[`access_application_id`],m(e[`access-application-id`],`access-application-id`,`text`)),d(await p(`Updating`,async()=>o(a,`PUT`,`/zones/${e.zoneId}/tags`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},R={command:`zone-tags`,describe:`Tags applied to individual zones for categorization and bulk management`,builder:e=>e.command(N).command(F).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`resource-tagging`,describe:`Tag accounts and zones with key-value metadata for organization, filtering, and policy targeting`,builder:e=>e.command(O).command(C).command(E).command(j).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,T as n,_ as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./local-D8bhHUMK.mjs";function f(e){return e.positional(`operation-id`,{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 <operation-id>`,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/${e()??`<account-id>`}/rules/lists/bulk_operations/${t[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(t[`operation-id`]))}`,pathParams:{"operation-id":String(t[`operation-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.bulkOperations.get({account_id:a,operation_id:t[`operation-id`]})),{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 n=>{if(n.dryRun){c({command:`cf rules lists create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),name:u(n.name,`name`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.rules.lists.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`An informative name for the list. Use this name in filter and rule expressions.`));let m=o({description:u(n.description,`description`,`text`),name:u(n.name,`name`,`text`)});s(await l(`Creating`,async()=>f.rules.lists.create({...m,account_id:p})),{successLabel:`Created`})}};function _(e){return e.positional(`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}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete <list-id>`,describe:`Deletes a specific list and all its items.`,builder:_,handler:async t=>{if(t.dryRun){c({command:`cf rules lists delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>a.rules.lists.delete({account_id:o,list_id:t[`list-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`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 b={command:`get <list-id>`,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/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.get({account_id:a,list_id:t[`list-id`]})),{successLabel:`Loaded`})}};function x(e){return e.positional(`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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`create <list-id>`,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/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=t.local?d:await r(n);if(t.accountId=o,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.rules.lists.items.create({body:e,account_id:o,list_id:t[`list-id`]})),{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(`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}).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 <list-id>`,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 t=>{if(t.dryRun){c({command:`cf rules lists items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let o=await i(t),u=t.local?d:await r(o);if(t.accountId=u,!await n({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}if(t.body){let e=a(t.body);s(await l(`Deleting`,async()=>o.rules.lists.items.delete({...e,account_id:u,list_id:t[`list-id`]})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>o.rules.lists.items.delete({account_id:u,list_id:t[`list-id`]})),{successLabel:`Deleted`})}};function T(e){return e.positional(`item-id`,{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 <item-id>`,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/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"item-id":String(t[`item-id`]??``),"list-id":String(t[`list-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.items.get({account_id:a,list_id:t[`list-id`],item_id:t[`item-id`]})),{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[`per-page`],search:t.search};if(t.dryRun){c({command:`cf rules lists items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.rules.lists.items.list({account_id:o,list_id:t[`list-id`],...n})),{successLabel:`Loaded`})}};function k(e){return e.positional(`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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const A={command:`update <list-id>`,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/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=t.local?d:await r(n);if(t.accountId=o,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.rules.lists.items.update({body:e,account_id:o,list_id:t[`list-id`]})),{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/${e()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.list({account_id:a})),{successLabel:`Loaded`})}};function P(e){return e.positional(`list-id`,{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 <list-id>`,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/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({description:u(t.description,`description`,`text`)}):a(t.body)});return}let n=await i(t),f=t.local?d:await r(n);if(t.accountId=f,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.rules.lists.update({...e,account_id:f,list_id:t[`list-id`]})),{successLabel:`Updated`});return}let p=o({description:u(t.description,`description`,`text`)});s(await l(`Updating`,async()=>n.rules.lists.update({...p,account_id:f,list_id:t[`list-id`]})),{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};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,S as r,T as i,_ as a,n as o}from"./auth-BqDOIrKX.mjs";import{n as s,t as c}from"./body-parser-CBpeIUns.mjs";import{t as l}from"./output-CUxZRM5A.mjs";import{n as u,t as d}from"./progress-Cent9Lsg.mjs";import{n as f}from"./input-validation-CTqtyiY9.mjs";import{t as p}from"./local-D8bhHUMK.mjs";import{t as m}from"./cli-types-CMNMD1V7.mjs";function h(e){return e.option(`description`,{type:`string`,description:`An informative description of the ruleset.`,default:``}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).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:h,handler:async r=>{if(r.dryRun){u({command:`cf rulesets account-rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets`,pathParams:{},bodyKind:`json`,body:r.body===void 0?c({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),kind:f(r.kind,`kind`,`text`),phase:f(r.phase,`phase`,`text`)}):s(r.body)});return}let i=await o(r),m=r.local?p:await a(i);if(r.accountId=m,r.body){let e=s(r.body);l(await d(`Creating`,async()=>i.rulesets.accountRulesets.create({...e,account_id:m})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await t(`name`,`The human-readable name of the ruleset.`)),r.kind===void 0&&(r.kind=await n(`kind`,`The kind of the ruleset.`,[`managed`,`custom`,`root`,`zone`])),r.phase===void 0&&(r.phase=await n(`phase`,`The phase of the ruleset.`,[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]));let h=c({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),kind:f(r.kind,`kind`,`text`),phase:f(r.phase,`phase`,`text`)});l(await d(`Creating`,async()=>i.rulesets.accountRulesets.create({...h,account_id:m})),{successLabel:`Created`})}};function te(e){return e.positional(`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 g={command:`delete <ruleset-id>`,describe:`Deletes all versions of an existing account ruleset.`,builder:te,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}l(await d(`Deleting`,async()=>n.rulesets.accountRulesets.delete({account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`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 v={command:`get <ruleset-id>`,describe:`Fetches the latest version of an account ruleset.`,builder:_,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.get({account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`number`,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 b={command:`list`,describe:`Fetches all rulesets at the account level.`,builder:y,handler:async t=>{let n={cursor:t.cursor,per_page:t[`per-page`]};if(t.dryRun){u({command:`cf rulesets account-rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),i=t.local?p:await a(r);t.accountId=i,l(await d(`Loading`,async()=>r.rulesets.accountRulesets.list({account_id:i,...n})),{successLabel:`Loaded`})}};function x(e){return e.positional(`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 <ruleset-phase>`,describe:`Fetches the latest version of the account entry point ruleset for a given phase.`,builder:m(x),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.phases.get({account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Loaded`})}};function C(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).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 <ruleset-phase>`,describe:`Updates an account entry point ruleset, creating a new version.`,builder:m(C),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`json`,body:t.body===void 0?c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.rulesets.accountRulesets.phases.update({...e,account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Updated`});return}let i=c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`)});l(await d(`Updating`,async()=>n.rulesets.accountRulesets.phases.update({...i,account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Updated`})}};function T(e){return e.positional(`ruleset-version`,{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 E={command:`get <ruleset-version>`,describe:`Fetches a specific version of an account entry point ruleset.`,builder:m(T),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.phases.versions.get({account_id:r,ruleset_phase:t[`ruleset-phase`],ruleset_version:t[`ruleset-version`]})),{successLabel:`Loaded`})}};function D(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 O={command:`list`,describe:`Fetches the versions of an account entry point ruleset.`,builder:m(D),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint/versions`,pathParams:{"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.phases.versions.list({account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Loaded`})}},k={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},A={command:`phases`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(S).command(w).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const M={command:`create <ruleset-id>`,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:j,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.rulesets.accountRulesets.rules.create({...e,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`});return}let i=c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}});l(await d(`Creating`,async()=>n.rulesets.accountRulesets.rules.create({...i,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`})}};function N(e){return e.positional(`rule-id`,{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 P={command:`delete <rule-id>`,describe:`Deletes an existing rule from an account ruleset.`,builder:N,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}l(await d(`Deleting`,async()=>n.rulesets.accountRulesets.rules.delete({account_id:r,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function F(e){return e.positional(`rule-id`,{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(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const I={command:`update <rule-id>`,describe:`Updates an existing rule in an account ruleset.`,builder:F,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.rulesets.accountRulesets.rules.update({...e,account_id:r,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let i=c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}});l(await d(`Updating`,async()=>n.rulesets.accountRulesets.rules.update({...i,account_id:r,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},L={command:`rules`,describe:`Operations for account-rulesets.rules`,builder:e=>e.command(M).command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`update <ruleset-id>`,describe:`Updates an account ruleset, creating a new version.`,builder:R,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`),kind:f(t.kind,`kind`,`text`),phase:f(t.phase,`phase`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.rulesets.accountRulesets.update({...e,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Updated`});return}let i=c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`),kind:f(t.kind,`kind`,`text`),phase:f(t.phase,`phase`,`text`)});l(await d(`Updating`,async()=>n.rulesets.accountRulesets.update({...i,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Updated`})}};function B(e){return e.positional(`rule-tag`,{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 V={command:`tag <rule-tag>`,describe:`Fetches the rules of a managed account ruleset version for a given tag.`,builder:B,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}/by_tag/${t[`rule-tag`]==null?`<rule-tag>`:encodeURIComponent(String(t[`rule-tag`]))}`,pathParams:{"rule-tag":String(t[`rule-tag`]??``),"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.versions.byTag.tag({account_id:r,ruleset_id:t[`ruleset-id`],ruleset_version:t[`ruleset-version`],rule_tag:t[`rule-tag`]})),{successLabel:`Loaded`})}},H={command:`by-tag`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).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 <ruleset-version>`,describe:`Deletes an existing version of an account ruleset.`,builder:U,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}l(await d(`Deleting`,async()=>n.rulesets.accountRulesets.versions.delete({account_id:r,ruleset_id:t[`ruleset-id`],ruleset_version:t[`ruleset-version`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <ruleset-version>`,describe:`Fetches a specific version of an account ruleset.`,builder:G,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.versions.get({account_id:r,ruleset_id:t[`ruleset-id`],ruleset_version:t[`ruleset-version`]})),{successLabel:`Loaded`})}};function q(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 J={command:`list`,describe:`Fetches the versions of an account ruleset.`,builder:q,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.versions.list({account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`rule-tag`,{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 X={command:`tag <rule-tag>`,describe:`Fetches the rules of a managed zone ruleset version for a given tag.`,builder:Y,handler:async e=>{if(e.dryRun){u({command:`cf rulesets account-rulesets versions zone-by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}/by_tag/${e[`rule-tag`]==null?`<rule-tag>`:encodeURIComponent(String(e[`rule-tag`]))}`,pathParams:{"rule-tag":String(e[`rule-tag`]??``),"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.accountRulesets.versions.zoneByTag.tag({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`],rule_tag:e[`rule-tag`]})),{successLabel:`Loaded`})}},Z={command:`zone-by-tag`,describe:`Operations for account-rulesets.versions.zone-by-tag`,builder:e=>e.command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Q={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(W).command(K).command(J).command(H).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ne={command:`account-rulesets`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(ee).command(g).command(v).command(b).command(z).command(A).command(L).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`description`,{type:`string`,description:`An informative description of the ruleset.`,default:``}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`create`,describe:`Creates a ruleset at the zone level.`,builder:re,handler:async e=>{if(e.dryRun){u({command:`cf rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)}):s(e.body)});return}let i=await o(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,e.body){let t=s(e.body);l(await d(`Creating`,async()=>i.rulesets.create({...t,zone_id:a})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The human-readable name of the ruleset.`)),e.kind===void 0&&(e.kind=await n(`kind`,`The kind of the ruleset.`,[`managed`,`custom`,`root`,`zone`])),e.phase===void 0&&(e.phase=await n(`phase`,`The phase of the ruleset.`,[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]));let p=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)});l(await d(`Creating`,async()=>i.rulesets.create({...p,zone_id:a})),{successLabel:`Created`})}};function ae(e){return e.positional(`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 oe={command:`delete <ruleset-id>`,describe:`Deletes all versions of an existing zone ruleset.`,builder:ae,handler:async e=>{if(e.dryRun){u({command:`cf rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
6
+ `);return}l(await d(`Deleting`,async()=>t.rulesets.delete({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`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 ce={command:`get <ruleset-id>`,describe:`Fetches the latest version of a zone ruleset.`,builder:se,handler:async e=>{if(e.dryRun){u({command:`cf rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.get({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Loaded`})}};function le(e){return e.option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`number`,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 ue={command:`list`,describe:`Fetches all rulesets at the zone level.`,builder:le,handler:async e=>{let t={cursor:e.cursor,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>n.rulesets.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function de(e){return e.positional(`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 fe={command:`get <ruleset-phase>`,describe:`Fetches the latest version of the zone entry point ruleset for a given phase.`,builder:m(de),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.phases.get({zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Loaded`})}};function pe(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).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:`update <ruleset-phase>`,describe:`Updates a zone entry point ruleset, creating a new version.`,builder:m(pe),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`)}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.rulesets.phases.update({...r,zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Updated`});return}let i=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`)});l(await d(`Updating`,async()=>t.rulesets.phases.update({...i,zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Updated`})}};function he(e){return e.positional(`ruleset-version`,{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 ge={command:`get <ruleset-version>`,describe:`Fetches a specific version of a zone entry point ruleset.`,builder:m(he),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.phases.versions.get({zone_id:n,ruleset_phase:e[`ruleset-phase`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Loaded`})}};function _e(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 ve={command:`list`,describe:`Fetches the versions of a zone entry point ruleset.`,builder:m(_e),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint/versions`,pathParams:{"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.phases.versions.list({zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Loaded`})}},ye={command:`versions`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(ge).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},be={command:`phases`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(fe).command(me).command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xe(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const Se={command:`create <ruleset-id>`,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:xe,handler:async e=>{if(e.dryRun){u({command:`cf rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.rulesets.rules.create({...r,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Created`});return}let i=c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});l(await d(`Creating`,async()=>t.rulesets.rules.create({...i,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Created`})}};function Ce(e){return e.positional(`rule-id`,{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 we={command:`delete <rule-id>`,describe:`Deletes an existing rule from a zone ruleset.`,builder:Ce,handler:async e=>{if(e.dryRun){u({command:`cf rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
7
+ `);return}l(await d(`Deleting`,async()=>t.rulesets.rules.delete({zone_id:n,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function Te(e){return e.positional(`rule-id`,{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(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const Ee={command:`edit <rule-id>`,describe:`Updates an existing rule in a zone ruleset.`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf rulesets rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.rulesets.rules.edit({...r,zone_id:n,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});l(await d(`Updating`,async()=>t.rulesets.rules.edit({...i,zone_id:n,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}},De={command:`rules`,describe:`Individual rules within a ruleset — each with an expression, action, and priority`,builder:e=>e.command(Se).command(we).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).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 Oe={command:`update <ruleset-id>`,describe:`Updates a zone ruleset, creating a new version.`,builder:$,handler:async e=>{if(e.dryRun){u({command:`cf rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.rulesets.update({...r,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Updated`});return}let i=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)});l(await d(`Updating`,async()=>t.rulesets.update({...i,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`delete <ruleset-version>`,describe:`Deletes an existing version of a zone ruleset.`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
8
+ `);return}l(await d(`Deleting`,async()=>t.rulesets.versions.delete({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Deleted`})}};function je(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`get <ruleset-version>`,describe:`Fetches a specific version of a zone ruleset.`,builder:je,handler:async e=>{if(e.dryRun){u({command:`cf rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.versions.get({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Loaded`})}};function Ne(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 Pe={command:`list`,describe:`Fetches the versions of a zone ruleset.`,builder:Ne,handler:async e=>{if(e.dryRun){u({command:`cf rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.versions.list({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Loaded`})}},Fe={command:`versions`,describe:`Immutable snapshots of a ruleset, allowing rollback and audit of rule changes`,builder:e=>e.command(Ae).command(Me).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ie={command:`rulesets`,describe:`Versioned collections of rules that control how Cloudflare processes traffic — WAF, transform, redirect, and more`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(Oe).command(ne).command(be).command(De).command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ie as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,T as t,_ as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./local-D8bhHUMK.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(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 p={command:`bulk-create`,describe:`Modifies one or more rules in a Web Analytics ruleset with a single request.`,builder:f,handler:async t=>{if(t.dryRun){s({command:`cf rum rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({delete_rules:t[`delete-rules`]}):i(t.body)});return}let l=await r(t),d=t.local?u:await n(l);if(t.accountId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>l.rum.rules.bulkCreate({...e,account_id:d,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`});return}let f=a({delete_rules:t[`delete-rules`]});o(await c(`Creating`,async()=>l.rum.rules.bulkCreate({...f,account_id:d,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`})}};function m(e){return e.positional(`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 h={command:`create <ruleset-id>`,describe:`Creates a new rule in a Web Analytics ruleset.`,builder:m,handler:async t=>{if(t.dryRun){s({command:`cf rum rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rule`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Creating`,async()=>d.rum.rules.create({body:e,account_id:f,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`});return}let p=a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths});o(await c(`Creating`,async()=>d.rum.rules.create({body:p,account_id:f,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`})}};function g(e){return e.positional(`rule-id`,{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 _={command:`delete <rule-id>`,describe:`Deletes an existing rule from a Web Analytics ruleset.`,builder:g,handler:async i=>{if(i.dryRun){s({command:`cf rum rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${i[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(i[`ruleset-id`]))}/rule/${i[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(i[`rule-id`]))}`,pathParams:{"ruleset-id":String(i[`ruleset-id`]??``),"rule-id":String(i[`rule-id`]??``)},bodyKind:`none`});return}let a=await r(i),l=i.local?u:await n(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({account_id:l,ruleset_id:i[`ruleset-id`],rule_id:i[`rule-id`]})),{successLabel:`Deleted`})}};function v(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 y={command:`list`,describe:`Lists all the rules in a Web Analytics ruleset.`,builder:v,handler:async t=>{if(t.dryRun){s({command:`cf rum rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.rum.rules.list({account_id:a,ruleset_id:t[`ruleset-id`]})),{successLabel:`Loaded`})}};function b(e){return e.positional(`rule-id`,{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 x={command:`update <rule-id>`,describe:`Updates a rule in a Web Analytics ruleset.`,builder:b,handler:async t=>{if(t.dryRun){s({command:`cf rum rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rule/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``),"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Updating`,async()=>d.rum.rules.update({body:e,account_id:f,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let p=a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths});o(await c(`Updating`,async()=>d.rum.rules.update({body:p,account_id:f,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},S={command:`rules`,describe:`Operations for rules`,builder:e=>e.command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(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 w={command:`create`,describe:`Creates a new Web Analytics site.`,builder:C,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info`,pathParams:{},bodyKind:`json`,body:t.body===void 0?a({auto_install:t[`auto-install`],host:l(t.host,`host`,`text`),zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Creating`,async()=>d.rum.siteInfo.create({...e,account_id:f})),{successLabel:`Created`});return}let p=a({auto_install:t[`auto-install`],host:l(t.host,`host`,`text`),zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)});o(await c(`Creating`,async()=>d.rum.siteInfo.create({...p,account_id:f})),{successLabel:`Created`})}};function T(e){return e.positional(`site-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const E={command:`delete <site-id>`,describe:`Deletes an existing Web Analytics site.`,builder:T,handler:async i=>{if(i.dryRun){s({command:`cf rum site-info delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/${i[`site-id`]==null?`<site-id>`:encodeURIComponent(String(i[`site-id`]))}`,pathParams:{"site-id":String(i[`site-id`]??``)},bodyKind:`none`});return}let a=await r(i),l=i.local?u:await n(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({account_id:l,site_id:i[`site-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`site-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <site-id>`,describe:`Retrieves a Web Analytics site.`,builder:D,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.rum.siteInfo.get({account_id:a,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function k(e){return e.option(`per-page`,{type:`number`,description:`Number of items to return per page of results.`}).option(`page`,{type:`number`,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 A={command:`list`,describe:`Lists all Web Analytics sites of an account.`,builder:d(k),handler:async t=>{let i={per_page:t[`per-page`],page:t.page,order_by:t[`order-by`]};if(t.dryRun){s({command:`cf rum site-info list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/list`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),l=t.local?u:await n(a);t.accountId=l,o(await c(`Loading`,async()=>a.rum.siteInfo.list({account_id:l,...i})),{successLabel:`Loaded`})}};function j(e){return e.positional(`site-id`,{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 M={command:`update <site-id>`,describe:`Updates an existing Web Analytics site.`,builder:j,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({auto_install:t[`auto-install`],enabled:t.enabled,host:l(t.host,`host`,`text`),lite:t.lite,zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Updating`,async()=>d.rum.siteInfo.update({...e,account_id:f,site_id:t[`site-id`]})),{successLabel:`Updated`});return}let p=a({auto_install:t[`auto-install`],enabled:t.enabled,host:l(t.host,`host`,`text`),lite:t.lite,zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)});o(await c(`Updating`,async()=>d.rum.siteInfo.update({...p,account_id:f,site_id:t[`site-id`]})),{successLabel:`Updated`})}},N={command:`site-info`,describe:`Operations for site-info`,builder:e=>e.command(w).command(E).command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`rum`,describe:`rum`,builder:e=>e.command(S).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./output-D7_yAFVR.mjs";import{n as t}from"./metadata-DGdCpUxn.mjs";function n(e){return typeof e==`object`&&!!e&&`version`in e&&`schemas`in e&&typeof e.version==`string`&&typeof e.schemas==`object`}const r={command:`schema [command..]`,describe:`Show API schema details for a command`,builder:e=>e.positional(`command`,{describe:`Command path segments (e.g., dns records create)`,type:`string`,array:!0,default:[]}).option(`list`,{type:`boolean`,describe:`List all available schemas`,default:!1}),handler:async r=>{let i=t(import.meta.url,`schemas.json`,n);if(i||(console.error("Error: Could not load schemas.json. Run `pnpm generate` first."),process.exit(1)),r.list){e(Object.entries(i.schemas).map(([e,t])=>({command:`cf ${e}`,httpMethod:t.httpMethod,apiPath:t.path,operationId:t.operationId})));return}r.command.length===0&&(console.error(`Usage: cf schema <command...> or cf schema --list`),console.error(`Example: cf schema dns records create`),process.exit(1));let a=r.command.join(` `),o=i.schemas[a];if(!o){let e=Object.keys(i.schemas).filter(e=>e.includes(a)||a.includes(e));if(e.length>0){console.error(`Schema not found for "${a}". Did you mean:`);for(let t of e)console.error(` cf schema ${t}`)}else console.error(`Schema not found for "${a}". Use --list to see available schemas.`);process.exit(1)}e(o)}};export{r as default};
2
+ import{t as e}from"./output-CUxZRM5A.mjs";import{n as t}from"./metadata-jh2EIan8.mjs";function n(e){return typeof e==`object`&&!!e&&`version`in e&&`schemas`in e&&typeof e.version==`string`&&typeof e.schemas==`object`}const r={command:`schema [command..]`,describe:`Show API schema details for a command`,builder:e=>e.positional(`command`,{describe:`Command path segments (e.g., dns records create)`,type:`string`,array:!0,default:[]}).option(`list`,{type:`boolean`,describe:`List all available schemas`,default:!1}),handler:async r=>{let i=t(import.meta.url,`schemas.json`,n);if(i||(console.error("Error: Could not load schemas.json. Run `pnpm generate` first."),process.exit(1)),r.list){e(Object.entries(i.schemas).map(([e,t])=>({command:`cf ${e}`,httpMethod:t.httpMethod,apiPath:t.path,operationId:t.operationId})));return}r.command.length===0&&(console.error(`Usage: cf schema <command...> or cf schema --list`),console.error(`Example: cf schema dns records create`),process.exit(1));let a=r.command.join(` `),o=i.schemas[a];if(!o){let e=Object.keys(i.schemas).filter(e=>e.includes(a)||a.includes(e));if(e.length>0){console.error(`Schema not found for "${a}". Did you mean:`);for(let t of e)console.error(` cf schema ${t}`)}else console.error(`Schema not found for "${a}". Use --list to see available schemas.`);process.exit(1)}e(o)}};export{r as default};
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,E as t,S as n,T as r,i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./cli-types-CMNMD1V7.mjs";function p(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema is enabled`}).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:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:p,handler:async r=>{if(r.dryRun){l({command:`cf schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({kind:d(r.kind,`kind`,`text`),name:d(r.name,`name`,`text`),source:d(r.source,`source`,`text`),validation_enabled:r[`validation-enabled`]}):o(r.body)});return}let i=await a(r),f=await n({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=f,r.body){let e=o(r.body);c(await u(`Creating`,async()=>i.schemaValidation.schemas.create({...e,zone_id:f})),{successLabel:`Created`});return}if(r.kind===void 0&&(r.kind=await t(`kind`,`The kind of the schema`,[`openapi_v3`])),r.name===void 0&&(r.name=await e(`name`,`A human-readable name for the schema`)),r.source===void 0&&(r.source=await e(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),r[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let p=s({kind:d(r.kind,`kind`,`text`),name:d(r.name,`name`,`text`),source:d(r.source,`source`,`text`),validation_enabled:r[`validation-enabled`]});c(await u(`Creating`,async()=>i.schemaValidation.schemas.create({...p,zone_id:f})),{successLabel:`Created`})}};function h(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,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 <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield. Operations using this schema will lose their validation rules.`,builder:h,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`none`});return}let t=await a(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>t.schemaValidation.schemas.delete({zone_id:i,schema_id:e[`schema-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`validation-enabled`,{type:`boolean`,description:`Flag whether schema is enabled for validation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <schema-id>`,describe:`Modifies an existing OpenAPI schema in API Shield, updating the validation rules for associated API operations.`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation schemas edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({validation_enabled:e[`validation-enabled`]}):o(e.body)});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.schemaValidation.schemas.edit({...n,zone_id:r,schema_id:e[`schema-id`]})),{successLabel:`Updated`});return}let i=s({validation_enabled:e[`validation-enabled`]});c(await u(`Updating`,async()=>t.schemaValidation.schemas.edit({...i,zone_id:r,schema_id:e[`schema-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <schema-id>`,describe:`Gets the contents and metadata of a specific OpenAPI schema uploaded to API Shield.`,builder:y,handler:async e=>{let t={omit_source:e[`omit-source`]};if(e.dryRun){l({command:`cf schema-validation schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.schemaValidation.schemas.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}};function x(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone.`,builder:x,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf schema-validation schemas hosts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/hosts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.schemaValidation.schemas.hosts.list({zone_id:i,...t})),{successLabel:`Loaded`})}},C={command:`hosts`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`validation-enabled`,{type:`boolean`,description:`Filter for enabled schemas`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Shield with pagination support.`,builder:w,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],omit_source:e[`omit-source`],validation_enabled:e[`validation-enabled`]};if(e.dryRun){l({command:`cf schema-validation schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.schemaValidation.schemas.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function E(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in Web Asset Management or not. `new` will just return operations from the schema that do not exist otherwise. `existing` will just return operations from the schema that already exist.",choices:[`new`,`existing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <schema-id>`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:f(E),handler:async e=>{let t={feature:e.feature,host:e.host,method:e.method,endpoint:e.endpoint,page:e.page,per_page:e[`per-page`],operation_status:e[`operation-status`]};if(e.dryRun){l({command:`cf schema-validation schemas operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.schemaValidation.schemas.operations.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}},O={command:`operations`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},k={command:`schemas`,describe:`Uploaded API schemas used to validate incoming requests against expected formats`,builder:e=>e.command(m).command(g).command(v).command(b).command(T).command(C).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
4
+ Mitigation actions are as follows:
5
+
6
+ - \`"log"\` - log request when request does not conform to schema
7
+ - \`"block"\` - deny access to the site when request does not conform to schema
8
+ - \`"none"\` - skip running schema validation
9
+ `,choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:`When set, this overrides both zone level and operation level mitigation actions.
10
+
11
+ - \`"none"\` - skip running schema validation entirely for the request
12
+ - \`null\` - clears any existing override
13
+ `,choices:[`none`]}).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:`edit`,describe:`Partially updates global schema validation settings for a zone using PATCH semantics.`,builder:A,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)}):o(e.body)});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.schemaValidation.settings.edit({body:n,zone_id:r})),{successLabel:`Updated`});return}let i=s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)});c(await u(`Updating`,async()=>t.schemaValidation.settings.edit({body:i,zone_id:r})),{successLabel:`Updated`})}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get`,describe:`Retrieves the current global schema validation settings for a zone.`,builder:M,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.schemaValidation.settings.get({zone_id:r})),{successLabel:`Loaded`})}};function P(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 F={command:`bulk-edit`,describe:`Updates schema validation settings for multiple API operations in a single request. Efficient for applying consistent validation rules across endpoints.`,builder:P,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.schemaValidation.settings.operations.bulkEdit({body:n,zone_id:r})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i(t,`PATCH`,`/zones/${e.zoneId}/schema_validation/settings/operations`)),{successLabel:`Updated`})}};function I(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,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 L={command:`delete <operation-id>`,describe:`Removes custom schema validation settings for a specific API operation, reverting to zone-level defaults.`,builder:I,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`none`});return}let t=await a(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
14
+ `);return}c(await u(`Deleting`,async()=>t.schemaValidation.settings.operations.delete({zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Deleted`})}};function R(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get <operation-id>`,describe:`Retrieves the schema validation settings configured for a specific API operation.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.schemaValidation.settings.operations.get({zone_id:r,operation_id:e[`operation-id`]})),{successLabel:`Loaded`})}};function B(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`list`,describe:`Lists all per-operation schema validation settings configured for the zone.`,builder:B,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf schema-validation settings operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.schemaValidation.settings.operations.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function H(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`mitigation-action`,{type:`string`,description:'When set, this applies a mitigation action to this operation\n\n - `"log"` - log request when request does not conform to schema for this operation\n - `"block"` - deny access to the site when request does not conform to schema for this operation\n - `"none"` - will skip mitigation for this operation\n - `null` - clears any mitigation action\n',choices:[`log`,`block`,`none`]}).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:`update <operation-id>`,describe:`Fully updates schema validation settings for a specific API operation.`,builder:H,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({mitigation_action:d(e[`mitigation-action`],`mitigation-action`,`text`)}):o(e.body)});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.schemaValidation.settings.operations.update({...t,zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Updated`});return}e[`mitigation-action`]===void 0&&(e[`mitigation-action`]=await t(`mitigation-action`,'When set, this applies a mitigation action to this operation - `"log"` - log request when request does not conform to schema for this operation - `"block"` - deny access to the site when request does not conform to schema for this operation - `"none"` - will skip mitigation for this operation - `null` - clears any mitigation action ',[`log`,`block`,`none`]));let f=s({mitigation_action:d(e[`mitigation-action`],`mitigation-action`,`text`)});c(await u(`Updating`,async()=>r.schemaValidation.settings.operations.update({...f,zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Updated`})}},W={command:`operations`,describe:`Zone-level schema validation settings including default actions for unmatched requests`,builder:e=>e.command(F).command(L).command(z).command(V).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
15
+ Mitigation actions are as follows:
16
+
17
+ - \`"log"\` - log request when request does not conform to schema
18
+ - \`"block"\` - deny access to the site when request does not conform to schema
19
+ - \`"none"\` - skip running schema validation
20
+ `,choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:`When set, this overrides both zone level and operation level mitigation actions.
21
+
22
+ - \`"none"\` - skip running schema validation entirely for the request
23
+ - \`null\` - clears any existing override
24
+ `,choices:[`none`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`update`,describe:`Fully updates global schema validation settings for a zone, replacing existing configuration.`,builder:G,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)}):o(e.body)});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.schemaValidation.settings.update({...t,zone_id:i})),{successLabel:`Updated`});return}e[`validation-default-mitigation-action`]===void 0&&(e[`validation-default-mitigation-action`]=await t(`validation-default-mitigation-action`,'The default mitigation action used Mitigation actions are as follows: - `"log"` - log request when request does not conform to schema - `"block"` - deny access to the site when request does not conform to schema - `"none"` - skip running schema validation ',[`none`,`log`,`block`]));let f=s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)});c(await u(`Updating`,async()=>r.schemaValidation.settings.update({...f,zone_id:i})),{successLabel:`Updated`})}},q={command:`settings`,describe:`Zone-level schema validation settings including default actions for unmatched requests`,builder:e=>e.command(j).command(N).command(K).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`schema-validation`,describe:`API schema validation settings — enforce request/response schemas and configure validation behavior`,builder:e=>e.command(k).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{J as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,T as t,_ as n,i as r,n as i}from"./auth-BqDOIrKX.mjs";import{t as a}from"./output-CUxZRM5A.mjs";import{n as o,t as s}from"./progress-Cent9Lsg.mjs";import{n as c,t as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./local-D8bhHUMK.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const p={command:`create`,describe:"Creates a new SCIM Group (user group) for the account. The `displayName` must not be empty and must not begin with `CF` (reserved for system groups).",builder:f,handler:async t=>{if(t.dryRun){o({command:`cf scim groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{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 m(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style 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 h={command:`delete <group-id>`,describe:`Deletes a SCIM Group (custom user groups only). System groups backed by Cloudflare permission groups cannot be deleted via SCIM. Returns 204 No Content on success.`,builder:m,handler:async r=>{if(r.dryRun){o({command:`cf scim groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?u:await n(c);if(r.accountId=l,!await t({force:!!r.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>c.scim.groups.delete({account_id:l,group_id:r[`group-id`]})),{successLabel:`Deleted`})}};function g(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style 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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const _={command:`edit <group-id>`,describe:"Partially updates a SCIM Group via PATCH operations (RFC 7644 Section 3.5.2). Supports add, remove, and replace operations on `members`, `displayName`, and `externalId`. For system groups (prefixed `cloudflare-v1-`), only member management operations are supported.",builder:g,handler:async t=>{if(t.dryRun){o({command:`cf scim groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``)},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Groups/${encodeURIComponent(String(t[`group-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Groups/${encodeURIComponent(String(t[`group-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <group-id>`,describe:`Retrieves a single SCIM Group resource by group ID.`,builder:v,handler:async t=>{if(t.dryRun){o({command:`cf scim groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.groups.get({account_id:c,group_id:t[`group-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `displayName eq "value"` is supported.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:"Lists SCIM Group resources for the account. Returns both system groups (backed by Cloudflare permission groups, prefixed `cloudflare-v1-`) and custom user groups. Supports filtering by `displayName` using SCIM filter syntax.",builder:b,handler:async t=>{let r={startIndex:t[`start-index`],count:t.count,filter:t.filter};if(t.dryRun){o({command:`cf scim groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},query:r,bodyKind:`none`});return}let c=await i(t),l=t.local?u:await n(c);t.accountId=l,a(await s(`Loading`,async()=>c.scim.groups.list({account_id:l,...r})),{successLabel:`Loaded`})}},S={command:`groups`,describe:`Groups operations`,builder:e=>e.command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`resource-type-id`,{type:`string`,description:`The resource type identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <resource-type-id>`,describe:"Returns a single SCIM resource type by ID (RFC 7643 Section 6). Valid IDs are `User` and `Group`.",builder:d(C),handler:async t=>{if(t.dryRun){o({command:`cf scim resource-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/ResourceTypes/${t[`resource-type-id`]==null?`<resource-type-id>`:encodeURIComponent(String(t[`resource-type-id`]))}`,pathParams:{"resource-type-id":String(t[`resource-type-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.resourceTypes.get({account_id:c,resource_type_id:t[`resource-type-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Returns the list of SCIM resource types supported by the Cloudflare SCIM service (RFC 7643 Section 6, RFC 7644 Section 4). Clients use this to discover available resource categories (e.g. Users, Groups) and their associated schemas. Query parameters are not supported on this endpoint.`,builder:T,handler:async t=>{if(t.dryRun){o({command:`cf scim resource-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/ResourceTypes`,pathParams:{},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.resourceTypes.list({account_id:c})),{successLabel:`Loaded`})}},D={command:`resource-types`,describe:`Resource Types operations`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`schema-id`,{type:`string`,description:`The schema URI identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <schema-id>`,describe:"Returns a single SCIM schema definition by schema URI ID (RFC 7643 Section 7). Valid IDs are `urn:ietf:params:scim:schemas:core:2.0:User` and `urn:ietf:params:scim:schemas:core:2.0:Group`.",builder:O,handler:async t=>{if(t.dryRun){o({command:`cf scim schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}`,pathParams:{"schema-id":String(t[`schema-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.schemas.get({account_id:c,schema_id:t[`schema-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Returns the list of SCIM schemas supported by the Cloudflare SCIM service (RFC 7643 Section 7, RFC 7644 Section 4). Clients use this to introspect the attributes of each resource type. Query parameters are not supported on this endpoint.`,builder:A,handler:async t=>{if(t.dryRun){o({command:`cf scim schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Schemas`,pathParams:{},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.schemas.list({account_id:c})),{successLabel:`Loaded`})}},M={command:`schemas`,describe:`Schemas operations`,builder:e=>e.command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get`,describe:`Returns the SCIM 2.0 Service Provider configuration (RFC 7643 Section 5). IdPs use this endpoint to auto-configure their SCIM integration with Cloudflare, discovering which optional features (patch, bulk, filter, etc.) are supported.`,builder:N,handler:async t=>{if(t.dryRun){o({command:`cf scim service-provider-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/ServiceProviderConfig`,pathParams:{},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.serviceProviderConfig.get({account_id:c})),{successLabel:`Loaded`})}},F={command:`service-provider-config`,describe:`Service Provider Config operations`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const L={command:`create`,describe:"Provisions a new account member via SCIM. The `userName` field must be a valid email address and must match the primary email in `emails`. The account must be an Enterprise account with SCIM entitlements enabled.",builder:I,handler:async t=>{if(t.dryRun){o({command:`cf scim users create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users`,pathParams:{},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{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 R(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const z={command:`edit <user-id>`,describe:'Partially updates a SCIM User via PATCH operations (RFC 7644 Section 3.5.2). Supports updating `userName`, `name.givenName`, `name.familyName`, and `active`. Setting `active: false` deprovisions the user (removes them from the account). For IdP compatibility, `emails[type eq "work"].value` is also accepted as an alias for `userName`.',builder:R,handler:async t=>{if(t.dryRun){o({command:`cf scim users edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users/${t[`user-id`]==null?`<user-id>`:encodeURIComponent(String(t[`user-id`]))}`,pathParams:{"user-id":String(t[`user-id`]??``)},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function B(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <user-id>`,describe:`Retrieves a single account member as a SCIM User resource by user tag.`,builder:B,handler:async t=>{if(t.dryRun){o({command:`cf scim users get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users/${t[`user-id`]==null?`<user-id>`:encodeURIComponent(String(t[`user-id`]))}`,pathParams:{"user-id":String(t[`user-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.users.get({account_id:c,user_id:t[`user-id`]})),{successLabel:`Loaded`})}};function H(e){return e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `userName eq "value"` is supported.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`list`,describe:'Lists account members as SCIM User resources. Supports optional filtering by `userName` (email) using the SCIM filter syntax (e.g. `userName eq "user@example.com"`). Pagination is controlled via `startIndex` and `count` query parameters per RFC 7644 Section 3.4.2.4.',builder:H,handler:async t=>{let r={startIndex:t[`start-index`],count:t.count,filter:t.filter};if(t.dryRun){o({command:`cf scim users list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users`,pathParams:{},query:r,bodyKind:`none`});return}let c=await i(t),l=t.local?u:await n(c);t.accountId=l,a(await s(`Loading`,async()=>c.scim.users.list({account_id:l,...r})),{successLabel:`Loaded`})}};function W(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const G={command:`update <user-id>`,describe:"Replaces a SCIM User resource (RFC 7644 Section 3.5.1). Fully replaces the mutable attributes of the user. Supports updating `userName`, `name`, `emails`, and `active`.",builder:W,handler:async t=>{if(t.dryRun){o({command:`cf scim users update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users/${t[`user-id`]==null?`<user-id>`:encodeURIComponent(String(t[`user-id`]))}`,pathParams:{"user-id":String(t[`user-id`]??``)},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{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.`)}},K={command:`users`,describe:`Users operations`,builder:e=>e.command(L).command(z).command(V).command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`scim`,describe:`SCIM 2.0 provisioning — manage users, groups, and identity provider sync for your account`,builder:e=>e.command(S).command(D).command(M).command(F).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{q as default};