cf 0.0.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,T as t,h as n,t as r,x as i}from"./auth-CQcAgnOy.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-CjcQ6ato.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";function f(e){return e.option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`id`,{type:`string`,description:`gateway id`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-5000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported.`,choices:[`postpaid`],default:`postpaid`}).option(`zdr`,{type:`boolean`,description:`The zdr 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 p={command:`create`,describe:`Creates a new AI Gateway.`,builder:f,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways`,pathParams:{},bodyKind:`json`,body:{authentication:e.authentication,"cache-invalidate-on-update":e[`cache-invalidate-on-update`],"cache-ttl":e[`cache-ttl`],"collect-logs":e[`collect-logs`],id:e.id,"log-management":e[`log-management`],"log-management-strategy":e[`log-management-strategy`],logpush:e.logpush,"logpush-public-key":e[`logpush-public-key`],"rate-limiting-interval":e[`rate-limiting-interval`],"rate-limiting-limit":e[`rate-limiting-limit`],"rate-limiting-technique":e[`rate-limiting-technique`],"retry-backoff":e[`retry-backoff`],"retry-delay":e[`retry-delay`],"retry-max-attempts":e[`retry-max-attempts`],"workers-ai-billing-mode":e[`workers-ai-billing-mode`],zdr:e.zdr,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways`,{body:t})),{successLabel:`Created`});return}if(e[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(e[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(e[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(e.id===void 0&&(e.id=await t(`id`,`gateway id`)),e[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(e[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let m={};e.authentication!==void 0&&a(m,[`authentication`],e.authentication),e[`cache-invalidate-on-update`]!==void 0&&a(m,[`cache_invalidate_on_update`],e[`cache-invalidate-on-update`]),e[`cache-ttl`]!==void 0&&a(m,[`cache_ttl`],e[`cache-ttl`]),e[`collect-logs`]!==void 0&&a(m,[`collect_logs`],e[`collect-logs`]),e.id!==void 0&&a(m,[`id`],u(e.id,`id`,`text`)),e[`log-management`]!==void 0&&a(m,[`log_management`],e[`log-management`]),e[`log-management-strategy`]!==void 0&&a(m,[`log_management_strategy`],u(e[`log-management-strategy`],`log-management-strategy`,`text`)),e.logpush!==void 0&&a(m,[`logpush`],e.logpush),e[`logpush-public-key`]!==void 0&&a(m,[`logpush_public_key`],u(e[`logpush-public-key`],`logpush-public-key`,`text`)),e[`rate-limiting-interval`]!==void 0&&a(m,[`rate_limiting_interval`],e[`rate-limiting-interval`]),e[`rate-limiting-limit`]!==void 0&&a(m,[`rate_limiting_limit`],e[`rate-limiting-limit`]),e[`rate-limiting-technique`]!==void 0&&a(m,[`rate_limiting_technique`],u(e[`rate-limiting-technique`],`rate-limiting-technique`,`text`)),e[`retry-backoff`]!==void 0&&a(m,[`retry_backoff`],u(e[`retry-backoff`],`retry-backoff`,`text`)),e[`retry-delay`]!==void 0&&a(m,[`retry_delay`],e[`retry-delay`]),e[`retry-max-attempts`]!==void 0&&a(m,[`retry_max_attempts`],e[`retry-max-attempts`]),e[`workers-ai-billing-mode`]!==void 0&&a(m,[`workers_ai_billing_mode`],u(e[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`)),e.zdr!==void 0&&a(m,[`zdr`],e.zdr),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function m(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`name`,{type:`string`,description:`The name 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 ee={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:m,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/datasets`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`json`,body:{enable:e.enable,name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/datasets`,{body:t})),{successLabel:`Created`});return}if(e.enable===void 0)throw Error(`--enable is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.enable!==void 0&&a(m,[`enable`],e.enable),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/datasets`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function te(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:te,handler:async t=>{if(t.dryRun){c({command:`cf ai-gateway datasets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${t[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(t[`gateway-id`]))}/datasets/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{"gateway-id":String(t[`gateway-id`]??``),id:String(t.id??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>a.aiGateway.datasets.delete(o,t[`gateway-id`],t.id)),{successLabel:`Deleted`})}};function g(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:g,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/datasets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.datasets.get(a,e[`gateway-id`],e.id)),{successLabel:`Loaded`})}};function v(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`name`,{type:`string`,description:`Name`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`search`,{type:`string`,description:`Search by id, name, filters`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:v,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],name:e.name,enable:e.enable,search:e.search};if(e.dryRun){c({command:`cf ai-gateway datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/datasets`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.aiGateway.datasets.list(o,e[`gateway-id`],t)),{successLabel:`Loaded`})}};function b(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`name`,{type:`string`,description:`The name 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 <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:b,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway datasets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/datasets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`json`,body:{enable:e.enable,name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Updating`,async()=>f.put(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/datasets/${encodeURIComponent(String(e.id))}`,{body:t})),{successLabel:`Updated`});return}if(e.enable===void 0)throw Error(`--enable is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.enable!==void 0&&a(m,[`enable`],e.enable),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Updating`,async()=>f.put(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/datasets/${encodeURIComponent(String(e.id))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},S={command:`datasets`,describe:`Curated collections of gateway logs used as inputs for evaluations and fine-tuning`,builder:e=>e.command(ee).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const w={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:C,handler:async t=>{if(t.dryRun){c({command:`cf ai-gateway delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}s(await l(`Deleting`,async()=>a.aiGateway.delete(o,t.id)),{successLabel:`Deleted`})}};function T(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`version-id`,{type:`string`,description:`The version_id 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 E={command:`create-deployment <id>`,describe:`Create a new AI Gateway Dynamic Route Deployment.`,builder:T,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing create-deployment`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/deployments`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`json`,body:{"version-id":e[`version-id`],body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes/${encodeURIComponent(String(e.id))}/deployments`,{body:t})),{successLabel:`Created`});return}e[`version-id`]===void 0&&(e[`version-id`]=await t(`version-id`,`The version_id field`));let m={};e[`version-id`]!==void 0&&a(m,[`version_id`],u(e[`version-id`],`version-id`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes/${encodeURIComponent(String(e.id))}/deployments`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function D(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`create-version <id>`,describe:`Create a new AI Gateway Dynamic Route Version.`,builder:D,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing create-version`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),a=e.local?d:await n(t);if(e.accountId=a,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${a}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes/${encodeURIComponent(String(e.id))}/versions`,{body:n})),{successLabel:`Created`});return}s(await l(`Creating`,async()=>t.aiGateway.dynamicRouting.createVersion(a,e[`gateway-id`],e.id)),{successLabel:`Created`})}};function k(e){return e.positional(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name 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 A={command:`create <gateway-id>`,describe:`Create a new AI Gateway Dynamic Route.`,builder:k,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes`,{body:t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function j(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const M={command:`delete <id>`,describe:`Delete an AI Gateway Dynamic Route.`,builder:j,handler:async t=>{if(t.dryRun){c({command:`cf ai-gateway dynamic-routing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${t[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(t[`gateway-id`]))}/routes/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{"gateway-id":String(t[`gateway-id`]??``),id:String(t.id??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}s(await l(`Deleting`,async()=>a.aiGateway.dynamicRouting.delete(o,t[`gateway-id`],t.id)),{successLabel:`Deleted`})}};function N(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get-version <version-id>`,describe:`Get an AI Gateway Dynamic Route Version.`,builder:N,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing get-version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions/${e[`version-id`]==null?`<version-id>`:encodeURIComponent(String(e[`version-id`]))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``),"version-id":String(e[`version-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.dynamicRouting.getVersion(a,e[`gateway-id`],e.id,e[`version-id`])),{successLabel:`Loaded`})}};function F(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <id>`,describe:`Get an AI Gateway Dynamic Route.`,builder:F,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.dynamicRouting.get(a,e[`gateway-id`],e.id)),{successLabel:`Loaded`})}};function L(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list-deployments <id>`,describe:`List all AI Gateway Dynamic Route Deployments.`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing list-deployments`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/deployments`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.dynamicRouting.listDeployments(a,e[`gateway-id`],e.id)),{successLabel:`Loaded`})}};function z(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list-versions <id>`,describe:`List all AI Gateway Dynamic Route Versions.`,builder:z,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing list-versions`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.dynamicRouting.listVersions(a,e[`gateway-id`],e.id)),{successLabel:`Loaded`})}};function V(e){return e.option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`list`,describe:`List all AI Gateway Dynamic Routes.`,builder:V,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.dynamicRouting.list(a,e[`gateway-id`])),{successLabel:`Loaded`})}};function U(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name 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 W={command:`update <id>`,describe:`Update an AI Gateway Dynamic Route.`,builder:U,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway dynamic-routing update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/routes/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Updating`,async()=>f.patch(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes/${encodeURIComponent(String(e.id))}`,{body:t})),{successLabel:`Updated`});return}e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Updating`,async()=>f.patch(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/routes/${encodeURIComponent(String(e.id))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},G={command:`dynamic-routing`,describe:`Route requests across multiple AI providers with fallback, load-balancing, and versioned deployments`,builder:e=>e.command(A).command(E).command(O).command(M).command(I).command(P).command(H).command(R).command(B).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order-by`,{type:`string`,description:`Order by`}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`list`,describe:`Lists all available evaluator types for scoring AI gateway responses.`,builder:K,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order_by:e[`order-by`],order_by_direction:e[`order-by-direction`]};if(e.dryRun){c({command:`cf ai-gateway evaluation-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/evaluation-types`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.aiGateway.evaluationTypes.list(o,t)),{successLabel:`Loaded`})}},J={command:`evaluation-types`,describe:`Available evaluator types for scoring AI gateway responses (accuracy, toxicity, etc.)`,builder:e=>e.command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Y(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dataset-ids`,{type:`string`,array:!0,description:`The dataset_ids field`}).option(`evaluation-type-ids`,{type:`string`,array:!0,description:`The evaluation_type_ids field`}).option(`name`,{type:`string`,description:`The name 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:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:Y,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway evaluations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/evaluations`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`json`,body:{"dataset-ids":e[`dataset-ids`],"evaluation-type-ids":e[`evaluation-type-ids`],name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/evaluations`,{body:t})),{successLabel:`Created`});return}if(e[`dataset-ids`]===void 0)throw Error(`--dataset-ids is required (or pass --body with this field set).`);if(e[`evaluation-type-ids`]===void 0)throw Error(`--evaluation-type-ids is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e[`dataset-ids`]!==void 0&&a(m,[`dataset_ids`],e[`dataset-ids`]),e[`evaluation-type-ids`]!==void 0&&a(m,[`evaluation_type_ids`],e[`evaluation-type-ids`]),e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/evaluations`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Z(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Q={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:Z,handler:async t=>{if(t.dryRun){c({command:`cf ai-gateway evaluations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${t[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(t[`gateway-id`]))}/evaluations/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{"gateway-id":String(t[`gateway-id`]??``),id:String(t.id??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
6
+ `);return}s(await l(`Deleting`,async()=>a.aiGateway.evaluations.delete(o,t[`gateway-id`],t.id)),{successLabel:`Deleted`})}};function ne(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:ne,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway evaluations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/evaluations/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.evaluations.get(a,e[`gateway-id`],e.id)),{successLabel:`Loaded`})}};function ie(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`name`,{type:`string`,description:`Name`}).option(`processed`,{type:`boolean`,description:`Processed`}).option(`search`,{type:`string`,description:`Search by id, name`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:ie,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],name:e.name,processed:e.processed,search:e.search};if(e.dryRun){c({command:`cf ai-gateway evaluations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/evaluations`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.aiGateway.evaluations.list(o,e[`gateway-id`],t)),{successLabel:`Loaded`})}},oe={command:`evaluations`,describe:`Run quality evaluations against gateway logs or datasets to score model outputs`,builder:e=>e.command(X).command(Q).command(re).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function se(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:se,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.get(a,e.id)),{successLabel:`Loaded`})}};function le(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search by id`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:le,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){c({command:`cf ai-gateway list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.aiGateway.list(o,t)),{successLabel:`Loaded`})}};function de(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`,`cost`,`tokens_in`,`tokens_out`,`duration`,`feedback`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`limit`,{type:`number`,description:`Limit`}).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 fe={command:`delete <gateway-id>`,describe:`Deletes gateway log entries matching the specified criteria.`,builder:de,handler:async t=>{let a={order_by:t[`order-by`],order_by_direction:t[`order-by-direction`],filters:t.filters,limit:t.limit};if(t.dryRun){c({command:`cf ai-gateway logs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${t[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(t[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(t[`gateway-id`]??``)},query:a,bodyKind:`none`});return}let o=await r(t),u=t.local?d:await n(o);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
7
+ `);return}s(await l(`Deleting`,async()=>o.aiGateway.logs.delete(u,t[`gateway-id`],a)),{successLabel:`Deleted`})}};function pe(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`feedback`,{type:`number`,description:`The feedback field`}).option(`score`,{type:`number`,description:`The score 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 me={command:`edit <id>`,describe:`Updates metadata for an AI Gateway log entry.`,builder:pe,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway logs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/logs/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``),"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`json`,body:{feedback:e.feedback,score:e.score,body:e.body}});return}let t=await r(e),u=e.local?d:await n(t);if(e.accountId=u,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.patch(`/accounts/${u}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/logs/${encodeURIComponent(String(e.id))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.feedback!==void 0&&a(f,[`feedback`],e.feedback),e.score!==void 0&&a(f,[`score`],e.score),s(await l(`Updating`,async()=>t.patch(`/accounts/${u}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/logs/${encodeURIComponent(String(e.id))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function he(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <id>`,describe:`Retrieves detailed information for a specific AI Gateway log entry.`,builder:he,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/logs/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``),"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.logs.get(e.id,e[`gateway-id`],a)),{successLabel:`Loaded`})}};function _e(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`meta-info`,{type:`boolean`,description:`Meta info`}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`start-date`,{type:`string`,description:`Start date`}).option(`end-date`,{type:`string`,description:`End date`}).option(`min-cost`,{type:`number`,description:`Min cost`}).option(`max-cost`,{type:`number`,description:`Max cost`}).option(`min-tokens-in`,{type:`number`,description:`Min tokens in`}).option(`max-tokens-in`,{type:`number`,description:`Max tokens in`}).option(`min-tokens-out`,{type:`number`,description:`Min tokens out`}).option(`max-tokens-out`,{type:`number`,description:`Max tokens out`}).option(`min-total-tokens`,{type:`number`,description:`Min total tokens`}).option(`max-total-tokens`,{type:`number`,description:`Max total tokens`}).option(`min-duration`,{type:`number`,description:`Min duration`}).option(`max-duration`,{type:`number`,description:`Max duration`}).option(`feedback`,{type:`string`,description:`Feedback`}).option(`success`,{type:`boolean`,description:`Success`}).option(`cached`,{type:`boolean`,description:`Cached`}).option(`model`,{type:`string`,description:`Model`}).option(`model-type`,{type:`string`,description:`Model type`}).option(`provider`,{type:`string`,description:`Provider`}).option(`request-content-type`,{type:`string`,description:`Request content type`}).option(`response-content-type`,{type:`string`,description:`Response content type`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`list`,describe:`Lists request/response log entries for the AI gateway with filtering and pagination.`,builder:_e,handler:async e=>{let t={search:e.search,page:e.page,per_page:e[`per-page`],order_by:e[`order-by`],order_by_direction:e[`order-by-direction`],filters:e.filters,meta_info:e[`meta-info`],direction:e.direction,start_date:e[`start-date`],end_date:e[`end-date`],min_cost:e[`min-cost`],max_cost:e[`max-cost`],min_tokens_in:e[`min-tokens-in`],max_tokens_in:e[`max-tokens-in`],min_tokens_out:e[`min-tokens-out`],max_tokens_out:e[`max-tokens-out`],min_total_tokens:e[`min-total-tokens`],max_total_tokens:e[`max-total-tokens`],min_duration:e[`min-duration`],max_duration:e[`max-duration`],feedback:e.feedback,success:e.success,cached:e.cached,model:e.model,model_type:e[`model-type`],provider:e.provider,request_content_type:e[`request-content-type`],response_content_type:e[`response-content-type`]};if(e.dryRun){c({command:`cf ai-gateway logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.aiGateway.logs.list(o,e[`gateway-id`],t)),{successLabel:`Loaded`})}};function ye(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`request <id>`,describe:`Retrieves the original request payload for an AI Gateway log entry.`,builder:ye,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway logs request`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/logs/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/request`,pathParams:{id:String(e.id??``),"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.logs.request(e.id,e[`gateway-id`],a)),{successLabel:`Loaded`})}};function xe(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`response <id>`,describe:`Retrieves the response payload for an AI Gateway log entry.`,builder:xe,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway logs response`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/logs/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/response`,pathParams:{id:String(e.id??``),"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.logs.response(e.id,e[`gateway-id`],a)),{successLabel:`Loaded`})}},Ce={command:`logs`,describe:`Inspect individual request/response pairs that passed through the gateway`,builder:e=>e.command(fe).command(me).command(ge).command(ve).command(be).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`alias`,{type:`string`,description:`The alias field`}).option(`default-config`,{type:`boolean`,description:`The default_config field`}).option(`provider-slug`,{type:`string`,description:`The provider_slug field`}).option(`rate-limit`,{type:`number`,description:`The rate_limit field`}).option(`rate-limit-period`,{type:`number`,description:`The rate_limit_period field`,default:60}).option(`secret`,{type:`string`,description:`The secret field`}).option(`secret-id`,{type:`string`,description:`The secret_id 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 Te={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:we,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway provider-configs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/provider_configs`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},bodyKind:`json`,body:{alias:e.alias,"default-config":e[`default-config`],"provider-slug":e[`provider-slug`],"rate-limit":e[`rate-limit`],"rate-limit-period":e[`rate-limit-period`],secret:e.secret,"secret-id":e[`secret-id`],body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/provider_configs`,{body:t})),{successLabel:`Created`});return}if(e.alias===void 0&&(e.alias=await t(`alias`,`The alias field`)),e[`default-config`]===void 0)throw Error(`--default-config is required (or pass --body with this field set).`);e[`provider-slug`]===void 0&&(e[`provider-slug`]=await t(`provider-slug`,`The provider_slug field`)),e.secret===void 0&&(e.secret=await t(`secret`,`The secret field`)),e[`secret-id`]===void 0&&(e[`secret-id`]=await t(`secret-id`,`The secret_id field`));let m={};e.alias!==void 0&&a(m,[`alias`],u(e.alias,`alias`,`text`)),e[`default-config`]!==void 0&&a(m,[`default_config`],e[`default-config`]),e[`provider-slug`]!==void 0&&a(m,[`provider_slug`],u(e[`provider-slug`],`provider-slug`,`text`)),e[`rate-limit`]!==void 0&&a(m,[`rate_limit`],e[`rate-limit`]),e[`rate-limit-period`]!==void 0&&a(m,[`rate_limit_period`],e[`rate-limit-period`]),e.secret!==void 0&&a(m,[`secret`],u(e.secret,`secret`,`text`)),e[`secret-id`]!==void 0&&a(m,[`secret_id`],u(e[`secret-id`],`secret-id`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/provider_configs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Ee(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const De={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:Ee,handler:async t=>{if(t.dryRun){c({command:`cf ai-gateway provider-configs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${t[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(t[`gateway-id`]))}/provider_configs/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{"gateway-id":String(t[`gateway-id`]??``),id:String(t.id??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
8
+ `);return}s(await l(`Deleting`,async()=>a.aiGateway.providerConfigs.delete(o,t[`gateway-id`],t.id)),{successLabel:`Deleted`})}};function $(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Oe={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:$,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){c({command:`cf ai-gateway provider-configs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/provider_configs`,pathParams:{"gateway-id":String(e[`gateway-id`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.aiGateway.providerConfigs.list(o,e[`gateway-id`],t)),{successLabel:`Loaded`})}};function ke(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`secret`,{type:`string`,description:`The secret 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 Ae={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:ke,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway provider-configs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/provider_configs/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),id:String(e.id??``)},bodyKind:`json`,body:{secret:e.secret,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Updating`,async()=>f.put(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/provider_configs/${encodeURIComponent(String(e.id))}`,{body:t})),{successLabel:`Updated`});return}e.secret===void 0&&(e.secret=await t(`secret`,`The secret field`));let m={};e.secret!==void 0&&a(m,[`secret`],u(e.secret,`secret`,`text`)),s(await l(`Updating`,async()=>f.put(`/accounts/${p}/ai-gateway/gateways/${encodeURIComponent(String(e[`gateway-id`]))}/provider_configs/${encodeURIComponent(String(e.id))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},je={command:`provider-configs`,describe:`Store API keys and endpoint settings for each upstream AI provider`,builder:e=>e.command(Te).command(De).command(Oe).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-5000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported.`,choices:[`postpaid`]}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const Ne={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:Me,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`json`,body:{authentication:e.authentication,"cache-invalidate-on-update":e[`cache-invalidate-on-update`],"cache-ttl":e[`cache-ttl`],"collect-logs":e[`collect-logs`],"log-management":e[`log-management`],"log-management-strategy":e[`log-management-strategy`],logpush:e.logpush,"logpush-public-key":e[`logpush-public-key`],"rate-limiting-interval":e[`rate-limiting-interval`],"rate-limiting-limit":e[`rate-limiting-limit`],"rate-limiting-technique":e[`rate-limiting-technique`],"retry-backoff":e[`retry-backoff`],"retry-delay":e[`retry-delay`],"retry-max-attempts":e[`retry-max-attempts`],"store-id":e[`store-id`],"stripe-authorization":e[`stripe-authorization`],"workers-ai-billing-mode":e[`workers-ai-billing-mode`],zdr:e.zdr,body:e.body}});return}let t=await r(e),f=e.local?d:await n(t);if(e.accountId=f,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${f}/ai-gateway/gateways/${encodeURIComponent(String(e.id))}`,{body:n})),{successLabel:`Updated`});return}if(e[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(e[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(e[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(e[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(e[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let p={};e.authentication!==void 0&&a(p,[`authentication`],e.authentication),e[`cache-invalidate-on-update`]!==void 0&&a(p,[`cache_invalidate_on_update`],e[`cache-invalidate-on-update`]),e[`cache-ttl`]!==void 0&&a(p,[`cache_ttl`],e[`cache-ttl`]),e[`collect-logs`]!==void 0&&a(p,[`collect_logs`],e[`collect-logs`]),e[`log-management`]!==void 0&&a(p,[`log_management`],e[`log-management`]),e[`log-management-strategy`]!==void 0&&a(p,[`log_management_strategy`],u(e[`log-management-strategy`],`log-management-strategy`,`text`)),e.logpush!==void 0&&a(p,[`logpush`],e.logpush),e[`logpush-public-key`]!==void 0&&a(p,[`logpush_public_key`],u(e[`logpush-public-key`],`logpush-public-key`,`text`)),e[`rate-limiting-interval`]!==void 0&&a(p,[`rate_limiting_interval`],e[`rate-limiting-interval`]),e[`rate-limiting-limit`]!==void 0&&a(p,[`rate_limiting_limit`],e[`rate-limiting-limit`]),e[`rate-limiting-technique`]!==void 0&&a(p,[`rate_limiting_technique`],u(e[`rate-limiting-technique`],`rate-limiting-technique`,`text`)),e[`retry-backoff`]!==void 0&&a(p,[`retry_backoff`],u(e[`retry-backoff`],`retry-backoff`,`text`)),e[`retry-delay`]!==void 0&&a(p,[`retry_delay`],e[`retry-delay`]),e[`retry-max-attempts`]!==void 0&&a(p,[`retry_max_attempts`],e[`retry-max-attempts`]),e[`store-id`]!==void 0&&a(p,[`store_id`],u(e[`store-id`],`store-id`,`text`)),e[`stripe-authorization`]!==void 0&&a(p,[`stripe`,`authorization`],u(e[`stripe-authorization`],`stripe-authorization`,`text`)),e[`workers-ai-billing-mode`]!==void 0&&a(p,[`workers_ai_billing_mode`],u(e[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`)),e.zdr!==void 0&&a(p,[`zdr`],e.zdr),s(await l(`Updating`,async()=>t.put(`/accounts/${f}/ai-gateway/gateways/${encodeURIComponent(String(e.id))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Pe(e){return e.positional(`provider`,{type:`string`,description:`Provider`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`get <provider>`,describe:`Retrieves the endpoint URL for an AI Gateway.`,builder:Pe,handler:async e=>{if(e.dryRun){c({command:`cf ai-gateway urls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/ai-gateway/gateways/${e[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(e[`gateway-id`]))}/url/${e.provider==null?`<provider>`:encodeURIComponent(String(e.provider))}`,pathParams:{"gateway-id":String(e[`gateway-id`]??``),provider:String(e.provider??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.aiGateway.urls.get(e[`gateway-id`],a,e.provider)),{successLabel:`Loaded`})}},Ie={command:`urls`,describe:`Retrieve the gateway's proxy URL used by clients to send inference requests`,builder:e=>e.command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Le={command:`ai-gateway`,describe:`Proxy, cache, rate-limit, and observe requests to AI providers — OpenAI, Anthropic, Workers AI, and more`,builder:e=>e.command(p).command(w).command(ce).command(ue).command(Ne).command(S).command(G).command(J).command(oe).command(Ce).command(je).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Le as default};