cf 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/dist/_meta/commands.json +4040 -1629
  2. package/dist/_meta/hand-written-commands.json +16 -43
  3. package/dist/_meta/schemas.json +445 -756
  4. package/dist/abuse-reports-BAQR1w79.mjs +26 -0
  5. package/dist/access-C8KMplzp.mjs +27 -0
  6. package/dist/account-B-KQSR0L.mjs +12 -0
  7. package/dist/account-tags-EncLJpLc.mjs +15 -0
  8. package/dist/accounts-BA4Mp3A_.mjs +132 -0
  9. package/dist/acm-ByxUJcqF.mjs +15 -0
  10. package/dist/addressing-C-ym0h0G.mjs +93 -0
  11. package/dist/agent-memory-CkPSiZDI.mjs +34 -0
  12. package/dist/ai-DkE_Q64s.mjs +31 -0
  13. package/dist/ai-audit-pPcjYWI5.mjs +6 -0
  14. package/dist/ai-gateway-DtrwF1lQ.mjs +147 -0
  15. package/dist/ai-search-DLD_kDS1.mjs +79 -0
  16. package/dist/ai-security-jyZcBl9g.mjs +10 -0
  17. package/dist/alerting-DOROjm8E.mjs +56 -0
  18. package/dist/analytics-rQ-h-plT.mjs +21 -0
  19. package/dist/analytics_engine-Cg9gCAMt.mjs +4 -0
  20. package/dist/{lifecycle-CadF_i2n.mjs → ansi-styles-eKEZXVwN.mjs} +1 -1
  21. package/dist/api-security-B8p8vp8u.mjs +154 -0
  22. package/dist/argo-g8SjUb_t.mjs +10 -0
  23. package/dist/artifacts-B1PaeF5h.mjs +43 -0
  24. package/dist/audit-logs-DmU_PHy_.mjs +4 -0
  25. package/dist/auth-CZqics6E.mjs +2 -0
  26. package/dist/auth-Cp7gT-AF.mjs +8 -0
  27. package/dist/billing-CvTbUg-H.mjs +23 -0
  28. package/dist/bot-management-z53tbcbH.mjs +9 -0
  29. package/dist/botnet-feed-CSBbJdr_.mjs +11 -0
  30. package/dist/brand-protection-DzV211IQ.mjs +27 -0
  31. package/dist/browser-extension-C0Hi9CHX.mjs +15 -0
  32. package/dist/browser-run-DYQvMAyo.mjs +46 -0
  33. package/dist/build-BPIp8J5F.mjs +2 -0
  34. package/dist/build-OC77a1zq.mjs +2 -0
  35. package/dist/builds-CwKRqjQ5.mjs +71 -0
  36. package/dist/cache-CugNPPsJ.mjs +45 -0
  37. package/dist/certificate-authorities-DaEnJYge.mjs +6 -0
  38. package/dist/cf-oadujOtC.mjs +18 -0
  39. package/dist/{chunk-6EUZQHAF-B7bSMYLe.mjs → chunk-6EUZQHAF-QVTL_mC-.mjs} +1 -1
  40. package/dist/chunk-DL5FNmn1.mjs +2 -0
  41. package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-Cr1H_iK6.mjs} +1 -1
  42. package/dist/chunk-Q72B4Q5Z-DKhx_4ok.mjs +2 -0
  43. package/dist/chunk-QBZBEHZB-Byagrlop.mjs +2 -0
  44. package/dist/chunk-XLADBZ7F-BXKOjWbx.mjs +374 -0
  45. package/dist/client-certificates-DZUIqBTB.mjs +13 -0
  46. package/dist/client-side-security-Dk6F1ENG.mjs +63 -0
  47. package/dist/cloud-connector-avpf86kG.mjs +6 -0
  48. package/dist/cloudflared-DhItYrCq.mjs +2 -0
  49. package/dist/cloudforce-one-DNRhUD8z.mjs +456 -0
  50. package/dist/command-B2Qe-WUa.mjs +2 -0
  51. package/dist/{command-BL6weJf3.mjs → command-CF0giIIc.mjs} +1 -1
  52. package/dist/command-D45NW-R3.mjs +2 -0
  53. package/dist/command-DIvPLK8x.mjs +2 -0
  54. package/dist/{completions-Dn621okY.mjs → completions-xPLd1cvL.mjs} +3 -3
  55. package/dist/{config-BY6KpMZs.mjs → config-B4vIa0zp.mjs} +1 -1
  56. package/dist/connector-interrupts-BSztJ-Ko.mjs +6 -0
  57. package/dist/connector-telemetry-events-_M8CCK6_.mjs +6 -0
  58. package/dist/connector-telemetry-snapshots-DySvmR9a.mjs +6 -0
  59. package/dist/connectors-BSmhzNB7.mjs +15 -0
  60. package/dist/containers-B5vDcFzo.mjs +78 -0
  61. package/dist/{dist-CFQREIRi.mjs → containers-CFzvhmyz.mjs} +84 -83
  62. package/dist/content-scan-CeLZAcbT.mjs +14 -0
  63. package/dist/cps-BlI_Od72.mjs +6 -0
  64. package/dist/csamScanner-Cn7d0HWS.mjs +10 -0
  65. package/dist/ct-alerting-lhgFPu-y.mjs +5 -0
  66. package/dist/custom-certificates-Ba4Do5qt.mjs +17 -0
  67. package/dist/custom-csrs-MNUIx8yX.mjs +11 -0
  68. package/dist/custom-hostnames-Dj1SBd0J.mjs +27 -0
  69. package/dist/custom-nameservers-C7nzhNzV.mjs +9 -0
  70. package/dist/custom-pages-BgfhGksj.mjs +21 -0
  71. package/dist/d1-P2kWbdID.mjs +45 -0
  72. package/dist/data-security-pBIozmRL.mjs +71 -0
  73. package/dist/dcv-delegation-Bpy9WnKZ.mjs +4 -0
  74. package/dist/delegate-GctF_lrq.mjs +2 -0
  75. package/dist/delegate.mjs +1 -1
  76. package/dist/{deploy-BtETDvDA.mjs → deploy-CVYdt3NK.mjs} +1 -1
  77. package/dist/{deploy-input-BoLTdQzS.mjs → deploy-input-DpOgndz4.mjs} +1 -1
  78. package/dist/{dev-B5WcIpEr.mjs → dev-PPUBjWcm.mjs} +1 -1
  79. package/dist/diagnostics-C62habGQ.mjs +15 -0
  80. package/dist/{dialog-Bud0hiYv.mjs → dialog-C_ccBiZp.mjs} +1 -1
  81. package/dist/dist-B4pQ4CXK.mjs +48 -0
  82. package/dist/{dist-BRg_z9Ut.mjs → dist-BpadEMNY.mjs} +1 -1
  83. package/dist/dist-dc4E1u01.mjs +272 -0
  84. package/dist/dls-CpkcyQ8C.mjs +17 -0
  85. package/dist/dns-DG1X4Wap.mjs +135 -0
  86. package/dist/dns-firewall-B1gGHEDo.mjs +71 -0
  87. package/dist/{dot-prop-6SRZBKHT-wIVDg_fl.mjs → dot-prop-6SRZBKHT-Dj7YOlwR.mjs} +1 -1
  88. package/dist/dry-run-CLX6Pbtq.mjs +2 -0
  89. package/dist/durable-objects-D214VhxH.mjs +8 -0
  90. package/dist/email-auth-Ba4ONan2.mjs +6 -0
  91. package/dist/email-routing-BlqKnqNM.mjs +45 -0
  92. package/dist/email-security-Dl1E1Dko.mjs +160 -0
  93. package/dist/email-sending-DIRSSRIz.mjs +47 -0
  94. package/dist/error-sanitization-BkgUhGVc.mjs +2 -0
  95. package/dist/error-sanitization-DOlqWkNu.mjs +2 -0
  96. package/dist/fieldExtractors-zqYKMCEn.mjs +9 -0
  97. package/dist/firewall-DdsDh8GD.mjs +56 -0
  98. package/dist/flagship-CkUIVW7c.mjs +28 -0
  99. package/dist/fraud-BUpZgvQT.mjs +22 -0
  100. package/dist/google-tag-gateway-Bi1uLnEU.mjs +6 -0
  101. package/dist/healthchecks-DjQWb3EM.mjs +22 -0
  102. package/dist/hostnames-ClBLPbct.mjs +11 -0
  103. package/dist/hyperdrive-U54xZsWU.mjs +37 -0
  104. package/dist/iam-T-wWmOep.mjs +52 -0
  105. package/dist/images-ia5UG1GW.mjs +71 -0
  106. package/dist/index.mjs +1 -1
  107. package/dist/intel-BhswZLMI.mjs +76 -0
  108. package/dist/{interactive-CGOh-aYq.mjs → interactive-B6woOLo-.mjs} +23 -23
  109. package/dist/interactive-DnUvQHjc.mjs +2 -0
  110. package/dist/ips-Dad_EvhM.mjs +4 -0
  111. package/dist/keyless-certificates-BhHaxLjM.mjs +13 -0
  112. package/dist/keys-DjIPvqj4.mjs +4 -0
  113. package/dist/kv-DzXVnK94.mjs +21 -0
  114. package/dist/leaked-credential-checks-B9G_ZTNH.mjs +18 -0
  115. package/dist/lifecycle-Ichnb2x1.mjs +2 -0
  116. package/dist/load-balancers-3wGHPsYz.mjs +76 -0
  117. package/dist/local-B6b2OIBW.mjs +2 -0
  118. package/dist/local-BrfySqnx.mjs +2 -0
  119. package/dist/{local-runtime-Dj8k-p62.mjs → local-runtime-DD8DAIlm.mjs} +1 -1
  120. package/dist/login-CEQbOgBM.mjs +5 -0
  121. package/dist/login-DEWvGuaU.mjs +2 -0
  122. package/dist/logo-matches-YGRPstPi.mjs +6 -0
  123. package/dist/logos-BirufUgo.mjs +7 -0
  124. package/dist/logpush-BlNbUHyV.mjs +46 -0
  125. package/dist/logs-DmFlVF9q.mjs +48 -0
  126. package/dist/magic-cloud-networking-B3Wj2dhJ.mjs +71 -0
  127. package/dist/magic-network-monitoring-ry63w2Rw.mjs +36 -0
  128. package/dist/magic-transit-CBVOK2aa.mjs +387 -0
  129. package/dist/managed-defense-BdW6s483.mjs +18 -0
  130. package/dist/managed-transforms-BIeiofIS.mjs +9 -0
  131. package/dist/matches-CAnwci0P.mjs +6 -0
  132. package/dist/mcp-BfhOMGFE.mjs +32 -0
  133. package/dist/mesh-CxUL2Wf-.mjs +26 -0
  134. package/dist/mtls-certificates-CzmTw4zs.mjs +13 -0
  135. package/dist/network-C68psMbz.mjs +50 -0
  136. package/dist/network-interconnects-CLsMrTuk.mjs +73 -0
  137. package/dist/oauth-D4bkeMAw.mjs +14 -0
  138. package/dist/oauth-DouM-qz0.mjs +2 -0
  139. package/dist/oauth-clients-DbUmVE_5.mjs +16 -0
  140. package/dist/oauth-scopes-CQ18rwBg.mjs +4 -0
  141. package/dist/observability-DpYxkFeZ.mjs +80 -0
  142. package/dist/{open-PBXRGS4R-ClEt4E8F.mjs → open-PBXRGS4R-C4CKEADM.mjs} +1 -1
  143. package/dist/open-PBXRGS4R-C_-G_4DC.mjs +4 -0
  144. package/dist/organization-Dg55Xfz7.mjs +75 -0
  145. package/dist/organizations-QnyzGjB2.mjs +4 -0
  146. package/dist/origin-ca-certificates-Co5lqIGL.mjs +11 -0
  147. package/dist/origin-post-quantum-encryption-Cz8JZamC.mjs +6 -0
  148. package/dist/origin-tls-client-auth-Dd0T1Kfv.mjs +30 -0
  149. package/dist/{output-Z2lQmPUW.mjs → output-Bia1u2k5.mjs} +1 -1
  150. package/dist/page-rules--D3eXrCf.mjs +39 -0
  151. package/dist/pages-Ce8DDgNr.mjs +60 -0
  152. package/dist/pay-per-crawl-CpkEbasz.mjs +65 -0
  153. package/dist/pay-per-use-fyM1DWgY.mjs +6 -0
  154. package/dist/pipelines-CAqCgBLh.mjs +44 -0
  155. package/dist/precursor-DBnn4Q35.mjs +4 -0
  156. package/dist/previews-y_nSqWK5.mjs +4 -0
  157. package/dist/progress-Bi02B6v4.mjs +2 -0
  158. package/dist/{prompt-BP8XrQSj.mjs → prompt-Bx2PB-tt.mjs} +1 -1
  159. package/dist/queries-dg-CVXjf.mjs +9 -0
  160. package/dist/queues-C_ilLbRI.mjs +63 -0
  161. package/dist/r2-data-catalog-DGv6aROr.mjs +44 -0
  162. package/dist/r2-hZAkra-l.mjs +127 -0
  163. package/dist/radar-BO9b0aZy.mjs +300 -0
  164. package/dist/{raw-fetch-DNH2V8qH.mjs → raw-fetch-DNTQkXbg.mjs} +1 -1
  165. package/dist/realtime-eSavuSeE.mjs +172 -0
  166. package/dist/registrar-Ct30kOXZ.mjs +43 -0
  167. package/dist/registrar-sandbox-Dmn9zGUk.mjs +56 -0
  168. package/dist/{registry-BrtVdMrC.mjs → registry-vreNkX6u.mjs} +1 -1
  169. package/dist/reporting-B-F5aWUJ.mjs +14 -0
  170. package/dist/request-headers-Dnbzv6RZ.mjs +2 -0
  171. package/dist/request-tracers-CaubpUFV.mjs +4 -0
  172. package/dist/resolve-BXemCSyA.mjs +2 -0
  173. package/dist/resolve-CUDKxUrW.mjs +2 -0
  174. package/dist/resource-sharing-6Snv-b69.mjs +40 -0
  175. package/dist/resource-tagging-W_LFiX2J.mjs +4 -0
  176. package/dist/rules-C26eyeA5.mjs +18 -0
  177. package/dist/rulesets-BKzIwVtJ.mjs +37 -0
  178. package/dist/rum-Xdw5hyWY.mjs +30 -0
  179. package/dist/run-BBBMrSrs.mjs +2 -0
  180. package/dist/run-BRucX7Rz.mjs +2 -0
  181. package/dist/{schema-DmuJtMN5.mjs → schema-DqtYndhB.mjs} +1 -1
  182. package/dist/{schema-flags-CUGxFeZe.mjs → schema-flags-CebDI0f1.mjs} +1 -1
  183. package/dist/scim-odJTXiIe.mjs +18 -0
  184. package/dist/{sdk-Bvqx-_3z.mjs → sdk-CvIO3tWS.mjs} +1 -1
  185. package/dist/secrets-store-RYpWWzaw.mjs +24 -0
  186. package/dist/security-center-B3D95vCa.mjs +30 -0
  187. package/dist/security-txt-BSytVv-9.mjs +9 -0
  188. package/dist/shared-D67owd9x.mjs +2 -0
  189. package/dist/smart-shield-C83Sfnf4.mjs +24 -0
  190. package/dist/snippets-B6oE9WIa.mjs +20 -0
  191. package/dist/source-BR4_k2ad.mjs +6 -0
  192. package/dist/spawn-CKqJ9J4_.mjs +523 -0
  193. package/dist/spectrum-CfxY--X_.mjs +83 -0
  194. package/dist/speed-DzK-kiWt.mjs +24 -0
  195. package/dist/src-B3h6tKMt.mjs +108 -0
  196. package/dist/ssl-dnjzPcSB.mjs +45 -0
  197. package/dist/startup-profile-CYEokTVe.mjs +2 -0
  198. package/dist/startup-profile-CgWHy4rE.mjs +17 -0
  199. package/dist/state-BxCejn42.mjs +2 -0
  200. package/dist/state-DSzkxXML.mjs +2 -0
  201. package/dist/stream-oFyhS4Wi.mjs +102 -0
  202. package/dist/submit-4f-ravmC.mjs +4 -0
  203. package/dist/tags-DrIP6Uiq.mjs +4 -0
  204. package/dist/{telemetry-2s9Y3FaN.mjs → telemetry-Dk1GcQ0u.mjs} +1 -1
  205. package/dist/telemetry-Ds4epd3D.mjs +2 -0
  206. package/dist/telemetry-mKEb8lYB.mjs +2 -0
  207. package/dist/tenant-C-gc3NWv.mjs +12 -0
  208. package/dist/tenant-custom-nameservers-DduTQIwh.mjs +9 -0
  209. package/dist/{tools-Dz1JCrHd.mjs → tools-BMKpYraQ.mjs} +1 -1
  210. package/dist/tunnels-D0QYsskp.mjs +29 -0
  211. package/dist/turnstile-C6Q3spRB.mjs +33 -0
  212. package/dist/ui-DH95w1Qk.mjs +5 -0
  213. package/dist/undici-DTSBJHNS.mjs +96 -0
  214. package/dist/update-check-BBS1K1jt.mjs +2 -0
  215. package/dist/update-check-CTLoakFV.mjs +2 -0
  216. package/dist/update-check-worker.mjs +2 -0
  217. package/dist/url-info-Cs0V89qq.mjs +4 -0
  218. package/dist/url-normalization-DaEQYy5h.mjs +9 -0
  219. package/dist/url-scanner-C4YVeQ4v.mjs +16 -0
  220. package/dist/user-BV1VY3Kl.mjs +112 -0
  221. package/dist/values-qDS63E43.mjs +4 -0
  222. package/dist/vectorize-NFzD3mP5.mjs +32 -0
  223. package/dist/version-W6_TN_kN.mjs +2 -0
  224. package/dist/waiting-rooms-Y9YGj3ih.mjs +53 -0
  225. package/dist/web-assets-Gd6z8dbt.mjs +64 -0
  226. package/dist/web3-DCJx4NRp.mjs +28 -0
  227. package/dist/workers-B-j-1ygi.mjs +36 -0
  228. package/dist/workers-builds-DPrNKjZW.mjs +14 -0
  229. package/dist/workers-for-platforms-BjKAhMLA.mjs +25 -0
  230. package/dist/workers-vpc-C5YoCnQK.mjs +13 -0
  231. package/dist/workflows-C2KKIJjl.mjs +43 -0
  232. package/dist/zaraz-CVLCs1IX.mjs +22 -0
  233. package/dist/zero-trust-BtJi4OXF.mjs +795 -0
  234. package/dist/zone-hKgt0WzO.mjs +4 -0
  235. package/dist/zones-CCNyaD3J.mjs +124 -0
  236. package/package.json +12 -9
  237. package/dist/_meta/agent-context.json +0 -195
  238. package/dist/abuse-reports-CDFjJ2e8.mjs +0 -8
  239. package/dist/access-BoT1waG4.mjs +0 -11
  240. package/dist/account-agnMUKWj.mjs +0 -2
  241. package/dist/account-tags-BRMMHCee.mjs +0 -9
  242. package/dist/accounts-Cut77dAt.mjs +0 -30
  243. package/dist/acm-C8WgXNCl.mjs +0 -3
  244. package/dist/addressing-CR8EV42x.mjs +0 -13
  245. package/dist/agent-context-Wj5TRRbW.mjs +0 -8
  246. package/dist/agent-memory-CVJpKKZy.mjs +0 -6
  247. package/dist/ai-BbNYt-yI.mjs +0 -5
  248. package/dist/ai-audit-mVajM-2i.mjs +0 -2
  249. package/dist/ai-gateway-BsepSA_v.mjs +0 -13
  250. package/dist/ai-search-DbEJqm5-.mjs +0 -7
  251. package/dist/ai-security-DmyB5EYk.mjs +0 -4
  252. package/dist/alerting-dmy3hd8O.mjs +0 -6
  253. package/dist/analytics-B1xBMla0.mjs +0 -5
  254. package/dist/analytics_engine-DazCn3iC.mjs +0 -2
  255. package/dist/api-security-0HXCzfHk.mjs +0 -50
  256. package/dist/argo-DSHsE8zv.mjs +0 -2
  257. package/dist/artifacts-CwiU9Mxu.mjs +0 -5
  258. package/dist/audit-logs-DwFtMDwH.mjs +0 -2
  259. package/dist/auth-B0ZyXc3y.mjs +0 -5
  260. package/dist/auth-DWxtJ918.mjs +0 -8
  261. package/dist/billing-Cbpadkgu.mjs +0 -3
  262. package/dist/bot-management-B6M2Vyyn.mjs +0 -5
  263. package/dist/botnet-feed-Dn8UuE4h.mjs +0 -3
  264. package/dist/brand-protection-B5R0b3pu.mjs +0 -3
  265. package/dist/browser-extension-D55pYZf_.mjs +0 -3
  266. package/dist/browser-run-C1b2VkGB.mjs +0 -4
  267. package/dist/build-CP2JUfV1.mjs +0 -2
  268. package/dist/builds-CVEXO_4a.mjs +0 -9
  269. package/dist/cache-BU5xX82E.mjs +0 -9
  270. package/dist/certificate-authorities--tZTWJWD.mjs +0 -2
  271. package/dist/cf-BV2HLCQm.mjs +0 -18
  272. package/dist/chunk-QBZBEHZB-BcCMlc8C.mjs +0 -2
  273. package/dist/chunk-XLADBZ7F-DgFrtUhW.mjs +0 -103
  274. package/dist/chunk-vbHwaUoU.mjs +0 -2
  275. package/dist/client-certificates-DX84qeYG.mjs +0 -3
  276. package/dist/client-side-security-DsSO2rZQ.mjs +0 -37
  277. package/dist/cloud-connector-cf8qlxap.mjs +0 -2
  278. package/dist/cloudforce-one-DzVXorbu.mjs +0 -32
  279. package/dist/command-DYrspBc0.mjs +0 -2
  280. package/dist/connector-interrupts-DqpqPPkp.mjs +0 -2
  281. package/dist/connector-telemetry-events-CCD-_B-8.mjs +0 -2
  282. package/dist/connector-telemetry-snapshots-D3CeGGhk.mjs +0 -2
  283. package/dist/connectors-aPQspZdg.mjs +0 -3
  284. package/dist/containers-D0Kjl8h-.mjs +0 -58
  285. package/dist/content-scan-BVx18XmS.mjs +0 -4
  286. package/dist/cps-ByazyM0x.mjs +0 -2
  287. package/dist/csamScanner-OG5lQxBC.mjs +0 -6
  288. package/dist/ct-alerting-BJx5n8Zf.mjs +0 -3
  289. package/dist/custom-certificates-BuJ2e9TA.mjs +0 -5
  290. package/dist/custom-csrs-CR_5qbST.mjs +0 -3
  291. package/dist/custom-hostnames-BzDTsQXb.mjs +0 -5
  292. package/dist/custom-nameservers-OfMPRGkD.mjs +0 -3
  293. package/dist/custom-pages-BmGXoTIo.mjs +0 -3
  294. package/dist/d1-DedC8N0N.mjs +0 -21
  295. package/dist/data-security-B2UB26ry.mjs +0 -7
  296. package/dist/dcv-delegation-C11vmzbG.mjs +0 -2
  297. package/dist/diagnostics-Cf6BLpAo.mjs +0 -3
  298. package/dist/dist-CyisSore.mjs +0 -371
  299. package/dist/dist-Dr4Hg_Up.mjs +0 -48
  300. package/dist/dls-R6PvHbhj.mjs +0 -3
  301. package/dist/dns-Cl8se64c.mjs +0 -29
  302. package/dist/dns-firewall-WtmKilDT.mjs +0 -57
  303. package/dist/dry-run-YSQndLvt.mjs +0 -2
  304. package/dist/durable-objects-jfVU6yp_.mjs +0 -2
  305. package/dist/email-auth-DPmZ85eW.mjs +0 -2
  306. package/dist/email-routing-Bf6DbNTr.mjs +0 -6
  307. package/dist/email-security-DTifjSxM.mjs +0 -18
  308. package/dist/email-sending-Dm3WkFHV.mjs +0 -7
  309. package/dist/error-sanitization-D8zuyPj_.mjs +0 -2
  310. package/dist/fieldExtractors-CeXZL0-I.mjs +0 -3
  311. package/dist/firewall-D5N2APXO.mjs +0 -8
  312. package/dist/flagship-sUOy9jei.mjs +0 -4
  313. package/dist/fraud-WLW2Ep1Z.mjs +0 -20
  314. package/dist/google-tag-gateway-lbww1FaJ.mjs +0 -2
  315. package/dist/healthchecks-0ih8Qjiw.mjs +0 -4
  316. package/dist/hostnames-Ba6FuL8K.mjs +0 -3
  317. package/dist/hyperdrive-DMqcU639.mjs +0 -21
  318. package/dist/iam-CXlYm0uC.mjs +0 -6
  319. package/dist/images-D_g1oli6.mjs +0 -8
  320. package/dist/intel-B8bS0ARd.mjs +0 -8
  321. package/dist/ips-68fzniN4.mjs +0 -2
  322. package/dist/keyless-certificates-CeLnqBvX.mjs +0 -3
  323. package/dist/keys-DkVdS2lF.mjs +0 -2
  324. package/dist/kv-gDAN50BQ.mjs +0 -5
  325. package/dist/leaked-credential-checks-DfnvHpvg.mjs +0 -4
  326. package/dist/load-balancers-m0HqyXPZ.mjs +0 -6
  327. package/dist/local-BwL_gesw.mjs +0 -2
  328. package/dist/logo-matches-DPbHlsKQ.mjs +0 -2
  329. package/dist/logos-DFBJFAYJ.mjs +0 -3
  330. package/dist/logpush-gzmlZayc.mjs +0 -4
  331. package/dist/logs-BuzwQgt5.mjs +0 -18
  332. package/dist/magic-cloud-networking-BbHCi1Vp.mjs +0 -5
  333. package/dist/magic-network-monitoring-kWMmnPTG.mjs +0 -4
  334. package/dist/magic-transit-ClSmJDKw.mjs +0 -111
  335. package/dist/managed-defense-EOihg1UR.mjs +0 -2
  336. package/dist/managed-transforms-BZ_XdGE2.mjs +0 -3
  337. package/dist/matches-B6sG0_fr.mjs +0 -2
  338. package/dist/mcp--kK0vS5i.mjs +0 -4
  339. package/dist/mesh-DfXYUHOO.mjs +0 -4
  340. package/dist/mtls-certificates-DZd-0X7l.mjs +0 -3
  341. package/dist/network-U6f_5ihp.mjs +0 -6
  342. package/dist/network-interconnects-DKZGTiYM.mjs +0 -41
  343. package/dist/oauth-BdVr2hJp.mjs +0 -14
  344. package/dist/oauth-clients-CY3OkPhC.mjs +0 -4
  345. package/dist/oauth-scopes-BTY7_5L-.mjs +0 -2
  346. package/dist/observability-Bsp-LdmJ.mjs +0 -10
  347. package/dist/organization-BSeMdj-7.mjs +0 -45
  348. package/dist/organizations-BroR48Nv.mjs +0 -2
  349. package/dist/origin-ca-certificates-jC-EMn6W.mjs +0 -3
  350. package/dist/origin-post-quantum-encryption-DIspLvA0.mjs +0 -2
  351. package/dist/origin-tls-client-auth-CZ_nUEcM.mjs +0 -4
  352. package/dist/page-rules-ZcdjPohY.mjs +0 -27
  353. package/dist/pages-W4tKa7xk.mjs +0 -14
  354. package/dist/pay-per-crawl-BNM1mJmP.mjs +0 -5
  355. package/dist/pay-per-use-DKxlnkH3.mjs +0 -2
  356. package/dist/pipelines-Dug0BR-c.mjs +0 -6
  357. package/dist/precursor-D-11DkRU.mjs +0 -4
  358. package/dist/previews-D_Nv4dR6.mjs +0 -4
  359. package/dist/progress-a5IKeKni.mjs +0 -2
  360. package/dist/queries-BdA2vJoe.mjs +0 -3
  361. package/dist/queues-Bu06ZqUE.mjs +0 -7
  362. package/dist/r2-COC9wMKb.mjs +0 -25
  363. package/dist/r2-data-catalog-CX5Rl5Qx.mjs +0 -16
  364. package/dist/radar-L-yoLIHF.mjs +0 -2
  365. package/dist/realtime-JKIiXfzi.mjs +0 -20
  366. package/dist/registrar-_dYUZrK0.mjs +0 -43
  367. package/dist/registrar-sandbox-D1yfW_Q_.mjs +0 -56
  368. package/dist/reporting-3fyoMcmb.mjs +0 -2
  369. package/dist/request-headers-BhQQAfJt.mjs +0 -2
  370. package/dist/request-tracers-TisEth2p.mjs +0 -2
  371. package/dist/resolve-CYUp6YgC.mjs +0 -2
  372. package/dist/resource-sharing-C4-dnohU.mjs +0 -6
  373. package/dist/resource-tagging-BRDifKqM.mjs +0 -2
  374. package/dist/rules-BCF3gIkw.mjs +0 -4
  375. package/dist/rulesets-wp6rllt3.mjs +0 -5
  376. package/dist/rum-B77awgoB.mjs +0 -4
  377. package/dist/run-BS8otL3u.mjs +0 -2
  378. package/dist/scim-C9BmUYil.mjs +0 -4
  379. package/dist/secrets-store-ckkZR2dM.mjs +0 -7
  380. package/dist/security-center-BCahKT57.mjs +0 -2
  381. package/dist/security-txt-0SI5du7I.mjs +0 -3
  382. package/dist/shared-D0B-7q-D.mjs +0 -2
  383. package/dist/smart-shield-BDPbrZa4.mjs +0 -4
  384. package/dist/snippets-CVRR_h0i.mjs +0 -4
  385. package/dist/spawn-DP4T92ss.mjs +0 -519
  386. package/dist/spectrum-CjNXQIQE.mjs +0 -63
  387. package/dist/speed-CrXCHk3h.mjs +0 -4
  388. package/dist/src-BbnV77C4.mjs +0 -108
  389. package/dist/ssl-DKORhHkh.mjs +0 -15
  390. package/dist/startup-profile-CBIH6yZy.mjs +0 -17
  391. package/dist/state-QUu6HfxC.mjs +0 -2
  392. package/dist/stream-wY3zi3FK.mjs +0 -16
  393. package/dist/submit-B-4oCBSk.mjs +0 -2
  394. package/dist/tags-5uJEkYJZ.mjs +0 -2
  395. package/dist/telemetry-n3NJourL.mjs +0 -2
  396. package/dist/tenant-BkFvv2o3.mjs +0 -2
  397. package/dist/tenant-custom-nameservers-DcjC1q0r.mjs +0 -3
  398. package/dist/tunnel-Cd4ipbvJ.mjs +0 -2
  399. package/dist/tunnels-9Zg3ePwD.mjs +0 -5
  400. package/dist/turnstile-BTwKYpzD.mjs +0 -23
  401. package/dist/ui-DQSZeaG5.mjs +0 -5
  402. package/dist/url-info-D7Y61BFd.mjs +0 -2
  403. package/dist/url-normalization-B4n8HiNQ.mjs +0 -3
  404. package/dist/url-scanner-CiCIltSQ.mjs +0 -2
  405. package/dist/user-DDFDGJ0Y.mjs +0 -12
  406. package/dist/values-DRznB_Cl.mjs +0 -2
  407. package/dist/vectorize-CbznPhzq.mjs +0 -4
  408. package/dist/waiting-rooms-CKP5hYBK.mjs +0 -11
  409. package/dist/web-assets-C-ZoSkkh.mjs +0 -8
  410. package/dist/web3-DwlN4dOw.mjs +0 -4
  411. package/dist/workers-builds-ECw_x_kp.mjs +0 -2
  412. package/dist/workers-for-platforms-BYGy46R6.mjs +0 -5
  413. package/dist/workers-vpc-CCosFcxz.mjs +0 -3
  414. package/dist/workers-zFMrbUkg.mjs +0 -6
  415. package/dist/workflows-C8GXGDRW.mjs +0 -5
  416. package/dist/zaraz-B5UIREaz.mjs +0 -2
  417. package/dist/zero-trust-DUp0XoIo.mjs +0 -91
  418. package/dist/zone-BGLkk-mL.mjs +0 -2
  419. package/dist/zones-CwYjNXMH.mjs +0 -44
  420. /package/dist/{alerts-CarPLL8k.mjs → alerts-CstOk8n0.mjs} +0 -0
  421. /package/dist/{autorag-zK-3harf.mjs → autorag-PRTwXGgn.mjs} +0 -0
  422. /package/dist/{body-parser-Cmw7PZ7a.mjs → body-parser-CUWbw_Tq.mjs} +0 -0
  423. /package/dist/{brands-CpgTsX8h.mjs → brands-BHRXlWDm.mjs} +0 -0
  424. /package/dist/{clear-C5gzBA8G.mjs → clear-UvKESVx3.mjs} +0 -0
  425. /package/dist/{cli-types-abvWQN3T.mjs → cli-types-tt_LZMbn.mjs} +0 -0
  426. /package/dist/{connector-telemetry-events-latest-BY-dbhQZ.mjs → connector-telemetry-events-latest-DwnFeZg0.mjs} +0 -0
  427. /package/dist/{connector-telemetry-snapshots-latest-DoMvHvCO.mjs → connector-telemetry-snapshots-latest-Dv6rZlxs.mjs} +0 -0
  428. /package/dist/{domain-info-Cw3G4nap.mjs → domain-info-BqTDXNBo.mjs} +0 -0
  429. /package/dist/{health-DkEXPkS6.mjs → health-CwPzzrV6.mjs} +0 -0
  430. /package/dist/{input-validation-nF-0Ze2h.mjs → input-validation-Ch4Vllrm.mjs} +0 -0
  431. /package/dist/{internal-4fU2r5en.mjs → internal-WLHfxX64.mjs} +0 -0
  432. /package/dist/{live-B4iGrwY2.mjs → live-D_k7eHdv.mjs} +0 -0
  433. /package/dist/{metadata-C5fJJr-k.mjs → metadata-APBiectA.mjs} +0 -0
  434. /package/dist/{project-settings-Bc3wYHo8.mjs → project-settings-DSXevRvj.mjs} +0 -0
  435. /package/dist/{rate-limit-analytics-DNsAFIeM.mjs → rate-limit-analytics-CDTPxSET.mjs} +0 -0
  436. /package/dist/{rate-limits-CsOim7bm.mjs → rate-limits-C3K9smdl.mjs} +0 -0
  437. /package/dist/{ready-tTe-zcIw.mjs → ready-CvwvbdTX.mjs} +0 -0
  438. /package/dist/{recent-submissions-B3eTV5yC.mjs → recent-submissions-CjzcT-iH.mjs} +0 -0
  439. /package/dist/{refute-BY76YVrT.mjs → refute-CIAFMj00.mjs} +0 -0
  440. /package/dist/{scan-logo-DdoF_a5y.mjs → scan-logo-zFkphtQ3.mjs} +0 -0
  441. /package/dist/{scan-page-sSgLwwZN.mjs → scan-page-CLl2MAkZ.mjs} +0 -0
  442. /package/dist/{search-BFvQr-sl.mjs → search-12jA1b4l.mjs} +0 -0
  443. /package/dist/{signed-url-Cr8hiZPJ.mjs → signed-url-U0T_PEMR.mjs} +0 -0
  444. /package/dist/{submission-info-DT2mLnu1.mjs → submission-info-CZ84a3Nb.mjs} +0 -0
  445. /package/dist/{theme-CeVf-5qG.mjs → theme-BiIYWOed.mjs} +0 -0
  446. /package/dist/{total-queries-6gs5iy9T.mjs → total-queries-CJTc9Pde.mjs} +0 -0
  447. /package/dist/{tracked-domains-D6XKO2EV.mjs → tracked-domains-BKLxnnSv.mjs} +0 -0
  448. /package/dist/{verify-CM1NakP0.mjs → verify-CZW5Fo1q.mjs} +0 -0
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-BwL_gesw.mjs";import{f as t,g as n}from"./oauth-BdVr2hJp.mjs";import{r}from"./auth-DWxtJ918.mjs";import{t as i}from"./output-Z2lQmPUW.mjs";import{t as a}from"./dry-run-YSQndLvt.mjs";import{t as o}from"./progress-a5IKeKni.mjs";import{t as s}from"./run-BS8otL3u.mjs";import"./telemetry-n3NJourL.mjs";import{n as c,r as l,t as u}from"./body-parser-Cmw7PZ7a.mjs";import{n as d}from"./input-validation-nF-0Ze2h.mjs";import{a as f,i as p,n as m}from"./prompt-BP8XrQSj.mjs";import{t as h}from"./cli-types-abvWQN3T.mjs";function g(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`download`,{type:`string`,description:`Download`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'matchedAt', 'domain', 'similarityScore', or 'registrar'`,choices:[`matchedAt`,`domain`,`similarityScore`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:h(g),handler:async c=>s({command:`brand-protection logo-matches get`,classification:{safeFlags:[`order-by`,`order`,`dry-run`]}},c,async()=>{let s={offset:c.offset,limit:c.limit,query_id:c[`query-id`],download:c.download,orderBy:c[`order-by`],order:c.order};if(c.dryRun){a({command:`cf brand-protection logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/matches`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.brandProtection.logoMatches.get({account_id:u,...s})),{successLabel:`Loaded`})})},v={command:`logo-matches`,describe:`Operations for logo-matches`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`search-lookback`,{type:`boolean`,description:`If true, search historic scanned images for matches above the similarity threshold`,default:!0}).option(`similarity-threshold`,{type:`number`,description:`Minimum similarity score (0-1) required for visual matches`}).option(`tag`,{type:`string`,description:`Unique identifier for the logo query`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:y,handler:async l=>s({command:`brand-protection logos create`,classification:{safeFlags:[`search-lookback`,`dry-run`]}},l,async()=>{if(l.dryRun){a({command:`cf brand-protection logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},bodyKind:`json`,body:l.body===void 0?u({image_data:d(l[`image-data`],`image-data`,`text`),search_lookback:l[`search-lookback`],similarity_threshold:l[`similarity-threshold`],tag:d(l.tag,`tag`,`text`)}):c(l.body)});return}let s=await r(l),p=l.local?e:await t();if(l.accountId=p,l.body){let e=c(l.body);i(await o(`Creating`,async()=>s.brandProtection.logos.create({...e,account_id:p})),{successLabel:`Created`});return}if(l[`image-data`]===void 0&&(l[`image-data`]=await f(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),l[`similarity-threshold`]===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);l.tag===void 0&&(l.tag=await f(`tag`,`Unique identifier for the logo query`));let m=u({image_data:d(l[`image-data`],`image-data`,`text`),search_lookback:l[`search-lookback`],similarity_threshold:l[`similarity-threshold`],tag:d(l.tag,`tag`,`text`)});i(await o(`Creating`,async()=>s.brandProtection.logos.create({...m,account_id:p})),{successLabel:`Created`})})};function x(e){return e.positional(`query-id`,{type:`string`,description:`Query 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 S={command:`delete <query-id>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:x,handler:async c=>s({command:`brand-protection logos delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf brand-protection logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${c[`query-id`]==null?`<query-id>`:encodeURIComponent(String(c[`query-id`]))}`,pathParams:{"query-id":String(c[`query-id`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await m({force:!!c.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>s.brandProtection.logos.delete({account_id:l,query_id:c[`query-id`]})),{successLabel:`Deleted`})})};function C(e){return e.option(`id`,{type:`string`,description:`Optional query ID to retrieve a specific logo query`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get`,describe:`Get all saved brand protection logo queries for an account. Optionally specify id to get a single query. Set download=true to include base64-encoded image data.`,builder:C,handler:async c=>s({command:`brand-protection logos get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={id:c.id,download:c.download};if(c.dryRun){a({command:`cf brand-protection logos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.brandProtection.logos.get({account_id:u,...s})),{successLabel:`Loaded`})})},T={command:`logos`,describe:`Operations for logos`,builder:e=>e.command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`action`,{type:`string`,description:`The action field`,choices:[`dismiss`,`undismiss`]}).option(`match-ids`,{type:`string`,array:!0,description:`The match_ids field`}).option(`matches`,{type:`string`,description:`The matches field. Provide as a JSON array of objects or @path/to/file.json.`}).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 D={command:`bulk-dismiss`,describe:`Dismiss or undismiss multiple matches in a single request. Accepts either the new format (matches: [{query_id, domain_id}]) for per-query control, or the legacy format (match_ids: [number]) which dismisses for all queries sharing each match's hash. Returns per-item success/error results.`,builder:E,handler:async f=>s({command:`brand-protection matches bulk-dismiss`,classification:{safeFlags:[`action`,`dry-run`]}},f,async()=>{if(f.dryRun){a({command:`cf brand-protection matches bulk-dismiss`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/matches/bulk-dismiss`,pathParams:{},bodyKind:`json`,body:f.body===void 0?u({action:d(f.action,`action`,`text`),match_ids:f[`match-ids`],matches:l(f.matches,`matches`)}):c(f.body)});return}let s=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=c(f.body);i(await o(`Creating`,async()=>s.brandProtection.matches.bulkDismiss({...e,account_id:m})),{successLabel:`Created`});return}f.action===void 0&&(f.action=await p(`action`,`The action field`,[`dismiss`,`undismiss`]));let h=u({action:d(f.action,`action`,`text`),match_ids:f[`match-ids`],matches:l(f.matches,`matches`)});i(await o(`Creating`,async()=>s.brandProtection.matches.bulkDismiss({...h,account_id:m})),{successLabel:`Created`})})};function O(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID or comma-separated list of Query IDs. When multiple IDs are provided, matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and dismissed state.`,demandOption:!0}).option(`include-domain-id`,{type:`string`,description:`Include domain ID`}).option(`include-dismissed`,{type:`string`,description:`Include dismissed`}).option(`domain-search`,{type:`string`,description:`Filter matches by domain name (substring match)`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'domain', 'first_seen', or 'registrar'`,choices:[`domain`,`first_seen`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get`,describe:`Get paginated list of domain matches for one or more brand protection queries. When multiple query_ids are provided (comma-separated), matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and individual dismissed state.`,builder:h(O),handler:async c=>s({command:`brand-protection matches get`,classification:{safeFlags:[`order-by`,`order`,`dry-run`]}},c,async()=>{let s={offset:c.offset,limit:c.limit,query_id:c[`query-id`],include_domain_id:c[`include-domain-id`],include_dismissed:c[`include-dismissed`],domain_search:c[`domain-search`],orderBy:c[`order-by`],order:c.order};if(c.dryRun){a({command:`cf brand-protection matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/matches`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.brandProtection.matches.get({account_id:u,...s})),{successLabel:`Loaded`})})},A={command:`matches`,describe:`Operations for matches`,builder:e=>e.command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`domain-id`,{type:`string`,description:`Domain ID`,demandOption:!0}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`dismiss <domain-id>`,describe:`Mark a specific domain as dismissed for a given query. Dismissals are per-query — dismissing a domain in one query does not affect other queries.`,builder:j,handler:async c=>s({command:`brand-protection queries dismiss`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf brand-protection queries dismiss`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/queries/${c[`query-id`]==null?`<query-id>`:encodeURIComponent(String(c[`query-id`]))}/matches/${c[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(c[`domain-id`]))}/dismiss`,pathParams:{"query-id":String(c[`query-id`]??``),"domain-id":String(c[`domain-id`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Creating`,async()=>s.brandProtection.queries.dismiss({account_id:l,query_id:c[`query-id`],domain_id:c[`domain-id`]})),{successLabel:`Created`})})};function N(e){return e.option(`id`,{type:`string`,description:`ID`}).option(`page`,{type:`number`,description:`Optional page number for paginated list requests. Defaults to 1 when only per_page is supplied. Omit page and per_page to preserve the legacy full-list response.`}).option(`per-page`,{type:`number`,description:`Optional number of queries per page for paginated list requests. Defaults to 100 when only page is supplied. Maximum 100. Omit page and per_page to preserve the legacy full-list response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get`,describe:`Get all saved brand protection queries for an account`,builder:N,handler:async c=>s({command:`brand-protection queries get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={id:c.id,page:c.page,per_page:c[`per-page`]};if(c.dryRun){a({command:`cf brand-protection queries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.brandProtection.queries.get({account_id:u,...s})),{successLabel:`Loaded`})})};function F(e){return e.positional(`domain-id`,{type:`string`,description:`Domain ID`,demandOption:!0}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`undismiss <domain-id>`,describe:`Remove the dismissed status from a specific domain for a given query. Undismissals are per-query — undismissing a domain in one query does not affect other queries.`,builder:F,handler:async c=>s({command:`brand-protection queries undismiss`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf brand-protection queries undismiss`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/queries/${c[`query-id`]==null?`<query-id>`:encodeURIComponent(String(c[`query-id`]))}/matches/${c[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(c[`domain-id`]))}/undismiss`,pathParams:{"query-id":String(c[`query-id`]??``),"domain-id":String(c[`domain-id`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Creating`,async()=>s.brandProtection.queries.undismiss({account_id:l,query_id:c[`query-id`],domain_id:c[`domain-id`]})),{successLabel:`Created`})})},L={command:`queries`,describe:`Operations for queries`,builder:e=>e.command(M).command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`show-historic`,{type:`string`,description:`Include scanned images without domain metadata (historic data). Default: false (only show images with domain)`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score threshold for matches (0-1, default: 0)`,default:0}).option(`top-k`,{type:`number`,description:`Number of closest matches to return (1-100, default: 10)`,default:10}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`submit`,describe:`Submit an image and find the n closest matches from the scanned images index without creating any match records. Returns similarity scores and metadata for each match.`,builder:R,handler:async l=>s({command:`brand-protection submit`,classification:{safeFlags:[`dry-run`]}},l,async()=>{let s={showHistoric:l[`show-historic`],download:l.download};if(l.dryRun){a({command:`cf brand-protection submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/search`,pathParams:{},query:s,bodyKind:`json`,body:l.body===void 0?u({image_data:d(l[`image-data`],`image-data`,`text`),score_threshold:l[`score-threshold`],top_k:l[`top-k`]}):c(l.body)});return}let p=await r(l),m=l.local?e:await t();if(l.accountId=m,l.body){let e=c(l.body);new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>p.brandProtection.submit({...e,account_id:m,...s})),{successLabel:`Created`});return}l[`image-data`]===void 0&&(l[`image-data`]=await f(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let h=u({image_data:d(l[`image-data`],`image-data`,`text`),score_threshold:l[`score-threshold`],top_k:l[`top-k`]});new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>p.brandProtection.submit({...h,account_id:m,...s})),{successLabel:`Created`})})};function B(e){return e.option(`brand`,{type:`string`,description:`The brand 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 V={command:`create`,describe:`Uses AI to scan all domains in the lookback table and identify potential phishing or impersonation attempts against the given brand string.`,builder:B,handler:async l=>s({command:`brand-protection trial create`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){a({command:`cf brand-protection trial create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/trial`,pathParams:{},bodyKind:`json`,body:l.body===void 0?u({brand:d(l.brand,`brand`,`text`)}):c(l.body)});return}let s=await r(l),p=l.local?e:await t();if(l.accountId=p,l.body){let e=c(l.body);i(await o(`Creating`,async()=>s.brandProtection.trial.create({...e,account_id:p})),{successLabel:`Created`});return}l.brand===void 0&&(l.brand=await f(`brand`,`The brand field`));let m=u({brand:d(l.brand,`brand`,`text`)});i(await o(`Creating`,async()=>s.brandProtection.trial.create({...m,account_id:p})),{successLabel:`Created`})})},H={command:`trial`,describe:`Operations for trial`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,builder:U,handler:async c=>s({command:`brand-protection url-info`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf brand-protection url-info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cloudforce-one/v2/brand-protection/total-queries`,pathParams:{},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.brandProtection.urlInfo({account_id:l})),{successLabel:`Loaded`})})},G={command:`brand-protection`,describe:`brand-protection`,builder:e=>e.command(z).command(W).command(v).command(T).command(A).command(L).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{G as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-BwL_gesw.mjs";import{f as t,g as n}from"./oauth-BdVr2hJp.mjs";import{r}from"./auth-DWxtJ918.mjs";import{t as i}from"./output-Z2lQmPUW.mjs";import{t as a}from"./dry-run-YSQndLvt.mjs";import{t as o}from"./progress-a5IKeKni.mjs";import{t as s}from"./run-BS8otL3u.mjs";import"./telemetry-n3NJourL.mjs";import{n as c,r as l,t as u}from"./body-parser-Cmw7PZ7a.mjs";import{n as d}from"./input-validation-nF-0Ze2h.mjs";import{a as f,n as p}from"./prompt-BP8XrQSj.mjs";function m(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-team-name`,{type:`string`,description:"Access team name. The service derives `team_domain` as `<team_name>.cloudflareaccess.com`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`create`,describe:`Creates the browser extension configuration for an account.`,builder:m,handler:async l=>s({command:`browser-extension config create`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){a({command:`cf browser-extension config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:l.body===void 0?u({config:{min_extension_version:d(l[`config-min-extension-version`],`config-min-extension-version`,`text`),team_name:d(l[`config-team-name`],`config-team-name`,`text`)}}):c(l.body)});return}let s=await r(l),p=l.local?e:await t();if(l.accountId=p,l.body){let e=c(l.body);i(await o(`Creating`,async()=>s.browserExtension.config.create({...e,account_id:p})),{successLabel:`Created`});return}l[`config-team-name`]===void 0&&(l[`config-team-name`]=await f(`config-team-name`,"Access team name. The service derives `team_domain` as `<team_name>.cloudflareaccess.com`."));let m=u({config:{min_extension_version:d(l[`config-min-extension-version`],`config-min-extension-version`,`text`),team_name:d(l[`config-team-name`],`config-team-name`,`text`)}});i(await o(`Creating`,async()=>s.browserExtension.config.create({...m,account_id:p})),{successLabel:`Created`})})};function g(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 _={command:`delete`,describe:`Deletes the browser extension configuration for an account. The shard mapping is preserved and not deleted.`,builder:g,handler:async c=>s({command:`browser-extension config delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf browser-extension config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>s.browserExtension.config.delete({account_id:l})),{successLabel:`Deleted`})})};function v(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Returns the browser extension configuration for an account.`,builder:v,handler:async c=>s({command:`browser-extension config get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf browser-extension config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.browserExtension.config.get({account_id:l})),{successLabel:`Loaded`})})};function b(e){return e.option(`fields`,{type:`string`,array:!0,description:`The fields field`}).option(`filters`,{type:`string`,description:`The filters field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:`The from field`}).option(`include-total`,{type:`boolean`,description:`The includeTotal field`,default:!1}).option(`limit`,{type:`number`,description:`The limit field`,default:50}).option(`page`,{type:`number`,description:`The page field`,default:1}).option(`to`,{type:`string`,description:`The to field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`search`,describe:`Searches browser extension event logs for an account. The request accepts only supported fields and filters; raw SQL is not accepted.`,builder:b,handler:async p=>s({command:`browser-extension config logs extension-events search`,classification:{safeFlags:[`include-total`,`dry-run`]}},p,async()=>{if(p.dryRun){a({command:`cf browser-extension config logs extension-events search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config/logs/extension-events/search`,pathParams:{},bodyKind:`json`,body:p.body===void 0?u({fields:p.fields,filters:l(p.filters,`filters`),from:d(p.from,`from`,`text`),includeTotal:p[`include-total`],limit:p.limit,page:p.page,to:d(p.to,`to`,`text`)}):c(p.body)});return}let s=await r(p),m=p.local?e:await t();if(p.accountId=m,p.body){let e=c(p.body);i(await o(`Loading`,async()=>s.browserExtension.config.logs.extensionEvents.search({...e,account_id:m})),{successLabel:`Loaded`});return}p.from===void 0&&(p.from=await f(`from`,`The from field`)),p.to===void 0&&(p.to=await f(`to`,`The to field`));let h=u({fields:p.fields,filters:l(p.filters,`filters`),from:d(p.from,`from`,`text`),includeTotal:p[`include-total`],limit:p.limit,page:p.page,to:d(p.to,`to`,`text`)});i(await o(`Loading`,async()=>s.browserExtension.config.logs.extensionEvents.search({...h,account_id:m})),{successLabel:`Loaded`})})},S={command:`extension-events`,describe:`Operations for config.logs.extension-events`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},C={command:`logs`,describe:`Operations for config.logs`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-team-name`,{type:`string`,description:"Access team name. The service derives `team_domain` as `<team_name>.cloudflareaccess.com`."}).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 T={command:`update`,describe:`Replaces the browser extension configuration for an account. The configuration must already exist. The shard mapping is immutable.`,builder:w,handler:async l=>s({command:`browser-extension config update`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){a({command:`cf browser-extension config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:l.body===void 0?u({config:{min_extension_version:d(l[`config-min-extension-version`],`config-min-extension-version`,`text`),team_name:d(l[`config-team-name`],`config-team-name`,`text`)}}):c(l.body)});return}let s=await r(l),p=l.local?e:await t();if(l.accountId=p,l.body){let e=c(l.body);i(await o(`Updating`,async()=>s.browserExtension.config.update({...e,account_id:p})),{successLabel:`Updated`});return}l[`config-team-name`]===void 0&&(l[`config-team-name`]=await f(`config-team-name`,"Access team name. The service derives `team_domain` as `<team_name>.cloudflareaccess.com`."));let m=u({config:{min_extension_version:d(l[`config-min-extension-version`],`config-min-extension-version`,`text`),team_name:d(l[`config-team-name`],`config-team-name`,`text`)}});i(await o(`Updating`,async()=>s.browserExtension.config.update({...m,account_id:p})),{successLabel:`Updated`})})},E={command:`config`,describe:`Operations for config`,builder:e=>e.command(h).command(_).command(y).command(T).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`registration-id`,{type:`string`,description:`Browser extension registration ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <registration-id>`,describe:`Returns the installed extension inventory for a single registered browser extension device.`,builder:D,handler:async c=>s({command:`browser-extension inventories get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf browser-extension inventories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config/inventories/${c[`registration-id`]==null?`<registration-id>`:encodeURIComponent(String(c[`registration-id`]))}`,pathParams:{"registration-id":String(c[`registration-id`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.browserExtension.inventories.get({account_id:l,registration_id:c[`registration-id`]})),{successLabel:`Loaded`})})};function k(e){return e.option(`cursor`,{type:`string`,description:`Opaque cursor from a previous response to fetch the next page.`}).option(`per-page`,{type:`number`,description:`Number of results per page (default 50, max 200).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:"Returns the installed extension inventory for each registered browser extension device in the account. Each device reports its inventory periodically; this endpoint returns the latest known snapshot per device. Results are paginated by cursor. Pass the `cursor` from a previous response to fetch the next page. `per_page` controls page size (default 50, max 200).",builder:k,handler:async c=>s({command:`browser-extension inventories list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={cursor:c.cursor,per_page:c[`per-page`]};if(c.dryRun){a({command:`cf browser-extension inventories list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-extension/config/inventories`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.browserExtension.inventories.list({account_id:u,...s})),{successLabel:`Loaded`})})},j={command:`inventories`,describe:`Operations for inventories`,builder:e=>e.command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`browser-extension`,describe:`browser-extension`,builder:e=>e.command(E).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-BwL_gesw.mjs";import{f as t,g as n}from"./oauth-BdVr2hJp.mjs";import{a as r,r as i}from"./auth-DWxtJ918.mjs";import{t as a}from"./output-Z2lQmPUW.mjs";import{t as o}from"./dry-run-YSQndLvt.mjs";import{t as s}from"./progress-a5IKeKni.mjs";import{t as c}from"./run-BS8otL3u.mjs";import"./telemetry-n3NJourL.mjs";import{i as l,n as u,r as d,t as f}from"./body-parser-Cmw7PZ7a.mjs";import{n as p}from"./input-validation-nF-0Ze2h.mjs";import{n as m}from"./prompt-BP8XrQSj.mjs";import{t as h}from"./cli-types-abvWQN3T.mjs";import{n as g,t as _}from"./raw-fetch-DNH2V8qH.mjs";function v(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`create`,describe:"Starts a crawl job for the provided URL and its children. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:v,handler:async l=>c({command:`browser-run crawl create`,classification:{safeFlags:[`dry-run`]}},l,async()=>{let c={cacheTTL:l[`cache-ttl`]};if(l.dryRun){o({command:`cf browser-run crawl create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/crawl`,pathParams:{},query:c,bodyKind:`json`,body:l.body===void 0?void 0:u(l.body)});return}let d=await i(l),f=l.local?e:await t();if(l.accountId=f,l.body){let e=u(l.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>d.browserRun.crawl.create({body:e,account_id:f,...c})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/crawl`,{query:c})),{successLabel:`Created`})})};function te(e){return e.positional(`job-id`,{type:`string`,description:`The ID of the crawl job to cancel.`,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 y={command:`delete <job-id>`,describe:`Cancels an ongoing crawl job by setting its status to cancelled and stopping all queued URLs.`,builder:te,handler:async r=>c({command:`browser-run crawl delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},r,async()=>{if(r.dryRun){o({command:`cf browser-run crawl delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/crawl/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{"job-id":String(r[`job-id`]??``)},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.
3
- `);return}a(await s(`Deleting`,async()=>c.browserRun.crawl.delete({account_id:l,job_id:r[`job-id`]})),{successLabel:`Deleted`})})};function b(e){return e.positional(`job-id`,{type:`string`,description:`Crawl job ID.`,demandOption:!0}).option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`status`,{type:`string`,description:`Filter by URL status.`,choices:[`queued`,`errored`,`completed`,`disallowed`,`skipped`,`cancelled`]}).option(`cursor`,{type:`number`,description:`Cursor for pagination.`}).option(`limit`,{type:`number`,description:`Limit for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get <job-id>`,describe:`Returns the result of a crawl job.`,builder:h(b),handler:async r=>c({command:`browser-run crawl get`,classification:{safeFlags:[`status`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`],status:r.status,cursor:r.cursor,limit:r.limit};if(r.dryRun){o({command:`cf browser-run crawl get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/crawl/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{"job-id":String(r[`job-id`]??``)},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.browserRun.crawl.get({account_id:u,job_id:r[`job-id`],...c})),{successLabel:`Loaded`})})},S={command:`crawl`,describe:`Operations for crawl`,builder:e=>e.command(ee).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID to connect to.`,demandOption:!0}).option(`keep-alive`,{type:`number`,description:`Keep-alive time in ms (only valid when acquiring new session).`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`cf-brapi-guardrails`,{type:`string`,description:`Optional base64url-encoded JSON connection guardrails (mode)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`connect <session-id>`,describe:`Establishes a WebSocket connection to an existing browser session.`,builder:C,handler:async l=>c({command:`browser-run devtools browser connect`,classification:{safeFlags:[`lab`,`recording`,`dry-run`]}},l,async()=>{let c={keep_alive:l[`keep-alive`],lab:l.lab,recording:l.recording},u={};if(l[`cf-brapi-guardrails`]!==void 0&&(u[`cf-brapi-guardrails`]=String(l[`cf-brapi-guardrails`])),l.dryRun){o({command:`cf browser-run devtools browser connect`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${l[`session-id`]==null?`<session-id>`:encodeURIComponent(String(l[`session-id`]))}`,pathParams:{"session-id":String(l[`session-id`]??``)},query:c,bodyKind:`none`});return}let d=await i(l),f=l.local?e:await t();l.accountId=f,a(await s(`Loading`,async()=>r(d,`GET`,`/accounts/${f}/browser-rendering/devtools/browser/${encodeURIComponent(String(l[`session-id`]))}`,{query:c,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Loaded`})})};function T(e){return e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in milliseconds.`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`targets`,{type:`boolean`,description:`Include browser targets in response.`}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URL remains valid, in milliseconds (max 60 minutes). Only used when targets is true.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`guardrails-allowed-domain-sets`,{type:`string`,array:!0,description:`Max 4 entries: curated preset names (common-cdns) and/or https URLs of newline-separated hostname lists.`}).option(`guardrails-allowed-domains`,{type:`string`,array:!0,description:`Hostname patterns, max 50. Supports exact hosts (example.com) or a single * wildcard anywhere. Prefer *.example.com (subdomain wildcard) over *example.com (prefix wildcard) to avoid matching overbroad lookalikes like evilexample.com.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const E={command:`create`,describe:`Acquires a browser and returns its session ID and websocket URL. Optionally accepts a JSON body with session guardrails to restrict outbound HTTP/S traffic.`,builder:T,handler:async r=>c({command:`browser-run devtools browser create`,classification:{safeFlags:[`lab`,`targets`,`recording`,`dry-run`]}},r,async()=>{let c={keep_alive:r[`keep-alive`],lab:r.lab,targets:r.targets,liveViewUrlExpiresInMs:r[`live-view-url-expires-in-ms`],recording:r.recording};if(r.dryRun){o({command:`cf browser-run devtools browser create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({guardrails:{allowedDomainSets:r[`guardrails-allowed-domain-sets`],allowedDomains:r[`guardrails-allowed-domains`]}}):u(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.devtools.browser.create({...e,account_id:d,...c})),{successLabel:`Created`});return}let p=f({guardrails:{allowedDomainSets:r[`guardrails-allowed-domain-sets`],allowedDomains:r[`guardrails-allowed-domains`]}});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.devtools.browser.create({...p,account_id:d,...c})),{successLabel:`Created`})})};function D(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID to close.`,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 O={command:`delete <session-id>`,describe:`Closes an existing browser session.`,builder:D,handler:async r=>c({command:`browser-run devtools browser delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``)},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
- `);return}a(await s(`Deleting`,async()=>c.browserRun.devtools.browser.delete({account_id:l,session_id:r[`session-id`]})),{successLabel:`Deleted`})})};function k(e){return e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in ms (only valid when acquiring new session).`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`cf-brapi-guardrails`,{type:`string`,description:`Optional base64url-encoded JSON session guardrails (allowedDomains and allowedDomainSets)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`launch`,describe:'Acquires and establishes a WebSocket connection to a browser session. Session guardrails may be supplied in the `cf-brapi-guardrails` header as base64url-encoded JSON of the same `guardrails` object the POST body accepts (for example `{"allowedDomains":["*.example.com"]}`).',builder:k,handler:async l=>c({command:`browser-run devtools browser launch`,classification:{safeFlags:[`lab`,`recording`,`dry-run`]}},l,async()=>{let c={keep_alive:l[`keep-alive`],lab:l.lab,recording:l.recording},u={};if(l[`cf-brapi-guardrails`]!==void 0&&(u[`cf-brapi-guardrails`]=String(l[`cf-brapi-guardrails`])),l.dryRun){o({command:`cf browser-run devtools browser launch`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},query:c,bodyKind:`none`});return}let d=await i(l),f=l.local?e:await t();l.accountId=f,a(await s(`Loading`,async()=>r(d,`GET`,`/accounts/${f}/browser-rendering/devtools/browser`,{query:c,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Loaded`})})};function j(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID`,demandOption:!0}).option(`expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds. Default: 5 minutes. Max: 60 minutes.`,default:3e5}).option(`guardrails-mode`,{type:`string`,description:`The guardrails.mode field`,choices:[`readonly`]}).option(`target-id`,{type:`string`,description:`Target ID (page) to connect to. If omitted, auto-resolves to the first active page.`}).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([`guardrails-mode`].some(t=>e[t]!==void 0)){let t=[`guardrails-mode`].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 --guardrails-* flag is set`)}return!0})}const M={command:`create <session-id>`,describe:"Generates time-limited URLs to view a remote browser session. Set `guardrails: { mode: 'readonly' }` to create a view-only link.",builder:j,handler:async r=>c({command:`browser-run devtools browser live-view create`,classification:{safeFlags:[`guardrails-mode`,`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser live-view create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/live_view`,pathParams:{"session-id":String(r[`session-id`]??``)},bodyKind:`json`,body:r.body===void 0?f({expiresInMs:r[`expires-in-ms`],guardrails:{mode:p(r[`guardrails-mode`],`guardrails-mode`,`text`)},targetId:p(r[`target-id`],`target-id`,`text`)}):u(r.body)});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,r.body){let e=u(r.body);a(await s(`Creating`,async()=>c.browserRun.devtools.browser.liveView.create({...e,account_id:l,session_id:r[`session-id`]})),{successLabel:`Created`});return}let d=f({expiresInMs:r[`expires-in-ms`],guardrails:{mode:p(r[`guardrails-mode`],`guardrails-mode`,`text`)},targetId:p(r[`target-id`],`target-id`,`text`)});a(await s(`Creating`,async()=>c.browserRun.devtools.browser.liveView.create({...d,account_id:l,session_id:r[`session-id`]})),{successLabel:`Created`})})},N={command:`live-view`,describe:`Operations for devtools.browser.live-view`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.positional(`target-id`,{type:`string`,description:`Target ID, e.g. page ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`cf-brapi-guardrails`,{type:`string`,description:`Optional base64url-encoded JSON connection guardrails (mode)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get <target-id>`,describe:`Establishes a WebSocket connection to a specific Chrome DevTools target or page.`,builder:P,handler:async l=>c({command:`browser-run devtools browser page get`,classification:{safeFlags:[`dry-run`]}},l,async()=>{let c={};if(l[`cf-brapi-guardrails`]!==void 0&&(c[`cf-brapi-guardrails`]=String(l[`cf-brapi-guardrails`])),l.dryRun){o({command:`cf browser-run devtools browser page get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${l[`session-id`]==null?`<session-id>`:encodeURIComponent(String(l[`session-id`]))}/page/${l[`target-id`]==null?`<target-id>`:encodeURIComponent(String(l[`target-id`]))}`,pathParams:{"session-id":String(l[`session-id`]??``),"target-id":String(l[`target-id`]??``)},bodyKind:`none`});return}let u=await i(l),d=l.local?e:await t();l.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/browser-rendering/devtools/browser/${encodeURIComponent(String(l[`session-id`]))}/page/${encodeURIComponent(String(l[`target-id`]))}`,{headers:Object.keys(c).length>0?c:void 0})),{successLabel:`Loaded`})})},I={command:`page`,describe:`Operations for devtools.browser.page`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`protocol <session-id>`,describe:`Returns the complete Chrome DevTools Protocol schema including all domains, commands, events, and types. This schema describes the entire CDP API surface.`,builder:L,handler:async r=>c({command:`browser-run devtools browser protocol`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser protocol`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/protocol`,pathParams:{"session-id":String(r[`session-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.devtools.browser.protocol({account_id:l,session_id:r[`session-id`]})),{successLabel:`Loaded`})})};function z(e){return e.positional(`target-id`,{type:`string`,description:`Target ID to activate.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`activate <target-id>`,describe:`Activates (brings to front) a specific browser target by its ID.`,builder:z,handler:async r=>c({command:`browser-run devtools browser targets activate`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser targets activate`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/activate/${r[`target-id`]==null?`<target-id>`:encodeURIComponent(String(r[`target-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``),"target-id":String(r[`target-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.devtools.browser.targets.activate({account_id:l,session_id:r[`session-id`],target_id:r[`target-id`]})),{successLabel:`Loaded`})})};function V(e){return e.positional(`target-id`,{type:`string`,description:`Target ID to close.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`close <target-id>`,describe:`Closes a specific browser target (tab, page, etc.) by its ID. Returns 'Target is closing' on success or an error if the target is not found.`,builder:V,handler:async r=>c({command:`browser-run devtools browser targets close`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser targets close`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/close/${r[`target-id`]==null?`<target-id>`:encodeURIComponent(String(r[`target-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``),"target-id":String(r[`target-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.devtools.browser.targets.close({account_id:l,session_id:r[`session-id`],target_id:r[`target-id`]})),{successLabel:`Loaded`})})};function U(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`url`,{type:`string`,description:`Url`}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URL remains valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`create <session-id>`,describe:`Opens a new tab in the browser. Optionally specify a URL to navigate to.`,builder:U,handler:async r=>c({command:`browser-run devtools browser targets create`,classification:{safeFlags:[`dry-run`]}},r,async()=>{let c={url:r.url,liveViewUrlExpiresInMs:r[`live-view-url-expires-in-ms`]};if(r.dryRun){o({command:`cf browser-run devtools browser targets create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/new`,pathParams:{"session-id":String(r[`session-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Updating`,async()=>l.browserRun.devtools.browser.targets.create({account_id:u,session_id:r[`session-id`],...c})),{successLabel:`Updated`})})};function G(e){return e.positional(`target-id`,{type:`string`,description:`Target ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <target-id>`,describe:`Returns the debuggable target with the given ID.`,builder:G,handler:async r=>c({command:`browser-run devtools browser targets get`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser targets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/list/${r[`target-id`]==null?`<target-id>`:encodeURIComponent(String(r[`target-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``),"target-id":String(r[`target-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.devtools.browser.targets.get({account_id:l,session_id:r[`session-id`],target_id:r[`target-id`]})),{successLabel:`Loaded`})})};function q(e){return e.option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:q,handler:async r=>c({command:`browser-run devtools browser targets list`,classification:{safeFlags:[`dry-run`]}},r,async()=>{let c={liveViewUrlExpiresInMs:r[`live-view-url-expires-in-ms`]};if(r.dryRun){o({command:`cf browser-run devtools browser targets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/list`,pathParams:{"session-id":String(r[`session-id`]??``)},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.browserRun.devtools.browser.targets.list({account_id:u,session_id:r[`session-id`],...c})),{successLabel:`Loaded`})})},Y={command:`targets`,describe:`Operations for devtools.browser.targets`,builder:e=>e.command(B).command(H).command(W).command(K).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`version <session-id>`,describe:`Get browser version metadata.`,builder:X,handler:async r=>c({command:`browser-run devtools browser version`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools browser version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json/version`,pathParams:{"session-id":String(r[`session-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.devtools.browser.version({account_id:l,session_id:r[`session-id`]})),{successLabel:`Loaded`})})},Q={command:`browser`,describe:`Operations for devtools.browser`,builder:e=>e.command(w).command(E).command(O).command(A).command(R).command(Z).command(N).command(I).command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`get <session-id>`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:ne,handler:async r=>c({command:`browser-run devtools json get`,classification:{safeFlags:[`dry-run`]}},r,async()=>{let c={liveViewUrlExpiresInMs:r[`live-view-url-expires-in-ms`]};if(r.dryRun){o({command:`cf browser-run devtools json get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/json`,pathParams:{"session-id":String(r[`session-id`]??``)},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.browserRun.devtools.json.get({account_id:u,session_id:r[`session-id`],...c})),{successLabel:`Loaded`})})},ie={command:`json`,describe:`Operations for devtools.json`,builder:e=>e.command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.positional(`session-id`,{type:`string`,description:`Session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get <session-id>`,describe:`Get details for a specific browser session.`,builder:ae,handler:async r=>c({command:`browser-run devtools session get`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run devtools session get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/session/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.devtools.session.get({account_id:l,session_id:r[`session-id`]})),{successLabel:`Loaded`})})};function se(e){return e.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 ce={command:`list`,describe:`List active browser sessions.`,builder:se,handler:async r=>c({command:`browser-run devtools session list`,classification:{safeFlags:[`dry-run`]}},r,async()=>{let c={limit:r.limit,offset:r.offset};if(r.dryRun){o({command:`cf browser-run devtools session list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/devtools/session`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.browserRun.devtools.session.list({account_id:u,...c})),{successLabel:`Loaded`})})},le={command:`session`,describe:`Operations for devtools.session`,builder:e=>e.command(oe).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ue={command:`devtools`,describe:`Operations for devtools`,builder:e=>e.command(Q).command(ie).command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`interesting-only`,{type:`boolean`,description:`The interestingOnly field`}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`root`,{type:`string`,description:`The root field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const fe={command:`accessibility-tree`,describe:"Returns the page's accessibility tree. Use `interestingOnly` to only return semantically meaningful nodes; use `root` to scope the tree to a CSS-selector-anchored subtree. Control page loading with `gotoOptions` and `waitFor*` options.",builder:de,handler:async r=>c({command:`browser-run quick-action accessibility-tree`,classification:{safeFlags:[`best-attempt`,`interesting-only`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action accessibility-tree`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/accessibilityTree`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),interestingOnly:r[`interesting-only`],rejectRequestPattern:r[`reject-request-pattern`],root:p(r.root,`root`,`text`),setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.accessibilityTree({body:e,account_id:m,...c})),{successLabel:`Created`});return}let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),interestingOnly:r[`interesting-only`],rejectRequestPattern:r[`reject-request-pattern`],root:p(r.root,`root`,`text`),setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.accessibilityTree({body:h,account_id:m,...c})),{successLabel:`Created`})})};function pe(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const me={command:`content`,describe:"Fetches rendered HTML content from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:pe,handler:async r=>c({command:`browser-run quick-action content`,classification:{safeFlags:[`best-attempt`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action content`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/content`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.content({body:e,account_id:m,...c})),{successLabel:`Created`});return}let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.content({body:h,account_id:m,...c})),{successLabel:`Created`})})};function he(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`custom-ai`,{type:`string`,description:`Optional list of custom AI models to use for the request. The models will be tried in the order provided, and in case a model returns an error, the next one will be used as fallback. Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`prompt`,{type:`string`,description:`The prompt field`}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`response-format-type`,{type:`string`,description:`The response_format.type field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`response-format-type`].some(t=>e[t]!==void 0)){let t=[`response-format-type`].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 --response_format-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const ge={command:`json`,describe:"Gets json from a webpage from a provided URL or HTML. Pass `prompt` or `schema` in the body. Control page loading with `gotoOptions` and `waitFor*` options.",builder:he,handler:async r=>c({command:`browser-run quick-action json`,classification:{safeFlags:[`best-attempt`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action json`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/json`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),custom_ai:d(r[`custom-ai`],`custom-ai`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),prompt:p(r.prompt,`prompt`,`text`),rejectRequestPattern:r[`reject-request-pattern`],response_format:{type:p(r[`response-format-type`],`response-format-type`,`text`)},setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.json({body:e,account_id:m,...c})),{successLabel:`Created`});return}let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),custom_ai:d(r[`custom-ai`],`custom-ai`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),prompt:p(r.prompt,`prompt`,`text`),rejectRequestPattern:r[`reject-request-pattern`],response_format:{type:p(r[`response-format-type`],`response-format-type`,`text`)},setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.json({body:h,account_id:m,...c})),{successLabel:`Created`})})};function _e(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`exclude-external-links`,{type:`boolean`,description:`The excludeExternalLinks field`,default:!1}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`visible-links-only`,{type:`boolean`,description:`The visibleLinksOnly field`,default:!1}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const ve={command:`links`,describe:`Get links from a web page.`,builder:_e,handler:async r=>c({command:`browser-run quick-action links`,classification:{safeFlags:[`best-attempt`,`exclude-external-links`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`visible-links-only`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action links`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/links`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),excludeExternalLinks:r[`exclude-external-links`],gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},visibleLinksOnly:r[`visible-links-only`],waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.links({body:e,account_id:m,...c})),{successLabel:`Created`});return}let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),excludeExternalLinks:r[`exclude-external-links`],gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},visibleLinksOnly:r[`visible-links-only`],waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.links({body:h,account_id:m,...c})),{successLabel:`Created`})})};function ye(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const be={command:`markdown`,describe:"Gets markdown of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options.",builder:ye,handler:async r=>c({command:`browser-run quick-action markdown`,classification:{safeFlags:[`best-attempt`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action markdown`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/markdown`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.markdown({body:e,account_id:m,...c})),{successLabel:`Created`});return}let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.markdown({body:h,account_id:m,...c})),{successLabel:`Created`})})};function xe(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`pdf-options-display-header-footer`,{type:`boolean`,description:`Whether to show the header and footer.`}).option(`pdf-options-footer-template`,{type:`string`,description:`HTML template for the print footer.`}).option(`pdf-options-format`,{type:`string`,description:`Paper format. Takes priority over width and height if set.`,choices:[`letter`,`legal`,`tabloid`,`ledger`,`a0`,`a1`,`a2`,`a3`,`a4`,`a5`,`a6`]}).option(`pdf-options-header-template`,{type:`string`,description:`HTML template for the print header.`}).option(`pdf-options-landscape`,{type:`boolean`,description:`Whether to print in landscape orientation.`}).option(`pdf-options-omit-background`,{type:`boolean`,description:`Hides default white background and allows generating pdfs with transparency.`}).option(`pdf-options-outline`,{type:`boolean`,description:`Generate document outline.`}).option(`pdf-options-page-ranges`,{type:`string`,description:`Paper ranges to print, e.g. '1-5, 8, 11-13'.`}).option(`pdf-options-prefer-csspage-size`,{type:`boolean`,description:`Give CSS @page size priority over other size declarations.`}).option(`pdf-options-print-background`,{type:`boolean`,description:`Set to true to print background graphics.`}).option(`pdf-options-scale`,{type:`number`,description:`Scales the rendering of the web page. Amount must be between 0.1 and 2.`}).option(`pdf-options-tagged`,{type:`boolean`,description:`Generate tagged (accessible) PDF.`}).option(`pdf-options-timeout`,{type:`number`,description:`Timeout in milliseconds.`}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const Se={command:`pdf`,describe:"Fetches rendered PDF from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:xe,handler:async r=>c({command:`browser-run quick-action pdf`,classification:{safeFlags:[`best-attempt`,`pdf-options-display-header-footer`,`pdf-options-format`,`pdf-options-landscape`,`pdf-options-omit-background`,`pdf-options-outline`,`pdf-options-prefer-csspage-size`,`pdf-options-print-background`,`pdf-options-tagged`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`,`text`]}},r,async()=>{let a={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action pdf`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/pdf`,pathParams:{},query:a,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),pdfOptions:{displayHeaderFooter:r[`pdf-options-display-header-footer`],footerTemplate:p(r[`pdf-options-footer-template`],`pdf-options-footer-template`,`text`),format:p(r[`pdf-options-format`],`pdf-options-format`,`text`),headerTemplate:p(r[`pdf-options-header-template`],`pdf-options-header-template`,`text`),landscape:r[`pdf-options-landscape`],omitBackground:r[`pdf-options-omit-background`],outline:r[`pdf-options-outline`],pageRanges:p(r[`pdf-options-page-ranges`],`pdf-options-page-ranges`,`text`),preferCSSPageSize:r[`pdf-options-prefer-csspage-size`],printBackground:r[`pdf-options-print-background`],scale:r[`pdf-options-scale`],tagged:r[`pdf-options-tagged`],timeout:r[`pdf-options-timeout`]},rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}await i(r);let c=r.local?e:await t();if(r.accountId=c,r.body){let e=u(r.body),t=new URLSearchParams(Object.entries(a).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),n=await s(`Creating`,async()=>_(`/accounts/${c}/browser-rendering/pdf${t?`?`+t:``}`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:JSON.stringify(e),contentType:`application/json`}));g(r.text===!0?n.toString(`utf-8`):n);return}let m={};r[`action-timeout`]!==void 0&&l(m,[`actionTimeout`],r[`action-timeout`]),r[`add-script-tag`]!==void 0&&l(m,[`addScriptTag`],d(r[`add-script-tag`],`add-script-tag`)),r[`add-style-tag`]!==void 0&&l(m,[`addStyleTag`],d(r[`add-style-tag`],`add-style-tag`)),r[`allow-request-pattern`]!==void 0&&l(m,[`allowRequestPattern`],r[`allow-request-pattern`]),r[`authenticate-password`]!==void 0&&l(m,[`authenticate`,`password`],p(r[`authenticate-password`],`authenticate-password`,`text`)),r[`authenticate-username`]!==void 0&&l(m,[`authenticate`,`username`],p(r[`authenticate-username`],`authenticate-username`,`text`)),r[`best-attempt`]!==void 0&&l(m,[`bestAttempt`],r[`best-attempt`]),r.cookies!==void 0&&l(m,[`cookies`],d(r.cookies,`cookies`)),r[`emulate-media-type`]!==void 0&&l(m,[`emulateMediaType`],p(r[`emulate-media-type`],`emulate-media-type`,`text`)),r[`goto-options-referer`]!==void 0&&l(m,[`gotoOptions`,`referer`],p(r[`goto-options-referer`],`goto-options-referer`,`text`)),r[`goto-options-referrer-policy`]!==void 0&&l(m,[`gotoOptions`,`referrerPolicy`],p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`)),r[`goto-options-timeout`]!==void 0&&l(m,[`gotoOptions`,`timeout`],r[`goto-options-timeout`]),r.html!==void 0&&l(m,[`html`],p(r.html,`html`,`text`)),r[`pdf-options-display-header-footer`]!==void 0&&l(m,[`pdfOptions`,`displayHeaderFooter`],r[`pdf-options-display-header-footer`]),r[`pdf-options-footer-template`]!==void 0&&l(m,[`pdfOptions`,`footerTemplate`],p(r[`pdf-options-footer-template`],`pdf-options-footer-template`,`text`)),r[`pdf-options-format`]!==void 0&&l(m,[`pdfOptions`,`format`],p(r[`pdf-options-format`],`pdf-options-format`,`text`)),r[`pdf-options-header-template`]!==void 0&&l(m,[`pdfOptions`,`headerTemplate`],p(r[`pdf-options-header-template`],`pdf-options-header-template`,`text`)),r[`pdf-options-landscape`]!==void 0&&l(m,[`pdfOptions`,`landscape`],r[`pdf-options-landscape`]),r[`pdf-options-omit-background`]!==void 0&&l(m,[`pdfOptions`,`omitBackground`],r[`pdf-options-omit-background`]),r[`pdf-options-outline`]!==void 0&&l(m,[`pdfOptions`,`outline`],r[`pdf-options-outline`]),r[`pdf-options-page-ranges`]!==void 0&&l(m,[`pdfOptions`,`pageRanges`],p(r[`pdf-options-page-ranges`],`pdf-options-page-ranges`,`text`)),r[`pdf-options-prefer-csspage-size`]!==void 0&&l(m,[`pdfOptions`,`preferCSSPageSize`],r[`pdf-options-prefer-csspage-size`]),r[`pdf-options-print-background`]!==void 0&&l(m,[`pdfOptions`,`printBackground`],r[`pdf-options-print-background`]),r[`pdf-options-scale`]!==void 0&&l(m,[`pdfOptions`,`scale`],r[`pdf-options-scale`]),r[`pdf-options-tagged`]!==void 0&&l(m,[`pdfOptions`,`tagged`],r[`pdf-options-tagged`]),r[`pdf-options-timeout`]!==void 0&&l(m,[`pdfOptions`,`timeout`],r[`pdf-options-timeout`]),r[`reject-request-pattern`]!==void 0&&l(m,[`rejectRequestPattern`],r[`reject-request-pattern`]),r[`set-java-script-enabled`]!==void 0&&l(m,[`setJavaScriptEnabled`],r[`set-java-script-enabled`]),r.url!==void 0&&l(m,[`url`],p(r.url,`url`,`text`)),r[`user-agent`]!==void 0&&l(m,[`userAgent`],p(r[`user-agent`],`user-agent`,`text`)),r[`viewport-device-scale-factor`]!==void 0&&l(m,[`viewport`,`deviceScaleFactor`],r[`viewport-device-scale-factor`]),r[`viewport-has-touch`]!==void 0&&l(m,[`viewport`,`hasTouch`],r[`viewport-has-touch`]),r[`viewport-height`]!==void 0&&l(m,[`viewport`,`height`],r[`viewport-height`]),r[`viewport-is-landscape`]!==void 0&&l(m,[`viewport`,`isLandscape`],r[`viewport-is-landscape`]),r[`viewport-is-mobile`]!==void 0&&l(m,[`viewport`,`isMobile`],r[`viewport-is-mobile`]),r[`viewport-width`]!==void 0&&l(m,[`viewport`,`width`],r[`viewport-width`]),r[`wait-for-selector-hidden`]!==void 0&&l(m,[`waitForSelector`,`hidden`],r[`wait-for-selector-hidden`]),r[`wait-for-selector-selector`]!==void 0&&l(m,[`waitForSelector`,`selector`],p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`)),r[`wait-for-selector-timeout`]!==void 0&&l(m,[`waitForSelector`,`timeout`],r[`wait-for-selector-timeout`]),r[`wait-for-selector-visible`]!==void 0&&l(m,[`waitForSelector`,`visible`],r[`wait-for-selector-visible`]),r[`wait-for-timeout`]!==void 0&&l(m,[`waitForTimeout`],r[`wait-for-timeout`]);let h=new URLSearchParams(Object.entries(a).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),v=await s(`Creating`,async()=>_(`/accounts/${c}/browser-rendering/pdf${h?`?`+h:``}`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:Object.keys(m).length>0?m:void 0}));g(r.text===!0?v.toString(`utf-8`):v)})};function Ce(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`elements`,{type:`string`,description:`The elements field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const we={command:`scrape`,describe:`Get meta attributes like height, width, text and others of selected elements.`,builder:Ce,handler:async r=>c({command:`browser-run quick-action scrape`,classification:{safeFlags:[`best-attempt`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action scrape`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/scrape`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),elements:d(r.elements,`elements`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.scrape({body:e,account_id:m,...c})),{successLabel:`Created`});return}if(r.elements===void 0)throw Error(`--elements is required (or pass --body with this field set).`);let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),elements:d(r.elements,`elements`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.scrape({body:h,account_id:m,...c})),{successLabel:`Created`})})};function Te(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`screenshot-options-capture-beyond-viewport`,{type:`boolean`,description:`The screenshotOptions.captureBeyondViewport field`}).option(`screenshot-options-clip-height`,{type:`number`,description:`The screenshotOptions.clip.height field`}).option(`screenshot-options-clip-scale`,{type:`number`,description:`The screenshotOptions.clip.scale field`}).option(`screenshot-options-clip-width`,{type:`number`,description:`The screenshotOptions.clip.width field`}).option(`screenshot-options-clip-x`,{type:`number`,description:`The screenshotOptions.clip.x field`}).option(`screenshot-options-clip-y`,{type:`number`,description:`The screenshotOptions.clip.y field`}).option(`screenshot-options-from-surface`,{type:`boolean`,description:`The screenshotOptions.fromSurface field`}).option(`screenshot-options-full-page`,{type:`boolean`,description:`The screenshotOptions.fullPage field`}).option(`screenshot-options-omit-background`,{type:`boolean`,description:`The screenshotOptions.omitBackground field`}).option(`screenshot-options-optimize-for-speed`,{type:`boolean`,description:`The screenshotOptions.optimizeForSpeed field`}).option(`screenshot-options-quality`,{type:`number`,description:`The screenshotOptions.quality field`}).option(`scroll-page`,{type:`boolean`,description:`The scrollPage field`}).option(`selector`,{type:`string`,description:`The selector field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`screenshot-options-capture-beyond-viewport`,`screenshot-options-clip-height`,`screenshot-options-clip-scale`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`,`screenshot-options-from-surface`,`screenshot-options-full-page`,`screenshot-options-omit-background`,`screenshot-options-optimize-for-speed`,`screenshot-options-quality`].some(t=>e[t]!==void 0)){let t=[`screenshot-options-clip-height`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`].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 --screenshotOptions-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const Ee={command:`screenshot`,describe:"Takes a screenshot of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, `fullPage`, `clip` and others.",builder:Te,handler:async r=>c({command:`browser-run quick-action screenshot`,classification:{safeFlags:[`best-attempt`,`screenshot-options-capture-beyond-viewport`,`screenshot-options-from-surface`,`screenshot-options-full-page`,`screenshot-options-omit-background`,`screenshot-options-optimize-for-speed`,`scroll-page`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`,`text`]}},r,async()=>{let a={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action screenshot`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/screenshot`,pathParams:{},query:a,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],screenshotOptions:{captureBeyondViewport:r[`screenshot-options-capture-beyond-viewport`],clip:{height:r[`screenshot-options-clip-height`],scale:r[`screenshot-options-clip-scale`],width:r[`screenshot-options-clip-width`],x:r[`screenshot-options-clip-x`],y:r[`screenshot-options-clip-y`]},fromSurface:r[`screenshot-options-from-surface`],fullPage:r[`screenshot-options-full-page`],omitBackground:r[`screenshot-options-omit-background`],optimizeForSpeed:r[`screenshot-options-optimize-for-speed`],quality:r[`screenshot-options-quality`]},scrollPage:r[`scroll-page`],selector:p(r.selector,`selector`,`text`),setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}await i(r);let c=r.local?e:await t();if(r.accountId=c,r.body){let e=u(r.body),t=new URLSearchParams(Object.entries(a).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),n=await s(`Creating`,async()=>_(`/accounts/${c}/browser-rendering/screenshot${t?`?`+t:``}`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:JSON.stringify(e),contentType:`application/json`}));g(r.text===!0?n.toString(`utf-8`):n);return}let m={};r[`action-timeout`]!==void 0&&l(m,[`actionTimeout`],r[`action-timeout`]),r[`add-script-tag`]!==void 0&&l(m,[`addScriptTag`],d(r[`add-script-tag`],`add-script-tag`)),r[`add-style-tag`]!==void 0&&l(m,[`addStyleTag`],d(r[`add-style-tag`],`add-style-tag`)),r[`allow-request-pattern`]!==void 0&&l(m,[`allowRequestPattern`],r[`allow-request-pattern`]),r[`authenticate-password`]!==void 0&&l(m,[`authenticate`,`password`],p(r[`authenticate-password`],`authenticate-password`,`text`)),r[`authenticate-username`]!==void 0&&l(m,[`authenticate`,`username`],p(r[`authenticate-username`],`authenticate-username`,`text`)),r[`best-attempt`]!==void 0&&l(m,[`bestAttempt`],r[`best-attempt`]),r.cookies!==void 0&&l(m,[`cookies`],d(r.cookies,`cookies`)),r[`emulate-media-type`]!==void 0&&l(m,[`emulateMediaType`],p(r[`emulate-media-type`],`emulate-media-type`,`text`)),r[`goto-options-referer`]!==void 0&&l(m,[`gotoOptions`,`referer`],p(r[`goto-options-referer`],`goto-options-referer`,`text`)),r[`goto-options-referrer-policy`]!==void 0&&l(m,[`gotoOptions`,`referrerPolicy`],p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`)),r[`goto-options-timeout`]!==void 0&&l(m,[`gotoOptions`,`timeout`],r[`goto-options-timeout`]),r.html!==void 0&&l(m,[`html`],p(r.html,`html`,`text`)),r[`reject-request-pattern`]!==void 0&&l(m,[`rejectRequestPattern`],r[`reject-request-pattern`]),r[`screenshot-options-capture-beyond-viewport`]!==void 0&&l(m,[`screenshotOptions`,`captureBeyondViewport`],r[`screenshot-options-capture-beyond-viewport`]),r[`screenshot-options-clip-height`]!==void 0&&l(m,[`screenshotOptions`,`clip`,`height`],r[`screenshot-options-clip-height`]),r[`screenshot-options-clip-scale`]!==void 0&&l(m,[`screenshotOptions`,`clip`,`scale`],r[`screenshot-options-clip-scale`]),r[`screenshot-options-clip-width`]!==void 0&&l(m,[`screenshotOptions`,`clip`,`width`],r[`screenshot-options-clip-width`]),r[`screenshot-options-clip-x`]!==void 0&&l(m,[`screenshotOptions`,`clip`,`x`],r[`screenshot-options-clip-x`]),r[`screenshot-options-clip-y`]!==void 0&&l(m,[`screenshotOptions`,`clip`,`y`],r[`screenshot-options-clip-y`]),r[`screenshot-options-from-surface`]!==void 0&&l(m,[`screenshotOptions`,`fromSurface`],r[`screenshot-options-from-surface`]),r[`screenshot-options-full-page`]!==void 0&&l(m,[`screenshotOptions`,`fullPage`],r[`screenshot-options-full-page`]),r[`screenshot-options-omit-background`]!==void 0&&l(m,[`screenshotOptions`,`omitBackground`],r[`screenshot-options-omit-background`]),r[`screenshot-options-optimize-for-speed`]!==void 0&&l(m,[`screenshotOptions`,`optimizeForSpeed`],r[`screenshot-options-optimize-for-speed`]),r[`screenshot-options-quality`]!==void 0&&l(m,[`screenshotOptions`,`quality`],r[`screenshot-options-quality`]),r[`scroll-page`]!==void 0&&l(m,[`scrollPage`],r[`scroll-page`]),r.selector!==void 0&&l(m,[`selector`],p(r.selector,`selector`,`text`)),r[`set-java-script-enabled`]!==void 0&&l(m,[`setJavaScriptEnabled`],r[`set-java-script-enabled`]),r.url!==void 0&&l(m,[`url`],p(r.url,`url`,`text`)),r[`user-agent`]!==void 0&&l(m,[`userAgent`],p(r[`user-agent`],`user-agent`,`text`)),r[`viewport-device-scale-factor`]!==void 0&&l(m,[`viewport`,`deviceScaleFactor`],r[`viewport-device-scale-factor`]),r[`viewport-has-touch`]!==void 0&&l(m,[`viewport`,`hasTouch`],r[`viewport-has-touch`]),r[`viewport-height`]!==void 0&&l(m,[`viewport`,`height`],r[`viewport-height`]),r[`viewport-is-landscape`]!==void 0&&l(m,[`viewport`,`isLandscape`],r[`viewport-is-landscape`]),r[`viewport-is-mobile`]!==void 0&&l(m,[`viewport`,`isMobile`],r[`viewport-is-mobile`]),r[`viewport-width`]!==void 0&&l(m,[`viewport`,`width`],r[`viewport-width`]),r[`wait-for-selector-hidden`]!==void 0&&l(m,[`waitForSelector`,`hidden`],r[`wait-for-selector-hidden`]),r[`wait-for-selector-selector`]!==void 0&&l(m,[`waitForSelector`,`selector`],p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`)),r[`wait-for-selector-timeout`]!==void 0&&l(m,[`waitForSelector`,`timeout`],r[`wait-for-selector-timeout`]),r[`wait-for-selector-visible`]!==void 0&&l(m,[`waitForSelector`,`visible`],r[`wait-for-selector-visible`]),r[`wait-for-timeout`]!==void 0&&l(m,[`waitForTimeout`],r[`wait-for-timeout`]);let h=new URLSearchParams(Object.entries(a).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),v=await s(`Creating`,async()=>_(`/accounts/${c}/browser-rendering/screenshot${h?`?`+h:``}`,{method:`POST`,local:r.local===!0,persistTo:r.persistTo,body:Object.keys(m).length>0?m:void 0}));g(r.text===!0?v.toString(`utf-8`):v)})};function De(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`add-script-tag`,{type:`string`,description:`Adds a script element into the page with the desired URL or content. Provide as a JSON array of objects or @path/to/file.json.`}).option(`add-style-tag`,{type:`string`,description:'Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a `<style type="text/css">` tag with the content. Provide as a JSON array of objects or @path/to/file.json.'}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`cookies`,{type:`string`,description:`Check [options](https://pptr.dev/api/puppeteer.page.setcookie). Provide as a JSON array of objects or @path/to/file.json.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`formats`,{type:`string`,array:!0,description:`The formats field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`screenshot-options-capture-beyond-viewport`,{type:`boolean`,description:`The screenshotOptions.captureBeyondViewport field`}).option(`screenshot-options-clip-height`,{type:`number`,description:`The screenshotOptions.clip.height field`}).option(`screenshot-options-clip-scale`,{type:`number`,description:`The screenshotOptions.clip.scale field`}).option(`screenshot-options-clip-width`,{type:`number`,description:`The screenshotOptions.clip.width field`}).option(`screenshot-options-clip-x`,{type:`number`,description:`The screenshotOptions.clip.x field`}).option(`screenshot-options-clip-y`,{type:`number`,description:`The screenshotOptions.clip.y field`}).option(`screenshot-options-from-surface`,{type:`boolean`,description:`The screenshotOptions.fromSurface field`}).option(`screenshot-options-full-page`,{type:`boolean`,description:`The screenshotOptions.fullPage field`}).option(`screenshot-options-omit-background`,{type:`boolean`,description:`The screenshotOptions.omitBackground field`}).option(`screenshot-options-optimize-for-speed`,{type:`boolean`,description:`The screenshotOptions.optimizeForSpeed field`}).option(`screenshot-options-quality`,{type:`number`,description:`The screenshotOptions.quality field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).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([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].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 --authenticate-* flag is set`)}return!0}).check(e=>{if([`screenshot-options-capture-beyond-viewport`,`screenshot-options-clip-height`,`screenshot-options-clip-scale`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`,`screenshot-options-from-surface`,`screenshot-options-full-page`,`screenshot-options-omit-background`,`screenshot-options-optimize-for-speed`,`screenshot-options-quality`].some(t=>e[t]!==void 0)){let t=[`screenshot-options-clip-height`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`].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 --screenshotOptions-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].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 --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].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 --waitForSelector-* flag is set`)}return!0})}const $={command:`snapshot`,describe:"Returns the page's HTML content and screenshot. Control page loading with `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, `fullPage`, `clip` and others.",builder:De,handler:async r=>c({command:`browser-run quick-action snapshot`,classification:{safeFlags:[`best-attempt`,`screenshot-options-capture-beyond-viewport`,`screenshot-options-from-surface`,`screenshot-options-full-page`,`screenshot-options-omit-background`,`screenshot-options-optimize-for-speed`,`set-java-script-enabled`,`viewport-has-touch`,`viewport-is-landscape`,`viewport-is-mobile`,`wait-for-selector-hidden`,`wait-for-selector-visible`,`dry-run`]}},r,async()=>{let c={cacheTTL:r[`cache-ttl`]};if(r.dryRun){o({command:`cf browser-run quick-action snapshot`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/snapshot`,pathParams:{},query:c,bodyKind:`json`,body:r.body===void 0?f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),formats:r.formats,gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],screenshotOptions:{captureBeyondViewport:r[`screenshot-options-capture-beyond-viewport`],clip:{height:r[`screenshot-options-clip-height`],scale:r[`screenshot-options-clip-scale`],width:r[`screenshot-options-clip-width`],x:r[`screenshot-options-clip-x`],y:r[`screenshot-options-clip-y`]},fromSurface:r[`screenshot-options-from-surface`],fullPage:r[`screenshot-options-full-page`],omitBackground:r[`screenshot-options-omit-background`],optimizeForSpeed:r[`screenshot-options-optimize-for-speed`],quality:r[`screenshot-options-quality`]},setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]}):u(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=u(r.body);new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.snapshot({body:e,account_id:m,...c})),{successLabel:`Created`});return}let h=f({actionTimeout:r[`action-timeout`],addScriptTag:d(r[`add-script-tag`],`add-script-tag`),addStyleTag:d(r[`add-style-tag`],`add-style-tag`),allowRequestPattern:r[`allow-request-pattern`],authenticate:{password:p(r[`authenticate-password`],`authenticate-password`,`text`),username:p(r[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:r[`best-attempt`],cookies:d(r.cookies,`cookies`),emulateMediaType:p(r[`emulate-media-type`],`emulate-media-type`,`text`),formats:r.formats,gotoOptions:{referer:p(r[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:p(r[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:r[`goto-options-timeout`]},html:p(r.html,`html`,`text`),rejectRequestPattern:r[`reject-request-pattern`],screenshotOptions:{captureBeyondViewport:r[`screenshot-options-capture-beyond-viewport`],clip:{height:r[`screenshot-options-clip-height`],scale:r[`screenshot-options-clip-scale`],width:r[`screenshot-options-clip-width`],x:r[`screenshot-options-clip-x`],y:r[`screenshot-options-clip-y`]},fromSurface:r[`screenshot-options-from-surface`],fullPage:r[`screenshot-options-full-page`],omitBackground:r[`screenshot-options-omit-background`],optimizeForSpeed:r[`screenshot-options-optimize-for-speed`],quality:r[`screenshot-options-quality`]},setJavaScriptEnabled:r[`set-java-script-enabled`],url:p(r.url,`url`,`text`),userAgent:p(r[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:r[`viewport-device-scale-factor`],hasTouch:r[`viewport-has-touch`],height:r[`viewport-height`],isLandscape:r[`viewport-is-landscape`],isMobile:r[`viewport-is-mobile`],width:r[`viewport-width`]},waitForSelector:{hidden:r[`wait-for-selector-hidden`],selector:p(r[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:r[`wait-for-selector-timeout`],visible:r[`wait-for-selector-visible`]},waitForTimeout:r[`wait-for-timeout`]});new URLSearchParams(Object.entries(c).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>l.browserRun.quickAction.snapshot({body:h,account_id:m,...c})),{successLabel:`Created`})})},Oe={command:`quick-action`,describe:`Operations for quick-action`,builder:e=>e.command(fe).command(me).command(ge).command(ve).command(be).command(Se).command(we).command(Ee).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`session-id`,{type:`string`,description:`Session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <session-id>`,describe:`Returns the recording data for a given session as a dictionary of events per targetId.`,builder:ke,handler:async r=>c({command:`browser-run recording get`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){o({command:`cf browser-run recording get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/recording/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.browserRun.recording.get({account_id:l,session_id:r[`session-id`]})),{successLabel:`Loaded`})})};function je(e){return e.positional(`session-id`,{type:`string`,description:`Session ID.`,demandOption:!0}).option(`format`,{type:`string`,description:"Set to `har` to return a HAR JSON document."}).option(`target`,{type:`string`,description:`Target ID to include in the response.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`get <session-id>`,describe:`Returns network recording events for the requested target ID. Use ?format=har for a HAR JSON document.`,builder:je,handler:async r=>c({command:`browser-run recording network get`,classification:{safeFlags:[`dry-run`]}},r,async()=>{let c={format:r.format,target:r.target};if(r.dryRun){o({command:`cf browser-run recording network get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/browser-rendering/recording/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}/network`,pathParams:{"session-id":String(r[`session-id`]??``)},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.browserRun.recording.network.get({account_id:u,session_id:r[`session-id`],...c})),{successLabel:`Loaded`})})},Ne={command:`network`,describe:`Operations for recording.network`,builder:e=>e.command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pe={command:`recording`,describe:`Operations for recording`,builder:e=>e.command(Ae).command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Fe={command:`browser-run`,describe:`browser-run`,builder:e=>e.command(S).command(ue).command(Oe).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Fe as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e}from"./chunk-vbHwaUoU.mjs";import{t}from"./src-BbnV77C4.mjs";import{A as n}from"./dist-CyisSore.mjs";import{a as r,o as i}from"./theme-CeVf-5qG.mjs";import"./ui-DQSZeaG5.mjs";import{n as a}from"./dist-BRg_z9Ut.mjs";import{a as o,i as s,n as c,r as l,t as u}from"./spawn-DP4T92ss.mjs";import d from"node:path";import{readBuildOutput as f}from"@cloudflare/build-output-utils";import{convertToWranglerConfig as p}from"@cloudflare/config";var m=class extends Error{constructor(e){super(e),this.name=`BuildOutputConfigError`}};function h(e,t,n={}){if(e===void 0){if(n.requireRequestedMode&&t!==void 0)throw new m(`The Build Output was created with mode "${t}", but this command did not specify a mode. Rerun with "--mode ${t}".`);return}if(t===void 0)throw new m(`The Build Output does not record which mode it was created with, but this command requested mode "${e}". Rebuild with "--mode ${e}" before deploying.`);if(t!==e)throw new m(`The Build Output was created with mode "${t}", but this command requested mode "${e}". To use the existing Build Output, rerun with "--mode ${t}". To deploy in ${e} mode, rebuild with "--mode ${e}" before deploying.`)}function g(e,t){let n=e.config,{buildContext:r,...i}=t,{manifest:a,...o}=n,s=p({...i,worker:o,containers:[]});n.manifest?.mainModule&&e.bundleDir&&(s.main=d.join(e.bundleDir,n.manifest.mainModule));let c=d.resolve(`cloudflare.config.ts`),{validationConfig:l,containerReferences:u}=v(s),f=_(l,e.configPath,c);y(f,u);let{containers:m,...h}=f;return{wranglerConfig:h,builtConfig:n}}function _(e,t,r){let{config:i,diagnostics:a}=n(e,t,r,{});if(a.hasErrors())throw new m(a.renderErrors());return a.hasWarnings()&&console.warn(a.renderWarnings()),i}function v(e){let{containers:t,...n}=e,r=new Map;return n.exports!==void 0&&(n.exports=Object.fromEntries(Object.entries(n.exports).map(([e,t])=>{if(!(`container`in t)||typeof t.container!=`string`)return[e,t];r.set(e,t.container);let{container:n,...i}=t;return[e,i]}))),{validationConfig:n,containerReferences:r}}function y(e,t){e.exports===void 0||t.size===0||(e.exports=Object.fromEntries(Object.entries(e.exports).map(([e,n])=>{let r=t.get(e);return[e,r===void 0?n:{...n,container:r}]})))}var b=e({default:()=>w,runBuild:()=>S});function x(e){return e}async function S(e,n={},d={}){let p=n.output??`stdout`,m=process.cwd(),h=await l(m,n),_=h?.buildCommand,v={...h?.env,...d.isPreview?{CLOUDFLARE_PREVIEW_BUILD:`true`}:{}};if(h&&!h.configured&&(_=(await s(h,n)).buildCommand),_&&e&&!h?.framework?.supportsMode)throw Error(`The detected command \`${_}\` does not currently support \`--mode\`.`);p!==`silent`&&a.message(r.bold(`Build`),{symbol:i.dim(`├`),spacing:0,output:p===`stderr`?process.stderr:void 0});let y=e?[`--mode`,e]:[],b;if(_)b=await o(_,m,{...n,env:v,args:y});else{let e=c(m);p!==`silent`&&a.message(`Delegating to ${C(e)}`,{spacing:0,output:p===`stderr`?process.stderr:void 0}),b=await u(e,`build`,y,{...n,env:v})}if(b.exitCode!==0||b.signal)throw new t(b.exitCode,{signal:b.signal});let{workers:{default:x},rootConfig:S}=await f(m);g(x,S),p!==`silent`&&a.success(`Build complete`,{spacing:0,output:p===`stderr`?process.stderr:void 0})}function C(e){switch(e.impl.pkg){case`@cloudflare/vite-plugin`:return`Vite`;case`wrangler`:return`Wrangler`;case`cloudflare-py-dev-server`:return`the Python dev server`;case`cloudflare-rs-dev-server`:return`the Rust dev server`;default:return e.impl.pkg}}const w={command:`build`,describe:`Build a project for Cloudflare`,builder:x,handler:async e=>{await S(e.mode)}};export{m as a,h as i,S as n,g as r,b as t};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-BwL_gesw.mjs";import{f as t,g as n}from"./oauth-BdVr2hJp.mjs";import{r}from"./auth-DWxtJ918.mjs";import{t as i}from"./output-Z2lQmPUW.mjs";import{t as a}from"./dry-run-YSQndLvt.mjs";import{t as o}from"./progress-a5IKeKni.mjs";import{t as s}from"./run-BS8otL3u.mjs";import"./telemetry-n3NJourL.mjs";import{n as c,t as l}from"./body-parser-Cmw7PZ7a.mjs";import{n as u}from"./input-validation-nF-0Ze2h.mjs";import{a as d,i as f,n as p}from"./prompt-BP8XrQSj.mjs";import{t as m}from"./cli-types-abvWQN3T.mjs";function h(e){return e.positional(`build-uuid`,{type:`string`,description:`Build UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`cancel <build-uuid>`,describe:`Cancel a queued or running build.`,builder:h,handler:async c=>s({command:`builds cancel`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds cancel`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/builds/${c[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(c[`build-uuid`]))}/cancel`,pathParams:{"build-uuid":String(c[`build-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Updating`,async()=>s.builds.cancel({account_id:l,build_uuid:c[`build-uuid`]})),{successLabel:`Updated`})})};function te(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`seed-repo-owner`,{type:`string`,description:`Repository owner or namespace.`}).option(`seed-repo-path`,{type:`string`,description:`Path within the repository to seed.`}).option(`seed-repo-provider`,{type:`string`,description:`Source control provider for the seed repository.`,choices:[`github`,`gitlab`]}).option(`seed-repo-repository`,{type:`string`,description:`Repository name.`}).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([`seed-repo-owner`,`seed-repo-path`,`seed-repo-provider`,`seed-repo-repository`].some(t=>e[t]!==void 0)){let t=[`seed-repo-owner`,`seed-repo-provider`,`seed-repo-repository`].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 --seed_repo-* flag is set`)}return!0})}const g={command:`create <trigger-uuid>`,describe:`Start a build for a branch or commit using the selected trigger.`,builder:te,handler:async d=>s({command:`builds create`,classification:{safeFlags:[`seed-repo-provider`,`dry-run`]}},d,async()=>{if(d.dryRun){a({command:`cf builds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${d[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(d[`trigger-uuid`]))}/builds`,pathParams:{"trigger-uuid":String(d[`trigger-uuid`]??``)},bodyKind:`json`,body:d.body===void 0?l({seed_repo:{owner:u(d[`seed-repo-owner`],`seed-repo-owner`,`text`),path:u(d[`seed-repo-path`],`seed-repo-path`,`text`),provider:u(d[`seed-repo-provider`],`seed-repo-provider`,`text`),repository:u(d[`seed-repo-repository`],`seed-repo-repository`,`text`)}}):c(d.body)});return}let s=await r(d),f=d.local?e:await t();if(d.accountId=f,d.body){let e=c(d.body);i(await o(`Creating`,async()=>s.builds.create({body:e,account_id:f,trigger_uuid:d[`trigger-uuid`]})),{successLabel:`Created`});return}let p=l({seed_repo:{owner:u(d[`seed-repo-owner`],`seed-repo-owner`,`text`),path:u(d[`seed-repo-path`],`seed-repo-path`,`text`),provider:u(d[`seed-repo-provider`],`seed-repo-provider`,`text`),repository:u(d[`seed-repo-repository`],`seed-repo-repository`,`text`)}});i(await o(`Creating`,async()=>s.builds.create({body:p,account_id:f,trigger_uuid:d[`trigger-uuid`]})),{successLabel:`Created`})})};function _(e){return e.positional(`script-name`,{type:`string`,description:`Human-readable name of the worker.`,demandOption:!0}).option(`branch`,{type:`string`,description:`Git branch name.`}).option(`deploy-hook-name`,{type:`string`,description:`Deploy hook name (1-58 characters).`}).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:`create <script-name>`,describe:`Create an HTTP hook that starts a build for a selected Worker branch.`,builder:_,handler:async f=>s({command:`builds deploy-hooks create`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){a({command:`cf builds deploy-hooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${f[`script-name`]==null?`<script-name>`:encodeURIComponent(String(f[`script-name`]))}/deploy_hooks`,pathParams:{"script-name":String(f[`script-name`]??``)},bodyKind:`json`,body:f.body===void 0?l({branch:u(f.branch,`branch`,`text`),deploy_hook_name:u(f[`deploy-hook-name`],`deploy-hook-name`,`text`)}):c(f.body)});return}let s=await r(f),p=f.local?e:await t();if(f.accountId=p,f.body){let e=c(f.body);i(await o(`Creating`,async()=>s.builds.deployHooks.create({body:e,account_id:p,script_name:f[`script-name`]})),{successLabel:`Created`});return}f.branch===void 0&&(f.branch=await d(`branch`,`Git branch name.`)),f[`deploy-hook-name`]===void 0&&(f[`deploy-hook-name`]=await d(`deploy-hook-name`,`Deploy hook name (1-58 characters).`));let m=l({branch:u(f.branch,`branch`,`text`),deploy_hook_name:u(f[`deploy-hook-name`],`deploy-hook-name`,`text`)});i(await o(`Creating`,async()=>s.builds.deployHooks.create({body:m,account_id:p,script_name:f[`script-name`]})),{successLabel:`Created`})})};function y(e){return e.positional(`deploy-hook-uuid`,{type:`string`,description:`Deploy hook UUID`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Human-readable name of the worker.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete <deploy-hook-uuid>`,describe:`Delete a deploy hook so its UUID can no longer start builds.`,builder:y,handler:async c=>s({command:`builds deploy-hooks delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds deploy-hooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`script-name`]==null?`<script-name>`:encodeURIComponent(String(c[`script-name`]))}/deploy_hooks/${c[`deploy-hook-uuid`]==null?`<deploy-hook-uuid>`:encodeURIComponent(String(c[`deploy-hook-uuid`]))}`,pathParams:{"script-name":String(c[`script-name`]??``),"deploy-hook-uuid":String(c[`deploy-hook-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>s.builds.deployHooks.delete({account_id:l,script_name:c[`script-name`],deploy_hook_uuid:c[`deploy-hook-uuid`]})),{successLabel:`Deleted`})})};function x(e){return e.positional(`deploy-hook-uuid`,{type:`string`,description:`Deploy hook UUID`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Human-readable name of the worker.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <deploy-hook-uuid>`,describe:`Retrieve the name, branch, Worker identifier, and timestamps for a deploy hook.`,builder:x,handler:async c=>s({command:`builds deploy-hooks get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds deploy-hooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`script-name`]==null?`<script-name>`:encodeURIComponent(String(c[`script-name`]))}/deploy_hooks/${c[`deploy-hook-uuid`]==null?`<deploy-hook-uuid>`:encodeURIComponent(String(c[`deploy-hook-uuid`]))}`,pathParams:{"script-name":String(c[`script-name`]??``),"deploy-hook-uuid":String(c[`deploy-hook-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.deployHooks.get({account_id:l,script_name:c[`script-name`],deploy_hook_uuid:c[`deploy-hook-uuid`]})),{successLabel:`Loaded`})})};function C(e){return e.option(`script-name`,{type:`string`,description:`Human-readable name of the worker.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`List the branch-specific deploy hooks configured for a Worker.`,builder:C,handler:async c=>s({command:`builds deploy-hooks list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds deploy-hooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`script-name`]==null?`<script-name>`:encodeURIComponent(String(c[`script-name`]))}/deploy_hooks`,pathParams:{"script-name":String(c[`script-name`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.deployHooks.list({account_id:l,script_name:c[`script-name`]})),{successLabel:`Loaded`})})};function T(e){return e.positional(`deploy-hook-uuid`,{type:`string`,description:`Deploy hook UUID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`trigger <deploy-hook-uuid>`,describe:`Trigger a build using a deploy hook. This endpoint does not require authentication - the deploy_hook_uuid acts as a secret token.`,builder:T,handler:async e=>s({command:`builds deploy-hooks trigger`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf builds deploy-hooks trigger`,method:`POST`,url:`https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/${e[`deploy-hook-uuid`]==null?`<deploy-hook-uuid>`:encodeURIComponent(String(e[`deploy-hook-uuid`]))}`,pathParams:{"deploy-hook-uuid":String(e[`deploy-hook-uuid`]??``)},bodyKind:`none`});return}let t=await r(e);i(await o(`Creating`,async()=>t.builds.deployHooks.trigger({deploy_hook_uuid:e[`deploy-hook-uuid`]})),{successLabel:`Created`})})};function D(e){return e.positional(`deploy-hook-uuid`,{type:`string`,description:`Deploy hook UUID`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Human-readable name of the worker.`,demandOption:!0}).option(`branch`,{type:`string`,description:`Git branch name.`}).option(`deploy-hook-name`,{type:`string`,description:`Deploy hook name (1-58 characters).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <deploy-hook-uuid>`,describe:`Replace the name and target branch for a deploy hook.`,builder:D,handler:async f=>s({command:`builds deploy-hooks update`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){a({command:`cf builds deploy-hooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${f[`script-name`]==null?`<script-name>`:encodeURIComponent(String(f[`script-name`]))}/deploy_hooks/${f[`deploy-hook-uuid`]==null?`<deploy-hook-uuid>`:encodeURIComponent(String(f[`deploy-hook-uuid`]))}`,pathParams:{"script-name":String(f[`script-name`]??``),"deploy-hook-uuid":String(f[`deploy-hook-uuid`]??``)},bodyKind:`json`,body:f.body===void 0?l({branch:u(f.branch,`branch`,`text`),deploy_hook_name:u(f[`deploy-hook-name`],`deploy-hook-name`,`text`)}):c(f.body)});return}let s=await r(f),p=f.local?e:await t();if(f.accountId=p,f.body){let e=c(f.body);i(await o(`Updating`,async()=>s.builds.deployHooks.update({body:e,account_id:p,script_name:f[`script-name`],deploy_hook_uuid:f[`deploy-hook-uuid`]})),{successLabel:`Updated`});return}f.branch===void 0&&(f.branch=await d(`branch`,`Git branch name.`)),f[`deploy-hook-name`]===void 0&&(f[`deploy-hook-name`]=await d(`deploy-hook-name`,`Deploy hook name (1-58 characters).`));let m=l({branch:u(f.branch,`branch`,`text`),deploy_hook_name:u(f[`deploy-hook-name`],`deploy-hook-name`,`text`)});i(await o(`Updating`,async()=>s.builds.deployHooks.update({body:m,account_id:p,script_name:f[`script-name`],deploy_hook_uuid:f[`deploy-hook-uuid`]})),{successLabel:`Updated`})})},k={command:`deploy-hooks`,describe:`Manage branch-specific HTTP hooks that start builds.`,builder:e=>e.command(v).command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.positional(`build-uuid`,{type:`string`,description:`Build UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <build-uuid>`,describe:`Retrieve status, outcome, timestamps, trigger settings, and source metadata for a build UUID.`,builder:A,handler:async c=>s({command:`builds get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/builds/${c[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(c[`build-uuid`]))}`,pathParams:{"build-uuid":String(c[`build-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.get({account_id:l,build_uuid:c[`build-uuid`]})),{successLabel:`Loaded`})})};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get`,describe:`Return whether the account's build-minute allowance is exhausted and when it refreshes.`,builder:M,handler:async c=>s({command:`builds limits get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/account/limits`,pathParams:{},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.limits.get({account_id:l})),{successLabel:`Loaded`})})},P={command:`limits`,describe:`View build-minute availability and refresh information.`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`external-script-id`,{type:`string`,description:`System-generated tag of the Worker. This is not the Worker name.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number for pagination`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`List paginated build records associated with a Worker tag.`,builder:F,handler:async c=>s({command:`builds list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={page:c.page,per_page:c[`per-page`]};if(c.dryRun){a({command:`cf builds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`external-script-id`]==null?`<external-script-id>`:encodeURIComponent(String(c[`external-script-id`]))}/builds`,pathParams:{"external-script-id":String(c[`external-script-id`]??``)},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.builds.list({account_id:u,external_script_id:c[`external-script-id`],...s})),{successLabel:`Loaded`})})};function L(e){return e.positional(`build-uuid`,{type:`string`,description:`Build UUID.`,demandOption:!0}).option(`cursor`,{type:`string`,description:`Pagination cursor for log retrieval.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get <build-uuid>`,describe:`Retrieve cursor-paginated log lines for a build UUID.`,builder:L,handler:async c=>s({command:`builds logs get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={cursor:c.cursor};if(c.dryRun){a({command:`cf builds logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/builds/${c[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(c[`build-uuid`]))}/logs`,pathParams:{"build-uuid":String(c[`build-uuid`]??``)},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.builds.logs.get({account_id:u,build_uuid:c[`build-uuid`],...s})),{successLabel:`Loaded`})})},z={command:`logs`,describe:`Retrieve build logs.`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`repo-id`,{type:`string`,description:`Provider-specific repository identifier.`,demandOption:!0}).option(`provider-type`,{type:`string`,description:`SCM provider type`,demandOption:!0}).option(`provider-account-id`,{type:`string`,description:`Provider-specific identifier of the account or namespace that owns the repository.`,demandOption:!0}).option(`branch`,{type:`string`,description:`Git branch name.`,demandOption:!0}).option(`root-directory`,{type:`string`,description:`Repository directory in which build and deploy commands run.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <repo-id>`,describe:`Analyze repository for automatic configuration detection`,builder:B,handler:async c=>s({command:`builds repos config-autofill get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={branch:c.branch,root_directory:c[`root-directory`]};if(c.dryRun){a({command:`cf builds repos config-autofill get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/repos/${c[`provider-type`]==null?`<provider-type>`:encodeURIComponent(String(c[`provider-type`]))}/${c[`provider-account-id`]==null?`<provider-account-id>`:encodeURIComponent(String(c[`provider-account-id`]))}/${c[`repo-id`]==null?`<repo-id>`:encodeURIComponent(String(c[`repo-id`]))}/config_autofill`,pathParams:{"provider-type":String(c[`provider-type`]??``),"provider-account-id":String(c[`provider-account-id`]??``),"repo-id":String(c[`repo-id`]??``)},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.builds.repos.configAutofill.get({account_id:u,provider_type:c[`provider-type`],provider_account_id:c[`provider-account-id`],repo_id:c[`repo-id`],...s})),{successLabel:`Loaded`})})},H={command:`config-autofill`,describe:`Operations for repos.config-autofill`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`repo-connection-uuid`,{type:`string`,description:`Repository connection UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const W={command:`delete <repo-connection-uuid>`,describe:`Delete a saved repository connection.`,builder:U,handler:async c=>s({command:`builds repos connections delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds repos connections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/repos/connections/${c[`repo-connection-uuid`]==null?`<repo-connection-uuid>`:encodeURIComponent(String(c[`repo-connection-uuid`]))}`,pathParams:{"repo-connection-uuid":String(c[`repo-connection-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force})){process.stderr.write(`Aborted.
4
- `);return}i(await o(`Deleting`,async()=>s.builds.repos.connections.delete({account_id:l,repo_connection_uuid:c[`repo-connection-uuid`]})),{successLabel:`Deleted`})})};function G(e){return e.option(`provider-account-id`,{type:`string`,description:`Provider-specific identifier of the account or namespace that owns the repository.`}).option(`provider-account-name`,{type:`string`,description:`Human-readable name of the account or namespace that owns the repository.`}).option(`provider-type`,{type:`string`,description:`Source control provider.`,choices:[`github`,`gitlab`,`gitlab_internal`,`origin`]}).option(`repo-id`,{type:`string`,description:`Provider-specific repository identifier.`}).option(`repo-name`,{type:`string`,description:`Human-readable repository name.`}).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:`upsert`,describe:`Save the repository connection required by build triggers.`,builder:G,handler:async p=>s({command:`builds repos connections upsert`,classification:{safeFlags:[`provider-type`,`dry-run`]}},p,async()=>{if(p.dryRun){a({command:`cf builds repos connections upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/repos/connections`,pathParams:{},bodyKind:`json`,body:p.body===void 0?l({provider_account_id:u(p[`provider-account-id`],`provider-account-id`,`text`),provider_account_name:u(p[`provider-account-name`],`provider-account-name`,`text`),provider_type:u(p[`provider-type`],`provider-type`,`text`),repo_id:u(p[`repo-id`],`repo-id`,`text`),repo_name:u(p[`repo-name`],`repo-name`,`text`)}):c(p.body)});return}let s=await r(p),m=p.local?e:await t();if(p.accountId=m,p.body){let e=c(p.body);i(await o(`Updating`,async()=>s.builds.repos.connections.upsert({...e,account_id:m})),{successLabel:`Updated`});return}p[`provider-account-id`]===void 0&&(p[`provider-account-id`]=await d(`provider-account-id`,`Provider-specific identifier of the account or namespace that owns the repository.`)),p[`provider-account-name`]===void 0&&(p[`provider-account-name`]=await d(`provider-account-name`,`Human-readable name of the account or namespace that owns the repository.`)),p[`provider-type`]===void 0&&(p[`provider-type`]=await f(`provider-type`,`Source control provider.`,[`github`,`gitlab`,`gitlab_internal`,`origin`])),p[`repo-id`]===void 0&&(p[`repo-id`]=await d(`repo-id`,`Provider-specific repository identifier.`)),p[`repo-name`]===void 0&&(p[`repo-name`]=await d(`repo-name`,`Human-readable repository name.`));let h=l({provider_account_id:u(p[`provider-account-id`],`provider-account-id`,`text`),provider_account_name:u(p[`provider-account-name`],`provider-account-name`,`text`),provider_type:u(p[`provider-type`],`provider-type`,`text`),repo_id:u(p[`repo-id`],`repo-id`,`text`),repo_name:u(p[`repo-name`],`repo-name`,`text`)});i(await o(`Updating`,async()=>s.builds.repos.connections.upsert({...h,account_id:m})),{successLabel:`Updated`})})},q={command:`connections`,describe:`Operations for repos.connections`,builder:e=>e.command(W).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`repos`,describe:`Manage source repository connections for Workers Builds.`,builder:e=>e.command(H).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Y(e){return e.option(`build-token-name`,{type:`string`,description:`The build_token_name field`}).option(`build-token-secret`,{type:`string`,description:`The build_token_secret field`}).option(`cloudflare-token-id`,{type:`string`,description:`The cloudflare_token_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const X={command:`create`,describe:`Create a new build authentication token`,builder:Y,handler:async f=>s({command:`builds tokens create`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){a({command:`cf builds tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/tokens`,pathParams:{},bodyKind:`json`,body:f.body===void 0?l({build_token_name:u(f[`build-token-name`],`build-token-name`,`text`),build_token_secret:u(f[`build-token-secret`],`build-token-secret`,`text`),cloudflare_token_id:u(f[`cloudflare-token-id`],`cloudflare-token-id`,`text`)}):c(f.body)});return}let s=await r(f),p=f.local?e:await t();if(f.accountId=p,f.body){let e=c(f.body);i(await o(`Creating`,async()=>s.builds.tokens.create({...e,account_id:p})),{successLabel:`Created`});return}f[`build-token-name`]===void 0&&(f[`build-token-name`]=await d(`build-token-name`,`The build_token_name field`)),f[`build-token-secret`]===void 0&&(f[`build-token-secret`]=await d(`build-token-secret`,`The build_token_secret field`)),f[`cloudflare-token-id`]===void 0&&(f[`cloudflare-token-id`]=await d(`cloudflare-token-id`,`The cloudflare_token_id field`));let m=l({build_token_name:u(f[`build-token-name`],`build-token-name`,`text`),build_token_secret:u(f[`build-token-secret`],`build-token-secret`,`text`),cloudflare_token_id:u(f[`cloudflare-token-id`],`cloudflare-token-id`,`text`)});i(await o(`Creating`,async()=>s.builds.tokens.create({...m,account_id:p})),{successLabel:`Created`})})};function Z(e){return e.positional(`build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Q={command:`delete <build-token-uuid>`,describe:`Delete a stored build token owned by the current user.`,builder:Z,handler:async c=>s({command:`builds tokens delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/tokens/${c[`build-token-uuid`]==null?`<build-token-uuid>`:encodeURIComponent(String(c[`build-token-uuid`]))}`,pathParams:{"build-token-uuid":String(c[`build-token-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force})){process.stderr.write(`Aborted.
5
- `);return}i(await o(`Deleting`,async()=>s.builds.tokens.delete({account_id:l,build_token_uuid:c[`build-token-uuid`]})),{successLabel:`Deleted`})})};function ne(e){return e.option(`page`,{type:`number`,description:`Page number for pagination`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`List metadata for build tokens available to the current user without returning their secrets.`,builder:ne,handler:async c=>s({command:`builds tokens list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={page:c.page,per_page:c[`per-page`]};if(c.dryRun){a({command:`cf builds tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/tokens`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.builds.tokens.list({account_id:u,...s})),{successLabel:`Loaded`})})},ie={command:`tokens`,describe:`Manage credentials used by Workers Builds to deploy Workers.`,builder:e=>e.command(X).command(Q).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const oe={command:`purge <trigger-uuid>`,describe:`Delete cached dependencies and build artifacts associated with a trigger.`,builder:ae,handler:async c=>s({command:`builds triggers cache purge`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds triggers cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${c[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(c[`trigger-uuid`]))}/purge_build_cache`,pathParams:{"trigger-uuid":String(c[`trigger-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force,message:`This operation purges the build cache for a Workers Builds trigger.`})){process.stderr.write(`Aborted.
6
- `);return}i(await o(`Deleting`,async()=>s.builds.triggers.cache.purge({account_id:l,trigger_uuid:c[`trigger-uuid`]})),{successLabel:`Deleted`})})},se={command:`cache`,describe:`Operations for triggers.cache`,builder:e=>e.command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return e.option(`branch-excludes`,{type:`string`,array:!0,description:`Branch patterns that must not start builds.`}).option(`branch-includes`,{type:`string`,array:!0,description:`Branch patterns that can start builds.`}).option(`build-caching-enabled`,{type:`boolean`,description:`Whether builds reuse cached dependencies and build artifacts.`,default:!1}).option(`build-command`,{type:`string`,description:`Command to build the Worker.`}).option(`build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`}).option(`deploy-command`,{type:`string`,description:`Command to deploy the Worker.`}).option(`external-script-id`,{type:`string`,description:`System-generated tag of the Worker. This is not the Worker name.`}).option(`path-excludes`,{type:`string`,array:!0,description:`Path patterns that must not start builds.`}).option(`path-includes`,{type:`string`,array:!0,description:`Path patterns that can start builds.`}).option(`repo-connection-uuid`,{type:`string`,description:`Repository connection UUID.`}).option(`root-directory`,{type:`string`,description:`Repository directory in which build and deploy commands run.`}).option(`trigger-name`,{type:`string`,description:`Human-readable name of the build trigger.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`create`,describe:`Create a trigger defining the repository connection, Worker tag, commands, filters, cache setting, and build token.`,builder:ce,handler:async f=>s({command:`builds triggers create`,classification:{safeFlags:[`build-caching-enabled`,`dry-run`]}},f,async()=>{if(f.dryRun){a({command:`cf builds triggers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers`,pathParams:{},bodyKind:`json`,body:f.body===void 0?l({branch_excludes:f[`branch-excludes`],branch_includes:f[`branch-includes`],build_caching_enabled:f[`build-caching-enabled`],build_command:u(f[`build-command`],`build-command`,`text`),build_token_uuid:u(f[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:u(f[`deploy-command`],`deploy-command`,`text`),external_script_id:u(f[`external-script-id`],`external-script-id`,`text`),path_excludes:f[`path-excludes`],path_includes:f[`path-includes`],repo_connection_uuid:u(f[`repo-connection-uuid`],`repo-connection-uuid`,`text`),root_directory:u(f[`root-directory`],`root-directory`,`text`),trigger_name:u(f[`trigger-name`],`trigger-name`,`text`)}):c(f.body)});return}let s=await r(f),p=f.local?e:await t();if(f.accountId=p,f.body){let e=c(f.body);i(await o(`Creating`,async()=>s.builds.triggers.create({...e,account_id:p})),{successLabel:`Created`});return}if(f[`branch-excludes`]===void 0)throw Error(`--branch-excludes is required (or pass --body with this field set).`);if(f[`branch-includes`]===void 0)throw Error(`--branch-includes is required (or pass --body with this field set).`);if(f[`build-command`]===void 0&&(f[`build-command`]=await d(`build-command`,`Command to build the Worker.`)),f[`build-token-uuid`]===void 0&&(f[`build-token-uuid`]=await d(`build-token-uuid`,`UUID of the build token used when deploying the Worker.`)),f[`deploy-command`]===void 0&&(f[`deploy-command`]=await d(`deploy-command`,`Command to deploy the Worker.`)),f[`external-script-id`]===void 0&&(f[`external-script-id`]=await d(`external-script-id`,`System-generated tag of the Worker. This is not the Worker name.`)),f[`path-excludes`]===void 0)throw Error(`--path-excludes is required (or pass --body with this field set).`);if(f[`path-includes`]===void 0)throw Error(`--path-includes is required (or pass --body with this field set).`);f[`repo-connection-uuid`]===void 0&&(f[`repo-connection-uuid`]=await d(`repo-connection-uuid`,`Repository connection UUID.`)),f[`root-directory`]===void 0&&(f[`root-directory`]=await d(`root-directory`,`Repository directory in which build and deploy commands run.`)),f[`trigger-name`]===void 0&&(f[`trigger-name`]=await d(`trigger-name`,`Human-readable name of the build trigger.`));let m=l({branch_excludes:f[`branch-excludes`],branch_includes:f[`branch-includes`],build_caching_enabled:f[`build-caching-enabled`],build_command:u(f[`build-command`],`build-command`,`text`),build_token_uuid:u(f[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:u(f[`deploy-command`],`deploy-command`,`text`),external_script_id:u(f[`external-script-id`],`external-script-id`,`text`),path_excludes:f[`path-excludes`],path_includes:f[`path-includes`],repo_connection_uuid:u(f[`repo-connection-uuid`],`repo-connection-uuid`,`text`),root_directory:u(f[`root-directory`],`root-directory`,`text`),trigger_name:u(f[`trigger-name`],`trigger-name`,`text`)});i(await o(`Creating`,async()=>s.builds.triggers.create({...m,account_id:p})),{successLabel:`Created`})})};function ue(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const de={command:`delete <trigger-uuid>`,describe:`Delete a trigger and cancel its unfinished builds.`,builder:ue,handler:async c=>s({command:`builds triggers delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds triggers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${c[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(c[`trigger-uuid`]))}`,pathParams:{"trigger-uuid":String(c[`trigger-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force,message:`This operation deletes the build trigger and cancels its unfinished builds.`})){process.stderr.write(`Aborted.
7
- `);return}i(await o(`Deleting`,async()=>s.builds.triggers.delete({account_id:l,trigger_uuid:c[`trigger-uuid`]})),{successLabel:`Deleted`})})};function fe(e){return e.positional(`environment-variable-key`,{type:`string`,description:`Environment variable key.`,demandOption:!0}).option(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,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 <environment-variable-key>`,describe:`Delete one build-time variable or secret by key.`,builder:fe,handler:async c=>s({command:`builds triggers environment-variables delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds triggers environment-variables delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${c[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(c[`trigger-uuid`]))}/environment_variables/${c[`environment-variable-key`]==null?`<environment-variable-key>`:encodeURIComponent(String(c[`environment-variable-key`]))}`,pathParams:{"trigger-uuid":String(c[`trigger-uuid`]??``),"environment-variable-key":String(c[`environment-variable-key`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force})){process.stderr.write(`Aborted.
8
- `);return}i(await o(`Deleting`,async()=>s.builds.triggers.environmentVariables.delete({account_id:l,trigger_uuid:c[`trigger-uuid`],environment_variable_key:c[`environment-variable-key`]})),{successLabel:`Deleted`})})};function me(e){return e.option(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`list`,describe:`List build-time variables configured for a trigger. Secret values are not returned.`,builder:me,handler:async c=>s({command:`builds triggers environment-variables list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds triggers environment-variables list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${c[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(c[`trigger-uuid`]))}/environment_variables`,pathParams:{"trigger-uuid":String(c[`trigger-uuid`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.triggers.environmentVariables.list({account_id:l,trigger_uuid:c[`trigger-uuid`]})),{successLabel:`Loaded`})})};function ge(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Map of environment-variable names to build-time values. Names must begin with a letter or underscore and contain only letters, numbers, and underscores.`})}const _e={command:`upsert <trigger-uuid>`,describe:`Add or replace build-time variables and secrets without changing unspecified keys.`,builder:ge,handler:async l=>s({command:`builds triggers environment-variables upsert`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){a({command:`cf builds triggers environment-variables upsert`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${l[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(l[`trigger-uuid`]))}/environment_variables`,pathParams:{"trigger-uuid":String(l[`trigger-uuid`]??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let s=await r(l),u=l.local?e:await t();if(l.accountId=u,l.body){let e=c(l.body);i(await o(`Updating`,async()=>s.builds.triggers.environmentVariables.upsert({body:e,account_id:u,trigger_uuid:l[`trigger-uuid`]})),{successLabel:`Updated`});return}if(l.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})},ve={command:`environment-variables`,describe:`Operations for triggers.environment-variables`,builder:e=>e.command(pe).command(he).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(e){return e.option(`external-script-id`,{type:`string`,description:`System-generated tag of the Worker. This is not the Worker name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`list`,describe:`List trigger UUIDs and build settings associated with a Worker tag.`,builder:ye,handler:async c=>s({command:`builds triggers list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds triggers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`external-script-id`]==null?`<external-script-id>`:encodeURIComponent(String(c[`external-script-id`]))}/triggers`,pathParams:{"external-script-id":String(c[`external-script-id`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.triggers.list({account_id:l,external_script_id:c[`external-script-id`]})),{successLabel:`Loaded`})})};function xe(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`branch-excludes`,{type:`string`,array:!0,description:`Branch patterns that must not start builds.`}).option(`branch-includes`,{type:`string`,array:!0,description:`Branch patterns that can start builds.`}).option(`build-caching-enabled`,{type:`boolean`,description:`Whether builds reuse cached dependencies and build artifacts.`}).option(`build-command`,{type:`string`,description:`Command to build the Worker.`}).option(`build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`}).option(`deploy-command`,{type:`string`,description:`Command to deploy the Worker.`}).option(`path-excludes`,{type:`string`,array:!0,description:`Path patterns that must not start builds.`}).option(`path-includes`,{type:`string`,array:!0,description:`Path patterns that can start builds.`}).option(`root-directory`,{type:`string`,description:`Repository directory in which build and deploy commands run.`}).option(`trigger-name`,{type:`string`,description:`Human-readable name of the build trigger.`}).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 Se={command:`update <trigger-uuid>`,describe:`Update commands, cache settings, or branch and path filters for a trigger.`,builder:xe,handler:async d=>s({command:`builds triggers update`,classification:{safeFlags:[`build-caching-enabled`,`dry-run`]}},d,async()=>{if(d.dryRun){a({command:`cf builds triggers update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/triggers/${d[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(d[`trigger-uuid`]))}`,pathParams:{"trigger-uuid":String(d[`trigger-uuid`]??``)},bodyKind:`json`,body:d.body===void 0?l({branch_excludes:d[`branch-excludes`],branch_includes:d[`branch-includes`],build_caching_enabled:d[`build-caching-enabled`],build_command:u(d[`build-command`],`build-command`,`text`),build_token_uuid:u(d[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:u(d[`deploy-command`],`deploy-command`,`text`),path_excludes:d[`path-excludes`],path_includes:d[`path-includes`],root_directory:u(d[`root-directory`],`root-directory`,`text`),trigger_name:u(d[`trigger-name`],`trigger-name`,`text`)}):c(d.body)});return}let s=await r(d),f=d.local?e:await t();if(d.accountId=f,d.body){let e=c(d.body);i(await o(`Updating`,async()=>s.builds.triggers.update({...e,account_id:f,trigger_uuid:d[`trigger-uuid`]})),{successLabel:`Updated`});return}let p=l({branch_excludes:d[`branch-excludes`],branch_includes:d[`branch-includes`],build_caching_enabled:d[`build-caching-enabled`],build_command:u(d[`build-command`],`build-command`,`text`),build_token_uuid:u(d[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:u(d[`deploy-command`],`deploy-command`,`text`),path_excludes:d[`path-excludes`],path_includes:d[`path-includes`],root_directory:u(d[`root-directory`],`root-directory`,`text`),trigger_name:u(d[`trigger-name`],`trigger-name`,`text`)});i(await o(`Updating`,async()=>s.builds.triggers.update({...p,account_id:f,trigger_uuid:d[`trigger-uuid`]})),{successLabel:`Updated`})})},Ce={command:`triggers`,describe:`Configure how repository changes build and deploy Workers.`,builder:e=>e.command(le).command(de).command(be).command(Se).command(se).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.option(`version-ids`,{type:`string`,description:`Comma-separated list of version UUIDs (max 20).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get`,describe:`Retrieve builds associated with one or more Worker version IDs.`,builder:we,handler:async c=>s({command:`builds versions get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={version_ids:c[`version-ids`]};if(c.dryRun){a({command:`cf builds versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/builds`,pathParams:{},query:s,bodyKind:`none`});return}let l=await r(c),u=c.local?e:await t();c.accountId=u,i(await o(`Loading`,async()=>l.builds.versions.get({account_id:u,...s})),{successLabel:`Loaded`})})},Ee={command:`versions`,describe:`Find builds associated with Worker versions.`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.option(`git-repository-branch`,{type:`string`,description:`Git branch to watch for builds`}).option(`git-repository-provider-account-id`,{type:`string`,description:`Provider-specific identifier of the account or namespace that owns the repository.`}).option(`git-repository-provider-account-name`,{type:`string`,description:`Human-readable name of the account or namespace that owns the repository.`}).option(`git-repository-provider-type`,{type:`string`,description:`The git_repository.provider_type field`,choices:[`github`,`gitlab`,`gitlab_internal`,`origin`]}).option(`git-repository-repo-id`,{type:`string`,description:`Provider-specific repository identifier.`}).option(`git-repository-repo-name`,{type:`string`,description:`Human-readable repository name.`}).option(`git-repository-grant-id`,{type:`string`,description:`Grant ID required for grant-backed providers`}).option(`previews-base-config-build-command`,{type:`string`,description:`Command to build the Worker.`}).option(`previews-base-config-build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`}).option(`previews-base-config-deploy-command`,{type:`string`,description:`Command to deploy the Worker.`}).option(`previews-base-config-path-excludes`,{type:`string`,array:!0,description:`Path patterns that must not start builds.`}).option(`previews-base-config-path-includes`,{type:`string`,array:!0,description:`Path patterns that can start builds.`}).option(`previews-enabled`,{type:`boolean`,description:`Whether Previews are enabled for this Worker`}).option(`production-settings-build-command`,{type:`string`,description:`Command to build the Worker.`}).option(`production-settings-build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`}).option(`production-settings-deploy-command`,{type:`string`,description:`Command to deploy the Worker.`}).option(`production-settings-path-excludes`,{type:`string`,array:!0,description:`Path patterns that must not start builds.`}).option(`production-settings-path-includes`,{type:`string`,array:!0,description:`Path patterns that can start builds.`}).option(`script-tag`,{type:`string`,description:`System-generated tag of the Worker. This is not the Worker name.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a Worker build configuration.`})}const $={command:`create`,describe:`Connect a Worker tag to a repository and production build settings.`,builder:De,handler:async p=>s({command:`builds workers create`,classification:{safeFlags:[`git-repository-provider-type`,`previews-enabled`,`dry-run`]}},p,async()=>{if(p.dryRun){a({command:`cf builds workers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers`,pathParams:{},bodyKind:`json`,body:p.body===void 0?l({git_repository:{branch:u(p[`git-repository-branch`],`git-repository-branch`,`text`),provider_account_id:u(p[`git-repository-provider-account-id`],`git-repository-provider-account-id`,`text`),provider_account_name:u(p[`git-repository-provider-account-name`],`git-repository-provider-account-name`,`text`),provider_type:u(p[`git-repository-provider-type`],`git-repository-provider-type`,`text`),repo_id:u(p[`git-repository-repo-id`],`git-repository-repo-id`,`text`),repo_name:u(p[`git-repository-repo-name`],`git-repository-repo-name`,`text`),grant_id:u(p[`git-repository-grant-id`],`git-repository-grant-id`,`text`)},previews_base_config:{build_command:u(p[`previews-base-config-build-command`],`previews-base-config-build-command`,`text`),build_token_uuid:u(p[`previews-base-config-build-token-uuid`],`previews-base-config-build-token-uuid`,`text`),deploy_command:u(p[`previews-base-config-deploy-command`],`previews-base-config-deploy-command`,`text`),path_excludes:p[`previews-base-config-path-excludes`],path_includes:p[`previews-base-config-path-includes`]},previews_enabled:p[`previews-enabled`],production_settings:{build_command:u(p[`production-settings-build-command`],`production-settings-build-command`,`text`),build_token_uuid:u(p[`production-settings-build-token-uuid`],`production-settings-build-token-uuid`,`text`),deploy_command:u(p[`production-settings-deploy-command`],`production-settings-deploy-command`,`text`),path_excludes:p[`production-settings-path-excludes`],path_includes:p[`production-settings-path-includes`]},script_tag:u(p[`script-tag`],`script-tag`,`text`)}):c(p.body)});return}let s=await r(p),m=p.local?e:await t();if(p.accountId=m,p.body){let e=c(p.body);i(await o(`Creating`,async()=>s.builds.workers.create({...e,account_id:m})),{successLabel:`Created`});return}if(p[`git-repository-branch`]===void 0&&(p[`git-repository-branch`]=await d(`git-repository-branch`,`Git branch to watch for builds`)),p[`git-repository-provider-account-id`]===void 0&&(p[`git-repository-provider-account-id`]=await d(`git-repository-provider-account-id`,`Provider-specific identifier of the account or namespace that owns the repository.`)),p[`git-repository-provider-account-name`]===void 0&&(p[`git-repository-provider-account-name`]=await d(`git-repository-provider-account-name`,`Human-readable name of the account or namespace that owns the repository.`)),p[`git-repository-provider-type`]===void 0&&(p[`git-repository-provider-type`]=await f(`git-repository-provider-type`,`The git_repository.provider_type field`,[`github`,`gitlab`,`gitlab_internal`,`origin`])),p[`git-repository-repo-id`]===void 0&&(p[`git-repository-repo-id`]=await d(`git-repository-repo-id`,`Provider-specific repository identifier.`)),p[`git-repository-repo-name`]===void 0&&(p[`git-repository-repo-name`]=await d(`git-repository-repo-name`,`Human-readable repository name.`)),p[`previews-base-config-build-command`]===void 0&&(p[`previews-base-config-build-command`]=await d(`previews-base-config-build-command`,`Command to build the Worker.`)),p[`previews-base-config-build-token-uuid`]===void 0&&(p[`previews-base-config-build-token-uuid`]=await d(`previews-base-config-build-token-uuid`,`UUID of the build token used when deploying the Worker.`)),p[`previews-base-config-deploy-command`]===void 0&&(p[`previews-base-config-deploy-command`]=await d(`previews-base-config-deploy-command`,`Command to deploy the Worker.`)),p[`previews-enabled`]===void 0)throw Error(`--previews-enabled is required (or pass --body with this field set).`);p[`production-settings-build-command`]===void 0&&(p[`production-settings-build-command`]=await d(`production-settings-build-command`,`Command to build the Worker.`)),p[`production-settings-build-token-uuid`]===void 0&&(p[`production-settings-build-token-uuid`]=await d(`production-settings-build-token-uuid`,`UUID of the build token used when deploying the Worker.`)),p[`production-settings-deploy-command`]===void 0&&(p[`production-settings-deploy-command`]=await d(`production-settings-deploy-command`,`Command to deploy the Worker.`)),p[`script-tag`]===void 0&&(p[`script-tag`]=await d(`script-tag`,`System-generated tag of the Worker. This is not the Worker name.`));let h=l({git_repository:{branch:u(p[`git-repository-branch`],`git-repository-branch`,`text`),provider_account_id:u(p[`git-repository-provider-account-id`],`git-repository-provider-account-id`,`text`),provider_account_name:u(p[`git-repository-provider-account-name`],`git-repository-provider-account-name`,`text`),provider_type:u(p[`git-repository-provider-type`],`git-repository-provider-type`,`text`),repo_id:u(p[`git-repository-repo-id`],`git-repository-repo-id`,`text`),repo_name:u(p[`git-repository-repo-name`],`git-repository-repo-name`,`text`),grant_id:u(p[`git-repository-grant-id`],`git-repository-grant-id`,`text`)},previews_base_config:{build_command:u(p[`previews-base-config-build-command`],`previews-base-config-build-command`,`text`),build_token_uuid:u(p[`previews-base-config-build-token-uuid`],`previews-base-config-build-token-uuid`,`text`),deploy_command:u(p[`previews-base-config-deploy-command`],`previews-base-config-deploy-command`,`text`),path_excludes:p[`previews-base-config-path-excludes`],path_includes:p[`previews-base-config-path-includes`]},previews_enabled:p[`previews-enabled`],production_settings:{build_command:u(p[`production-settings-build-command`],`production-settings-build-command`,`text`),build_token_uuid:u(p[`production-settings-build-token-uuid`],`production-settings-build-token-uuid`,`text`),deploy_command:u(p[`production-settings-deploy-command`],`production-settings-deploy-command`,`text`),path_excludes:p[`production-settings-path-excludes`],path_includes:p[`production-settings-path-includes`]},script_tag:u(p[`script-tag`],`script-tag`,`text`)});i(await o(`Creating`,async()=>s.builds.workers.create({...h,account_id:m})),{successLabel:`Created`})})};function Oe(e){return e.positional(`script-tag`,{type:`string`,description:`The Worker script tag (external script 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 ke={command:`delete <script-tag>`,describe:`Delete build settings and triggers for a Worker tag and cancel unfinished builds. The Worker is not deleted.`,builder:Oe,handler:async c=>s({command:`builds workers delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){a({command:`cf builds workers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`script-tag`]==null?`<script-tag>`:encodeURIComponent(String(c[`script-tag`]))}`,pathParams:{"script-tag":String(c[`script-tag`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();if(c.accountId=l,!await p({force:!!c.force,message:`This operation deletes the Worker build configuration and its triggers, and cancels unfinished builds. The Worker is not deleted.`})){process.stderr.write(`Aborted.
9
- `);return}i(await o(`Deleting`,async()=>s.builds.workers.delete({account_id:l,script_tag:c[`script-tag`]})),{successLabel:`Deleted`})})};function Ae(e){return e.positional(`script-tag`,{type:`string`,description:`The Worker script tag (external script ID)`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const je={command:`get <script-tag>`,describe:`Retrieve the repository and production build settings associated with a Worker tag.`,builder:Ae,handler:async c=>s({command:`builds workers get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){a({command:`cf builds workers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${c[`script-tag`]==null?`<script-tag>`:encodeURIComponent(String(c[`script-tag`]))}`,pathParams:{"script-tag":String(c[`script-tag`]??``)},bodyKind:`none`});return}let s=await r(c),l=c.local?e:await t();c.accountId=l,i(await o(`Loading`,async()=>s.builds.workers.get({account_id:l,script_tag:c[`script-tag`]})),{successLabel:`Loaded`})})};function Me(e){return e.positional(`script-tag`,{type:`string`,description:`The Worker script tag (external script ID)`,demandOption:!0}).option(`patch-existing-previews`,{type:`string`,description:`Apply a previews_base_config patch to every existing Preview of the Worker as well as to the base config.`,choices:[`true`,`false`]}).option(`git-repository-branch`,{type:`string`,description:`New git branch to watch for builds`}).option(`previews-base-config-build-caching-enabled`,{type:`boolean`,description:`Whether builds reuse cached dependencies and build artifacts.`}).option(`previews-base-config-build-command`,{type:`string`,description:`Command to build the Worker.`}).option(`previews-base-config-build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`}).option(`previews-base-config-deploy-command`,{type:`string`,description:`Command to deploy the Worker.`}).option(`previews-base-config-path-excludes`,{type:`string`,array:!0,description:`Path patterns that must not start builds.`}).option(`previews-base-config-path-includes`,{type:`string`,array:!0,description:`Path patterns that can start builds.`}).option(`previews-base-config-root-directory`,{type:`string`,description:`Repository directory in which build and deploy commands run.`}).option(`previews-enabled`,{type:`boolean`,description:`Enable or disable Previews for this Worker. Enabling requires previews_base_config to already exist or to be sent in the same request.`}).option(`production-settings-build-caching-enabled`,{type:`boolean`,description:`Whether builds reuse cached dependencies and build artifacts.`}).option(`production-settings-build-command`,{type:`string`,description:`Command to build the Worker.`}).option(`production-settings-build-token-uuid`,{type:`string`,description:`UUID of the build token used when deploying the Worker.`}).option(`production-settings-deploy-command`,{type:`string`,description:`Command to deploy the Worker.`}).option(`production-settings-path-excludes`,{type:`string`,array:!0,description:`Path patterns that must not start builds.`}).option(`production-settings-path-includes`,{type:`string`,array:!0,description:`Path patterns that can start builds.`}).option(`production-settings-root-directory`,{type:`string`,description:`Repository directory in which build and deploy commands run.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for updating a Worker build configuration. At least one field must be provided.`})}const Ne={command:`update <script-tag>`,describe:`Update the build configuration for a Worker script. Supports partial updates to git repository settings, production build settings, and Preview settings.`,builder:m(Me),handler:async d=>s({command:`builds workers update`,classification:{safeFlags:[`patch-existing-previews`,`previews-base-config-build-caching-enabled`,`previews-enabled`,`production-settings-build-caching-enabled`,`dry-run`]}},d,async()=>{let s={patch_existing_previews:d[`patch-existing-previews`]};if(d.dryRun){a({command:`cf builds workers update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/workers/${d[`script-tag`]==null?`<script-tag>`:encodeURIComponent(String(d[`script-tag`]))}`,pathParams:{"script-tag":String(d[`script-tag`]??``)},query:s,bodyKind:`json`,body:d.body===void 0?l({git_repository:{branch:u(d[`git-repository-branch`],`git-repository-branch`,`text`)},previews_base_config:{build_caching_enabled:d[`previews-base-config-build-caching-enabled`],build_command:u(d[`previews-base-config-build-command`],`previews-base-config-build-command`,`text`),build_token_uuid:u(d[`previews-base-config-build-token-uuid`],`previews-base-config-build-token-uuid`,`text`),deploy_command:u(d[`previews-base-config-deploy-command`],`previews-base-config-deploy-command`,`text`),path_excludes:d[`previews-base-config-path-excludes`],path_includes:d[`previews-base-config-path-includes`],root_directory:u(d[`previews-base-config-root-directory`],`previews-base-config-root-directory`,`text`)},previews_enabled:d[`previews-enabled`],production_settings:{build_caching_enabled:d[`production-settings-build-caching-enabled`],build_command:u(d[`production-settings-build-command`],`production-settings-build-command`,`text`),build_token_uuid:u(d[`production-settings-build-token-uuid`],`production-settings-build-token-uuid`,`text`),deploy_command:u(d[`production-settings-deploy-command`],`production-settings-deploy-command`,`text`),path_excludes:d[`production-settings-path-excludes`],path_includes:d[`production-settings-path-includes`],root_directory:u(d[`production-settings-root-directory`],`production-settings-root-directory`,`text`)}}):c(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=c(d.body);new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Updating`,async()=>f.builds.workers.update({...e,account_id:p,script_tag:d[`script-tag`],...s})),{successLabel:`Updated`});return}let m=l({git_repository:{branch:u(d[`git-repository-branch`],`git-repository-branch`,`text`)},previews_base_config:{build_caching_enabled:d[`previews-base-config-build-caching-enabled`],build_command:u(d[`previews-base-config-build-command`],`previews-base-config-build-command`,`text`),build_token_uuid:u(d[`previews-base-config-build-token-uuid`],`previews-base-config-build-token-uuid`,`text`),deploy_command:u(d[`previews-base-config-deploy-command`],`previews-base-config-deploy-command`,`text`),path_excludes:d[`previews-base-config-path-excludes`],path_includes:d[`previews-base-config-path-includes`],root_directory:u(d[`previews-base-config-root-directory`],`previews-base-config-root-directory`,`text`)},previews_enabled:d[`previews-enabled`],production_settings:{build_caching_enabled:d[`production-settings-build-caching-enabled`],build_command:u(d[`production-settings-build-command`],`production-settings-build-command`,`text`),build_token_uuid:u(d[`production-settings-build-token-uuid`],`production-settings-build-token-uuid`,`text`),deploy_command:u(d[`production-settings-deploy-command`],`production-settings-deploy-command`,`text`),path_excludes:d[`production-settings-path-excludes`],path_includes:d[`production-settings-path-includes`],root_directory:u(d[`production-settings-root-directory`],`production-settings-root-directory`,`text`)}});new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Updating`,async()=>f.builds.workers.update({...m,account_id:p,script_tag:d[`script-tag`],...s})),{successLabel:`Updated`})})},Pe={command:`workers`,describe:`Manage repository-backed build configuration for Workers.`,builder:e=>e.command($).command(ke).command(je).command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Fe={command:`builds`,describe:`Build and deploy Workers from connected repositories, then inspect build status and logs.`,builder:e=>e.command(ee).command(g).command(j).command(I).command(k).command(P).command(z).command(J).command(ie).command(Ce).command(Ee).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Fe as default};