cf 0.9.1 → 0.11.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 (363) hide show
  1. package/README.md +20 -5
  2. package/dist/_meta/agent-context.json +46 -39
  3. package/dist/_meta/commands.json +9358 -10581
  4. package/dist/_meta/hand-written-commands.json +784 -0
  5. package/dist/_meta/schemas.json +14870 -14667
  6. package/dist/abuse-reports-sDBTV0qZ.mjs +8 -0
  7. package/dist/{access-CxyW_sIW.mjs → access-DcNzuCue.mjs} +1 -1
  8. package/dist/account-BX90zXn5.mjs +2 -0
  9. package/dist/account-tags-Bz3JG5hI.mjs +9 -0
  10. package/dist/accounts-DCuW3xyZ.mjs +28 -0
  11. package/dist/{acm-CHacxa3s.mjs → acm-zjfShZLS.mjs} +1 -1
  12. package/dist/{addressing-BnqNmmYN.mjs → addressing-DORQ64Ux.mjs} +11 -11
  13. package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-BgPR_aQr.mjs} +1 -1
  14. package/dist/agent-memory-C0hAUMeC.mjs +6 -0
  15. package/dist/ai-BpEBGMT2.mjs +5 -0
  16. package/dist/ai-audit-DnU3vn3E.mjs +2 -0
  17. package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
  18. package/dist/ai-search-DKbN9Tyd.mjs +7 -0
  19. package/dist/ai-security-C_I5lo58.mjs +4 -0
  20. package/dist/{alerting-qa8SkXlD.mjs → alerting-4T8gmZs-.mjs} +4 -4
  21. package/dist/analytics-Bxh4TCP7.mjs +3 -0
  22. package/dist/analytics_engine-fV56bjVN.mjs +2 -0
  23. package/dist/{api-security-MfHbfZyf.mjs → api-security-COk_i184.mjs} +20 -20
  24. package/dist/argo-DIRfvxvv.mjs +2 -0
  25. package/dist/args-DlUhyGU0.mjs +2 -0
  26. package/dist/artifacts-BBfXNfUg.mjs +4 -0
  27. package/dist/audit-logs-BlOrlAWe.mjs +2 -0
  28. package/dist/{auth-DuLchM18.mjs → auth-D3X9HYhD.mjs} +3 -3
  29. package/dist/auth-DPhNN3Ly.mjs +5 -0
  30. package/dist/billing-B9e4PnvN.mjs +3 -0
  31. package/dist/body-parser-BshbixEq.mjs +2 -0
  32. package/dist/bot-management-D2JVeS-V.mjs +5 -0
  33. package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
  34. package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
  35. package/dist/{browser-extension-q79xHrVW.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
  36. package/dist/browser-run-CHGOCTdG.mjs +4 -0
  37. package/dist/build-D0FhOj40.mjs +8 -0
  38. package/dist/{cache-Cl7vKJwH.mjs → cache-C6V7PbQM.mjs} +1 -1
  39. package/dist/{calls-DtK_ANxq.mjs → calls-Bye8Tyy-.mjs} +1 -1
  40. package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
  41. package/dist/cf-Ds4JFovl.mjs +18 -0
  42. package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
  43. package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
  44. package/dist/{client-certificates-BtPU9GsQ.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
  45. package/dist/{client-side-security-DAn-3jwp.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
  46. package/dist/cloud-connector-CL1jPQud.mjs +2 -0
  47. package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
  48. package/dist/command-C9VP3xaA.mjs +2 -0
  49. package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
  50. package/dist/config.d.mts +1460 -1348
  51. package/dist/config.mjs +1 -1
  52. package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
  53. package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
  54. package/dist/connector-telemetry-events-latest-BbpcII3_.mjs +2 -0
  55. package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
  56. package/dist/connector-telemetry-snapshots-latest-DuCiimXl.mjs +2 -0
  57. package/dist/{connectors-Bo6ZT8PT.mjs → connectors-BQwyBJ4_.mjs} +1 -1
  58. package/dist/containers-BrQtGiNp.mjs +58 -0
  59. package/dist/{content-scan-D03UfK2X.mjs → content-scan-DNzhXYkY.mjs} +1 -1
  60. package/dist/{csamScanner-DgS-7ADh.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
  61. package/dist/{ct-alerting-8AKtNnUg.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
  62. package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
  63. package/dist/custom-csrs-bhClr2SU.mjs +3 -0
  64. package/dist/custom-hostnames-C0eiGvG9.mjs +5 -0
  65. package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
  66. package/dist/custom-pages-DTINMR30.mjs +3 -0
  67. package/dist/d1-sKdExJYF.mjs +20 -0
  68. package/dist/data-security-mV3a6UfW.mjs +7 -0
  69. package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
  70. package/dist/delegate.mjs +1 -1
  71. package/dist/{deploy-DGlmjPTS.mjs → deploy-BL59O1O1.mjs} +1 -1
  72. package/dist/deploy-input-Dz6q-__n.mjs +2 -0
  73. package/dist/{dev-BbLV0Ti-.mjs → dev-BDaavgH1.mjs} +2 -2
  74. package/dist/diagnostics-CJV6qWUA.mjs +3 -0
  75. package/dist/{directory-CCndFkbQ.mjs → directory-B5zCMusW.mjs} +1 -1
  76. package/dist/{dispatch-namespaces-C48JQ9EA.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
  77. package/dist/dist-BHi7UhXO.mjs +72 -0
  78. package/dist/dist-BWpErtDM.mjs +384 -0
  79. package/dist/{dls-BBq99pjI.mjs → dls-t0hnIe_P.mjs} +1 -1
  80. package/dist/dns-C8FC2hbh.mjs +29 -0
  81. package/dist/{dns-firewall-DdwVtm12.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
  82. package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
  83. package/dist/dry-run-DL2V6yFm.mjs +2 -0
  84. package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
  85. package/dist/email-auth-BmYrl0pO.mjs +2 -0
  86. package/dist/email-routing-CF3_Z957.mjs +6 -0
  87. package/dist/email-security-F7OYcMkZ.mjs +18 -0
  88. package/dist/email-sending-EyU3WvGQ.mjs +7 -0
  89. package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
  90. package/dist/firewall-8YWWy4iB.mjs +11 -0
  91. package/dist/flagship-C4x0l-8J.mjs +4 -0
  92. package/dist/{fraud-AH47n-wL.mjs → fraud-HR_SdUx3.mjs} +1 -1
  93. package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
  94. package/dist/{healthchecks-DfEUG007.mjs → healthchecks-4qOvjrTN.mjs} +2 -2
  95. package/dist/{hostnames-DQUiD3Vr.mjs → hostnames-DehdYOMz.mjs} +1 -1
  96. package/dist/{hyperdrive-RyQboMWI.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
  97. package/dist/iam-DR72hmii.mjs +6 -0
  98. package/dist/images-CeKc5JPh.mjs +8 -0
  99. package/dist/index.mjs +1 -1
  100. package/dist/intel-DtFix9WL.mjs +8 -0
  101. package/dist/{interactive-mV8PABm6.mjs → interactive-C7M55Wxx.mjs} +1 -1
  102. package/dist/ips-CtWCjXAN.mjs +2 -0
  103. package/dist/{keyless-certificates-oNu5jWKF.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
  104. package/dist/keys-BmhG6Kn1.mjs +2 -0
  105. package/dist/{kv-Bi9B4E0A.mjs → kv-BuVPAuZP.mjs} +1 -1
  106. package/dist/{leaked-credential-checks-DKRjBLcr.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
  107. package/dist/load-balancers-CylN-l7n.mjs +6 -0
  108. package/dist/{local-DTyuGwTw.mjs → local-Be3lg_9E.mjs} +1 -1
  109. package/dist/{local-runtime-IAXhEugU.mjs → local-runtime-Ce7k598H.mjs} +1 -1
  110. package/dist/logexplorer-CvRPoKbj.mjs +17 -0
  111. package/dist/logo-matches-Heuft3yF.mjs +2 -0
  112. package/dist/logos-DRYjGBDq.mjs +3 -0
  113. package/dist/logpush-Dve9jOMp.mjs +4 -0
  114. package/dist/{logs-DmWWL5f9.mjs → logs-SC86FE89.mjs} +1 -1
  115. package/dist/{magic-cloud-networking-XbTa6P52.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
  116. package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
  117. package/dist/magic-transit-BK_3asH2.mjs +111 -0
  118. package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
  119. package/dist/matches-Iss9Fo4R.mjs +2 -0
  120. package/dist/mcp-8wxXT6JU.mjs +4 -0
  121. package/dist/mesh-Bf9UAS4J.mjs +4 -0
  122. package/dist/{moq-CJpE-eNj.mjs → moq-ZKMFOeVz.mjs} +1 -1
  123. package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
  124. package/dist/{network-D2WRXCDe.mjs → network-B1lBARU9.mjs} +1 -1
  125. package/dist/{network-interconnects-Clq4X1U8.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
  126. package/dist/oauth-DuEONNgC.mjs +14 -0
  127. package/dist/{oauth-clients-hilWfAlm.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
  128. package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
  129. package/dist/observability-Jya7-zkl.mjs +4 -0
  130. package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
  131. package/dist/{organization-D41rIvJa.mjs → organization-CYxYV4e0.mjs} +6 -6
  132. package/dist/organizations-SacGUW44.mjs +2 -0
  133. package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
  134. package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
  135. package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
  136. package/dist/{output-DgW1hQGX.mjs → output-Ccqw2WOb.mjs} +1 -1
  137. package/dist/page-rules-BqEyFR2c.mjs +27 -0
  138. package/dist/pages-CQ7ZVWk1.mjs +14 -0
  139. package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
  140. package/dist/pipelines-6De2Pe2C.mjs +6 -0
  141. package/dist/precursor-iwK-1P_d.mjs +4 -0
  142. package/dist/progress-BqQcF5QH.mjs +2 -0
  143. package/dist/project-settings-C_1-JI6Y.mjs +3 -0
  144. package/dist/prompt-B0sWIs9c.mjs +3 -0
  145. package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
  146. package/dist/queries-c7zvnfEQ.mjs +3 -0
  147. package/dist/queues-BU6y16qS.mjs +6 -0
  148. package/dist/r2-Jo3QMahK.mjs +24 -0
  149. package/dist/{r2-data-catalog-DLtf9d6o.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
  150. package/dist/radar-DIYAMEof.mjs +2 -0
  151. package/dist/{rate-limits-B1YjnGue.mjs → rate-limits-DewOcznT.mjs} +1 -1
  152. package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
  153. package/dist/realtimekit-cnZEVNDn.mjs +7 -0
  154. package/dist/registrar-BsWr_aPM.mjs +23 -0
  155. package/dist/{registrar-sandbox-0i1T3zne.mjs → registrar-sandbox-BlcpUyIH.mjs} +6 -6
  156. package/dist/{registry-DDcSvd8H.mjs → registry-jifR3_Y6.mjs} +1 -1
  157. package/dist/reporting--1AyTV7k.mjs +2 -0
  158. package/dist/request-tracers-C_VX7X6-.mjs +2 -0
  159. package/dist/{resource-sharing-Ctdi9D-j.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
  160. package/dist/resource-tagging-C33U6T74.mjs +2 -0
  161. package/dist/rules-BfjzALMi.mjs +4 -0
  162. package/dist/rulesets-3i_1Vwt-.mjs +5 -0
  163. package/dist/rum-CjmIckiR.mjs +4 -0
  164. package/dist/{schema-BeXPWeK9.mjs → schema-1mwmslUV.mjs} +1 -1
  165. package/dist/schema-flags-llLJuFFw.mjs +5 -0
  166. package/dist/{scim-BgGsmHrL.mjs → scim-pApmzA5B.mjs} +1 -1
  167. package/dist/sdk-ZctLa5jW.mjs +3 -0
  168. package/dist/{secrets-store-BCpFhYFv.mjs → secrets-store-DBC9WJau.mjs} +1 -1
  169. package/dist/security-center-Djm06dq-.mjs +2 -0
  170. package/dist/{security-txt-Be2Bif0z.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
  171. package/dist/{share-Bz2tFTUP.mjs → share-Dj-MNXrw.mjs} +4 -4
  172. package/dist/shared-BJvq4DkR.mjs +290 -0
  173. package/dist/smart-shield--8EpJjrF.mjs +4 -0
  174. package/dist/snippets-Dyz0PH60.mjs +4 -0
  175. package/dist/{spawn-CHkoow5W.mjs → spawn-C5Z7oWdp.mjs} +108 -112
  176. package/dist/{spectrum-BA0a42eM.mjs → spectrum-rAHWz8rH.mjs} +1 -1
  177. package/dist/{speed-mmOjxOzo.mjs → speed-BKepWBXj.mjs} +1 -1
  178. package/dist/src-gJma71Ec.mjs +108 -0
  179. package/dist/{ssl-Yr6kELqg.mjs → ssl-KdFiY3ev.mjs} +1 -1
  180. package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
  181. package/dist/{state-DZC531l2.mjs → state-Cu3cItUg.mjs} +1 -1
  182. package/dist/{stream-Cu0kYWbc.mjs → stream-CKJ6Tb0M.mjs} +13 -13
  183. package/dist/submit-BxbKKhBn.mjs +2 -0
  184. package/dist/tags-DA8dq9fx.mjs +2 -0
  185. package/dist/tenant-DLXw48hS.mjs +2 -0
  186. package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
  187. package/dist/{tools-D2Xxfkrc.mjs → tools-x8bj9E6b.mjs} +1 -1
  188. package/dist/{tunnel-CDYkWjnt.mjs → tunnel-CNQA5Flp.mjs} +1 -1
  189. package/dist/tunnels-CC10EOsU.mjs +2 -0
  190. package/dist/turnstile-CH58hnf4.mjs +23 -0
  191. package/dist/{ui-DIpjthrV.mjs → ui-CmnnBm_O.mjs} +1 -1
  192. package/dist/url-info-BpCgdUtL.mjs +2 -0
  193. package/dist/{url-normalization-BeKkOZz7.mjs → url-normalization-BzuynEy1.mjs} +1 -1
  194. package/dist/url-scanner-APIZbhB7.mjs +2 -0
  195. package/dist/user-2-NGebfI.mjs +12 -0
  196. package/dist/values-S_bNv819.mjs +2 -0
  197. package/dist/{vectorize-CjXfiFH4.mjs → vectorize-Bv7feLBC.mjs} +1 -1
  198. package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
  199. package/dist/{web-assets-BzM5vVzy.mjs → web-assets-C1UmOyzD.mjs} +1 -1
  200. package/dist/web3-GnUocVYH.mjs +4 -0
  201. package/dist/workers-J1-PLwdl.mjs +28 -0
  202. package/dist/{workers-builds-B44wc67O.mjs → workers-builds-DCHmWOMS.mjs} +4 -4
  203. package/dist/{workflows-rFuQWClt.mjs → workflows-CArfEI2c.mjs} +2 -2
  204. package/dist/zaraz-mg2YlR3_.mjs +2 -0
  205. package/dist/zero-trust-DVdUPtj1.mjs +93 -0
  206. package/dist/zone-DMAfrDJX.mjs +2 -0
  207. package/dist/zones-CNwxUi7I.mjs +21 -0
  208. package/package.json +10 -7
  209. package/dist/abuse-reports-CzDAjFpo.mjs +0 -8
  210. package/dist/account-Dd4-tDYJ.mjs +0 -2
  211. package/dist/account-tags-65fAlHrf.mjs +0 -9
  212. package/dist/accounts-Bp5KGc6r.mjs +0 -28
  213. package/dist/agent-memory-D--BQS0W.mjs +0 -6
  214. package/dist/ai-BnVlQDiI.mjs +0 -5
  215. package/dist/ai-audit-CfpDKXkD.mjs +0 -2
  216. package/dist/ai-gateway-oG4j_oYN.mjs +0 -13
  217. package/dist/ai-search-B2l3B_jn.mjs +0 -7
  218. package/dist/ai-security-byjIIrfl.mjs +0 -4
  219. package/dist/analytics-DeIKjC9n.mjs +0 -3
  220. package/dist/analytics_engine-BnECMIWJ.mjs +0 -2
  221. package/dist/argo-DFerMyXF.mjs +0 -2
  222. package/dist/artifacts-CtyEYYDa.mjs +0 -4
  223. package/dist/audit-logs-retFtvow.mjs +0 -2
  224. package/dist/auth-aazs91XL.mjs +0 -5
  225. package/dist/billing-CxQVqpGZ.mjs +0 -3
  226. package/dist/body-parser-CYD7PKFC.mjs +0 -2
  227. package/dist/bot-management-Rli7v7tg.mjs +0 -5
  228. package/dist/botnet-feed-Cw6XSEf8.mjs +0 -3
  229. package/dist/brand-protection-CTvnHGfV.mjs +0 -3
  230. package/dist/browser-run-FwtwnBzA.mjs +0 -4
  231. package/dist/build-Dji9BYmV.mjs +0 -2
  232. package/dist/certificate-authorities-DZP1RzAs.mjs +0 -2
  233. package/dist/cf-oSz9pud_.mjs +0 -18
  234. package/dist/chunk-LQW53VED-Xakf_rUn.mjs +0 -499
  235. package/dist/cloud-connector-BpVcvhjZ.mjs +0 -2
  236. package/dist/cloudforce-one-2PecncfX.mjs +0 -30
  237. package/dist/connector-interrupts-ollUcksZ.mjs +0 -2
  238. package/dist/connector-telemetry-events-D5_3X7XW.mjs +0 -2
  239. package/dist/connector-telemetry-snapshots-CJ9gLRFR.mjs +0 -2
  240. package/dist/containers-Bog7j0Hw.mjs +0 -54
  241. package/dist/custom-certificates-4y35UC1X.mjs +0 -5
  242. package/dist/custom-csrs-DwBrLh-H.mjs +0 -4
  243. package/dist/custom-hostnames-CDIAnsRa.mjs +0 -5
  244. package/dist/custom-nameservers-stk7ymnP.mjs +0 -3
  245. package/dist/custom-pages-vfDxrXbt.mjs +0 -4
  246. package/dist/d1-Cllm-iTT.mjs +0 -20
  247. package/dist/data-security-rnoSCEdL.mjs +0 -7
  248. package/dist/dcv-delegation-DCRCOL6l.mjs +0 -2
  249. package/dist/deploy-input-DhCo1I0I.mjs +0 -242
  250. package/dist/diagnostics-D5Yo2xqx.mjs +0 -3
  251. package/dist/dist-COfwjT96.mjs +0 -72
  252. package/dist/dns-DdQYtenF.mjs +0 -29
  253. package/dist/durable-objects-BvxXBht_.mjs +0 -2
  254. package/dist/email-CGOC_evd.mjs +0 -2
  255. package/dist/email-auth-DFvXKSkg.mjs +0 -2
  256. package/dist/email-routing-QBRPBlyl.mjs +0 -6
  257. package/dist/email-security-BFagcRPP.mjs +0 -18
  258. package/dist/email-sending-Ddhe7xjN.mjs +0 -7
  259. package/dist/filters-CGisPGD1.mjs +0 -4
  260. package/dist/firewall-DD8U-Brd.mjs +0 -11
  261. package/dist/flagship-FJHc4mFi.mjs +0 -4
  262. package/dist/google-tag-gateway-149kbuG_.mjs +0 -2
  263. package/dist/iam-BhHYhMXO.mjs +0 -6
  264. package/dist/images-CDViyKtZ.mjs +0 -8
  265. package/dist/intel-YHZbPlS3.mjs +0 -8
  266. package/dist/ips-BpCdldFx.mjs +0 -2
  267. package/dist/keys-yYtv7Ztr.mjs +0 -2
  268. package/dist/load-balancers-jRCN75mX.mjs +0 -7
  269. package/dist/logexplorer-kO8CULiK.mjs +0 -24
  270. package/dist/logo-matches-LyDAYPbI.mjs +0 -2
  271. package/dist/logos-O9f5bGSB.mjs +0 -3
  272. package/dist/logpush-dtXLu3Ck.mjs +0 -5
  273. package/dist/magic-network-monitoring-CpfkgZMp.mjs +0 -4
  274. package/dist/magic-transit-DwgZeIj-.mjs +0 -111
  275. package/dist/managed-transforms-DCmogkxv.mjs +0 -3
  276. package/dist/matches-BAeN8VM1.mjs +0 -2
  277. package/dist/mcp-DKZ2D050.mjs +0 -4
  278. package/dist/media-CnxgOViL.mjs +0 -2
  279. package/dist/mesh-CzIPtuaM.mjs +0 -4
  280. package/dist/mtls-certificates-Bbm_1lQI.mjs +0 -3
  281. package/dist/oauth-BPizUUqP.mjs +0 -15
  282. package/dist/oauth-scopes-CmbgsPYd.mjs +0 -2
  283. package/dist/observability-DXYgDdU5.mjs +0 -4
  284. package/dist/organizations-eNzfOwlP.mjs +0 -2
  285. package/dist/origin-ca-certificates-DaiAmw45.mjs +0 -3
  286. package/dist/origin-post-quantum-encryption-7YztBged.mjs +0 -2
  287. package/dist/origin-tls-client-auth-DRwURM8s.mjs +0 -4
  288. package/dist/page-rules-B2Csdc4h.mjs +0 -18
  289. package/dist/pages-BAL6Q7OY.mjs +0 -14
  290. package/dist/pay-per-crawl-C-1-ZAtn.mjs +0 -4
  291. package/dist/pipelines-cyQOuFLb.mjs +0 -6
  292. package/dist/precursor-BrweY39h.mjs +0 -4
  293. package/dist/progress-B84wYh91.mjs +0 -2
  294. package/dist/prompt-CDtLWxNv.mjs +0 -3
  295. package/dist/queries-oM8uGZy5.mjs +0 -3
  296. package/dist/queues-CTx04ZNw.mjs +0 -6
  297. package/dist/r2-CnlIUn7R.mjs +0 -24
  298. package/dist/radar-CGNgGh8v.mjs +0 -2
  299. package/dist/raw-fetch-Dz-QBoP_.mjs +0 -2
  300. package/dist/realtimekit-BPwzhNS9.mjs +0 -7
  301. package/dist/registrar-BEcb90RX.mjs +0 -21
  302. package/dist/reporting-CLbjHlnw.mjs +0 -2
  303. package/dist/request-tracers-BcKpofP1.mjs +0 -2
  304. package/dist/resource-tagging-DGEyVTDN.mjs +0 -2
  305. package/dist/rules-CmuB5rIN.mjs +0 -4
  306. package/dist/rulesets-CGaMq8vG.mjs +0 -8
  307. package/dist/rum-QT6EP4JK.mjs +0 -4
  308. package/dist/schema-flags-DHryz6SF.mjs +0 -5
  309. package/dist/sdk-m4xeaua4.mjs +0 -3
  310. package/dist/security-center-BNm4uPVB.mjs +0 -2
  311. package/dist/session-Ckt20hHa.mjs +0 -2
  312. package/dist/shared-BzPQog8H.mjs +0 -2
  313. package/dist/smart-shield-SODkOUyO.mjs +0 -4
  314. package/dist/snippets-B5jY8v_7.mjs +0 -4
  315. package/dist/src-CHW7s5IS.mjs +0 -108
  316. package/dist/submit-Dl_27e0n.mjs +0 -2
  317. package/dist/tags-Cdo_Pwtr.mjs +0 -2
  318. package/dist/tenant-EX-ANl6X.mjs +0 -2
  319. package/dist/tenant-custom-nameservers-BPHUeckw.mjs +0 -3
  320. package/dist/triggers-Bf9hbP3h.mjs +0 -2
  321. package/dist/tunnels-CgyX8R2J.mjs +0 -2
  322. package/dist/turnstile-BUtzlW-0.mjs +0 -23
  323. package/dist/url-info-CJsa1Oc9.mjs +0 -2
  324. package/dist/url-scanner-Cz-yl0_3.mjs +0 -2
  325. package/dist/user-BxHjEqpd.mjs +0 -12
  326. package/dist/values-C43NurfT.mjs +0 -2
  327. package/dist/versions-BFbc90Wu.mjs +0 -2
  328. package/dist/waiting-rooms-C5jSQv_r.mjs +0 -11
  329. package/dist/web3-Ctv9HGiR.mjs +0 -4
  330. package/dist/workers-D-YbIedB.mjs +0 -24
  331. package/dist/zaraz-BA6kY-b6.mjs +0 -2
  332. package/dist/zero-trust-DOFLlUz1.mjs +0 -102
  333. package/dist/zone-B_rgejLV.mjs +0 -2
  334. package/dist/zone-tags-BWdza4rH.mjs +0 -9
  335. package/dist/zones-DTWO7Vvn.mjs +0 -21
  336. /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
  337. /package/dist/{alerts-B85uj2Vx.mjs → alerts-15-IW4jE.mjs} +0 -0
  338. /package/dist/{autorag-Do9l_LyY.mjs → autorag-CFwRkEKw.mjs} +0 -0
  339. /package/dist/{brands-DateHCdd.mjs → brands-BgT1vu9B.mjs} +0 -0
  340. /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
  341. /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
  342. /package/dist/{clear-CB2kgcEB.mjs → clear-BlCK85Me.mjs} +0 -0
  343. /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
  344. /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C7LBxPBt.mjs} +0 -0
  345. /package/dist/{health-buY5f5pp.mjs → health-DZFfafkX.mjs} +0 -0
  346. /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
  347. /package/dist/{internal-CwyoJUHh.mjs → internal-BKHC2D1Y.mjs} +0 -0
  348. /package/dist/{live-wEpA5V_n.mjs → live-DwCvDmaH.mjs} +0 -0
  349. /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
  350. /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
  351. /package/dist/{ready-CBSCPiHE.mjs → ready-D9H2zHHI.mjs} +0 -0
  352. /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
  353. /package/dist/{refute-u7ZPQJZy.mjs → refute-2W8NLCN4.mjs} +0 -0
  354. /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-B8CyM1mi.mjs} +0 -0
  355. /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
  356. /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-CWhta3x7.mjs} +0 -0
  357. /package/dist/{search-D9WDwnV4.mjs → search-DZmBQJL9.mjs} +0 -0
  358. /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-CQrmWgz5.mjs} +0 -0
  359. /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-C98A0bqq.mjs} +0 -0
  360. /package/dist/{theme-BePJemMn.mjs → theme-CrIBazAF.mjs} +0 -0
  361. /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-BZoaFoDE.mjs} +0 -0
  362. /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
  363. /package/dist/{verify-2yi0H93r.mjs → verify-4e4L9IRk.mjs} +0 -0
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{r}from"./auth-DuLchM18.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-B84wYh91.mjs";import{n as s,t as c}from"./body-parser-CYD7PKFC.mjs";import{n as l}from"./input-validation-BBKJRoRB.mjs";import{a as u}from"./prompt-CDtLWxNv.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){a({command:`cf request-tracers traces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/request-tracer/trace`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({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`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.requestTracers.traces.create({...e,account_id:p})),{successLabel:`Created`});return}d.method===void 0&&(d.method=await u(`method`,`HTTP Method of tracing request`)),d.url===void 0&&(d.url=await u(`url`,`URL to which perform tracing request`));let m=c({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(await o(`Creating`,async()=>f.requestTracers.traces.create({...m,account_id:p})),{successLabel:`Created`})}},p={command:`traces`,describe:`Simulate request processing to debug rule matches, transforms, and routing decisions`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`request-tracers`,describe:`Trace how a request would be processed through Cloudflare's rules and configuration pipeline`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{r}from"./auth-DuLchM18.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-B84wYh91.mjs";function s(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 c={command:`get`,describe:`Lists all distinct tag keys and their distinct values across resources in an account.`,builder:s,handler:async s=>{let c={cursor:s.cursor};if(s.dryRun){a({command:`cf resource-tagging summary get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tags/summary`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.resourceTagging.summary.get({account_id:u,...c})),{successLabel:`Loaded`})}},l={command:`summary`,describe:`Operations for summary`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},u={command:`resource-tagging`,describe:`resource-tagging`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{r}from"./auth-DuLchM18.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-B84wYh91.mjs";import{n as s,t as c}from"./body-parser-CYD7PKFC.mjs";import{n as l}from"./input-validation-BBKJRoRB.mjs";import{a as u,n as d}from"./prompt-CDtLWxNv.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 s=>{if(s.dryRun){a({command:`cf rules lists bulk-operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/bulk_operations/${s[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(s[`operation-id`]))}`,pathParams:{"operation-id":String(s[`operation-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rules.lists.bulkOperations.get({account_id:l,operation_id:s[`operation-id`]})),{successLabel:`Loaded`})}},m={command:`bulk-operations`,describe:`Operations for lists.bulk-operations`,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 d=>{if(d.dryRun){a({command:`cf rules lists create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({description:l(d.description,`description`,`text`),name:l(d.name,`name`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.rules.lists.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`An informative name for the list. Use this name in filter and rule expressions.`));let m=c({description:l(d.description,`description`,`text`),name:l(d.name,`name`,`text`)});i(await o(`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 s=>{if(s.dryRun){a({command:`cf rules lists delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${s[`list-id`]==null?`<list-id>`:encodeURIComponent(String(s[`list-id`]))}`,pathParams:{"list-id":String(s[`list-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the custom list and every item it contains.`})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>c.rules.lists.delete({account_id:l,list_id:s[`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 s=>{if(s.dryRun){a({command:`cf rules lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${s[`list-id`]==null?`<list-id>`:encodeURIComponent(String(s[`list-id`]))}`,pathParams:{"list-id":String(s[`list-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rules.lists.get({account_id:l,list_id:s[`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 c=>{if(c.dryRun){a({command:`cf rules lists items create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${c[`list-id`]==null?`<list-id>`:encodeURIComponent(String(c[`list-id`]))}/items`,pathParams:{"list-id":String(c[`list-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,c.body){let e=s(c.body);i(await o(`Creating`,async()=>l.rules.lists.items.create({body:e,account_id:u,list_id:c[`list-id`]})),{successLabel:`Created`});return}if(c.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 c=>{if(c.dryRun){a({command:`cf rules lists items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${c[`list-id`]==null?`<list-id>`:encodeURIComponent(String(c[`list-id`]))}/items`,pathParams:{"list-id":String(c[`list-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,!await d({force:!!c.force,message:`This operation deletes the selected items from the custom list.`})){process.stderr.write(`Aborted.
4
- `);return}if(c.body){let e=s(c.body);i(await o(`Deleting`,async()=>l.rules.lists.items.delete({...e,account_id:u,list_id:c[`list-id`]})),{successLabel:`Deleted`});return}i(await o(`Deleting`,async()=>l.rules.lists.items.delete({account_id:u,list_id:c[`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 s=>{if(s.dryRun){a({command:`cf rules lists items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${s[`list-id`]==null?`<list-id>`:encodeURIComponent(String(s[`list-id`]))}/items/${s[`item-id`]==null?`<item-id>`:encodeURIComponent(String(s[`item-id`]))}`,pathParams:{"item-id":String(s[`item-id`]??``),"list-id":String(s[`list-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rules.lists.items.get({account_id:l,list_id:s[`list-id`],item_id:s[`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 that indicates where to continue when requesting the next/previous set of records. The response provides cursor values under `result_info.cursors`. 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 s=>{let c={cursor:s.cursor,per_page:s[`per-page`],search:s.search};if(s.dryRun){a({command:`cf rules lists items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${s[`list-id`]==null?`<list-id>`:encodeURIComponent(String(s[`list-id`]))}/items`,pathParams:{"list-id":String(s[`list-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.rules.lists.items.list({account_id:u,list_id:s[`list-id`],...c})),{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 c=>{if(c.dryRun){a({command:`cf rules lists items update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${c[`list-id`]==null?`<list-id>`:encodeURIComponent(String(c[`list-id`]))}/items`,pathParams:{"list-id":String(c[`list-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,c.body){let e=s(c.body);i(await o(`Updating`,async()=>l.rules.lists.items.update({body:e,account_id:u,list_id:c[`list-id`]})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},j={command:`items`,describe:`Operations for lists.items`,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 s=>{if(s.dryRun){a({command:`cf rules lists list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rules.lists.list({account_id:l})),{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 u=>{if(u.dryRun){a({command:`cf rules lists update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rules/lists/${u[`list-id`]==null?`<list-id>`:encodeURIComponent(String(u[`list-id`]))}`,pathParams:{"list-id":String(u[`list-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({description:l(u.description,`description`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.rules.lists.update({...e,account_id:f,list_id:u[`list-id`]})),{successLabel:`Updated`});return}let p=c({description:l(u.description,`description`,`text`)});i(await o(`Updating`,async()=>d.rules.lists.update({...p,account_id:f,list_id:u[`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};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n,h as r}from"./oauth-BPizUUqP.mjs";import{r as i}from"./auth-DuLchM18.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-B84wYh91.mjs";import{n as c,t as l}from"./body-parser-CYD7PKFC.mjs";import{n as u}from"./input-validation-BBKJRoRB.mjs";import{a as d,i as f,n as p}from"./prompt-CDtLWxNv.mjs";function m(e){return e.option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 h={command:`create`,describe:`Creates a ruleset at the account level.`,builder:m,handler:async r=>{let p={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets`,pathParams:{},query:p,bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`),kind:u(r.kind,`kind`,`text`),phase:u(r.phase,`phase`,`text`)}):c(r.body)});return}let m=await i(r),h=r.local?e:await t();if(r.accountId=h,r.body){let e=c(r.body);new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>m.rulesets.accountRulesets.create({...e,account_id:h,...p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await d(`name`,`The human-readable name of the ruleset.`)),r.kind===void 0&&(r.kind=await f(`kind`,`The kind of the ruleset.`,[`managed`,`custom`,`root`,`zone`])),r.phase===void 0&&(r.phase=await f(`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 g=l({description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`),kind:u(r.kind,`kind`,`text`),phase:u(r.phase,`phase`,`text`)});new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>m.rulesets.accountRulesets.create({...g,account_id:h,...p})),{successLabel:`Created`})}};function g(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 ee={command:`delete <ruleset-id>`,describe:`Deletes all versions of an existing account ruleset.`,builder:g,handler:async r=>{let c={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(r[`ruleset-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await p({force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>l.rulesets.accountRulesets.delete({account_id:u,ruleset_id:r[`ruleset-id`],...c})),{successLabel:`Deleted`})}};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})}const _={command:`get <ruleset-id>`,describe:`Fetches the latest version of an account ruleset.`,builder:te,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(r[`ruleset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.get({account_id:l,ruleset_id:r[`ruleset-id`]})),{successLabel:`Loaded`})}};function v(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 y={command:`list`,describe:`Fetches all rulesets at the account level.`,builder:v,handler:async r=>{let c={cursor:r.cursor,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf rulesets account-rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.rulesets.accountRulesets.list({account_id:u,...c})),{successLabel:`Loaded`})}};function b(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 x={command:`get <ruleset-phase>`,describe:`Fetches the latest version of the account entry point ruleset for a given phase.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets phases get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/phases/${r[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(r[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(r[`ruleset-phase`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.phases.get({account_id:l,ruleset_phase:r[`ruleset-phase`]})),{successLabel:`Loaded`})}};function S(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 C={command:`update <ruleset-phase>`,describe:`Updates an account entry point ruleset, creating a new version.`,builder:S,handler:async r=>{let d={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/phases/${r[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(r[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(r[`ruleset-phase`]??``)},query:d,bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.rulesets.accountRulesets.phases.update({...e,account_id:p,ruleset_phase:r[`ruleset-phase`],...d})),{successLabel:`Updated`});return}let m=l({description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`)});new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.rulesets.accountRulesets.phases.update({...m,account_id:p,ruleset_phase:r[`ruleset-phase`],...d})),{successLabel:`Updated`})}};function w(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 T={command:`get <ruleset-version>`,describe:`Fetches a specific version of an account entry point ruleset.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/phases/${r[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(r[`ruleset-phase`]))}/entrypoint/versions/${r[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(r[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(r[`ruleset-version`]??``),"ruleset-phase":String(r[`ruleset-phase`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.phases.versions.get({account_id:l,ruleset_phase:r[`ruleset-phase`],ruleset_version:r[`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 D={command:`list`,describe:`Fetches the versions of an account entry point ruleset.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/phases/${r[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(r[`ruleset-phase`]))}/entrypoint/versions`,pathParams:{"ruleset-phase":String(r[`ruleset-phase`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.phases.versions.list({account_id:l,ruleset_phase:r[`ruleset-phase`]})),{successLabel:`Loaded`})}},O={command:`versions`,describe:`Operations for account-rulesets.phases.versions`,builder:e=>e.command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},k={command:`phases`,describe:`Operations for account-rulesets.phases`,builder:e=>e.command(x).command(C).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 j={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:A,handler:async r=>{let d={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(r[`ruleset-id`]??``)},query:d,bodyKind:`json`,body:r.body===void 0?l({position:{before:u(r[`position-before`],`position-before`,`text`),after:u(r[`position-after`],`position-after`,`text`),index:r[`position-index`]}}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.rulesets.accountRulesets.rules.create({...e,account_id:p,ruleset_id:r[`ruleset-id`],...d})),{successLabel:`Created`});return}let m=l({position:{before:u(r[`position-before`],`position-before`,`text`),after:u(r[`position-after`],`position-after`,`text`),index:r[`position-index`]}});new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>f.rulesets.accountRulesets.rules.create({...m,account_id:p,ruleset_id:r[`ruleset-id`],...d})),{successLabel:`Created`})}};function M(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:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const N={command:`delete <rule-id>`,describe:`Deletes an existing rule from an account ruleset.`,builder:M,handler:async r=>{let c={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``),"ruleset-id":String(r[`ruleset-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await p({force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>l.rulesets.accountRulesets.rules.delete({account_id:u,ruleset_id:r[`ruleset-id`],rule_id:r[`rule-id`],...c})),{successLabel:`Deleted`})}};function P(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:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 F={command:`update <rule-id>`,describe:`Updates an existing rule in an account ruleset.`,builder:P,handler:async r=>{let d={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``),"ruleset-id":String(r[`ruleset-id`]??``)},query:d,bodyKind:`json`,body:r.body===void 0?l({position:{before:u(r[`position-before`],`position-before`,`text`),after:u(r[`position-after`],`position-after`,`text`),index:r[`position-index`]}}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.rulesets.accountRulesets.rules.update({...e,account_id:p,ruleset_id:r[`ruleset-id`],rule_id:r[`rule-id`],...d})),{successLabel:`Updated`});return}let m=l({position:{before:u(r[`position-before`],`position-before`,`text`),after:u(r[`position-after`],`position-after`,`text`),index:r[`position-index`]}});new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.rulesets.accountRulesets.rules.update({...m,account_id:p,ruleset_id:r[`ruleset-id`],rule_id:r[`rule-id`],...d})),{successLabel:`Updated`})}},I={command:`rules`,describe:`Operations for account-rulesets.rules`,builder:e=>e.command(j).command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 R={command:`update <ruleset-id>`,describe:`Updates an account ruleset, creating a new version.`,builder:L,handler:async r=>{let d={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(r[`ruleset-id`]??``)},query:d,bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`),kind:u(r.kind,`kind`,`text`),phase:u(r.phase,`phase`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.rulesets.accountRulesets.update({...e,account_id:p,ruleset_id:r[`ruleset-id`],...d})),{successLabel:`Updated`});return}let m=l({description:u(r.description,`description`,`text`),name:u(r.name,`name`,`text`),kind:u(r.kind,`kind`,`text`),phase:u(r.phase,`phase`,`text`)});new URLSearchParams(Object.entries(d).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>f.rulesets.accountRulesets.update({...m,account_id:p,ruleset_id:r[`ruleset-id`],...d})),{successLabel:`Updated`})}};function z(e){return e.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(`rule-tag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:`Fetches the rules of a managed account ruleset version for a given tag.`,builder:z,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets versions by-tag list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/versions/${r[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(r[`ruleset-version`]))}/by_tag/${r[`rule-tag`]==null?`<rule-tag>`:encodeURIComponent(String(r[`rule-tag`]))}`,pathParams:{"rule-tag":String(r[`rule-tag`]??``),"ruleset-version":String(r[`ruleset-version`]??``),"ruleset-id":String(r[`ruleset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.versions.byTag.list({account_id:l,ruleset_id:r[`ruleset-id`],ruleset_version:r[`ruleset-version`],rule_tag:r[`rule-tag`]})),{successLabel:`Loaded`})}},V={command:`by-tag`,describe:`Operations for account-rulesets.versions.by-tag`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(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:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 U={command:`delete <ruleset-version>`,describe:`Deletes an existing version of an account ruleset.`,builder:H,handler:async r=>{let c={dry_run:r[`dry-run`]};if(r.dryRun){o({command:`cf rulesets account-rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/versions/${r[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(r[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(r[`ruleset-version`]??``),"ruleset-id":String(r[`ruleset-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await p({force:!!r.force})){process.stderr.write(`Aborted.
5
- `);return}a(await s(`Deleting`,async()=>l.rulesets.accountRulesets.versions.delete({account_id:u,ruleset_id:r[`ruleset-id`],ruleset_version:r[`ruleset-version`],...c})),{successLabel:`Deleted`})}};function W(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 G={command:`get <ruleset-version>`,describe:`Fetches a specific version of an account ruleset.`,builder:W,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/versions/${r[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(r[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(r[`ruleset-version`]??``),"ruleset-id":String(r[`ruleset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.versions.get({account_id:l,ruleset_id:r[`ruleset-id`],ruleset_version:r[`ruleset-version`]})),{successLabel:`Loaded`})}};function K(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 q={command:`list`,describe:`Fetches the versions of an account ruleset.`,builder:K,handler:async r=>{if(r.dryRun){o({command:`cf rulesets account-rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rulesets/${r[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(r[`ruleset-id`]))}/versions`,pathParams:{"ruleset-id":String(r[`ruleset-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.rulesets.accountRulesets.versions.list({account_id:l,ruleset_id:r[`ruleset-id`]})),{successLabel:`Loaded`})}};function J(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 Y={command:`tag <rule-tag>`,describe:`Fetches the rules of a managed zone ruleset version for a given tag.`,builder:J,handler:async e=>{if(e.dryRun){o({command:`cf rulesets account-rulesets versions zone-by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`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`})}},X={command:`zone-by-tag`,describe:`Operations for account-rulesets.versions.zone-by-tag`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Z={command:`versions`,describe:`Operations for account-rulesets.versions`,builder:e=>e.command(U).command(G).command(q).command(V).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Q={command:`account-rulesets`,describe:`Operations for account-rulesets`,builder:e=>e.command(h).command(ee).command(_).command(y).command(R).command(k).command(I).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 re={command:`create`,describe:`Creates a ruleset at the zone level.`,builder:ne,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?l({description:u(e.description,`description`,`text`),name:u(e.name,`name`,`text`),kind:u(e.kind,`kind`,`text`),phase:u(e.phase,`phase`,`text`)}):c(e.body)});return}let n=await i(e),p=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=p,e.body){let r=c(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>n.rulesets.create({...r,zone_id:p,...t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await d(`name`,`The human-readable name of the ruleset.`)),e.kind===void 0&&(e.kind=await f(`kind`,`The kind of the ruleset.`,[`managed`,`custom`,`root`,`zone`])),e.phase===void 0&&(e.phase=await f(`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 m=l({description:u(e.description,`description`,`text`),name:u(e.name,`name`,`text`),kind:u(e.kind,`kind`,`text`),phase:u(e.phase,`phase`,`text`)});new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>n.rulesets.create({...m,zone_id:p,...t})),{successLabel:`Created`})}};function ie(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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-id>`,describe:`Deletes all versions of an existing zone ruleset.`,builder:ie,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=c,!await p({force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}a(await s(`Deleting`,async()=>n.rulesets.delete({zone_id:c,ruleset_id:e[`ruleset-id`],...t})),{successLabel:`Deleted`})}};function oe(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 se={command:`get <ruleset-id>`,describe:`Fetches the latest version of a zone ruleset.`,builder:oe,handler:async e=>{if(e.dryRun){o({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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.rulesets.get({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Loaded`})}};function ce(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 le={command:`list`,describe:`Fetches all rulesets at the zone level.`,builder:ce,handler:async e=>{let t={cursor:e.cursor,per_page:e[`per-page`]};if(e.dryRun){o({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 i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>n.rulesets.list({zone_id:c,...t})),{successLabel:`Loaded`})}};function ue(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 de={command:`get <ruleset-phase>`,describe:`Fetches the latest version of the zone entry point ruleset for a given phase.`,builder:ue,handler:async e=>{if(e.dryRun){o({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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.rulesets.phases.get({zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Loaded`})}};function fe(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 pe={command:`update <ruleset-phase>`,describe:`Updates a zone entry point ruleset, creating a new version.`,builder:fe,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?l({description:u(e.description,`description`,`text`),name:u(e.name,`name`,`text`)}):c(e.body)});return}let n=await i(e),d=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=d,e.body){let r=c(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>n.rulesets.phases.update({...r,zone_id:d,ruleset_phase:e[`ruleset-phase`],...t})),{successLabel:`Updated`});return}let f=l({description:u(e.description,`description`,`text`),name:u(e.name,`name`,`text`)});new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>n.rulesets.phases.update({...f,zone_id:d,ruleset_phase:e[`ruleset-phase`],...t})),{successLabel:`Updated`})}};function me(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 he={command:`get <ruleset-version>`,describe:`Fetches a specific version of a zone entry point ruleset.`,builder:me,handler:async e=>{if(e.dryRun){o({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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.rulesets.phases.versions.get({zone_id:n,ruleset_phase:e[`ruleset-phase`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Loaded`})}};function ge(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 _e={command:`list`,describe:`Fetches the versions of a zone entry point ruleset.`,builder:ge,handler:async e=>{if(e.dryRun){o({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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.rulesets.phases.versions.list({zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Loaded`})}},ve={command:`versions`,describe:`Operations for phases.versions`,builder:e=>e.command(he).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ye={command:`phases`,describe:`Operations for phases`,builder:e=>e.command(de).command(pe).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 xe={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:be,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?l({position:{before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):c(e.body)});return}let n=await i(e),d=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=d,e.body){let r=c(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>n.rulesets.rules.create({...r,zone_id:d,ruleset_id:e[`ruleset-id`],...t})),{successLabel:`Created`});return}let f=l({position:{before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>n.rulesets.rules.create({...f,zone_id:d,ruleset_id:e[`ruleset-id`],...t})),{successLabel:`Created`})}};function Se(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:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ce={command:`delete <rule-id>`,describe:`Deletes an existing rule from a zone ruleset.`,builder:Se,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=c,!await p({force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}a(await s(`Deleting`,async()=>n.rulesets.rules.delete({zone_id:c,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`],...t})),{successLabel:`Deleted`})}};function we(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:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 Te={command:`update <rule-id>`,describe:`Updates an existing rule in a zone ruleset.`,builder:we,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({command:`cf rulesets rules update`,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`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?l({position:{before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):c(e.body)});return}let n=await i(e),d=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=d,e.body){let r=c(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>n.rulesets.rules.update({...r,zone_id:d,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`],...t})),{successLabel:`Updated`});return}let f=l({position:{before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>n.rulesets.rules.update({...f,zone_id:d,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`],...t})),{successLabel:`Updated`})}},Ee={command:`rules`,describe:`Operations for rules`,builder:e=>e.command(xe).command(Ce).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 $={command:`update <ruleset-id>`,describe:`Updates a zone ruleset, creating a new version.`,builder:De,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?l({description:u(e.description,`description`,`text`),name:u(e.name,`name`,`text`),kind:u(e.kind,`kind`,`text`),phase:u(e.phase,`phase`,`text`)}):c(e.body)});return}let n=await i(e),d=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=d,e.body){let r=c(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>n.rulesets.update({...r,zone_id:d,ruleset_id:e[`ruleset-id`],...t})),{successLabel:`Updated`});return}let f=l({description:u(e.description,`description`,`text`),name:u(e.name,`name`,`text`),kind:u(e.kind,`kind`,`text`),phase:u(e.phase,`phase`,`text`)});new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Updating`,async()=>n.rulesets.update({...f,zone_id:d,ruleset_id:e[`ruleset-id`],...t})),{successLabel:`Updated`})}};function Oe(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:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 ke={command:`delete <ruleset-version>`,describe:`Deletes an existing version of a zone ruleset.`,builder:Oe,handler:async e=>{let t={dry_run:e[`dry-run`]};if(e.dryRun){o({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`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=c,!await p({force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}a(await s(`Deleting`,async()=>n.rulesets.versions.delete({zone_id:c,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`],...t})),{successLabel:`Deleted`})}};function Ae(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 je={command:`get <ruleset-version>`,describe:`Fetches a specific version of a zone ruleset.`,builder:Ae,handler:async e=>{if(e.dryRun){o({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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.rulesets.versions.get({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Loaded`})}};function Me(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 Ne={command:`list`,describe:`Fetches the versions of a zone ruleset.`,builder:Me,handler:async e=>{if(e.dryRun){o({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 i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.rulesets.versions.list({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Loaded`})}},Pe={command:`versions`,describe:`Operations for versions`,builder:e=>e.command(ke).command(je).command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Fe={command:`rulesets`,describe:`rulesets`,builder:e=>e.command(re).command(ae).command(se).command(le).command($).command(Q).command(ye).command(Ee).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Fe as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{r}from"./auth-DuLchM18.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-B84wYh91.mjs";import{n as s,t as c}from"./body-parser-CYD7PKFC.mjs";import{n as l}from"./input-validation-BBKJRoRB.mjs";import{n as u}from"./prompt-CDtLWxNv.mjs";import{t as d}from"./cli-types-BWdZbsFE.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 l=>{if(l.dryRun){a({command:`cf rum rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/v2/${l[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(l[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(l[`ruleset-id`]??``)},bodyKind:`json`,body:l.body===void 0?c({delete_rules:l[`delete-rules`]}):s(l.body)});return}let u=await r(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=s(l.body);i(await o(`Creating`,async()=>u.rum.rules.bulkCreate({...e,account_id:d,ruleset_id:l[`ruleset-id`]})),{successLabel:`Created`});return}let f=c({delete_rules:l[`delete-rules`]});i(await o(`Creating`,async()=>u.rum.rules.bulkCreate({...f,account_id:d,ruleset_id:l[`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 u=>{if(u.dryRun){a({command:`cf rum rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/v2/${u[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(u[`ruleset-id`]))}/rule`,pathParams:{"ruleset-id":String(u[`ruleset-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({host:l(u.host,`host`,`text`),inclusive:u.inclusive,is_paused:u[`is-paused`],paths:u.paths}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.rum.rules.create({body:e,account_id:f,ruleset_id:u[`ruleset-id`]})),{successLabel:`Created`});return}let p=c({host:l(u.host,`host`,`text`),inclusive:u.inclusive,is_paused:u[`is-paused`],paths:u.paths});i(await o(`Creating`,async()=>d.rum.rules.create({body:p,account_id:f,ruleset_id:u[`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 s=>{if(s.dryRun){a({command:`cf rum rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/v2/${s[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(s[`ruleset-id`]))}/rule/${s[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(s[`rule-id`]))}`,pathParams:{"ruleset-id":String(s[`ruleset-id`]??``),"rule-id":String(s[`rule-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await u({force:!!s.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>c.rum.rules.delete({account_id:l,ruleset_id:s[`ruleset-id`],rule_id:s[`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 s=>{if(s.dryRun){a({command:`cf rum rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/v2/${s[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(s[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(s[`ruleset-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rum.rules.list({account_id:l,ruleset_id:s[`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 u=>{if(u.dryRun){a({command:`cf rum rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/v2/${u[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(u[`ruleset-id`]))}/rule/${u[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(u[`rule-id`]))}`,pathParams:{"ruleset-id":String(u[`ruleset-id`]??``),"rule-id":String(u[`rule-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({host:l(u.host,`host`,`text`),inclusive:u.inclusive,is_paused:u[`is-paused`],paths:u.paths}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.rum.rules.update({body:e,account_id:f,ruleset_id:u[`ruleset-id`],rule_id:u[`rule-id`]})),{successLabel:`Updated`});return}let p=c({host:l(u.host,`host`,`text`),inclusive:u.inclusive,is_paused:u[`is-paused`],paths:u.paths});i(await o(`Updating`,async()=>d.rum.rules.update({body:p,account_id:f,ruleset_id:u[`ruleset-id`],rule_id:u[`rule-id`]})),{successLabel:`Updated`})}},S={command:`rules`,describe:`Rules that control which pages and paths are tracked by Web Analytics`,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 u=>{if(u.dryRun){a({command:`cf rum site-info create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({auto_install:u[`auto-install`],host:l(u.host,`host`,`text`),zone_tag:l(u[`zone-tag`],`zone-tag`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.rum.siteInfo.create({...e,account_id:f})),{successLabel:`Created`});return}let p=c({auto_install:u[`auto-install`],host:l(u.host,`host`,`text`),zone_tag:l(u[`zone-tag`],`zone-tag`,`text`)});i(await o(`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 s=>{if(s.dryRun){a({command:`cf rum site-info delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/${s[`site-id`]==null?`<site-id>`:encodeURIComponent(String(s[`site-id`]))}`,pathParams:{"site-id":String(s[`site-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await u({force:!!s.force})){process.stderr.write(`Aborted.
4
- `);return}i(await o(`Deleting`,async()=>c.rum.siteInfo.delete({account_id:l,site_id:s[`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 s=>{if(s.dryRun){a({command:`cf rum site-info get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/${s[`site-id`]==null?`<site-id>`:encodeURIComponent(String(s[`site-id`]))}`,pathParams:{"site-id":String(s[`site-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rum.siteInfo.get({account_id:l,site_id:s[`site-id`]})),{successLabel:`Loaded`})}};function k(e){return e.option(`all`,{type:`boolean`,description:`When true, includes sites that are disabled or paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-site-tags`,describe:`Returns all site tags for an account as an array of site tag strings. This endpoint returns all results without pagination.`,builder:k,handler:async s=>{let c={all:s.all};if(s.dryRun){a({command:`cf rum site-info list-site-tags`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/site_tag/list`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.rum.siteInfo.listSiteTags({account_id:u,...c})),{successLabel:`Loaded`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list-zone-tags`,describe:`Returns all zone tags associated with Web Analytics sites for an account. These can be used to filter or exclude zones in the zone selection input. This endpoint returns all results without pagination.`,builder:j,handler:async s=>{if(s.dryRun){a({command:`cf rum site-info list-zone-tags`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/zone_tag/list`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rum.siteInfo.listZoneTags({account_id:l})),{successLabel:`Loaded`})}};function N(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 P={command:`list`,describe:`Lists all Web Analytics sites of an account.`,builder:d(N),handler:async s=>{let c={per_page:s[`per-page`],page:s.page,order_by:s[`order-by`]};if(s.dryRun){a({command:`cf rum site-info list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/list`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.rum.siteInfo.list({account_id:u,...c})),{successLabel:`Loaded`})}};function F(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 I={command:`update <site-id>`,describe:`Updates an existing Web Analytics site.`,builder:F,handler:async u=>{if(u.dryRun){a({command:`cf rum site-info update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/${u[`site-id`]==null?`<site-id>`:encodeURIComponent(String(u[`site-id`]))}`,pathParams:{"site-id":String(u[`site-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({auto_install:u[`auto-install`],enabled:u.enabled,host:l(u.host,`host`,`text`),lite:u.lite,zone_tag:l(u[`zone-tag`],`zone-tag`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.rum.siteInfo.update({...e,account_id:f,site_id:u[`site-id`]})),{successLabel:`Updated`});return}let p=c({auto_install:u[`auto-install`],enabled:u.enabled,host:l(u.host,`host`,`text`),lite:u.lite,zone_tag:l(u[`zone-tag`],`zone-tag`,`text`)});i(await o(`Updating`,async()=>d.rum.siteInfo.update({...p,account_id:f,site_id:u[`site-id`]})),{successLabel:`Updated`})}};function L(e){return e.positional(`hostname`,{type:`string`,description:"The hostname to validate (e.g. example.com). The `pattern` below validates the hostname's structure (label syntax) only. In addition, the hostname must end in a valid public suffix (TLD). For the list of valid suffixes and how it is used, see the Public Suffix List: https://wiki.mozilla.org/Public_Suffix_List/Use_Cases",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`validate-hostname <hostname>`,describe:`Validates that the provided hostname is well-formed, does not contain wildcards, and has a valid TLD. Returns an empty result on success.`,builder:L,handler:async s=>{if(s.dryRun){a({command:`cf rum site-info validate-hostname`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/rum/site_info/validate/${s.hostname==null?`<hostname>`:encodeURIComponent(String(s.hostname))}`,pathParams:{hostname:String(s.hostname??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.rum.siteInfo.validateHostname({account_id:l,hostname:s.hostname})),{successLabel:`Loaded`})}},z={command:`site-info`,describe:`Web Analytics sites — register domains and get the JavaScript beacon snippet`,builder:e=>e.command(w).command(E).command(O).command(P).command(A).command(M).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`rum`,describe:`Real User Measurement (Web Analytics) — track page loads, Core Web Vitals, and visitor metrics`,builder:e=>e.command(S).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{B as default};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e}from"./session-Ckt20hHa.mjs";import{a as t}from"./theme-BePJemMn.mjs";import{i as n}from"./cf-oSz9pud_.mjs";import{r}from"./body-parser-CYD7PKFC.mjs";import{n as i}from"./input-validation-BBKJRoRB.mjs";import{mkdirSync as a,readFileSync as o,writeFileSync as s}from"node:fs";import{isDeepStrictEqual as c}from"node:util";import{dirname as l,join as u}from"node:path";import{createHash as d}from"node:crypto";const f=5e3;function p(e,t=new WeakSet){if(typeof e!=`object`||!e||Array.isArray(e)||t.has(e))return!1;t.add(e);let n=e,r=new Set([`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]),i=Array.isArray(n.type)?n.type:[n.type];if(n.type!==void 0&&!i.every(e=>typeof e==`string`&&r.has(e))||n.description!==void 0&&typeof n.description!=`string`||n.required!==void 0&&(!Array.isArray(n.required)||!n.required.every(e=>typeof e==`string`))||n.enum!==void 0&&!Array.isArray(n.enum)||n.oneOf!==void 0&&(!Array.isArray(n.oneOf)||!n.oneOf.every(e=>p(e,t)))||n.anyOf!==void 0&&(!Array.isArray(n.anyOf)||!n.anyOf.every(e=>p(e,t)))||[`minLength`,`maxLength`,`minimum`,`maximum`].some(e=>n[e]!==void 0&&(typeof n[e]!=`number`||!Number.isFinite(n[e])))||n.properties!==void 0&&(n.properties===null||typeof n.properties!=`object`||Array.isArray(n.properties)||!Object.values(n.properties).every(e=>p(e,t))))return!1;if(n.pattern!==void 0){if(typeof n.pattern!=`string`)return!1;try{new RegExp(n.pattern)}catch{return!1}}return!0}function m(e,t){if(typeof e!=`object`||!e)return;let n=e[t]??e;if(typeof n!=`object`||!n||!p(n))return;let r=n;return r.properties??r.oneOf??r.anyOf?r:void 0}function h(t,r){let i=d(`sha256`).update([e,...r].join(` `)).digest(`hex`).slice(0,32);return u(n(),`cache`,t,`${i}.json`)}function g(e,t){try{let n=JSON.parse(o(h(e,t),`utf-8`));return typeof n?.fetchedAt==`number`&&Date.now()-n.fetchedAt<=36e5&&p(n.schema)?n.schema:void 0}catch{return}}function _(e,t,n){try{let r=h(e,t);a(l(r),{recursive:!0}),s(r,JSON.stringify({fetchedAt:Date.now(),schema:n}),`utf-8`)}catch{}}function v(e){if(typeof e!=`object`||!e)return`the request failed`;let t=e.statusCode;if(t===404)return`not found, or this account can't access it`;if(t===401)return"credentials were rejected; update `CLOUDFLARE_API_TOKEN` or run `cf auth login`";if(t===403)return`these credentials can't read it — check your API token permissions`;let n=e.message;if(!n)return`the request failed`;let r=(n.split(`
3
- `)[0]??``).replace(/\.$/,``);return/^"?timeout"?$/i.test(r)?`the request timed out`:r}function y(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/_/g,`-`).toLowerCase()}function b(e){return e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase())}function x(e){return e.type===void 0&&e.properties===void 0&&e.enum===void 0&&e.const===void 0&&e.oneOf===void 0&&e.anyOf===void 0}function S(e){if(e===null)return`json`;if(Array.isArray(e))return`array`;switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`object`:return`object`;default:return`string`}}function C(e){let t=w(e);if(t.length>1){let e=new Set(t.map(C));return e.size===2&&e.has(`string`)&&e.has(`array`)?`string-or-array`:e.has(void 0)?void 0:e.size===1?[...e][0]??`json`:`json`}if(t[0]!==e)return C(t[0]??{});let n=Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type;if(n===`null`||Array.isArray(e.type)&&e.type.length===1&&e.type[0]===`null`)return`json`;if(n===void 0){let t=e.const===void 0?e.enum:[e.const];if(t?.length){let e=new Set(t.map(S));return e.size===1?[...e][0]??`json`:`json`}}if(n===void 0&&e.properties)return`object`;if(n===void 0&&x(e))return`json`;switch(n){case`number`:case`integer`:return`number`;case`boolean`:return`boolean`;case`array`:return`array`;case`object`:return`object`;default:return`string`}}function w(e){let t=e.oneOf??e.anyOf;return t?.length?t:[e]}function T(e,t,n,r){let i=C(t);if(i===void 0)return;let a=t.enum?.filter(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`);return{name:e.map(y).join(`-`),path:e,type:i,required:n,requiredWhen:r,description:t.description?.split(`
4
- `)[0],choices:a?.length?a.map(String):void 0,schema:t}}function E(e,t){return e===t?e:[...new Set([e,t])].every(e=>e===`string`||e===`array`||e===`string-or-array`)?`string-or-array`:`json`}function D(e,t){let n=E(e.type,t.type),r=e.schema.description??t.schema.description,i=n===`json`||n===`string-or-array`?{description:r}:{type:n===`number`?`number`:n,description:r};return{...e,type:n,required:e.required&&t.required,requiredWhen:k(e.requiredWhen,t.requiredWhen)?e.requiredWhen:void 0,choices:void 0,schema:i,requiredContainer:e.requiredContainer&&t.requiredContainer?!0:void 0}}function O(e,t={}){let n=new Set((t.exclude??[]).map(e=>e.join(`.`))),r=new Map,i=(e,t)=>{let n=r.get(e);r.set(e,n===void 0?t:D(n,t))},a=(e,t,o)=>{let s=w(e);for(let e of s){if(!e.properties)continue;let c=new Set(e.required??[]);for(let[l,u]of Object.entries(e.properties)){let e=[...t,l],d=e.join(`.`);if(n.has(d))continue;let f=w(u).some(e=>e.properties&&Object.keys(e.properties).length>0),p=s.length===1&&c.has(l),m=p&&o===void 0,h=p&&o!==void 0?o:void 0;if(f){a(u,e,p?o:e);let t=[...r.values()].some(t=>t.required===m&&k(t.requiredWhen,h)&&t.path.length>e.length&&e.every((e,n)=>t.path[n]===e));if(p&&!t){let t=T(e,u,m,h);t&&i(d,{...t,requiredContainer:!0})}continue}let g=T(e,u,m,h);g&&i(d,g)}}};return a(e,[]),[...r.values()].sort((e,t)=>e.required===t.required?e.name.localeCompare(t.name):e.required?-1:1)}function k(e,t){return e===t||e!==void 0&&t!==void 0&&e.length===t.length&&e.every((e,n)=>e===t[n])}function A(e,n){if(e.length===0)return`${t.brand(n)}\n (no input fields)`;let r=process.stdout.columns??80,i=e.map(e=>`--${e.name}`),a=Math.min(Math.max(...i.map(e=>e.length))+2,42),o=e.map((e,t)=>{let n=[`[${e.type}]`];e.required?n.push(`[required]`):e.requiredWhen&&n.push(`[required with --${e.requiredWhen.map(y).join(`-`)}-*]`),e.choices&&n.push(`[choices: ${e.choices.join(`, `)}]`),e.schema.const!==void 0&&n.push(`[must be: ${JSON.stringify(e.schema.const)}]`),e.schema.default!==void 0&&n.push(`[default: ${JSON.stringify(e.schema.default)}]`);let o=n.join(` `),s=Math.max(r-a-4,20)-o.length-1,c=e.description===void 0||s<12?``:e.description.length>s?`${e.description.slice(0,s-1)}…`:e.description,l=i[t]??``;return` ${l.length<a?l.padEnd(a):`${l} `}${[c,o].filter(Boolean).join(` `)}`});return[t.brand(n),...o].join(`
5
- `)}const j=`_ $0 -- body dry-run dryRun help h local persist-to persistTo profile quiet q version v zone z`.split(` `);function M(e,t){return t[e.name]??t[b(e.name)]}function N(e,t){return e.filter(n=>P(n,e,t)&&M(n,t)===void 0&&!F(n.path,e,t)&&!(n.requiredContainer&&I(n,e,t)))}function P(e,t,n){return e.required||e.requiredWhen!==void 0&&F(e.requiredWhen,t,n)}function F(e,t,n){return t.some(t=>{let r=M(t,n);if(r===void 0)return!1;if(t.path.length>=e.length)return e.every((e,n)=>t.path[n]===e);if(!t.path.every((t,n)=>e[n]===t))return!1;let i=r;if(typeof i==`string`)try{i=JSON.parse(i)}catch{return!1}for(let n of e.slice(t.path.length)){if(typeof i!=`object`||!i||Array.isArray(i)||!Object.hasOwn(i,n))return!1;i=i[n]}return!0})}function I(e,t,n){return t.some(t=>t!==e&&t.path.length>e.path.length&&e.path.every((e,n)=>t.path[n]===e)&&M(t,n)!==void 0)}function L(e){return e.flatMap(e=>[e.name,b(e.name)])}function R(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)??`undefined`}catch{return`unprintable value`}}function z(e,t,n){let r=r=>{n.push(`--${e.name} expects ${r} (got '${R(t)}')`)};switch(e.type){case`number`:{let n=typeof t==`number`?t:Number(R(t)),i=Array.isArray(e.schema.type)?e.schema.type:[e.schema.type];return Number.isFinite(n)?i.includes(`integer`)&&!i.includes(`number`)&&!Number.isInteger(n)?r(`an integer`):n:r(`a finite number`)}case`boolean`:return typeof t==`boolean`?t:t===`true`?!0:t===`false`?!1:r(`a boolean`);case`array`:case`object`:{let n=t;if(typeof t==`string`)try{n=JSON.parse(t)}catch{return r(`a JSON ${e.type}`)}return(e.type===`array`?Array.isArray(n):typeof n==`object`&&n&&!Array.isArray(n))?n:r(`a JSON ${e.type}`)}case`json`:{let n=Array.isArray(e.schema.type)?e.schema.type:[e.schema.type];if(n.length===1&&n[0]===`null`)return t===null||t===`null`?null:r(`null`);if(typeof t!=`string`)return t;try{return JSON.parse(t)}catch{return i(t,e.name,`json`)}}case`string-or-array`:if(typeof t!=`string`)return Array.isArray(t)?t:r(`a string or JSON array`);try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return i(t,e.name,`text`);default:{let n=Array.isArray(t)?t[t.length-1]:t;return typeof n==`boolean`?r(`a string`):typeof n==`string`?i(n,e.name,`text`):R(n)}}}function B(e,t,n){let{const:r,enum:i,pattern:a,minLength:o,maxLength:s,minimum:l,maximum:u}=e.schema;if(r!==void 0&&!c(t,r)){n.push(`--${e.name} must be ${JSON.stringify(r)}`);return}if(i!==void 0&&!i.some(e=>c(t,e))){n.push(`--${e.name} must be one of: ${i.map(R).join(`, `)}`);return}typeof t==`string`&&(a!==void 0&&!new RegExp(a).test(t)&&n.push(`--${e.name} does not match the required format (${a})`),o!==void 0&&t.length<o&&n.push(`--${e.name} must be at least ${o} characters`),s!==void 0&&t.length>s&&n.push(`--${e.name} must be at most ${s} characters`)),typeof t==`number`&&(l!==void 0&&t<l&&n.push(`--${e.name} must be at least ${l}`),u!==void 0&&t>u&&n.push(`--${e.name} must be at most ${u}`))}function V(e,t=[]){let n=new Set([...j,...t]),r=new Map;for(let t of Object.keys(e))!n.has(t)&&!r.has(y(t))&&r.set(y(t),t);return[...r.values()].sort()}function H(e,t,n={}){let i=[],a={},o=[...n.reserved??[],...L(e)];for(let n of e){let o=M(n,t);if(o===void 0){P(n,e,t)&&!F(n.path,e,t)&&!(n.requiredContainer&&I(n,e,t))&&i.push(`--${n.name} is required`);continue}let s=z(n,o,i);s!==void 0&&(B(n,s,i),r(a,n.path,s))}for(let e of V(t,o))i.push(`Unknown flag --${e}`);return{body:a,errors:i}}export{O as a,v as c,_ as d,A as i,m as l,L as n,V as o,N as r,f as s,H as t,g as u};