cf 0.9.0 → 0.9.1

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 (183) hide show
  1. package/dist/{abuse-reports-DnNvw2gG.mjs → abuse-reports-CzDAjFpo.mjs} +1 -1
  2. package/dist/{access-RbqBFrSC.mjs → access-CxyW_sIW.mjs} +1 -1
  3. package/dist/{account-D7xvYqDx.mjs → account-Dd4-tDYJ.mjs} +1 -1
  4. package/dist/{account-tags-CKRh1jra.mjs → account-tags-65fAlHrf.mjs} +1 -1
  5. package/dist/{accounts-2pGhN4s8.mjs → accounts-Bp5KGc6r.mjs} +1 -1
  6. package/dist/{acm-Szq4CoQN.mjs → acm-CHacxa3s.mjs} +1 -1
  7. package/dist/{addressing-CgTTbuCF.mjs → addressing-BnqNmmYN.mjs} +1 -1
  8. package/dist/{agent-memory-C8pT01pR.mjs → agent-memory-D--BQS0W.mjs} +1 -1
  9. package/dist/{ai-Cn0BniR4.mjs → ai-BnVlQDiI.mjs} +1 -1
  10. package/dist/{ai-audit-CCygMmsh.mjs → ai-audit-CfpDKXkD.mjs} +1 -1
  11. package/dist/{ai-gateway-D4tATNRV.mjs → ai-gateway-oG4j_oYN.mjs} +1 -1
  12. package/dist/{ai-search-2xP8FP_W.mjs → ai-search-B2l3B_jn.mjs} +1 -1
  13. package/dist/{ai-security-AUfzagSE.mjs → ai-security-byjIIrfl.mjs} +1 -1
  14. package/dist/{alerting-DbXVpGv3.mjs → alerting-qa8SkXlD.mjs} +1 -1
  15. package/dist/{analytics-UQrIx99t.mjs → analytics-DeIKjC9n.mjs} +1 -1
  16. package/dist/{analytics_engine-B_bMbfxW.mjs → analytics_engine-BnECMIWJ.mjs} +1 -1
  17. package/dist/{api-security-pSJdgmtK.mjs → api-security-MfHbfZyf.mjs} +1 -1
  18. package/dist/{argo-Br60zF3y.mjs → argo-DFerMyXF.mjs} +1 -1
  19. package/dist/{artifacts-D8HMRQmb.mjs → artifacts-CtyEYYDa.mjs} +1 -1
  20. package/dist/{audit-logs-BIHP5-rk.mjs → audit-logs-retFtvow.mjs} +1 -1
  21. package/dist/{auth-C6MhC9EZ.mjs → auth-DuLchM18.mjs} +2 -2
  22. package/dist/{auth-MeSu8lFz.mjs → auth-aazs91XL.mjs} +1 -1
  23. package/dist/{billing-0RNCYBJM.mjs → billing-CxQVqpGZ.mjs} +1 -1
  24. package/dist/{bot-management-uhBRnSPl.mjs → bot-management-Rli7v7tg.mjs} +1 -1
  25. package/dist/{botnet-feed-DEbMknrE.mjs → botnet-feed-Cw6XSEf8.mjs} +1 -1
  26. package/dist/{brand-protection-DY2qPL8d.mjs → brand-protection-CTvnHGfV.mjs} +1 -1
  27. package/dist/{browser-extension-DBsmLCUj.mjs → browser-extension-q79xHrVW.mjs} +1 -1
  28. package/dist/{browser-run-C5pYOwtf.mjs → browser-run-FwtwnBzA.mjs} +1 -1
  29. package/dist/{build-Nivzj54_.mjs → build-Dji9BYmV.mjs} +1 -1
  30. package/dist/{cache-BgRIDcFJ.mjs → cache-Cl7vKJwH.mjs} +1 -1
  31. package/dist/{calls-JrRne0U0.mjs → calls-DtK_ANxq.mjs} +1 -1
  32. package/dist/{certificate-authorities-BJ7W8GGQ.mjs → certificate-authorities-DZP1RzAs.mjs} +1 -1
  33. package/dist/{cf-BUKsENG5.mjs → cf-oSz9pud_.mjs} +1 -1
  34. package/dist/{client-certificates-6xxvcOgI.mjs → client-certificates-BtPU9GsQ.mjs} +1 -1
  35. package/dist/{client-side-security-cU0Z1tql.mjs → client-side-security-DAn-3jwp.mjs} +1 -1
  36. package/dist/{cloud-connector-DFooSAcn.mjs → cloud-connector-BpVcvhjZ.mjs} +1 -1
  37. package/dist/{cloudforce-one-Cp4bQmrG.mjs → cloudforce-one-2PecncfX.mjs} +1 -1
  38. package/dist/{connector-interrupts-BR47snkh.mjs → connector-interrupts-ollUcksZ.mjs} +1 -1
  39. package/dist/{connector-telemetry-events-CTMmX2BA.mjs → connector-telemetry-events-D5_3X7XW.mjs} +1 -1
  40. package/dist/{connector-telemetry-snapshots-5Y7m8Cw8.mjs → connector-telemetry-snapshots-CJ9gLRFR.mjs} +1 -1
  41. package/dist/{connectors-BRCQSsos.mjs → connectors-Bo6ZT8PT.mjs} +1 -1
  42. package/dist/{containers-CfKOM_f5.mjs → containers-Bog7j0Hw.mjs} +1 -1
  43. package/dist/{content-scan-CB4xHGv1.mjs → content-scan-D03UfK2X.mjs} +1 -1
  44. package/dist/{csamScanner-AQo_QTlq.mjs → csamScanner-DgS-7ADh.mjs} +1 -1
  45. package/dist/{ct-alerting-Bai-1Z3k.mjs → ct-alerting-8AKtNnUg.mjs} +1 -1
  46. package/dist/{custom-certificates-D6aQIGu2.mjs → custom-certificates-4y35UC1X.mjs} +1 -1
  47. package/dist/{custom-csrs-D0zBkQT5.mjs → custom-csrs-DwBrLh-H.mjs} +1 -1
  48. package/dist/{custom-hostnames-BiOVGwnR.mjs → custom-hostnames-CDIAnsRa.mjs} +1 -1
  49. package/dist/{custom-nameservers-G2MWpRwY.mjs → custom-nameservers-stk7ymnP.mjs} +1 -1
  50. package/dist/{custom-pages-BINNZTds.mjs → custom-pages-vfDxrXbt.mjs} +1 -1
  51. package/dist/{d1-FmAh7T7l.mjs → d1-Cllm-iTT.mjs} +1 -1
  52. package/dist/{data-security-2fmzF_Me.mjs → data-security-rnoSCEdL.mjs} +1 -1
  53. package/dist/{dcv-delegation-Cmxxgi9V.mjs → dcv-delegation-DCRCOL6l.mjs} +1 -1
  54. package/dist/{deploy-BzFbjH6a.mjs → deploy-DGlmjPTS.mjs} +1 -1
  55. package/dist/{deploy-input-BRMQehgs.mjs → deploy-input-DhCo1I0I.mjs} +1 -1
  56. package/dist/{dev-CWaf-qW4.mjs → dev-BbLV0Ti-.mjs} +1 -1
  57. package/dist/{diagnostics-Ca6r_972.mjs → diagnostics-D5Yo2xqx.mjs} +1 -1
  58. package/dist/{directory-CGNWfVQc.mjs → directory-CCndFkbQ.mjs} +1 -1
  59. package/dist/{dispatch-namespaces-CBo5kuf7.mjs → dispatch-namespaces-C48JQ9EA.mjs} +1 -1
  60. package/dist/{dls-CobKlH4N.mjs → dls-BBq99pjI.mjs} +1 -1
  61. package/dist/{dns-OfJXNYkK.mjs → dns-DdQYtenF.mjs} +1 -1
  62. package/dist/{dns-firewall-DZ2ij-nX.mjs → dns-firewall-DdwVtm12.mjs} +1 -1
  63. package/dist/{durable-objects-Cw_y37WB.mjs → durable-objects-BvxXBht_.mjs} +1 -1
  64. package/dist/{email-auth-DuJHdiwN.mjs → email-auth-DFvXKSkg.mjs} +1 -1
  65. package/dist/{email-routing-CRvIUSFm.mjs → email-routing-QBRPBlyl.mjs} +1 -1
  66. package/dist/{email-security-D-P8ln2L.mjs → email-security-BFagcRPP.mjs} +1 -1
  67. package/dist/{email-sending-BwRN8PMW.mjs → email-sending-Ddhe7xjN.mjs} +1 -1
  68. package/dist/{filters-DczM8qpH.mjs → filters-CGisPGD1.mjs} +1 -1
  69. package/dist/{firewall-BMiETRmM.mjs → firewall-DD8U-Brd.mjs} +1 -1
  70. package/dist/{flagship-CPkQMist.mjs → flagship-FJHc4mFi.mjs} +1 -1
  71. package/dist/{fraud-BhX0QNUl.mjs → fraud-AH47n-wL.mjs} +1 -1
  72. package/dist/{google-tag-gateway-CDtRxao4.mjs → google-tag-gateway-149kbuG_.mjs} +1 -1
  73. package/dist/{healthchecks-D2WwALvQ.mjs → healthchecks-DfEUG007.mjs} +1 -1
  74. package/dist/{hostnames-CGAFkYT1.mjs → hostnames-DQUiD3Vr.mjs} +1 -1
  75. package/dist/{hyperdrive-zLFPWFQj.mjs → hyperdrive-RyQboMWI.mjs} +1 -1
  76. package/dist/{iam-Su_hpatD.mjs → iam-BhHYhMXO.mjs} +1 -1
  77. package/dist/{images-D2ZflvBi.mjs → images-CDViyKtZ.mjs} +1 -1
  78. package/dist/index.mjs +1 -1
  79. package/dist/{intel-DPGzVovJ.mjs → intel-YHZbPlS3.mjs} +1 -1
  80. package/dist/{interactive-CM2G03lr.mjs → interactive-mV8PABm6.mjs} +1 -1
  81. package/dist/{ips-C5-NH1b0.mjs → ips-BpCdldFx.mjs} +1 -1
  82. package/dist/{keyless-certificates-Xx-oAN3Z.mjs → keyless-certificates-oNu5jWKF.mjs} +1 -1
  83. package/dist/{keys-B0FBtlOD.mjs → keys-yYtv7Ztr.mjs} +1 -1
  84. package/dist/{kv-BbZ9st5o.mjs → kv-Bi9B4E0A.mjs} +1 -1
  85. package/dist/{leaked-credential-checks-Vonw4inx.mjs → leaked-credential-checks-DKRjBLcr.mjs} +1 -1
  86. package/dist/{load-balancers-Ct5cyyF9.mjs → load-balancers-jRCN75mX.mjs} +1 -1
  87. package/dist/{local-eEF0NF51.mjs → local-DTyuGwTw.mjs} +1 -1
  88. package/dist/{local-runtime-BNCCOZ8s.mjs → local-runtime-IAXhEugU.mjs} +1 -1
  89. package/dist/{logexplorer-BhsAWxCr.mjs → logexplorer-kO8CULiK.mjs} +1 -1
  90. package/dist/{logo-matches-oHYc8Xaz.mjs → logo-matches-LyDAYPbI.mjs} +1 -1
  91. package/dist/{logos-DS0krPAz.mjs → logos-O9f5bGSB.mjs} +1 -1
  92. package/dist/{logpush-CFQBi88z.mjs → logpush-dtXLu3Ck.mjs} +1 -1
  93. package/dist/{logs-C07M9zn-.mjs → logs-DmWWL5f9.mjs} +1 -1
  94. package/dist/{magic-cloud-networking-ZPEK7O5I.mjs → magic-cloud-networking-XbTa6P52.mjs} +1 -1
  95. package/dist/{magic-network-monitoring-CY3CHSpX.mjs → magic-network-monitoring-CpfkgZMp.mjs} +1 -1
  96. package/dist/{magic-transit-CgPZ8iMn.mjs → magic-transit-DwgZeIj-.mjs} +1 -1
  97. package/dist/{managed-transforms-2XyQ14s3.mjs → managed-transforms-DCmogkxv.mjs} +1 -1
  98. package/dist/{matches-CIaCrdrs.mjs → matches-BAeN8VM1.mjs} +1 -1
  99. package/dist/{mcp-D2afM8MD.mjs → mcp-DKZ2D050.mjs} +1 -1
  100. package/dist/{mesh-DLNLi3UT.mjs → mesh-CzIPtuaM.mjs} +1 -1
  101. package/dist/{moq-BBQVNGo1.mjs → moq-CJpE-eNj.mjs} +1 -1
  102. package/dist/{mtls-certificates-C5j0Gn65.mjs → mtls-certificates-Bbm_1lQI.mjs} +1 -1
  103. package/dist/{network-CmuJqtFJ.mjs → network-D2WRXCDe.mjs} +1 -1
  104. package/dist/{network-interconnects-BlajBQqs.mjs → network-interconnects-Clq4X1U8.mjs} +1 -1
  105. package/dist/{oauth-BjHjJtnn.mjs → oauth-BPizUUqP.mjs} +1 -1
  106. package/dist/{oauth-clients-BSthfZP-.mjs → oauth-clients-hilWfAlm.mjs} +1 -1
  107. package/dist/{oauth-scopes-ByUp5bLU.mjs → oauth-scopes-CmbgsPYd.mjs} +1 -1
  108. package/dist/{observability-B5p3iwrq.mjs → observability-DXYgDdU5.mjs} +1 -1
  109. package/dist/{organization-DQIfNVCT.mjs → organization-D41rIvJa.mjs} +1 -1
  110. package/dist/{organizations-L_ycAy6r.mjs → organizations-eNzfOwlP.mjs} +1 -1
  111. package/dist/{origin-ca-certificates-opIcs3_Q.mjs → origin-ca-certificates-DaiAmw45.mjs} +1 -1
  112. package/dist/{origin-post-quantum-encryption-TSMXzoEL.mjs → origin-post-quantum-encryption-7YztBged.mjs} +1 -1
  113. package/dist/{origin-tls-client-auth-5CtcPUR6.mjs → origin-tls-client-auth-DRwURM8s.mjs} +1 -1
  114. package/dist/{page-rules-DPd1Y3IL.mjs → page-rules-B2Csdc4h.mjs} +1 -1
  115. package/dist/{pages-CskAn5mR.mjs → pages-BAL6Q7OY.mjs} +1 -1
  116. package/dist/{pay-per-crawl-BMa_V40s.mjs → pay-per-crawl-C-1-ZAtn.mjs} +1 -1
  117. package/dist/{pipelines-BbJjj1ZQ.mjs → pipelines-cyQOuFLb.mjs} +1 -1
  118. package/dist/{precursor-DgRWBN9_.mjs → precursor-BrweY39h.mjs} +1 -1
  119. package/dist/{progress-C-oFUtvC.mjs → progress-B84wYh91.mjs} +1 -1
  120. package/dist/{prompt-DM4z101s.mjs → prompt-CDtLWxNv.mjs} +1 -1
  121. package/dist/{queries-DrqcK0ZX.mjs → queries-oM8uGZy5.mjs} +1 -1
  122. package/dist/{queues-CutvMZcc.mjs → queues-CTx04ZNw.mjs} +1 -1
  123. package/dist/{r2-sFI62vhq.mjs → r2-CnlIUn7R.mjs} +1 -1
  124. package/dist/{r2-data-catalog-3vzU6FE1.mjs → r2-data-catalog-DLtf9d6o.mjs} +1 -1
  125. package/dist/{radar-Cu9rsTw_.mjs → radar-CGNgGh8v.mjs} +1 -1
  126. package/dist/{rate-limits-HRZ8zMSl.mjs → rate-limits-B1YjnGue.mjs} +1 -1
  127. package/dist/{raw-fetch-25gXED6c.mjs → raw-fetch-Dz-QBoP_.mjs} +1 -1
  128. package/dist/{realtimekit-msnGHBbf.mjs → realtimekit-BPwzhNS9.mjs} +1 -1
  129. package/dist/{registrar-C0EsXf83.mjs → registrar-BEcb90RX.mjs} +1 -1
  130. package/dist/{registrar-sandbox-CR9Rr7jV.mjs → registrar-sandbox-0i1T3zne.mjs} +1 -1
  131. package/dist/{registry-CJvn75Bq.mjs → registry-DDcSvd8H.mjs} +1 -1
  132. package/dist/{reporting-BB6sqe6r.mjs → reporting-CLbjHlnw.mjs} +1 -1
  133. package/dist/{request-tracers-BrsM3zXZ.mjs → request-tracers-BcKpofP1.mjs} +1 -1
  134. package/dist/{resource-sharing-CusU3kiy.mjs → resource-sharing-Ctdi9D-j.mjs} +1 -1
  135. package/dist/{resource-tagging-wXAcblmz.mjs → resource-tagging-DGEyVTDN.mjs} +1 -1
  136. package/dist/{rules-C2BxykEe.mjs → rules-CmuB5rIN.mjs} +1 -1
  137. package/dist/{rulesets-BHvhAeG_.mjs → rulesets-CGaMq8vG.mjs} +1 -1
  138. package/dist/{rum-Dyno5zj3.mjs → rum-QT6EP4JK.mjs} +1 -1
  139. package/dist/{schema-flags-C1BRprT2.mjs → schema-flags-DHryz6SF.mjs} +1 -1
  140. package/dist/{scim-Bb2xHpIz.mjs → scim-BgGsmHrL.mjs} +1 -1
  141. package/dist/{secrets-store-BMhjbceW.mjs → secrets-store-BCpFhYFv.mjs} +1 -1
  142. package/dist/{security-center-DRC4Mf3R.mjs → security-center-BNm4uPVB.mjs} +1 -1
  143. package/dist/{security-txt-Bh_2gymk.mjs → security-txt-Be2Bif0z.mjs} +1 -1
  144. package/dist/{session-Br-q_UIW.mjs → session-Ckt20hHa.mjs} +1 -1
  145. package/dist/{share-DfTpOxhk.mjs → share-Bz2tFTUP.mjs} +1 -1
  146. package/dist/{shared-BNjZc02w.mjs → shared-BzPQog8H.mjs} +1 -1
  147. package/dist/{smart-shield-rHn-Lckq.mjs → smart-shield-SODkOUyO.mjs} +1 -1
  148. package/dist/{snippets-nSLwH8uJ.mjs → snippets-B5jY8v_7.mjs} +1 -1
  149. package/dist/{spawn-Bj8QRFJ5.mjs → spawn-CHkoow5W.mjs} +1 -1
  150. package/dist/{spectrum-DuhSUTZI.mjs → spectrum-BA0a42eM.mjs} +1 -1
  151. package/dist/{speed-Dgby_e1J.mjs → speed-mmOjxOzo.mjs} +1 -1
  152. package/dist/{src-CgAVPA4I.mjs → src-CHW7s5IS.mjs} +4 -4
  153. package/dist/{ssl-BsxTHasY.mjs → ssl-Yr6kELqg.mjs} +1 -1
  154. package/dist/{state-C1m9nwUm.mjs → state-DZC531l2.mjs} +1 -1
  155. package/dist/{stream-CkEOX5Ko.mjs → stream-Cu0kYWbc.mjs} +1 -1
  156. package/dist/{submit-BjdywxTq.mjs → submit-Dl_27e0n.mjs} +1 -1
  157. package/dist/{tags-CFAw_Sce.mjs → tags-Cdo_Pwtr.mjs} +1 -1
  158. package/dist/{tenant-C66iOy5O.mjs → tenant-EX-ANl6X.mjs} +1 -1
  159. package/dist/{tenant-custom-nameservers-CyJZ_AB0.mjs → tenant-custom-nameservers-BPHUeckw.mjs} +1 -1
  160. package/dist/{triggers-Dv22ZXM4.mjs → triggers-Bf9hbP3h.mjs} +1 -1
  161. package/dist/{tunnel-BatkLdds.mjs → tunnel-CDYkWjnt.mjs} +1 -1
  162. package/dist/{tunnels-CstoXOoq.mjs → tunnels-CgyX8R2J.mjs} +1 -1
  163. package/dist/{turnstile-IoRtama4.mjs → turnstile-BUtzlW-0.mjs} +1 -1
  164. package/dist/{ui-DjQ4AQww.mjs → ui-DIpjthrV.mjs} +1 -1
  165. package/dist/{url-info-Hjhwr2la.mjs → url-info-CJsa1Oc9.mjs} +1 -1
  166. package/dist/{url-normalization-C2BP_Kl0.mjs → url-normalization-BeKkOZz7.mjs} +1 -1
  167. package/dist/{url-scanner-DmYVTdAE.mjs → url-scanner-Cz-yl0_3.mjs} +1 -1
  168. package/dist/{user-CVHm-cnB.mjs → user-BxHjEqpd.mjs} +1 -1
  169. package/dist/{values-Cmlw5wGZ.mjs → values-C43NurfT.mjs} +1 -1
  170. package/dist/{vectorize-BQtIqiNO.mjs → vectorize-CjXfiFH4.mjs} +1 -1
  171. package/dist/{versions-CU6Av1vh.mjs → versions-BFbc90Wu.mjs} +1 -1
  172. package/dist/{waiting-rooms-ku9UsAr9.mjs → waiting-rooms-C5jSQv_r.mjs} +1 -1
  173. package/dist/{web-assets-DmSKaxzf.mjs → web-assets-BzM5vVzy.mjs} +1 -1
  174. package/dist/{web3-DVv4jNul.mjs → web3-Ctv9HGiR.mjs} +1 -1
  175. package/dist/{workers-D8czeT64.mjs → workers-D-YbIedB.mjs} +1 -1
  176. package/dist/{workers-builds-DgrejrUc.mjs → workers-builds-B44wc67O.mjs} +1 -1
  177. package/dist/{workflows-BOi5MTEN.mjs → workflows-rFuQWClt.mjs} +1 -1
  178. package/dist/{zaraz-CGSSFJng.mjs → zaraz-BA6kY-b6.mjs} +1 -1
  179. package/dist/{zero-trust-BmA0VkgF.mjs → zero-trust-DOFLlUz1.mjs} +1 -1
  180. package/dist/{zone-Bx5ElO9U.mjs → zone-B_rgejLV.mjs} +1 -1
  181. package/dist/{zone-tags-izd3WWmy.mjs → zone-tags-BWdza4rH.mjs} +1 -1
  182. package/dist/{zones-_SnlZMiM.mjs → zones-DTWO7Vvn.mjs} +1 -1
  183. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,t as l}from"./body-parser-CYD7PKFC.mjs";import{n as u,t as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-DM4z101s.mjs";import{t as h}from"./cli-types-BWdZbsFE.mjs";import{n as ee,t as te}from"./raw-fetch-25gXED6c.mjs";function g(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`model`,{type:`string`,description:`The model field`}).option(`stream`,{type:`boolean`,description:`The stream 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 _={command:`chat-completions <id>`,describe:`Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/chat/completions`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function v(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead.`,default:!1}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`],default:`porter`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`The rewrite_model field`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`,default:5}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own.",default:!1}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`,default:!1}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`,default:1e5}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`,default:86400}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`],default:`all`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`,default:!1}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`,default:!0}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`],default:`sitemap`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`r2`,`web-crawler`]}).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([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].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 --index_method-* flag is set`)}return!0})}const y={command:`create <name> <id>`,describe:`Create a new AI Search instance with the given configuration.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.create({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}let p=l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id});a(await s(`Creating`,async()=>d.aiSearch.create({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function b(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <id>`,describe:`Permanently delete an AI Search instance and all its indexed data.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
2
+ import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{a as r,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,t as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-CDtLWxNv.mjs";import{t as h}from"./cli-types-BWdZbsFE.mjs";import{n as ee,t as te}from"./raw-fetch-Dz-QBoP_.mjs";function g(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`model`,{type:`string`,description:`The model field`}).option(`stream`,{type:`boolean`,description:`The stream 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 _={command:`chat-completions <id>`,describe:`Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/chat/completions`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function v(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead.`,default:!1}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`],default:`porter`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`The rewrite_model field`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`,default:5}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own.",default:!1}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`,default:!1}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`,default:1e5}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`,default:86400}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`],default:`all`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`,default:!1}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`,default:!0}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`],default:`sitemap`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`r2`,`web-crawler`]}).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([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].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 --index_method-* flag is set`)}return!0})}const y={command:`create <name> <id>`,describe:`Create a new AI Search instance with the given configuration.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.create({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}let p=l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id});a(await s(`Creating`,async()=>d.aiSearch.create({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function b(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <id>`,describe:`Permanently delete an AI Search instance and all its indexed data.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
3
3
  `);return}a(await s(`Deleting`,async()=>c.aiSearch.delete({account_id:l,name:r.name,id:r.id})),{successLabel:`Deleted`})}};function S(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <id>`,describe:`Retrieve the configuration and status of an AI Search instance.`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.get({account_id:l,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function w(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`chunks <item-id>`,describe:`Lists chunks for a specific item in an AI Search instance, including their text content.`,builder:w,handler:async r=>{let c={limit:r.limit,offset:r.offset};if(r.dryRun){o({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/chunks`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},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.aiSearch.items.chunks({account_id:u,name:r.name,id:r.id,item_id:r[`item-id`],...c})),{successLabel:`Loaded`})}};function E(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance 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 D={command:`delete <item-id>`,describe:`Deletes a file from a managed AI Search instance and triggers a reindex.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
4
4
  `);return}a(await s(`Deleting`,async()=>c.aiSearch.items.delete({account_id:l,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`download <item-id>`,describe:`Downloads the raw file content for a specific item from the managed AI Search instance storage.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/download`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}await i(r);let a=r.local?e:await t();r.accountId=a;let c=await s(`Loading`,async()=>te(`/accounts/${a}/ai-search/namespaces/${encodeURIComponent(String(r.name))}/instances/${encodeURIComponent(String(r.id))}/items/${encodeURIComponent(String(r[`item-id`]))}/download`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}));ee(r.text===!0?c.toString(`utf-8`):c)}};function A(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <item-id>`,describe:`Retrieves a specific indexed item from an AI Search instance.`,builder:A,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.items.get({account_id:l,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Loaded`})}};function M(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`sort-by`,{type:`string`,description:`Sort order for items. "status" (default) sorts by status priority then last_seen_at. "modified_at" sorts by file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Filter items by source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}`}).option(`item-id`,{type:`string`,description:`Filter items by their unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Filter items by their exact key (object key / filename). Keys are unique per source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Lists indexed items in an AI Search instance.`,builder:h(M),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search,sort_by:r[`sort-by`],status:r.status,source:r.source,metadata_filter:r[`metadata-filter`],item_id:r[`item-id`],key:r.key};if(r.dryRun){o({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items`,pathParams:{id:String(r.id??``),name:String(r.name??``)},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.aiSearch.items.list({account_id:u,name:r.name,id:r.id,...c})),{successLabel:`Loaded`})}};function P(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`logs <item-id>`,describe:`Lists processing logs for a specific item in an AI Search instance.`,builder:P,handler:async r=>{let c={limit:r.limit,cursor:r.cursor};if(r.dryRun){o({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/logs`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},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.aiSearch.items.logs({account_id:u,name:r.name,id:r.id,item_id:r[`item-id`],...c})),{successLabel:`Loaded`})}};function I(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).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 L={command:`sync <item-id>`,describe:`Syncs an item to an AI Search instance index.`,builder:I,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.items.sync({...e,account_id:f,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Updated`});return}r[`next-action`]===void 0&&(r[`next-action`]=await p(`next-action`,`The next_action field`,[`INDEX`]));let m=l({next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});a(await s(`Updating`,async()=>d.aiSearch.items.sync({...m,account_id:f,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Updated`})}};function R(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`JSON string of custom metadata key-value pairs.`}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."})}const z={command:`upload <id>`,describe:`Uploads a file to a managed AI Search instance via multipart/form-data.`,builder:R,handler:async c=>{if(c.dryRun){o({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}/instances/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}/items`,pathParams:{id:String(c.id??``),name:String(c.name??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file,metadata:c.metadata,"wait-for-completion":c[`wait-for-completion`]}});return}let l=await i(c),f=c.local?e:await t();if(c.accountId=f,c.file!==void 0||c.body!==void 0||c.metadata!==void 0||c[`wait-for-completion`]!==void 0){let e=new FormData;if(c.file){let t=d(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);c.metadata!==void 0&&e.append(`metadata`,String(u(c.metadata,`metadata`,`text`)??``)),c[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(c[`wait-for-completion`])),a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=u(c.body,`body`,`binary`);a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{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 B(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`key`,{type:`string`,description:`Item key / filename. Must not exceed 128 characters.`}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`upsert <id>`,describe:`Creates or updates an indexed item in an AI Search instance.`,builder:B,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({key:u(r.key,`key`,`text`),next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):c(r.body)});return}let d=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.items.upsert({...e,account_id:m,name:r.name,id:r.id})),{successLabel:`Updated`});return}r.key===void 0&&(r.key=await f(`key`,`Item key / filename. Must not exceed 128 characters.`)),r[`next-action`]===void 0&&(r[`next-action`]=await p(`next-action`,`The next_action field`,[`INDEX`]));let h=l({key:u(r.key,`key`,`text`),next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});a(await s(`Updating`,async()=>d.aiSearch.items.upsert({...h,account_id:m,name:r.name,id:r.id})),{successLabel:`Updated`})}},H={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).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:`cancel <job-id>`,describe:`Cancel an in-progress indexing job for an AI Search instance.`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({action:u(r.action,`action`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,!await m({force:!!r.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
5
5
  `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>d.aiSearch.jobs.cancel({...e,account_id:f,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Deleted`});return}r.action===void 0&&(r.action=await p(`action`,`The action field`,[`cancel`]));let h=l({action:u(r.action,`action`,`text`)});a(await s(`Deleting`,async()=>d.aiSearch.jobs.cancel({...h,account_id:f,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description 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 K={command:`create <id>`,describe:`Creates a new indexing job for an AI Search instance.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.jobs.create({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({description:u(r.description,`description`,`text`)});a(await s(`Creating`,async()=>d.aiSearch.jobs.create({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function q(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <job-id>`,describe:`Retrieves details for a specific AI Search indexing job.`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.jobs.get({account_id:l,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Loaded`})}};function Y(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance 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 X={command:`list`,describe:`Lists indexing jobs for an AI Search instance.`,builder:Y,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs`,pathParams:{id:String(r.id??``),name:String(r.name??``)},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.aiSearch.jobs.list({account_id:u,name:r.name,id:r.id,...c})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance 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 Q={command:`logs <job-id>`,describe:`Lists log entries for an AI Search indexing job.`,builder:Z,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}/logs`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},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.aiSearch.jobs.logs({account_id:u,name:r.name,id:r.id,job_id:r[`job-id`],...c})),{successLabel:`Loaded`})}},ne={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`List all AI Search instances in the account.`,builder:h(re),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search,order_by:r[`order-by`],order_by_direction:r[`order-by-direction`]};if(r.dryRun){o({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},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.aiSearch.list({account_id:u,name:r.name,...c})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace currently containing the instance.`,demandOption:!0}).option(`destination-namespace`,{type:`string`,description:`Target namespace to move the instance into.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`move <id>`,describe:`Moves an instance from its current namespace to the specified target namespace. Use 'default' with --destination-namespace to move the instance back to the default namespace. Fails with 400 if the target namespace already has an instance with the same id (ids must be unique within a namespace — the same id can exist in different namespaces).`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{name:String(r.name??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({new_namespace:u(r[`destination-namespace`],`destination-namespace`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.move({...e,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`});return}r[`destination-namespace`]===void 0&&(r[`destination-namespace`]=await f(`destination-namespace`,`Target namespace to move the instance into.`));let m=l({new_namespace:u(r[`destination-namespace`],`destination-namespace`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.move({...m,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`})}};function se(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`model`,{type:`string`,description:`The model field`}).option(`stream`,{type:`boolean`,description:`The stream 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 ce={command:`multi-chat-completions <name>`,describe:`Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`,builder:se,handler:async r=>{if(r.dryRun){o({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/chat/completions`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.multiChatCompletions({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}if(r[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.multiChatCompletions({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function le(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!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 ue={command:`multi-search <name> <query>`,describe:`Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`,builder:le,handler:async r=>{if(r.dryRun){o({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/search`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.multiSearch({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}if(r[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query});a(await s(`Creating`,async()=>d.aiSearch.multiSearch({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function de(e){return e.positional(`namespace`,{type:`string`,description:`Name for the new namespace.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).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 fe={command:`create <namespace>`,describe:`Create a namespace for organizing AI Search instances.`,builder:de,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},name:r.namespace}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.namespace.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},name:r.namespace});a(await s(`Creating`,async()=>d.aiSearch.namespace.create({...p,account_id:f})),{successLabel:`Created`})}};function pe(e){return e.positional(`name`,{type:`string`,description:`Namespace to delete.`,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 me={command:`delete <name>`,describe:`Permanently delete a namespace. The namespace must be empty (no instances), and the default namespace cannot be deleted.`,builder:pe,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-BjHjJtnn.mjs";import{r as t}from"./auth-C6MhC9EZ.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-C-oFUtvC.mjs";import{n as a,t as o}from"./body-parser-CYD7PKFC.mjs";import{n as s}from"./prompt-DM4z101s.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:"Get the custom topic categories defined for the zone. While AI Security for Apps is enabled, it scores every incoming prompt against these topics and writes the scores to the `cf.llm.prompt.custom_topic_categories` field, keyed by topic label. Topics can be configured while the detection is disabled, but no prompt is scored until you enable it.",builder:c,handler:async a=>{if(a.dryRun){r({command:`cf ai-security custom-topics get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.aiSecurity.customTopics.get({zone_id:s})),{successLabel:`Loaded`})}};function u(e){return e.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 d={command:`update`,describe:"Update the custom topic list of the zone, overwriting it entirely with the topics in the request, so include every topic you want to keep. Changes can take up to a minute to propagate. Each entry has a `label`, used to reference the topic in rule expressions and analytics, and a `topic` description, which the classifier scores prompts against while AI Security for Apps is enabled. The following rules apply: - A zone can hold at most 20 topics. - `label` must be 2–20 characters, using only lowercase letters (a–z), digits (0–9), and hyphens. - `topic` must be 2–50 printable ASCII characters. - Labels must be unique within the zone, and so must topic descriptions.",builder:u,handler:async o=>{if(o.dryRun){r({command:`cf ai-security custom-topics update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:o.body===void 0?void 0:a(o.body)});return}let c=await t(o),l=await e({zone:o.zone},c,{quiet:o.quiet});if(o.zoneId=l,!await s({force:!!o.force,message:`This operation overwrites the AI Security for Apps custom topics for a zone.`})){process.stderr.write(`Aborted.
2
+ import{h as e}from"./oauth-BPizUUqP.mjs";import{r as t}from"./auth-DuLchM18.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-B84wYh91.mjs";import{n as a,t as o}from"./body-parser-CYD7PKFC.mjs";import{n as s}from"./prompt-CDtLWxNv.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:"Get the custom topic categories defined for the zone. While AI Security for Apps is enabled, it scores every incoming prompt against these topics and writes the scores to the `cf.llm.prompt.custom_topic_categories` field, keyed by topic label. Topics can be configured while the detection is disabled, but no prompt is scored until you enable it.",builder:c,handler:async a=>{if(a.dryRun){r({command:`cf ai-security custom-topics get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.aiSecurity.customTopics.get({zone_id:s})),{successLabel:`Loaded`})}};function u(e){return e.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 d={command:`update`,describe:"Update the custom topic list of the zone, overwriting it entirely with the topics in the request, so include every topic you want to keep. Changes can take up to a minute to propagate. Each entry has a `label`, used to reference the topic in rule expressions and analytics, and a `topic` description, which the classifier scores prompts against while AI Security for Apps is enabled. The following rules apply: - A zone can hold at most 20 topics. - `label` must be 2–20 characters, using only lowercase letters (a–z), digits (0–9), and hyphens. - `topic` must be 2–50 printable ASCII characters. - Labels must be unique within the zone, and so must topic descriptions.",builder:u,handler:async o=>{if(o.dryRun){r({command:`cf ai-security custom-topics update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:o.body===void 0?void 0:a(o.body)});return}let c=await t(o),l=await e({zone:o.zone},c,{quiet:o.quiet});if(o.zoneId=l,!await s({force:!!o.force,message:`This operation overwrites the AI Security for Apps custom topics for a zone.`})){process.stderr.write(`Aborted.
3
3
  `);return}if(o.body){let e=a(o.body);n(await i(`Deleting`,async()=>c.aiSecurity.customTopics.update({body:e,zone_id:l})),{successLabel:`Deleted`});return}if(o.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},f={command:`custom-topics`,describe:`Organization-specific topic categories used by AI Security for Apps content detection`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:"Get the current AI Security for Apps status for the zone. While enabled, Cloudflare scans prompts sent to endpoints labeled `cf-llm` for personally identifiable information, unsafe topics, and prompt injection attempts.",builder:p,handler:async a=>{if(a.dryRun){r({command:`cf ai-security get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/ai-security/settings`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.aiSecurity.get({zone_id:s})),{successLabel:`Loaded`})}};function h(e){return e.option(`enabled`,{type:`boolean`,description:`Whether AI Security for Apps is enabled on the zone.`}).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:`AI Security for Apps enablement status for a zone.`})}const g={command:`update`,describe:"Update the AI Security for Apps status for the zone, enabling or disabling the detection. The detection results are exposed as `cf.llm.prompt.*` fields for use in custom rules and rate limiting rules; changes can take up to a minute to propagate.",builder:h,handler:async c=>{if(c.dryRun){r({command:`cf ai-security update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/ai-security/settings`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({enabled:c.enabled}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,!await s({force:!!c.force,message:`This operation toggles AI Security for Apps for a zone.`})){process.stderr.write(`Aborted.
4
4
  `);return}if(c.body){let e=a(c.body);n(await i(`Deleting`,async()=>l.aiSecurity.update({body:e,zone_id:u})),{successLabel:`Deleted`});return}let d=o({enabled:c.enabled});n(await i(`Deleting`,async()=>l.aiSecurity.update({body:d,zone_id:u})),{successLabel:`Deleted`})}},_={command:`ai-security`,describe:`Detect prompt injection, PII, and unsafe topics in traffic to your AI applications`,builder:e=>e.command(m).command(g).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{_ as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{r}from"./auth-C6MhC9EZ.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-C-oFUtvC.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,i as d,n as f}from"./prompt-DM4z101s.mjs";import{n as p,t as m}from"./raw-fetch-25gXED6c.mjs";function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`Gets a list of all alert types for which an account is eligible.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.availableAlerts.list({account_id:l})),{successLabel:`Loaded`})}},g={command:`available-alerts`,describe:`Operations for available-alerts`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get a list of all delivery mechanism types for which an account is eligible.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations eligible get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/eligible`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.eligible.get({account_id:l})),{successLabel:`Loaded`})}},y={command:`eligible`,describe:`Operations for destinations.eligible`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`create`,describe:`Creates a new token for integrating with PagerDuty.`,builder:b,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.alerting.destinations.pagerduty.create({account_id:l})),{successLabel:`Created`})}};function S(e){return e.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 C={command:`delete`,describe:`Deletes all the PagerDuty Services connected to the account.`,builder:S,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
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,i as d,n as f}from"./prompt-CDtLWxNv.mjs";import{n as p,t as m}from"./raw-fetch-Dz-QBoP_.mjs";function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`Gets a list of all alert types for which an account is eligible.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.availableAlerts.list({account_id:l})),{successLabel:`Loaded`})}},g={command:`available-alerts`,describe:`Operations for available-alerts`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get a list of all delivery mechanism types for which an account is eligible.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations eligible get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/eligible`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.eligible.get({account_id:l})),{successLabel:`Loaded`})}},y={command:`eligible`,describe:`Operations for destinations.eligible`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`create`,describe:`Creates a new token for integrating with PagerDuty.`,builder:b,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.alerting.destinations.pagerduty.create({account_id:l})),{successLabel:`Created`})}};function S(e){return e.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 C={command:`delete`,describe:`Deletes all the PagerDuty Services connected to the account.`,builder:S,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
3
3
  `);return}i(await o(`Deleting`,async()=>c.alerting.destinations.pagerduty.delete({account_id:l})),{successLabel:`Deleted`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get a list of all configured PagerDuty services.`,builder:w,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.pagerduty.get({account_id:l})),{successLabel:`Loaded`})}};function E(e){return e.positional(`token-id`,{type:`string`,description:`The token integration key`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`link <token-id>`,describe:`Links PagerDuty with the account using the integration token.`,builder:E,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations pagerduty link`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect/${s[`token-id`]==null?`<token-id>`:encodeURIComponent(String(s[`token-id`]))}`,pathParams:{"token-id":String(s[`token-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.pagerduty.link({account_id:l,token_id:s[`token-id`]})),{successLabel:`Loaded`})}},O={command:`pagerduty`,describe:`Operations for destinations.pagerduty`,builder:e=>e.command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).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`,describe:`Creates a new webhook destination.`,builder:k,handler:async d=>{if(d.dryRun){a({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),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.alerting.destinations.webhooks.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),d.url===void 0&&(d.url=await u(`url`,`The POST endpoint to call when dispatching a notification.`));let m=c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)});i(await o(`Creating`,async()=>f.alerting.destinations.webhooks.create({...m,account_id:p})),{successLabel:`Created`})}};function j(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,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 <webhook-id>`,describe:`Delete a configured webhook destination.`,builder:j,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
4
4
  `);return}i(await o(`Deleting`,async()=>c.alerting.destinations.webhooks.delete({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Deleted`})}};function N(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <webhook-id>`,describe:`Get details for a single webhooks destination.`,builder:N,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.webhooks.get({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Loaded`})}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`Gets a list of all configured webhook destinations.`,builder:F,handler:async s=>{if(s.dryRun){a({command:`cf alerting destinations webhooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.destinations.webhooks.list({account_id:l})),{successLabel:`Loaded`})}};function L(e){return e.positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).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 <webhook-id>`,describe:`Update a webhook destination.`,builder:L,handler:async d=>{if(d.dryRun){a({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/destinations/webhooks/${d[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(d[`webhook-id`]))}`,pathParams:{"webhook-id":String(d[`webhook-id`]??``)},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),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(`Updating`,async()=>f.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:d[`webhook-id`]})),{successLabel:`Updated`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),d.url===void 0&&(d.url=await u(`url`,`The POST endpoint to call when dispatching a notification.`));let m=c({name:l(d.name,`name`,`text`),secret:l(d.secret,`secret`,`text`),url:l(d.url,`url`,`text`)});i(await o(`Updating`,async()=>f.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:d[`webhook-id`]})),{successLabel:`Updated`})}},z={command:`webhooks`,describe:`Operations for destinations.webhooks`,builder:e=>e.command(A).command(M).command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(y).command(O).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`before`,{type:`string`,description:`Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`since`,{type:`string`,description:`Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`list`,describe:"Gets a list of history records for notifications sent to an account. The records are displayed for last `x` number of days based on the zone plan (free = 30, pro = 30, biz = 30, ent = 90).",builder:V,handler:async s=>{let c={per_page:s[`per-page`],before:s.before,page:s.page,since:s.since};if(s.dryRun){a({command:`cf alerting history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/history`,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.alerting.history.list({account_id:u,...c})),{successLabel:`Loaded`})}},U={command:`history`,describe:`Operations for history`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`,default:!0}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).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 Notification policy.`,builder:te,handler:async f=>{if(f.dryRun){a({command:`cf alerting policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`json`,body:f.body===void 0?c({alert_interval:l(f[`alert-interval`],`alert-interval`,`text`),alert_type:l(f[`alert-type`],`alert-type`,`text`),description:l(f.description,`description`,`text`),enabled:f.enabled,filters:{actions:f[`filters-actions`],affected_asns:f[`filters-affected-asns`],affected_components:f[`filters-affected-components`],affected_locations:f[`filters-affected-locations`],airport_code:f[`filters-airport-code`],alert_trigger_preferences:f[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:f[`filters-alert-trigger-preferences-value`],enabled:f[`filters-enabled`],environment:f[`filters-environment`],event:f[`filters-event`],event_source:f[`filters-event-source`],event_type:f[`filters-event-type`],group_by:f[`filters-group-by`],health_check_id:f[`filters-health-check-id`],incident_impact:f[`filters-incident-impact`],input_id:f[`filters-input-id`],insight_class:f[`filters-insight-class`],limit:f[`filters-limit`],logo_tag:f[`filters-logo-tag`],megabits_per_second:f[`filters-megabits-per-second`],new_health:f[`filters-new-health`],new_status:f[`filters-new-status`],packets_per_second:f[`filters-packets-per-second`],pool_id:f[`filters-pool-id`],pop_names:f[`filters-pop-names`],product:f[`filters-product`],project_id:f[`filters-project-id`],protocol:f[`filters-protocol`],query_tag:f[`filters-query-tag`],requests_per_second:f[`filters-requests-per-second`],selectors:f[`filters-selectors`],services:f[`filters-services`],slo:f[`filters-slo`],status:f[`filters-status`],target_hostname:f[`filters-target-hostname`],target_ip:f[`filters-target-ip`],target_zone_name:f[`filters-target-zone-name`],traffic_exclusions:f[`filters-traffic-exclusions`],tunnel_id:f[`filters-tunnel-id`],tunnel_name:f[`filters-tunnel-name`],type:f[`filters-type`],where:f[`filters-where`],zones:f[`filters-zones`]},name:l(f.name,`name`,`text`)}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Creating`,async()=>p.alerting.policies.create({...e,account_id:m})),{successLabel:`Created`});return}if(f[`alert-type`]===void 0&&(f[`alert-type`]=await d(`alert-type`,`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`))),f.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);f.name===void 0&&(f.name=await u(`name`,`Name of the policy.`));let h=c({alert_interval:l(f[`alert-interval`],`alert-interval`,`text`),alert_type:l(f[`alert-type`],`alert-type`,`text`),description:l(f.description,`description`,`text`),enabled:f.enabled,filters:{actions:f[`filters-actions`],affected_asns:f[`filters-affected-asns`],affected_components:f[`filters-affected-components`],affected_locations:f[`filters-affected-locations`],airport_code:f[`filters-airport-code`],alert_trigger_preferences:f[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:f[`filters-alert-trigger-preferences-value`],enabled:f[`filters-enabled`],environment:f[`filters-environment`],event:f[`filters-event`],event_source:f[`filters-event-source`],event_type:f[`filters-event-type`],group_by:f[`filters-group-by`],health_check_id:f[`filters-health-check-id`],incident_impact:f[`filters-incident-impact`],input_id:f[`filters-input-id`],insight_class:f[`filters-insight-class`],limit:f[`filters-limit`],logo_tag:f[`filters-logo-tag`],megabits_per_second:f[`filters-megabits-per-second`],new_health:f[`filters-new-health`],new_status:f[`filters-new-status`],packets_per_second:f[`filters-packets-per-second`],pool_id:f[`filters-pool-id`],pop_names:f[`filters-pop-names`],product:f[`filters-product`],project_id:f[`filters-project-id`],protocol:f[`filters-protocol`],query_tag:f[`filters-query-tag`],requests_per_second:f[`filters-requests-per-second`],selectors:f[`filters-selectors`],services:f[`filters-services`],slo:f[`filters-slo`],status:f[`filters-status`],target_hostname:f[`filters-target-hostname`],target_ip:f[`filters-target-ip`],target_zone_name:f[`filters-target-zone-name`],traffic_exclusions:f[`filters-traffic-exclusions`],tunnel_id:f[`filters-tunnel-id`],tunnel_name:f[`filters-tunnel-name`],type:f[`filters-type`],where:f[`filters-where`],zones:f[`filters-zones`]},name:l(f.name,`name`,`text`)});i(await o(`Creating`,async()=>p.alerting.policies.create({...h,account_id:m})),{successLabel:`Created`})}};function G(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,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 K={command:`delete <policy-id>`,describe:`Delete a Notification policy.`,builder:G,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
5
5
  `);return}i(await o(`Deleting`,async()=>c.alerting.policies.delete({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Deleted`})}};function q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`email`,{type:`string`,description:`Email`,demandOption:!0}).option(`token`,{type:`string`,description:`Token`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`details <policy-id>`,describe:`Shows details for unsubscribing an email address from a notification policy.`,builder:q,handler:async i=>{let s={email:i.email,token:i.token};if(i.dryRun){a({command:`cf alerting policies email details`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${i[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe`,pathParams:{"policy-id":String(i[`policy-id`]??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();p((await o(`Loading`,async()=>m(`/accounts/${c}/alerting/v3/policies/${encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe${l?`?`+l:``}`,{method:`GET`,local:i.local===!0,persistTo:i.persistTo}))).toString(`utf-8`))}};function Y(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`email`,{type:`string`,description:`Email`,demandOption:!0}).option(`token`,{type:`string`,description:`Token`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`unsubscribe <policy-id>`,describe:`Unsubscribes an email address from a notification policy.`,builder:Y,handler:async i=>{let s={email:i.email,token:i.token};if(i.dryRun){a({command:`cf alerting policies email unsubscribe`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${i[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe`,pathParams:{"policy-id":String(i[`policy-id`]??``)},query:s,bodyKind:`none`});return}await r(i);let c=i.local?e:await t();i.accountId=c;let l=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();p((await o(`Creating`,async()=>m(`/accounts/${c}/alerting/v3/policies/${encodeURIComponent(String(i[`policy-id`]))}/email/unsubscribe${l?`?`+l:``}`,{method:`POST`,local:i.local===!0,persistTo:i.persistTo}))).toString(`utf-8`))}},Z={command:`email`,describe:`Operations for policies.email`,builder:e=>e.command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`get <policy-id>`,describe:`Get details for a single policy.`,builder:Q,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.policies.get({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Loaded`})}};function re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`Get a list of all Notification policies.`,builder:re,handler:async s=>{if(s.dryRun){a({command:`cf alerting policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.alerting.policies.list({account_id:l})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`severity`,{type:`number`,description:`Severity level for the test alert. Defaults to INFO (1) if omitted.`}).option(`source`,{type:`string`,description:`Source identifier for the test alert.`}).option(`state-correlation-id`,{type:`string`,description:`Correlation ID for stateful test alerts. Required when state_event is set.`}).option(`state-event`,{type:`number`,description:`State event type for stateful test alerts. Use with state_correlation_id.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Optional configuration for the test notification. When omitted, a default INFO-severity test alert is sent.`})}const oe={command:`test <policy-id>`,describe:`Send a test notification for a policy to verify delivery mechanisms are working as expected.`,builder:ae,handler:async u=>{if(u.dryRun){a({command:`cf alerting policies test`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${u[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(u[`policy-id`]))}/test`,pathParams:{"policy-id":String(u[`policy-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({severity:u.severity,source:l(u.source,`source`,`text`),state_correlation_id:l(u[`state-correlation-id`],`state-correlation-id`,`text`),state_event:u[`state-event`]}):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.alerting.policies.test({...e,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Created`});return}let p=c({severity:u.severity,source:l(u.source,`source`,`text`),state_correlation_id:l(u[`state-correlation-id`],`state-correlation-id`,`text`),state_event:u[`state-event`]});i(await o(`Creating`,async()=>d.alerting.policies.test({...p,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Created`})}};function se(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`update <policy-id>`,describe:`Update a Notification policy.`,builder:se,handler:async u=>{if(u.dryRun){a({command:`cf alerting policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/policies/${u[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(u[`policy-id`]))}`,pathParams:{"policy-id":String(u[`policy-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({alert_interval:l(u[`alert-interval`],`alert-interval`,`text`),alert_type:l(u[`alert-type`],`alert-type`,`text`),description:l(u.description,`description`,`text`),enabled:u.enabled,filters:{actions:u[`filters-actions`],affected_asns:u[`filters-affected-asns`],affected_components:u[`filters-affected-components`],affected_locations:u[`filters-affected-locations`],airport_code:u[`filters-airport-code`],alert_trigger_preferences:u[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:u[`filters-alert-trigger-preferences-value`],enabled:u[`filters-enabled`],environment:u[`filters-environment`],event:u[`filters-event`],event_source:u[`filters-event-source`],event_type:u[`filters-event-type`],group_by:u[`filters-group-by`],health_check_id:u[`filters-health-check-id`],incident_impact:u[`filters-incident-impact`],input_id:u[`filters-input-id`],insight_class:u[`filters-insight-class`],limit:u[`filters-limit`],logo_tag:u[`filters-logo-tag`],megabits_per_second:u[`filters-megabits-per-second`],new_health:u[`filters-new-health`],new_status:u[`filters-new-status`],packets_per_second:u[`filters-packets-per-second`],pool_id:u[`filters-pool-id`],pop_names:u[`filters-pop-names`],product:u[`filters-product`],project_id:u[`filters-project-id`],protocol:u[`filters-protocol`],query_tag:u[`filters-query-tag`],requests_per_second:u[`filters-requests-per-second`],selectors:u[`filters-selectors`],services:u[`filters-services`],slo:u[`filters-slo`],status:u[`filters-status`],target_hostname:u[`filters-target-hostname`],target_ip:u[`filters-target-ip`],target_zone_name:u[`filters-target-zone-name`],traffic_exclusions:u[`filters-traffic-exclusions`],tunnel_id:u[`filters-tunnel-id`],tunnel_name:u[`filters-tunnel-name`],type:u[`filters-type`],where:u[`filters-where`],zones:u[`filters-zones`]},name:l(u.name,`name`,`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.alerting.policies.update({...e,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Updated`});return}let p=c({alert_interval:l(u[`alert-interval`],`alert-interval`,`text`),alert_type:l(u[`alert-type`],`alert-type`,`text`),description:l(u.description,`description`,`text`),enabled:u.enabled,filters:{actions:u[`filters-actions`],affected_asns:u[`filters-affected-asns`],affected_components:u[`filters-affected-components`],affected_locations:u[`filters-affected-locations`],airport_code:u[`filters-airport-code`],alert_trigger_preferences:u[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:u[`filters-alert-trigger-preferences-value`],enabled:u[`filters-enabled`],environment:u[`filters-environment`],event:u[`filters-event`],event_source:u[`filters-event-source`],event_type:u[`filters-event-type`],group_by:u[`filters-group-by`],health_check_id:u[`filters-health-check-id`],incident_impact:u[`filters-incident-impact`],input_id:u[`filters-input-id`],insight_class:u[`filters-insight-class`],limit:u[`filters-limit`],logo_tag:u[`filters-logo-tag`],megabits_per_second:u[`filters-megabits-per-second`],new_health:u[`filters-new-health`],new_status:u[`filters-new-status`],packets_per_second:u[`filters-packets-per-second`],pool_id:u[`filters-pool-id`],pop_names:u[`filters-pop-names`],product:u[`filters-product`],project_id:u[`filters-project-id`],protocol:u[`filters-protocol`],query_tag:u[`filters-query-tag`],requests_per_second:u[`filters-requests-per-second`],selectors:u[`filters-selectors`],services:u[`filters-services`],slo:u[`filters-slo`],status:u[`filters-status`],target_hostname:u[`filters-target-hostname`],target_ip:u[`filters-target-ip`],target_zone_name:u[`filters-target-zone-name`],traffic_exclusions:u[`filters-traffic-exclusions`],tunnel_id:u[`filters-tunnel-id`],tunnel_name:u[`filters-tunnel-name`],type:u[`filters-type`],where:u[`filters-where`],zones:u[`filters-zones`]},name:l(u.name,`name`,`text`)});i(await o(`Updating`,async()=>d.alerting.policies.update({...p,account_id:f,policy_id:u[`policy-id`]})),{successLabel:`Updated`})}},le={command:`policies`,describe:`Operations for policies`,builder:e=>e.command(W).command(K).command(ne).command(ie).command(oe).command(ce).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ue(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const de={command:`create`,describe:`Creates a new silence for an account.`,builder:ue,handler:async c=>{if(c.dryRun){a({command:`cf alerting silences create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences`,pathParams:{},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.alerting.silences.create({body:e,account_id:u})),{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 fe(e){return e.positional(`silence-id`,{type:`string`,description:`Silence 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 pe={command:`delete <silence-id>`,describe:`Deletes an existing silence for an account.`,builder:fe,handler:async s=>{if(s.dryRun){a({command:`cf alerting silences delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/alerting/v3/silences/${s[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(s[`silence-id`]))}`,pathParams:{"silence-id":String(s[`silence-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n,h as r}from"./oauth-BjHjJtnn.mjs";import{r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.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}from"./prompt-DM4z101s.mjs";function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`,builder:f,handler:async e=>{if(e.dryRun){o({command:`cf analytics latency colos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency/colos`,pathParams:{"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.analytics.latency.colos.get({zone_id:n})),{successLabel:`Loaded`})}},m={command:`colos`,describe:`Operations for latency.colos`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`bins`,{type:`string`,description:`Bins`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieves aggregate Argo Smart Routing analytics for a zone, including latency improvements, bandwidth savings, and routing statistics.`,builder:h,handler:async e=>{let t={bins:e.bins};if(e.dryRun){o({command:`cf analytics latency get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency`,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.analytics.latency.get({zone_id:c,...t})),{successLabel:`Loaded`})}},_={command:`latency`,describe:`Operations for latency`,builder:e=>e.command(g).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const y={command:`artAnalyticsQuerySummary <dataset>`,describe:`Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf analytics query artAnalyticsQuerySummary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/summary`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`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);a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQuerySummary({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQuerySummary({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}};function b(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`resolution`,{type:`string`,description:`Time bucket size for grouping results. Controls the granularity of the returned time slots.
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}from"./prompt-CDtLWxNv.mjs";function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`,builder:f,handler:async e=>{if(e.dryRun){o({command:`cf analytics latency colos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency/colos`,pathParams:{"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.analytics.latency.colos.get({zone_id:n})),{successLabel:`Loaded`})}},m={command:`colos`,describe:`Operations for latency.colos`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`bins`,{type:`string`,description:`Bins`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieves aggregate Argo Smart Routing analytics for a zone, including latency improvements, bandwidth savings, and routing statistics.`,builder:h,handler:async e=>{let t={bins:e.bins};if(e.dryRun){o({command:`cf analytics latency get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency`,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.analytics.latency.get({zone_id:c,...t})),{successLabel:`Loaded`})}},_={command:`latency`,describe:`Operations for latency`,builder:e=>e.command(g).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const y={command:`artAnalyticsQuerySummary <dataset>`,describe:`Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf analytics query artAnalyticsQuerySummary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/summary`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`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);a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQuerySummary({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQuerySummary({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}};function b(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`resolution`,{type:`string`,description:`Time bucket size for grouping results. Controls the granularity of the returned time slots.
3
3
  `}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const x={command:`artAnalyticsQueryTimeseries <dataset>`,describe:"Returns time-bucketed analytics data for a dataset. Includes time slots, each containing the requested stats, group-by dimensions, and resolution-controlled bucket size (e.g. `hour`, `day`).",builder:b,handler:async r=>{if(r.dryRun){o({command:`cf analytics query artAnalyticsQueryTimeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/timeseries`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),resolution:u(r.resolution,`resolution`,`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);a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQueryTimeseries({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),r.resolution===void 0&&(r.resolution=await d(`resolution`,`Time bucket size for grouping results. Controls the granularity of the returned time slots. `));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),resolution:u(r.resolution,`resolution`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQueryTimeseries({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}};function S(e){return e.positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`n`,{type:`number`,description:`Maximum number of results to return.`}).option(`order-by`,{type:`string`,description:`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const C={command:`artAnalyticsQueryTopN <dataset>`,describe:`Returns the top N results for a dataset by a specified stat. Includes an array of result rows, each containing the requested stats and group-by dimensions.`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf analytics query artAnalyticsQueryTopN`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/top-n`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),n:r.n,orderBy:u(r[`order-by`],`order-by`,`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);a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQueryTopN({...e,account_id:p,dataset:r.dataset})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);if(r.to===void 0&&(r.to=await d(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),r.n===void 0)throw Error(`--n is required (or pass --body with this field set).`);r[`order-by`]===void 0&&(r[`order-by`]=await d(`order-by`,`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`));let m=l({from:u(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:u(r.to,`to`,`text`),n:r.n,orderBy:u(r[`order-by`],`order-by`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.artAnalyticsQueryTopN({...m,account_id:p,dataset:r.dataset})),{successLabel:`Created`})}};function w(e){return e.option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`n`,{type:`number`,description:`Maximum number of integrations to return.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Returns the top N integrations for content findings.`})}const T={command:`dataSecurityContentFindingsTopN`,describe:`Returns the top N integrations ranked by total content findings.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf analytics query dataSecurityContentFindingsTopN`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/data-security/content-findings/top-n`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),n:r.n,to:u(r.to,`to`,`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);a(await s(`Creating`,async()=>f.analytics.query.dataSecurityContentFindingsTopN({...e,account_id:p})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await d(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.n===void 0)throw Error(`--n is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await d(`to`,`End of the query time range (exclusive). RFC3339.`));let m=l({from:u(r.from,`from`,`text`),n:r.n,to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.dataSecurityContentFindingsTopN({...m,account_id:p})),{successLabel:`Created`})}};function E(e){return e.option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for aggregate findings summary.`})}const D={command:`dataSecurityFindingsSummary`,describe:`Returns aggregate current-period and previous-period totals for CASB findings.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf analytics query dataSecurityFindingsSummary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/data-security/findings/summary`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`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);a(await s(`Creating`,async()=>f.analytics.query.dataSecurityFindingsSummary({...e,account_id:p})),{successLabel:`Created`});return}r.from===void 0&&(r.from=await d(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.to===void 0&&(r.to=await d(`to`,`End of the query time range (exclusive). RFC3339.`));let m=l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.dataSecurityFindingsSummary({...m,account_id:p})),{successLabel:`Created`})}};function O(e){return e.option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for findings timeseries.`})}const k={command:`dataSecurityFindingsTimeseries`,describe:`Returns merged time-bucketed CASB findings.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf analytics query dataSecurityFindingsTimeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics/query/data-security/findings/timeseries`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`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);a(await s(`Creating`,async()=>f.analytics.query.dataSecurityFindingsTimeseries({...e,account_id:p})),{successLabel:`Created`});return}r.from===void 0&&(r.from=await d(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.to===void 0&&(r.to=await d(`to`,`End of the query time range (exclusive). RFC3339.`));let m=l({from:u(r.from,`from`,`text`),to:u(r.to,`to`,`text`)});a(await s(`Creating`,async()=>f.analytics.query.dataSecurityFindingsTimeseries({...m,account_id:p})),{successLabel:`Created`})}},A={command:`query`,describe:`Operations for query`,builder:e=>e.command(y).command(x).command(C).command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(_).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{j as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,t as l}from"./input-validation-BBKJRoRB.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const d={command:`query`,describe:`Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`,builder:u,handler:async u=>{if(u.dryRun){o({command:`cf analytics_engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await i(u),f=u.local?e:await t();if(u.accountId=f,u.file){let e=l(u.file);a(await s(`Loading`,async()=>r(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}if(u.body){let e=c(u.body,`body`,`binary`);a(await s(`Loading`,async()=>r(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}a(await s(`Loading`,async()=>d.analyticsEngine.sql.query({account_id:f})),{successLabel:`Loaded`})}},f={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`analytics_engine`,describe:`analytics_engine`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
2
+ import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{a as r,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"./input-validation-BBKJRoRB.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const d={command:`query`,describe:`Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`,builder:u,handler:async u=>{if(u.dryRun){o({command:`cf analytics_engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await i(u),f=u.local?e:await t();if(u.accountId=f,u.file){let e=l(u.file);a(await s(`Loading`,async()=>r(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}if(u.body){let e=c(u.body,`body`,`binary`);a(await s(`Loading`,async()=>r(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}a(await s(`Loading`,async()=>d.analyticsEngine.sql.query({account_id:f})),{successLabel:`Loaded`})}},f={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`analytics_engine`,describe:`analytics_engine`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n,h as r}from"./oauth-BjHjJtnn.mjs";import{a as i,r as a}from"./auth-C6MhC9EZ.mjs";import{t as o}from"./output-DgW1hQGX.mjs";import{n as s,t as c}from"./progress-C-oFUtvC.mjs";import{n as l,t as u}from"./body-parser-CYD7PKFC.mjs";import{n as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-DM4z101s.mjs";import{t as h}from"./cli-types-BWdZbsFE.mjs";function ee(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema is enabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`create`,describe:`Uploads an OpenAPI schema that defines expected request formats for API operations.`,builder:ee,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({kind:d(e.kind,`kind`,`text`),name:d(e.name,`name`,`text`),source:d(e.source,`source`,`text`),validation_enabled:e[`validation-enabled`]}):l(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);o(await c(`Creating`,async()=>t.apiSecurity.schemaValidation.schemas.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.kind===void 0&&(e.kind=await p(`kind`,`The kind of the schema`,[`openapi_v3`])),e.name===void 0&&(e.name=await f(`name`,`A human-readable name for the schema`)),e.source===void 0&&(e.source=await f(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),e[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let i=u({kind:d(e.kind,`kind`,`text`),name:d(e.name,`name`,`text`),source:d(e.source,`source`,`text`),validation_enabled:e[`validation-enabled`]});o(await c(`Creating`,async()=>t.apiSecurity.schemaValidation.schemas.create({...i,zone_id:n})),{successLabel:`Created`})}};function g(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Security. Operations using this schema will lose their validation rules.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await m({force:!!e.force,message:`This operation permanently deletes the uploaded schema and removes its validation coverage.`})){process.stderr.write(`Aborted.
2
+ import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n,h as r}from"./oauth-BPizUUqP.mjs";import{a as i,r as a}from"./auth-DuLchM18.mjs";import{t as o}from"./output-DgW1hQGX.mjs";import{n as s,t as c}from"./progress-B84wYh91.mjs";import{n as l,t as u}from"./body-parser-CYD7PKFC.mjs";import{n as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-CDtLWxNv.mjs";import{t as h}from"./cli-types-BWdZbsFE.mjs";function ee(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema is enabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`create`,describe:`Uploads an OpenAPI schema that defines expected request formats for API operations.`,builder:ee,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({kind:d(e.kind,`kind`,`text`),name:d(e.name,`name`,`text`),source:d(e.source,`source`,`text`),validation_enabled:e[`validation-enabled`]}):l(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);o(await c(`Creating`,async()=>t.apiSecurity.schemaValidation.schemas.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.kind===void 0&&(e.kind=await p(`kind`,`The kind of the schema`,[`openapi_v3`])),e.name===void 0&&(e.name=await f(`name`,`A human-readable name for the schema`)),e.source===void 0&&(e.source=await f(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),e[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let i=u({kind:d(e.kind,`kind`,`text`),name:d(e.name,`name`,`text`),source:d(e.source,`source`,`text`),validation_enabled:e[`validation-enabled`]});o(await c(`Creating`,async()=>t.apiSecurity.schemaValidation.schemas.create({...i,zone_id:n})),{successLabel:`Created`})}};function g(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Security. Operations using this schema will lose their validation rules.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await m({force:!!e.force,message:`This operation permanently deletes the uploaded schema and removes its validation coverage.`})){process.stderr.write(`Aborted.
3
3
  `);return}o(await c(`Deleting`,async()=>t.apiSecurity.schemaValidation.schemas.delete({zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <schema-id>`,describe:`Gets the contents and metadata of a specific OpenAPI schema uploaded to API Security.`,builder:v,handler:async e=>{let t={omit_source:e[`omit-source`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}};function b(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone.`,builder:b,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas hosts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/hosts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.hosts.list({zone_id:i,...t})),{successLabel:`Loaded`})}},S={command:`hosts`,describe:`Operations for schema-validation.schemas.hosts`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`validation-enabled`,{type:`boolean`,description:`Filter for enabled schemas`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Security.`,builder:C,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],omit_source:e[`omit-source`],validation_enabled:e[`validation-enabled`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function T(e){return e.option(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in Web Asset Management or not. `new` will just return operations from the schema that do not exist otherwise. `existing` will just return operations from the schema that already exist.",choices:[`new`,`existing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:h(T),handler:async e=>{let t={feature:e.feature,host:e.host,method:e.method,endpoint:e.endpoint,page:e.page,per_page:e[`per-page`],operation_status:e[`operation-status`]};if(e.dryRun){s({command:`cf api-security schema-validation schemas operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.apiSecurity.schemaValidation.schemas.operations.list({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}},D={command:`operations`,describe:`Operations for schema-validation.schemas.operations`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`validation-enabled`,{type:`boolean`,description:`Flag whether schema is enabled for validation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const k={command:`set-validation <schema-id>`,describe:`Enables or disables validation for an uploaded OpenAPI schema without changing the schema document.`,builder:O,handler:async e=>{if(e.dryRun){s({command:`cf api-security schema-validation schemas set-validation`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({validation_enabled:e[`validation-enabled`]}):l(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);o(await c(`Updating`,async()=>t.apiSecurity.schemaValidation.schemas.setValidation({...r,zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Updated`});return}let i=u({validation_enabled:e[`validation-enabled`]});o(await c(`Updating`,async()=>t.apiSecurity.schemaValidation.schemas.setValidation({...i,zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Updated`})}},A={command:`schemas`,describe:`Operations for schema-validation.schemas`,builder:e=>e.command(te).command(_).command(y).command(w).command(k).command(S).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
4
4
  Mitigation actions are as follows:
5
5
 
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-BjHjJtnn.mjs";import{r as t}from"./auth-C6MhC9EZ.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-C-oFUtvC.mjs";import{n as a,t as o}from"./body-parser-CYD7PKFC.mjs";import{n as s}from"./input-validation-BBKJRoRB.mjs";import{i as c}from"./prompt-DM4z101s.mjs";function l(e){return e.option(`value`,{type:`string`,description:`Specifies the enablement value of Argo Smart Routing.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Configures the enablement of Argo Smart Routing.`})}const u={command:`edit`,describe:`Configures the value of the Argo Smart Routing enablement setting.`,builder:l,handler:async l=>{if(l.dryRun){r({command:`cf argo smart-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({value:s(l.value,`value`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.argo.smartRouting.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Specifies the enablement value of Argo Smart Routing.`,[`on`,`off`]));let f=o({value:s(l.value,`value`,`text`)});n(await i(`Updating`,async()=>u.argo.smartRouting.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves the value of Argo Smart Routing enablement setting.`,builder:d,handler:async a=>{if(a.dryRun){r({command:`cf argo smart-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.argo.smartRouting.get({zone_id:s})),{successLabel:`Loaded`})}},p={command:`smart-routing`,describe:`Operations for smart-routing`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`value`,{type:`string`,description:`Enables Tiered Caching.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Tiered Caching.`})}const h={command:`edit`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:m,handler:async l=>{if(l.dryRun){r({command:`cf argo tiered-caching edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({value:s(l.value,`value`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.argo.tieredCaching.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Enables Tiered Caching.`,[`on`,`off`]));let f=o({value:s(l.value,`value`,`text`)});n(await i(`Updating`,async()=>u.argo.tieredCaching.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:g,handler:async a=>{if(a.dryRun){r({command:`cf argo tiered-caching get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.argo.tieredCaching.get({zone_id:s})),{successLabel:`Loaded`})}},v={command:`tiered-caching`,describe:`Operations for tiered-caching`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`argo`,describe:`argo`,builder:e=>e.command(p).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
2
+ import{h as e}from"./oauth-BPizUUqP.mjs";import{r as t}from"./auth-DuLchM18.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-B84wYh91.mjs";import{n as a,t as o}from"./body-parser-CYD7PKFC.mjs";import{n as s}from"./input-validation-BBKJRoRB.mjs";import{i as c}from"./prompt-CDtLWxNv.mjs";function l(e){return e.option(`value`,{type:`string`,description:`Specifies the enablement value of Argo Smart Routing.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Configures the enablement of Argo Smart Routing.`})}const u={command:`edit`,describe:`Configures the value of the Argo Smart Routing enablement setting.`,builder:l,handler:async l=>{if(l.dryRun){r({command:`cf argo smart-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({value:s(l.value,`value`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.argo.smartRouting.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Specifies the enablement value of Argo Smart Routing.`,[`on`,`off`]));let f=o({value:s(l.value,`value`,`text`)});n(await i(`Updating`,async()=>u.argo.smartRouting.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves the value of Argo Smart Routing enablement setting.`,builder:d,handler:async a=>{if(a.dryRun){r({command:`cf argo smart-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.argo.smartRouting.get({zone_id:s})),{successLabel:`Loaded`})}},p={command:`smart-routing`,describe:`Operations for smart-routing`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`value`,{type:`string`,description:`Enables Tiered Caching.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Tiered Caching.`})}const h={command:`edit`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:m,handler:async l=>{if(l.dryRun){r({command:`cf argo tiered-caching edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({value:s(l.value,`value`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.argo.tieredCaching.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await c(`value`,`Enables Tiered Caching.`,[`on`,`off`]));let f=o({value:s(l.value,`value`,`text`)});n(await i(`Updating`,async()=>u.argo.tieredCaching.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:g,handler:async a=>{if(a.dryRun){r({command:`cf argo tiered-caching get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.argo.tieredCaching.get({zone_id:s})),{successLabel:`Loaded`})}},v={command:`tiered-caching`,describe:`Operations for tiered-caching`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`argo`,describe:`argo`,builder:e=>e.command(p).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};