cf 0.13.0 → 0.14.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 (266) hide show
  1. package/dist/_meta/agent-context.json +189 -187
  2. package/dist/_meta/commands.json +2591 -2248
  3. package/dist/_meta/hand-written-commands.json +146 -1
  4. package/dist/_meta/schemas.json +1548 -1313
  5. package/dist/{abuse-reports-BbaHw4ST.mjs → abuse-reports-CDFjJ2e8.mjs} +1 -1
  6. package/dist/{access-D6Xz892p.mjs → access-BoT1waG4.mjs} +1 -1
  7. package/dist/{account-DvxcqeaK.mjs → account-agnMUKWj.mjs} +1 -1
  8. package/dist/{account-tags-CeqfEWpz.mjs → account-tags-BRMMHCee.mjs} +1 -1
  9. package/dist/{accounts-Bx-8BMH9.mjs → accounts-Cut77dAt.mjs} +2 -2
  10. package/dist/{acm--0opdSGE.mjs → acm-C8WgXNCl.mjs} +1 -1
  11. package/dist/{addressing-BS1ynzLA.mjs → addressing-CR8EV42x.mjs} +1 -1
  12. package/dist/{agent-context-BPhyrSns.mjs → agent-context-Wj5TRRbW.mjs} +1 -1
  13. package/dist/{agent-memory-DczzpEw5.mjs → agent-memory-CVJpKKZy.mjs} +1 -1
  14. package/dist/{ai-CDdCTcQl.mjs → ai-BbNYt-yI.mjs} +1 -1
  15. package/dist/{ai-audit-Bx9KMQYh.mjs → ai-audit-mVajM-2i.mjs} +1 -1
  16. package/dist/{ai-gateway-BSXJEaYS.mjs → ai-gateway-BsepSA_v.mjs} +2 -2
  17. package/dist/{ai-search-DRQj1aMu.mjs → ai-search-DbEJqm5-.mjs} +1 -1
  18. package/dist/{ai-security-C_Rb0lGT.mjs → ai-security-DmyB5EYk.mjs} +1 -1
  19. package/dist/{alerting-BAR9eFs2.mjs → alerting-dmy3hd8O.mjs} +3 -3
  20. package/dist/analytics-B1xBMla0.mjs +5 -0
  21. package/dist/{analytics_engine-DkEzlhfT.mjs → analytics_engine-DazCn3iC.mjs} +1 -1
  22. package/dist/{api-security-jA0lOk6a.mjs → api-security-0HXCzfHk.mjs} +1 -1
  23. package/dist/{argo-Cz4pDagx.mjs → argo-DSHsE8zv.mjs} +1 -1
  24. package/dist/{artifacts-BcLTGfAv.mjs → artifacts-CwiU9Mxu.mjs} +1 -1
  25. package/dist/{audit-logs-DbIv4n6u.mjs → audit-logs-DwFtMDwH.mjs} +1 -1
  26. package/dist/{auth-rW5d3jtr.mjs → auth-B0ZyXc3y.mjs} +1 -1
  27. package/dist/{auth-tvDdC1J-.mjs → auth-DWxtJ918.mjs} +2 -2
  28. package/dist/{billing-Md87QjqW.mjs → billing-Cbpadkgu.mjs} +1 -1
  29. package/dist/{bot-management-VHMo4hpU.mjs → bot-management-B6M2Vyyn.mjs} +1 -1
  30. package/dist/{botnet-feed-BHqfo3sa.mjs → botnet-feed-Dn8UuE4h.mjs} +1 -1
  31. package/dist/{brand-protection-HUeR6Pof.mjs → brand-protection-B5R0b3pu.mjs} +1 -1
  32. package/dist/{browser-extension-199oZg3X.mjs → browser-extension-D55pYZf_.mjs} +1 -1
  33. package/dist/{browser-run-DDasyux-.mjs → browser-run-C1b2VkGB.mjs} +1 -1
  34. package/dist/build-CP2JUfV1.mjs +2 -0
  35. package/dist/{builds-B-lXn6JR.mjs → builds-CVEXO_4a.mjs} +8 -8
  36. package/dist/{cache-CevKpiTM.mjs → cache-BU5xX82E.mjs} +1 -1
  37. package/dist/{certificate-authorities-DAg-aO1B.mjs → certificate-authorities--tZTWJWD.mjs} +1 -1
  38. package/dist/cf-BV2HLCQm.mjs +18 -0
  39. package/dist/{chunk-QBZBEHZB-BuiXJn8j.mjs → chunk-QBZBEHZB-BcCMlc8C.mjs} +1 -1
  40. package/dist/chunk-XLADBZ7F-DgFrtUhW.mjs +103 -0
  41. package/dist/{client-certificates-Bay7oPLE.mjs → client-certificates-DX84qeYG.mjs} +1 -1
  42. package/dist/{client-side-security-CbU9xn0k.mjs → client-side-security-DsSO2rZQ.mjs} +1 -1
  43. package/dist/{cloud-connector-AH2ClcSL.mjs → cloud-connector-cf8qlxap.mjs} +1 -1
  44. package/dist/{cloudforce-one-DwOfS75V.mjs → cloudforce-one-DzVXorbu.mjs} +2 -2
  45. package/dist/command-BL6weJf3.mjs +3 -0
  46. package/dist/command-DYrspBc0.mjs +2 -0
  47. package/dist/{completions-nPO9PdSu.mjs → completions-Dn621okY.mjs} +1 -1
  48. package/dist/{config-B8lwPpVl.mjs → config-BY6KpMZs.mjs} +1 -1
  49. package/dist/config.d.mts +1 -1729
  50. package/dist/config.mjs +1 -1
  51. package/dist/{connector-interrupts-DcLrqM2V.mjs → connector-interrupts-DqpqPPkp.mjs} +1 -1
  52. package/dist/{connector-telemetry-events-PrJWgNs9.mjs → connector-telemetry-events-CCD-_B-8.mjs} +1 -1
  53. package/dist/{connector-telemetry-snapshots-CIjJm5yu.mjs → connector-telemetry-snapshots-D3CeGGhk.mjs} +1 -1
  54. package/dist/{connectors-CEAy30E-.mjs → connectors-aPQspZdg.mjs} +1 -1
  55. package/dist/{containers-BsbDqbSn.mjs → containers-D0Kjl8h-.mjs} +1 -1
  56. package/dist/{content-scan-BdK936iO.mjs → content-scan-BVx18XmS.mjs} +1 -1
  57. package/dist/{cps-oP97-qkm.mjs → cps-ByazyM0x.mjs} +1 -1
  58. package/dist/{csamScanner-DUNN4INg.mjs → csamScanner-OG5lQxBC.mjs} +1 -1
  59. package/dist/{ct-alerting-dV_gsV2w.mjs → ct-alerting-BJx5n8Zf.mjs} +1 -1
  60. package/dist/{custom-certificates-DYspvjo4.mjs → custom-certificates-BuJ2e9TA.mjs} +1 -1
  61. package/dist/{custom-csrs-DjSWLQRu.mjs → custom-csrs-CR_5qbST.mjs} +1 -1
  62. package/dist/{custom-hostnames-df1lH6IY.mjs → custom-hostnames-BzDTsQXb.mjs} +1 -1
  63. package/dist/{custom-nameservers-CLTbN-9R.mjs → custom-nameservers-OfMPRGkD.mjs} +1 -1
  64. package/dist/custom-pages-BmGXoTIo.mjs +3 -0
  65. package/dist/d1-DedC8N0N.mjs +21 -0
  66. package/dist/data-security-B2UB26ry.mjs +7 -0
  67. package/dist/{dcv-delegation-_r6Vc6VL.mjs → dcv-delegation-C11vmzbG.mjs} +1 -1
  68. package/dist/{deploy-QTGENpOM.mjs → deploy-BtETDvDA.mjs} +1 -1
  69. package/dist/{deploy-input-C7W1Bsji.mjs → deploy-input-BoLTdQzS.mjs} +1 -1
  70. package/dist/{dev-CAubuxCc.mjs → dev-B5WcIpEr.mjs} +2 -2
  71. package/dist/{diagnostics-B0DRh714.mjs → diagnostics-Cf6BLpAo.mjs} +1 -1
  72. package/dist/dialog-Bud0hiYv.mjs +2 -0
  73. package/dist/{dist-DW5BPGFs.mjs → dist-BRg_z9Ut.mjs} +1 -1
  74. package/dist/{shared-YJtB5KZB.mjs → dist-CFQREIRi.mjs} +86 -86
  75. package/dist/dist-CyisSore.mjs +371 -0
  76. package/dist/dist-Dr4Hg_Up.mjs +48 -0
  77. package/dist/{dls-CFzTHcZM.mjs → dls-R6PvHbhj.mjs} +1 -1
  78. package/dist/{dns-Dw6u-NV1.mjs → dns-Cl8se64c.mjs} +1 -1
  79. package/dist/{dns-firewall-CIPptslp.mjs → dns-firewall-WtmKilDT.mjs} +1 -1
  80. package/dist/dry-run-YSQndLvt.mjs +2 -0
  81. package/dist/{durable-objects-CCkeqqBq.mjs → durable-objects-jfVU6yp_.mjs} +1 -1
  82. package/dist/{email-auth-kdxO51Oz.mjs → email-auth-DPmZ85eW.mjs} +1 -1
  83. package/dist/{email-routing-BLggZdQq.mjs → email-routing-Bf6DbNTr.mjs} +1 -1
  84. package/dist/{email-security-DjADlgdM.mjs → email-security-DTifjSxM.mjs} +1 -1
  85. package/dist/{email-sending-Cz7E7GoP.mjs → email-sending-Dm3WkFHV.mjs} +1 -1
  86. package/dist/{error-sanitization-DfLijlBJ.mjs → error-sanitization-D8zuyPj_.mjs} +1 -1
  87. package/dist/{fieldExtractors-BWaMi6lD.mjs → fieldExtractors-CeXZL0-I.mjs} +1 -1
  88. package/dist/{firewall-5t6OBIOl.mjs → firewall-D5N2APXO.mjs} +1 -1
  89. package/dist/{flagship-CzG_VoNR.mjs → flagship-sUOy9jei.mjs} +1 -1
  90. package/dist/{fraud-UOg_69Ob.mjs → fraud-WLW2Ep1Z.mjs} +1 -1
  91. package/dist/{google-tag-gateway-DirkD-Q2.mjs → google-tag-gateway-lbww1FaJ.mjs} +1 -1
  92. package/dist/{healthchecks-BkHZGTp1.mjs → healthchecks-0ih8Qjiw.mjs} +1 -1
  93. package/dist/{hostnames-EUYOZm21.mjs → hostnames-Ba6FuL8K.mjs} +1 -1
  94. package/dist/{hyperdrive-ZoLJlJCL.mjs → hyperdrive-DMqcU639.mjs} +1 -1
  95. package/dist/{iam-BQ2xSgYN.mjs → iam-CXlYm0uC.mjs} +1 -1
  96. package/dist/{images-CkEq6ScP.mjs → images-D_g1oli6.mjs} +1 -1
  97. package/dist/index.mjs +1 -1
  98. package/dist/{intel-DDWEdGyl.mjs → intel-B8bS0ARd.mjs} +1 -1
  99. package/dist/interactive-CGOh-aYq.mjs +32 -0
  100. package/dist/{ips-54Qmy-Uw.mjs → ips-68fzniN4.mjs} +1 -1
  101. package/dist/{keyless-certificates-CXHLc3Qz.mjs → keyless-certificates-CeLnqBvX.mjs} +1 -1
  102. package/dist/{keys-rvI4TC3Z.mjs → keys-DkVdS2lF.mjs} +1 -1
  103. package/dist/{kv-CAeN1zBy.mjs → kv-gDAN50BQ.mjs} +1 -1
  104. package/dist/{leaked-credential-checks-CbbwtG-p.mjs → leaked-credential-checks-DfnvHpvg.mjs} +1 -1
  105. package/dist/{lifecycle-XswDq0ZB.mjs → lifecycle-CadF_i2n.mjs} +1 -1
  106. package/dist/{load-balancers-BFwdwAIU.mjs → load-balancers-m0HqyXPZ.mjs} +1 -1
  107. package/dist/{local-C6XsFD_W.mjs → local-BwL_gesw.mjs} +1 -1
  108. package/dist/{local-runtime-BUGCbx8r.mjs → local-runtime-Dj8k-p62.mjs} +1 -1
  109. package/dist/{logo-matches-Y3PxVn7t.mjs → logo-matches-DPbHlsKQ.mjs} +1 -1
  110. package/dist/{logos-BN8SvJhS.mjs → logos-DFBJFAYJ.mjs} +1 -1
  111. package/dist/{logpush-BnLA4WVm.mjs → logpush-gzmlZayc.mjs} +1 -1
  112. package/dist/logs-BuzwQgt5.mjs +18 -0
  113. package/dist/{magic-cloud-networking-wPuLwu-F.mjs → magic-cloud-networking-BbHCi1Vp.mjs} +1 -1
  114. package/dist/{magic-network-monitoring-BNERUpxS.mjs → magic-network-monitoring-kWMmnPTG.mjs} +1 -1
  115. package/dist/{magic-transit-6tvVOECW.mjs → magic-transit-ClSmJDKw.mjs} +1 -1
  116. package/dist/{managed-defense-AYwBOYIH.mjs → managed-defense-EOihg1UR.mjs} +1 -1
  117. package/dist/{managed-transforms-HZZNrkC7.mjs → managed-transforms-BZ_XdGE2.mjs} +1 -1
  118. package/dist/{matches-Dp91L3dL.mjs → matches-B6sG0_fr.mjs} +1 -1
  119. package/dist/{mcp-P7pcieiT.mjs → mcp--kK0vS5i.mjs} +1 -1
  120. package/dist/{mesh-DjFrk6PL.mjs → mesh-DfXYUHOO.mjs} +1 -1
  121. package/dist/{mtls-certificates-DZMoef2H.mjs → mtls-certificates-DZd-0X7l.mjs} +1 -1
  122. package/dist/{network-7cd1U6-I.mjs → network-U6f_5ihp.mjs} +1 -1
  123. package/dist/{network-interconnects-CQ7cPZjK.mjs → network-interconnects-DKZGTiYM.mjs} +1 -1
  124. package/dist/oauth-BdVr2hJp.mjs +14 -0
  125. package/dist/{oauth-clients-P9t-eMnx.mjs → oauth-clients-CY3OkPhC.mjs} +1 -1
  126. package/dist/{oauth-scopes-C3r9Qh_y.mjs → oauth-scopes-BTY7_5L-.mjs} +1 -1
  127. package/dist/{observability-M1DnLhMR.mjs → observability-Bsp-LdmJ.mjs} +1 -1
  128. package/dist/{open-PBXRGS4R-DARSUDEI.mjs → open-PBXRGS4R-ClEt4E8F.mjs} +3 -3
  129. package/dist/{organization-cUE7GDCt.mjs → organization-BSeMdj-7.mjs} +1 -1
  130. package/dist/{organizations-C-Hcpd0w.mjs → organizations-BroR48Nv.mjs} +1 -1
  131. package/dist/{origin-ca-certificates-C8cJMyQH.mjs → origin-ca-certificates-jC-EMn6W.mjs} +1 -1
  132. package/dist/{origin-post-quantum-encryption-DjZJCk8M.mjs → origin-post-quantum-encryption-DIspLvA0.mjs} +1 -1
  133. package/dist/{origin-tls-client-auth-BsjR5EAV.mjs → origin-tls-client-auth-CZ_nUEcM.mjs} +1 -1
  134. package/dist/{page-rules-B-zq1EUb.mjs → page-rules-ZcdjPohY.mjs} +1 -1
  135. package/dist/{pages-B6YpkPos.mjs → pages-W4tKa7xk.mjs} +1 -1
  136. package/dist/pay-per-crawl-BNM1mJmP.mjs +5 -0
  137. package/dist/pay-per-use-DKxlnkH3.mjs +2 -0
  138. package/dist/{pipelines-BJc_RylD.mjs → pipelines-Dug0BR-c.mjs} +1 -1
  139. package/dist/{precursor-CLQu7suY.mjs → precursor-D-11DkRU.mjs} +1 -1
  140. package/dist/previews-D_Nv4dR6.mjs +4 -0
  141. package/dist/{progress-V6SZV3Ux.mjs → progress-a5IKeKni.mjs} +1 -1
  142. package/dist/project-settings-Bc3wYHo8.mjs +3 -0
  143. package/dist/prompt-BP8XrQSj.mjs +3 -0
  144. package/dist/{queries-DSrrket-.mjs → queries-BdA2vJoe.mjs} +1 -1
  145. package/dist/{queues-Tf7kPBpn.mjs → queues-Bu06ZqUE.mjs} +1 -1
  146. package/dist/{r2-DmKNnxtC.mjs → r2-COC9wMKb.mjs} +1 -1
  147. package/dist/{r2-data-catalog-DBxoifOq.mjs → r2-data-catalog-CX5Rl5Qx.mjs} +1 -1
  148. package/dist/{radar-Csk7Ab-b.mjs → radar-L-yoLIHF.mjs} +1 -1
  149. package/dist/{raw-fetch-BVYQR6C5.mjs → raw-fetch-DNH2V8qH.mjs} +1 -1
  150. package/dist/{realtime-CDehZVhV.mjs → realtime-JKIiXfzi.mjs} +1 -1
  151. package/dist/{registrar-vflzeNQ9.mjs → registrar-_dYUZrK0.mjs} +2 -2
  152. package/dist/{registrar-sandbox-BxVdfnam.mjs → registrar-sandbox-D1yfW_Q_.mjs} +2 -2
  153. package/dist/{registry-CWUfXloz.mjs → registry-BrtVdMrC.mjs} +1 -1
  154. package/dist/{reporting-BaPZ1PHN.mjs → reporting-3fyoMcmb.mjs} +1 -1
  155. package/dist/request-headers-BhQQAfJt.mjs +2 -0
  156. package/dist/{request-tracers-C_UVBexV.mjs → request-tracers-TisEth2p.mjs} +1 -1
  157. package/dist/{resolve-B8CyM1mi.mjs → resolve-CYUp6YgC.mjs} +1 -1
  158. package/dist/{resource-sharing-CoB4S9j1.mjs → resource-sharing-C4-dnohU.mjs} +1 -1
  159. package/dist/{resource-tagging-CUiUC5g4.mjs → resource-tagging-BRDifKqM.mjs} +1 -1
  160. package/dist/{rules-4O8076_s.mjs → rules-BCF3gIkw.mjs} +2 -2
  161. package/dist/{rulesets-C84MxTYo.mjs → rulesets-wp6rllt3.mjs} +1 -1
  162. package/dist/{rum-Bvwkrntx.mjs → rum-B77awgoB.mjs} +1 -1
  163. package/dist/run-BS8otL3u.mjs +2 -0
  164. package/dist/{schema-C8hU6G9R.mjs → schema-DmuJtMN5.mjs} +1 -1
  165. package/dist/{schema-flags-DC4c6dka.mjs → schema-flags-CUGxFeZe.mjs} +4 -4
  166. package/dist/{scim-BvxQmde6.mjs → scim-C9BmUYil.mjs} +1 -1
  167. package/dist/{sdk-C12y5qCN.mjs → sdk-Bvqx-_3z.mjs} +1 -1
  168. package/dist/{secrets-store-DOKWiC-j.mjs → secrets-store-ckkZR2dM.mjs} +1 -1
  169. package/dist/{security-center-Bhy_aC-w.mjs → security-center-BCahKT57.mjs} +1 -1
  170. package/dist/{security-txt-L7HJ9tq5.mjs → security-txt-0SI5du7I.mjs} +1 -1
  171. package/dist/shared-D0B-7q-D.mjs +2 -0
  172. package/dist/{smart-shield-COMXuQ1S.mjs → smart-shield-BDPbrZa4.mjs} +1 -1
  173. package/dist/{snippets-DffQhlKt.mjs → snippets-CVRR_h0i.mjs} +1 -1
  174. package/dist/spawn-DP4T92ss.mjs +519 -0
  175. package/dist/{spectrum-Cmf7SqQE.mjs → spectrum-CjNXQIQE.mjs} +3 -3
  176. package/dist/{speed-m8cdhLFS.mjs → speed-CrXCHk3h.mjs} +1 -1
  177. package/dist/src-BbnV77C4.mjs +108 -0
  178. package/dist/{ssl-D4ffsdSw.mjs → ssl-DKORhHkh.mjs} +1 -1
  179. package/dist/{startup-profile-Dx95Y5cl.mjs → startup-profile-CBIH6yZy.mjs} +3 -3
  180. package/dist/{state-CHif8Y5I.mjs → state-QUu6HfxC.mjs} +1 -1
  181. package/dist/{stream-DPF5fojV.mjs → stream-wY3zi3FK.mjs} +1 -1
  182. package/dist/{submit-Br8hfP0_.mjs → submit-B-4oCBSk.mjs} +1 -1
  183. package/dist/{tags-Bnt4JuxQ.mjs → tags-5uJEkYJZ.mjs} +1 -1
  184. package/dist/{telemetry-DjGNSlkU.mjs → telemetry-2s9Y3FaN.mjs} +1 -1
  185. package/dist/{telemetry-Ch1vCICm.mjs → telemetry-n3NJourL.mjs} +1 -1
  186. package/dist/{tenant-D8u0CxoC.mjs → tenant-BkFvv2o3.mjs} +1 -1
  187. package/dist/{tenant-custom-nameservers-BrWMyslZ.mjs → tenant-custom-nameservers-DcjC1q0r.mjs} +1 -1
  188. package/dist/{tools-D9RZkZRc.mjs → tools-Dz1JCrHd.mjs} +1 -1
  189. package/dist/tunnel-Cd4ipbvJ.mjs +2 -0
  190. package/dist/{tunnels-BkNPpTHa.mjs → tunnels-9Zg3ePwD.mjs} +1 -1
  191. package/dist/{turnstile-MgwRECJv.mjs → turnstile-BTwKYpzD.mjs} +1 -1
  192. package/dist/{url-info-Ddp7MgcI.mjs → url-info-D7Y61BFd.mjs} +1 -1
  193. package/dist/{url-normalization-3ptK9ntV.mjs → url-normalization-B4n8HiNQ.mjs} +1 -1
  194. package/dist/{url-scanner-Psb9ollR.mjs → url-scanner-CiCIltSQ.mjs} +1 -1
  195. package/dist/{user-DWdshcIu.mjs → user-DDFDGJ0Y.mjs} +1 -1
  196. package/dist/{values-CDKQL1z2.mjs → values-DRznB_Cl.mjs} +1 -1
  197. package/dist/{vectorize-CTYYUyQj.mjs → vectorize-CbznPhzq.mjs} +1 -1
  198. package/dist/waiting-rooms-CKP5hYBK.mjs +11 -0
  199. package/dist/{web-assets-CpDwDEx8.mjs → web-assets-C-ZoSkkh.mjs} +1 -1
  200. package/dist/{web3-YsjDyAzH.mjs → web3-DwlN4dOw.mjs} +1 -1
  201. package/dist/{workers-builds-BWo5vUA9.mjs → workers-builds-ECw_x_kp.mjs} +1 -1
  202. package/dist/{workers-for-platforms-ASJsxYdM.mjs → workers-for-platforms-BYGy46R6.mjs} +2 -2
  203. package/dist/{workers-vpc-RkTnRvA2.mjs → workers-vpc-CCosFcxz.mjs} +1 -1
  204. package/dist/workers-zFMrbUkg.mjs +6 -0
  205. package/dist/{workflows-KrIFI9ns.mjs → workflows-C8GXGDRW.mjs} +1 -1
  206. package/dist/{zaraz-DglXbVzZ.mjs → zaraz-B5UIREaz.mjs} +1 -1
  207. package/dist/{zero-trust-RilTdSjX.mjs → zero-trust-DUp0XoIo.mjs} +50 -50
  208. package/dist/{zone-DsBtVkvT.mjs → zone-BGLkk-mL.mjs} +1 -1
  209. package/dist/{zones-BFxvWFQW.mjs → zones-CwYjNXMH.mjs} +1 -1
  210. package/package.json +11 -11
  211. package/dist/analytics-BaUZwNc5.mjs +0 -4
  212. package/dist/build-0QlYUfFS.mjs +0 -2
  213. package/dist/cf-C11NGkjx.mjs +0 -18
  214. package/dist/chunk-LQW53VED-CoECHA3R.mjs +0 -119
  215. package/dist/command-CMzMsll4.mjs +0 -2
  216. package/dist/custom-pages-DzKnSgL3.mjs +0 -3
  217. package/dist/d1-JBEqjJoj.mjs +0 -20
  218. package/dist/data-security-CIktWnXt.mjs +0 -7
  219. package/dist/dist-12KzRsBM.mjs +0 -387
  220. package/dist/dist-BCVqQpg2.mjs +0 -2
  221. package/dist/dist-Cp3uJN1x.mjs +0 -48
  222. package/dist/dist-S9K_8gq9.mjs +0 -9
  223. package/dist/dry-run-DiVy1lVo.mjs +0 -2
  224. package/dist/interactive-B2E03Fs-.mjs +0 -11
  225. package/dist/interactive-_B-EqD0Y.mjs +0 -23
  226. package/dist/logexplorer-D8rOPB5I.mjs +0 -17
  227. package/dist/logs-CDo7Y5sA.mjs +0 -3
  228. package/dist/oauth-DH3kMXSs.mjs +0 -14
  229. package/dist/pay-per-crawl-B4wx0lUb.mjs +0 -4
  230. package/dist/prompt-DjRTpML4.mjs +0 -3
  231. package/dist/public-BMg6-Hxh-BfUOZTDP.mjs +0 -2
  232. package/dist/request-headers-CC4eHmI2.mjs +0 -3
  233. package/dist/run-CRfinkSe.mjs +0 -2
  234. package/dist/schemas-O_ZNaF8R.mjs +0 -65
  235. package/dist/spawn-C1AISA2V.mjs +0 -526
  236. package/dist/src-C8phrg-8.mjs +0 -109
  237. package/dist/waiting-rooms-BUdmwXDY.mjs +0 -11
  238. package/dist/workers-BKKxaZcz.mjs +0 -6
  239. /package/dist/{alerts-B2SJO4nd.mjs → alerts-CarPLL8k.mjs} +0 -0
  240. /package/dist/{autorag-iNjZXw1n.mjs → autorag-zK-3harf.mjs} +0 -0
  241. /package/dist/{body-parser-DIlfApuJ.mjs → body-parser-Cmw7PZ7a.mjs} +0 -0
  242. /package/dist/{brands-BrVnNrT3.mjs → brands-CpgTsX8h.mjs} +0 -0
  243. /package/dist/{clear-an9o3dJ3.mjs → clear-C5gzBA8G.mjs} +0 -0
  244. /package/dist/{cli-types-CrSoSMPF.mjs → cli-types-abvWQN3T.mjs} +0 -0
  245. /package/dist/{connector-telemetry-events-latest-BqWfopFc.mjs → connector-telemetry-events-latest-BY-dbhQZ.mjs} +0 -0
  246. /package/dist/{connector-telemetry-snapshots-latest-C1m9U1En.mjs → connector-telemetry-snapshots-latest-DoMvHvCO.mjs} +0 -0
  247. /package/dist/{domain-info-B0Ykqv5l.mjs → domain-info-Cw3G4nap.mjs} +0 -0
  248. /package/dist/{health-CIUg1C5o.mjs → health-DkEXPkS6.mjs} +0 -0
  249. /package/dist/{input-validation-BxchZ9jE.mjs → input-validation-nF-0Ze2h.mjs} +0 -0
  250. /package/dist/{internal-DmpATljO.mjs → internal-4fU2r5en.mjs} +0 -0
  251. /package/dist/{live-B66u3_0g.mjs → live-B4iGrwY2.mjs} +0 -0
  252. /package/dist/{metadata-D062SVyy.mjs → metadata-C5fJJr-k.mjs} +0 -0
  253. /package/dist/{output-COcSQsfn.mjs → output-Z2lQmPUW.mjs} +0 -0
  254. /package/dist/{rate-limit-analytics-BknoecoM.mjs → rate-limit-analytics-DNsAFIeM.mjs} +0 -0
  255. /package/dist/{rate-limits-cdChIg_S.mjs → rate-limits-CsOim7bm.mjs} +0 -0
  256. /package/dist/{ready-C-H2cwp_.mjs → ready-tTe-zcIw.mjs} +0 -0
  257. /package/dist/{recent-submissions-DyuH_n5u.mjs → recent-submissions-B3eTV5yC.mjs} +0 -0
  258. /package/dist/{refute-uSlzkQKq.mjs → refute-BY76YVrT.mjs} +0 -0
  259. /package/dist/{scan-logo-DMk--WT7.mjs → scan-logo-DdoF_a5y.mjs} +0 -0
  260. /package/dist/{scan-page-DEHnAOJo.mjs → scan-page-sSgLwwZN.mjs} +0 -0
  261. /package/dist/{search-BlKeSfVD.mjs → search-BFvQr-sl.mjs} +0 -0
  262. /package/dist/{signed-url-CiGmGkLQ.mjs → signed-url-Cr8hiZPJ.mjs} +0 -0
  263. /package/dist/{submission-info-DHlTHDrs.mjs → submission-info-DT2mLnu1.mjs} +0 -0
  264. /package/dist/{total-queries-D5WvVfYi.mjs → total-queries-6gs5iy9T.mjs} +0 -0
  265. /package/dist/{tracked-domains-9deBK9bp.mjs → tracked-domains-D6XKO2EV.mjs} +0 -0
  266. /package/dist/{verify-S-TmhUDr.mjs → verify-CM1NakP0.mjs} +0 -0
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-C6XsFD_W.mjs";import{f as t,g as n}from"./oauth-DH3kMXSs.mjs";import{r}from"./auth-tvDdC1J-.mjs";import{t as i}from"./output-COcSQsfn.mjs";import{t as a}from"./dry-run-DiVy1lVo.mjs";import{t as o}from"./progress-V6SZV3Ux.mjs";import{t as s}from"./run-CRfinkSe.mjs";import"./telemetry-Ch1vCICm.mjs";import{n as c,t as l}from"./body-parser-DIlfApuJ.mjs";import{n as u}from"./input-validation-BxchZ9jE.mjs";import{a as d,i as f,n as p}from"./prompt-DjRTpML4.mjs";import{t as m}from"./cli-types-CrSoSMPF.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(`external-script-ids`,{type:`string`,description:`Comma-separated list of system-generated worker script tags (max 20).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get`,describe:`Retrieve the most recent builds for multiple worker scripts`,builder:M,handler:async c=>s({command:`builds latest get`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={external_script_ids:c[`external-script-ids`]};if(c.dryRun){a({command:`cf builds latest get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/builds/builds/latest`,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.latest.get({account_id:u,...s})),{successLabel:`Loaded`})})},P={command:`latest`,describe:`Operations for latest`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get`,describe:`Return whether the account's build-minute allowance is exhausted and when it refreshes.`,builder:F,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`})})},L={command:`limits`,describe:`View build-minute availability and refresh information.`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(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 z={command:`list`,describe:`List paginated build records associated with a Worker tag.`,builder:R,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 B(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 V={command:`get <build-uuid>`,describe:`Retrieve cursor-paginated log lines for a build UUID.`,builder:B,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`})})},H={command:`logs`,describe:`Retrieve build logs.`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(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 W={command:`get <repo-id>`,describe:`Analyze repository for automatic configuration detection`,builder:U,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`})})},G={command:`config-autofill`,describe:`Operations for repos.config-autofill`,builder:e=>e.command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(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 q={command:`delete <repo-connection-uuid>`,describe:`Delete a saved repository connection.`,builder:K,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 J(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 Y={command:`upsert`,describe:`Save the repository connection required by build triggers.`,builder:J,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`})})},X={command:`connections`,describe:`Operations for repos.connections`,builder:e=>e.command(q).command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Z={command:`repos`,describe:`Manage source repository connections for Workers Builds.`,builder:e=>e.command(G).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(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 ne={command:`create`,describe:`Create a new build authentication token`,builder:Q,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 re(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 ie={command:`delete <build-token-uuid>`,describe:`Delete a stored build token owned by the current user.`,builder:re,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 ae(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 oe={command:`list`,describe:`List metadata for build tokens available to the current user without returning their secrets.`,builder:ae,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`})})},se={command:`tokens`,describe:`Manage credentials used by Workers Builds to deploy Workers.`,builder:e=>e.command(ne).command(ie).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(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 le={command:`purge <trigger-uuid>`,describe:`Delete cached dependencies and build artifacts associated with a trigger.`,builder:ce,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`})})},ue={command:`cache`,describe:`Operations for triggers.cache`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(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 fe={command:`create`,describe:`Create a trigger defining the repository connection, Worker tag, commands, filters, cache setting, and build token.`,builder:de,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 pe(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 me={command:`delete <trigger-uuid>`,describe:`Delete a trigger and cancel its unfinished builds.`,builder:pe,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 he(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 ge={command:`delete <environment-variable-key>`,describe:`Delete one build-time variable or secret by key.`,builder:he,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 _e(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 ve={command:`list`,describe:`List build-time variables configured for a trigger. Secret values are not returned.`,builder:_e,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 ye(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 be={command:`upsert <trigger-uuid>`,describe:`Add or replace build-time variables and secrets without changing unspecified keys.`,builder:ye,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.`)})},xe={command:`environment-variables`,describe:`Operations for triggers.environment-variables`,builder:e=>e.command(ge).command(ve).command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(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 Ce={command:`list`,describe:`List trigger UUIDs and build settings associated with a Worker tag.`,builder:Se,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 we(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 Te={command:`update <trigger-uuid>`,describe:`Update commands, cache settings, or branch and path filters for a trigger.`,builder:we,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`})})},Ee={command:`triggers`,describe:`Configure how repository changes build and deploy Workers.`,builder:e=>e.command(fe).command(me).command(Ce).command(Te).command(ue).command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(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 $={command:`get`,describe:`Retrieve builds associated with one or more Worker version IDs.`,builder:De,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`})})},Oe={command:`versions`,describe:`Find builds associated with Worker versions.`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(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 Ae={command:`create`,describe:`Connect a Worker tag to a repository and production build settings.`,builder:ke,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 je(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 Me={command:`delete <script-tag>`,describe:`Delete build settings and triggers for a Worker tag and cancel unfinished builds. The Worker is not deleted.`,builder:je,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 Ne(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 Pe={command:`get <script-tag>`,describe:`Retrieve the repository and production build settings associated with a Worker tag.`,builder:Ne,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 Fe(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 Ie={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(Fe),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`})})},Le={command:`workers`,describe:`Manage repository-backed build configuration for Workers.`,builder:e=>e.command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Re={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(z).command(k).command(P).command(L).command(H).command(Z).command(se).command(Ee).command(Oe).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Re as default};
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};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-DH3kMXSs.mjs";import{a as t,r as n}from"./auth-tvDdC1J-.mjs";import{t as r}from"./output-COcSQsfn.mjs";import{t as i}from"./dry-run-DiVy1lVo.mjs";import{t as a}from"./progress-V6SZV3Ux.mjs";import{t as o}from"./run-CRfinkSe.mjs";import"./telemetry-Ch1vCICm.mjs";import{n as s,t as c}from"./body-parser-DIlfApuJ.mjs";import{n as l}from"./input-validation-BxchZ9jE.mjs";import{a as u,i as d,n as f}from"./prompt-DjRTpML4.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`bulk-delete`,describe:"Removes up to 100 IP-to-cloud-region mappings in a single request. Each IP is validated independently — successfully deleted items are returned in the `succeeded` array and IPs that could not be found or are invalid are returned in the `failed` array.",builder:p,handler:async c=>o({command:`cache origin-cloud-regions bulk-delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){i({command:`cf cache origin-cloud-regions bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/origin/cloud_regions/batch`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let o=await n(c);if(c.zoneId=await e({zone:c.zone},o,{quiet:c.quiet}),!await f({force:!!c.force,message:`Are you sure you want to delete these Origin Cloud Region configurations?`})){process.stderr.write(`Aborted.
2
+ import{h as e}from"./oauth-BdVr2hJp.mjs";import{a as t,r as n}from"./auth-DWxtJ918.mjs";import{t as r}from"./output-Z2lQmPUW.mjs";import{t as i}from"./dry-run-YSQndLvt.mjs";import{t as a}from"./progress-a5IKeKni.mjs";import{t as o}from"./run-BS8otL3u.mjs";import"./telemetry-n3NJourL.mjs";import{n as s,t as c}from"./body-parser-Cmw7PZ7a.mjs";import{n as l}from"./input-validation-nF-0Ze2h.mjs";import{a as u,i as d,n as f}from"./prompt-BP8XrQSj.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`bulk-delete`,describe:"Removes up to 100 IP-to-cloud-region mappings in a single request. Each IP is validated independently — successfully deleted items are returned in the `succeeded` array and IPs that could not be found or are invalid are returned in the `failed` array.",builder:p,handler:async c=>o({command:`cache origin-cloud-regions bulk-delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){i({command:`cf cache origin-cloud-regions bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/origin/cloud_regions/batch`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let o=await n(c);if(c.zoneId=await e({zone:c.zone},o,{quiet:c.quiet}),!await f({force:!!c.force,message:`Are you sure you want to delete these Origin Cloud Region configurations?`})){process.stderr.write(`Aborted.
3
3
  `);return}if(c.body){let e=s(c.body);if(Array.isArray(e)&&e.length>100){let n=Math.ceil(e.length/100),i=null;for(let r=0;r<e.length;r+=100){let s=e.slice(r,r+100);i=await a(`Deleting: batch ${Math.floor(r/100)+1}/${n}`,async()=>t(o,`DELETE`,`/zones/${c.zoneId}/origin/cloud_regions/batch`,{body:s}))}r(i,{successLabel:`Deleted`});return}r(await a(`Deleting`,async()=>t(o,`DELETE`,`/zones/${c.zoneId}/origin/cloud_regions/batch`,{body:e})),{successLabel:`Deleted`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function m(e){return e.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:`bulk-update`,describe:"Upserts up to 100 IP-to-cloud-region mappings in a single request. Items in the request body are created or replaced; mappings not included in the request body are preserved unchanged (this is a merge operation, not a full collection replacement). Each item is validated independently — valid items are applied and invalid items are returned in the `failed` array. The vendor and region for every item are validated against the list from `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`.",builder:m,handler:async c=>o({command:`cache origin-cloud-regions bulk-update`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){i({command:`cf cache origin-cloud-regions bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/origin/cloud_regions/batch`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let o=await n(c);if(c.zoneId=await e({zone:c.zone},o,{quiet:c.quiet}),c.body){let e=s(c.body);if(Array.isArray(e)&&e.length>100){let n=Math.ceil(e.length/100),i=null;for(let r=0;r<e.length;r+=100){let s=e.slice(r,r+100);i=await a(`Updating: batch ${Math.floor(r/100)+1}/${n}`,async()=>t(o,`PUT`,`/zones/${c.zoneId}/origin/cloud_regions/batch`,{body:s}))}r(i,{successLabel:`Updated`});return}r(await a(`Updating`,async()=>t(o,`PUT`,`/zones/${c.zoneId}/origin/cloud_regions/batch`,{body:e})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function g(e){return e.positional(`origin-ip`,{type:`string`,description:`Origin IP address whose mapping should be deleted.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <origin-ip>`,describe:`Removes the cloud region mapping for a single origin IP address. The IP path parameter is normalized before lookup. Returns the deleted IP on success. Returns 404 if no mapping exists for the specified IP. When the last mapping for the zone is removed the underlying rule record is also deleted.`,builder:g,handler:async t=>o({command:`cache origin-cloud-regions delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){i({command:`cf cache origin-cloud-regions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/origin/cloud_regions/${t[`origin-ip`]==null?`<origin-ip>`:encodeURIComponent(String(t[`origin-ip`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"origin-ip":String(t[`origin-ip`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await f({force:!!t.force,message:`Are you sure you want to delete this Origin Cloud Region configuration?`})){process.stderr.write(`Aborted.
4
4
  `);return}r(await a(`Deleting`,async()=>o.cache.originCloudRegions.delete({zone_id:s,origin_ip:t[`origin-ip`]})),{successLabel:`Deleted`})})};function v(e){return e.positional(`origin-ip`,{type:`string`,description:`Origin IP address to look up. IPv4 and IPv6 are supported.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <origin-ip>`,describe:`Returns the cloud region mapping for a single origin IP address. The IP path parameter is normalized before lookup (RFC 5952 for IPv6). Returns 404 if the zone has no mappings or if the specified IP has no mapping.`,builder:v,handler:async t=>o({command:`cache origin-cloud-regions get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){i({command:`cf cache origin-cloud-regions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/origin/cloud_regions/${t[`origin-ip`]==null?`<origin-ip>`:encodeURIComponent(String(t[`origin-ip`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"origin-ip":String(t[`origin-ip`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.originCloudRegions.get({zone_id:s,origin_ip:t[`origin-ip`]})),{successLabel:`Loaded`})})};function b(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).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 x={command:`list`,describe:`Returns all IP-to-cloud-region mappings configured for the zone with pagination support. Each mapping tells Cloudflare which cloud vendor and region hosts the origin at that IP, enabling the edge to route via the nearest Tiered Cache upper-tier co-located with that cloud provider. Returns an empty array when no mappings exist.`,builder:b,handler:async t=>o({command:`cache origin-cloud-regions list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let o={page:t.page,per_page:t[`per-page`]};if(t.dryRun){i({command:`cf cache origin-cloud-regions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/origin/cloud_regions`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.cache.originCloudRegions.list({zone_id:c,...o})),{successLabel:`Loaded`})})};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`supported-regions`,describe:`Returns the cloud vendors and regions that are valid values for origin cloud region mappings. Each region includes the Tiered Cache upper-tier colocation codes that will be used for cache routing when a mapping targeting that region is active. Requires the zone to have Tiered Cache enabled.`,builder:S,handler:async t=>o({command:`cache origin-cloud-regions supported-regions`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){i({command:`cf cache origin-cloud-regions supported-regions`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/origin/cloud_regions/supported_regions`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.originCloudRegions.supportedRegions({zone_id:s})),{successLabel:`Loaded`})})};function w(e){return e.positional(`origin-ip`,{type:`string`,description:`Origin IP address to create or replace.`,demandOption:!0}).option(`region`,{type:`string`,description:`Cloud vendor region identifier. Must be a valid region for the specified vendor as returned by the supported_regions endpoint.`}).option(`vendor`,{type:`string`,description:`Cloud vendor hosting the origin. Must be one of the supported vendors.`,choices:[`aws`,`azure`,`gcp`,`oci`]}).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 or replacing an origin cloud region mapping.`})}const T={command:`update <origin-ip>`,describe:"Creates a new IP-to-cloud-region mapping or replaces the existing mapping for the specified IP. PUT is idempotent — calling it repeatedly with the same body produces the same result. The IP path parameter is normalized to canonical form (RFC 5952 for IPv6) before storage. The vendor and region are validated against the list from `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`. Returns 400 if the `origin_ip` in the body does not match the URL path parameter. Returns 403 (code 1164) when the zone has reached the limit of 3,500 IP mappings.",builder:w,handler:async t=>o({command:`cache origin-cloud-regions update`,classification:{safeFlags:[`vendor`,`dry-run`]}},t,async()=>{if(t.dryRun){i({command:`cf cache origin-cloud-regions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/origin/cloud_regions/${t[`origin-ip`]==null?`<origin-ip>`:encodeURIComponent(String(t[`origin-ip`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"origin-ip":String(t[`origin-ip`]??``)},bodyKind:`json`,body:t.body===void 0?c({region:l(t.region,`region`,`text`),vendor:l(t.vendor,`vendor`,`text`)}):s(t.body)});return}let o=await n(t),f=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=f,t.body){let e=s(t.body);r(await a(`Updating`,async()=>o.cache.originCloudRegions.update({body:e,zone_id:f,origin_ip:t[`origin-ip`]})),{successLabel:`Updated`});return}t.region===void 0&&(t.region=await u(`region`,`Cloud vendor region identifier. Must be a valid region for the specified vendor as returned by the supported_regions endpoint.`)),t.vendor===void 0&&(t.vendor=await d(`vendor`,`Cloud vendor hosting the origin. Must be one of the supported vendors.`,[`aws`,`azure`,`gcp`,`oci`]));let p=c({region:l(t.region,`region`,`text`),vendor:l(t.vendor,`vendor`,`text`)});r(await a(`Updating`,async()=>o.cache.originCloudRegions.update({body:p,zone_id:f,origin_ip:t[`origin-ip`]})),{successLabel:`Updated`})})},E={command:`origin-cloud-regions`,describe:`Manage Origin Cloud Regions routing and failover configurations`,builder:e=>e.command(ee).command(h).command(_).command(y).command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`environment-id`,{type:`string`,description:`Environment 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`purge-environment <environment-id>`,describe:`Purge cached content scoped to a specific environment. Supports the same purge types as the zone-level endpoint (purge everything, by URL, by tag, host, or prefix). ### Availability and limits Please refer to [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).`,builder:D,handler:async c=>o({command:`cache purge-environment`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){i({command:`cf cache purge-environment`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/environments/${c[`environment-id`]==null?`<environment-id>`:encodeURIComponent(String(c[`environment-id`]))}/purge_cache`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``),"environment-id":String(c[`environment-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let o=await n(c),l=await e({zone:c.zone},o,{quiet:c.quiet});if(c.zoneId=l,!await f({force:!!c.force,message:`Are you sure you want to purge cache for this environment?`})){process.stderr.write(`Aborted.
5
5
  `);return}if(c.body){let e=s(c.body);r(await a(`Deleting`,async()=>o.cache.purgeEnvironment({body:e,zone_id:l,environment_id:c[`environment-id`]})),{successLabel:`Deleted`});return}r(await a(`Deleting`,async()=>t(o,`POST`,`/zones/${c.zoneId}/environments/${encodeURIComponent(String(c[`environment-id`]))}/purge_cache`)),{successLabel:`Deleted`})})};function k(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const A={command:`purge`,describe:'### Purge All Cached Content Removes ALL files from Cloudflare\'s cache. All tiers can purge everything. ``` {"purge_everything": true} ``` ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare\'s cache by specifying URLs. All tiers can purge by URL. To purge files with custom cache keys, include the headers used to compute the cache key as in the example. If you have a device type or geo in your cache key, you will need to include the CF-Device-Type or CF-IPCountry headers. If you have lang in your cache key, you will need to include the Accept-Language header. **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for http, 443 for https), but must be included otherwise. Single file purge example with files: ``` {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} ``` Single file purge example with url and header pairs: ``` {"files": [{"url": "http://www.example.com/cat_picture.jpg", "headers": {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}}, {"url": "http://www.example.com/dog_picture.jpg", "headers": {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}}]} ``` ### Purge Cached Content by Tag, Host or Prefix Granularly removes one or more files from Cloudflare\'s cache either by specifying the host, the associated Cache-Tag, or a Prefix. Flex purge with tags: ``` {"tags": ["a-cache-tag", "another-cache-tag"]} ``` Flex purge with hosts: ``` {"hosts": ["www.example.com", "images.example.com"]} ``` Flex purge with prefixes: ``` {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} ``` ### Availability and limits Please refer to [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).',builder:k,handler:async c=>o({command:`cache purge`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){i({command:`cf cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/purge_cache`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let o=await n(c),l=await e({zone:c.zone},o,{quiet:c.quiet});if(c.zoneId=l,!await f({force:!!c.force,message:`This operation will delete cached content for the zone.`})){process.stderr.write(`Aborted.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-DH3kMXSs.mjs";import{r as t}from"./auth-tvDdC1J-.mjs";import{t as n}from"./output-COcSQsfn.mjs";import{t as r}from"./dry-run-DiVy1lVo.mjs";import{t as i}from"./progress-V6SZV3Ux.mjs";import{t as a}from"./run-CRfinkSe.mjs";import"./telemetry-Ch1vCICm.mjs";import{n as o,t as s}from"./body-parser-DIlfApuJ.mjs";import{n as c}from"./input-validation-BxchZ9jE.mjs";function l(e){return e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`List Hostname Associations.`,builder:l,handler:async o=>a({command:`certificate-authorities hostname-associations get`,classification:{safeFlags:[`dry-run`]}},o,async()=>{let a={mtls_certificate_id:o[`mtls-certificate-id`]};if(o.dryRun){r({command:`cf certificate-authorities hostname-associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},query:a,bodyKind:`none`});return}let s=await t(o),c=await e({zone:o.zone},s,{quiet:o.quiet});o.zoneId=c,n(await i(`Loading`,async()=>s.certificateAuthorities.hostnameAssociations.get({zone_id:c,...a})),{successLabel:`Loaded`})})};function d(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`update`,describe:`Replace Hostname Associations.`,builder:d,handler:async l=>a({command:`certificate-authorities hostname-associations update`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){r({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?s({hostnames:l.hostnames,mtls_certificate_id:c(l[`mtls-certificate-id`],`mtls-certificate-id`,`text`)}):o(l.body)});return}let a=await t(l),u=await e({zone:l.zone},a,{quiet:l.quiet});if(l.zoneId=u,l.body){let e=o(l.body);n(await i(`Updating`,async()=>a.certificateAuthorities.hostnameAssociations.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=s({hostnames:l.hostnames,mtls_certificate_id:c(l[`mtls-certificate-id`],`mtls-certificate-id`,`text`)});n(await i(`Updating`,async()=>a.certificateAuthorities.hostnameAssociations.update({...d,zone_id:u})),{successLabel:`Updated`})})},p={command:`hostname-associations`,describe:`Operations for hostname-associations`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`certificate-authorities`,describe:`certificate-authorities`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
2
+ import{h as e}from"./oauth-BdVr2hJp.mjs";import{r as t}from"./auth-DWxtJ918.mjs";import{t as n}from"./output-Z2lQmPUW.mjs";import{t as r}from"./dry-run-YSQndLvt.mjs";import{t as i}from"./progress-a5IKeKni.mjs";import{t as a}from"./run-BS8otL3u.mjs";import"./telemetry-n3NJourL.mjs";import{n as o,t as s}from"./body-parser-Cmw7PZ7a.mjs";import{n as c}from"./input-validation-nF-0Ze2h.mjs";function l(e){return e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`List Hostname Associations.`,builder:l,handler:async o=>a({command:`certificate-authorities hostname-associations get`,classification:{safeFlags:[`dry-run`]}},o,async()=>{let a={mtls_certificate_id:o[`mtls-certificate-id`]};if(o.dryRun){r({command:`cf certificate-authorities hostname-associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},query:a,bodyKind:`none`});return}let s=await t(o),c=await e({zone:o.zone},s,{quiet:o.quiet});o.zoneId=c,n(await i(`Loading`,async()=>s.certificateAuthorities.hostnameAssociations.get({zone_id:c,...a})),{successLabel:`Loaded`})})};function d(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`update`,describe:`Replace Hostname Associations.`,builder:d,handler:async l=>a({command:`certificate-authorities hostname-associations update`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){r({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?s({hostnames:l.hostnames,mtls_certificate_id:c(l[`mtls-certificate-id`],`mtls-certificate-id`,`text`)}):o(l.body)});return}let a=await t(l),u=await e({zone:l.zone},a,{quiet:l.quiet});if(l.zoneId=u,l.body){let e=o(l.body);n(await i(`Updating`,async()=>a.certificateAuthorities.hostnameAssociations.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=s({hostnames:l.hostnames,mtls_certificate_id:c(l[`mtls-certificate-id`],`mtls-certificate-id`,`text`)});n(await i(`Updating`,async()=>a.certificateAuthorities.hostnameAssociations.update({...d,zone_id:u})),{successLabel:`Updated`})})},p={command:`hostname-associations`,describe:`Operations for hostname-associations`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`certificate-authorities`,describe:`certificate-authorities`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,F as t,G as n,Ot as r,T as i,W as a,X as o,et as s,j as c,l,p as u,w as d,wt as f}from"./dist-CyisSore.mjs";import{a as p,c as m,d as h,f as g,h as _,i as v,l as y,m as b,n as ee,o as te,p as ne,r as x,s as re,t as ie,u as S}from"./chunk-XLADBZ7F-DgFrtUhW.mjs";import{chmodSync as C,existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,writeFileSync as k}from"node:fs";import A from"node:path";import{URLSearchParams as ae}from"node:url";function j(e){function t(){return A.resolve(e(),`preferences.json`)}_(t,`getUserPreferencesPath`);function n(){try{let e=E(t(),`utf8`),n=JSON.parse(e);return typeof n==`object`&&n?n:{}}catch{return{}}}_(n,`readUserPreferences`);function r(e){let r={...n(),...e},i=t();T(A.dirname(i),{recursive:!0}),k(i,JSON.stringify(r,null,` `),{encoding:`utf-8`})}return _(r,`updateUserPreferences`),{readUserPreferences:n,updateUserPreferences:r}}_(j,`createPreferences`);var M=6e4,N=525600,P=43200,F=1440,I=Symbol.for(`constructDateFrom`);function L(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&I in e?e[I](t):e instanceof Date?new e.constructor(t):new Date(t)}_(L,`constructFrom`);function R(e,t){return L(t||e,e)}_(R,`toDate`);var z={};function B(){return z}_(B,`getDefaultOptions`);function V(e){let t=R(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}_(V,`getTimezoneOffsetInMilliseconds`);function H(e,...t){let n=L.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}_(H,`normalizeDates`);function U(e,t){let n=R(e)-+R(t);return n<0?-1:n>0?1:n}_(U,`compareAsc`);function oe(e){return L(e,Date.now())}_(oe,`constructNow`);function se(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}_(se,`getRoundingMethod`);var ce={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},le=_((e,t,n)=>{let r,i=ce[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r},`formatDistance`);function W(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}_(W,`buildFormatLongFn`);var ue={date:W({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:W({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:W({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},de={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},fe=_((e,t,n,r)=>de[e],`formatRelative`);function G(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}_(G,`buildLocalizeFn`);var pe={ordinalNumber:_((e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},`ordinalNumber`),era:G({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:G({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:_(e=>e-1,`argumentCallback`)}),month:G({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:G({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:G({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function K(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?me(s,e=>e.test(o)):q(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}_(K,`buildMatchFn`);function q(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}_(q,`findKey`);function me(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}_(me,`findIndex`);function he(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}_(he,`buildMatchPatternFn`);var ge={code:`en-US`,formatDistance:le,formatLong:ue,formatRelative:fe,localize:pe,match:{ordinalNumber:he({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:_(e=>parseInt(e,10),`valueCallback`)}),era:K({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:K({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:_(e=>e+1,`valueCallback`)}),month:K({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:K({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:K({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function _e(e,t,n){let r=B(),i=n?.locale??r.locale??ge,a=U(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=H(n?.in,...a>0?[t,e]:[e,t]),l=se(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/M,f=(u-(V(c)-V(s)))/M,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<F?`hour`:f<P?`day`:f<N?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/F);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/P);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/N);return i.formatDistance(`xYears`,e,o)}}_(_e,`formatDistanceStrict`);function ve(e,t){return _e(e,oe(e),t)}_(ve,`formatDistanceToNowStrict`);function J(e,t){return{read:_(()=>{let n=t();if(!w(n))return;let r=f(n);try{return S(e,r)}catch{return}},`read`),write(n){let r=t();T(A.dirname(r),{recursive:!0}),k(r,g(e,n),{encoding:`utf-8`,mode:384}),C(r,384)},clear(){let e=t(),n=w(e);return O(e,{force:!0}),n},path:t}}_(J,`createFileStorage`);function ye(t){let{logger:n,prompt:r}=t;return _(async function(t,i){if(e())return n.log(i),!0;let a=await r(t);return typeof a==`string`&&a.trim().toLowerCase()===`yes`},`ensureTemporaryTermsAccepted`)}_(ye,`createTemporaryTermsPrompt`);var be=[9106,1e4];function Y(e){return e?.code}_(Y,`getErrorCode`);function xe(e){let t=Y(e);return t!==void 0&&be.includes(t)}_(xe,`isMembershipsInaccessible`);function Se(e){return{"no-credentials-non-interactive":`Could not authenticate because no credentials were found and the environment is non-interactive. Set a CLOUDFLARE_API_TOKEN environment variable or run \`${e}\` in an interactive terminal first.`,"no-credentials-login-failed":`No credentials were found and the login attempt was unsuccessful. Run \`${e}\` to try again.`,"token-expired-non-interactive":`Your auth token has expired and could not be refreshed, and the environment is non-interactive. Run \`${e}\` in an interactive terminal or set a CLOUDFLARE_API_TOKEN.`,"token-expired-login-failed":`Your auth token has expired and could not be refreshed, and the login attempt was unsuccessful. Run \`${e}\` to try again.`}}_(Se,`notLoggedInErrorBodies`);function Ce(e,t,n){let r=new Date(t.claim.expiresAt);e.log(v`
3
+ Temporary account ready:
4
+ Account: ${t.account.name} (${n?`reused`:`created`})
5
+ Claim within: ${ve(r)}
6
+ Claim URL: ${t.claim.url}
7
+ `)}_(Ce,`logTemporaryPreviewAccount`);function we(a,o){let{logger:s}=o,f=a.cliName,p=Se(a.commands.login),m=`
8
+ Run \`${a.commands.whoami}\` to check your current authentication status.`,h=j(a.getConfigPath),g=l(s,a.cacheNamespace?{namespace:a.cacheNamespace}:void 0),v=ie({serviceName:a.keyringServiceName,getConfigPath:a.getConfigPath,isKeyringEnabled:_(()=>h.readUserPreferences().keyring_enabled===!0,`isKeyringEnabled`),logger:s,isNonInteractiveOrCI:e,loginCommand:a.commands.login,format:a.fileFormat}),y=a.allowGlobalAuthKey??!0,b=ee({logger:s,isNonInteractiveOrCI:e,openInBrowser:_(e=>c(e,s),`openInBrowser`),hasEnvCredentials:_(()=>te({allowGlobalAuthKey:y})!==void 0,`hasEnvCredentials`),purgeOnLoginOrLogout:g.purgeConfigCaches,clientId:a.clientId,consent:a.consent,displayName:a.displayName,deviceLoginCommand:a.commands.deviceLogin,redirectUri:a.redirectUri,storageFactory:v.storageFactory,allowGlobalAuthKey:y,temporary:{storage:J(a.fileFormat,a.getTemporaryAccountConfigPath),prompt:ye({logger:s,prompt:o.prompt})}});function x(e){b.setProfile(e)}_(x,`setProfile`);function S(){return b.getActiveProfile()}_(S,`getActiveProfile`);function C(){return v.getActiveStore(b.getActiveProfile())}_(C,`getCredentialStore`);function w(e,t){b.setTemporaryAllowed(e,t)}_(w,`setTemporaryAllowed`);function T(){return b.getAPIToken()}_(T,`getAPIToken`);function E(){return b.requireApiToken()}_(E,`requireApiToken`);function D(e,t){return{complianceConfig:e,scopes:t?.scopes??a.getDefaultScopeKeys(),browser:t?.browser??!0,callbackHost:t?.callbackHost,callbackPort:t?.callbackPort,profile:t?.profile,device:t?.device??a.useDeviceFlowByDefault??!1}}_(D,`withLoginDefaults`);async function O(e,t){return b.login(D(e,t))}_(O,`login`);async function k(e){return b.logout(e)}_(k,`logout`);async function A(e,t){return b.getActiveTemporaryAccount()?{loggedIn:!0}:b.loginOrRefreshIfRequired(D(e,t))}_(A,`loginOrRefreshIfRequired`);async function M(){return b.getOAuthTokenFromLocalState()}_(M,`getOAuthTokenFromLocalState`);function N(){return b.getScopes()}_(N,`getScopes`);function P(){return v.storageFactory(S()).read()}_(P,`readAuthCredentials`);function F(e){v.storageFactory(S()).write(e)}_(F,`writeAuthCredentials`);function I(){let e=b.getActiveProfile();return e===`default`?`${a.accountCachePrefix}.json`:`${a.accountCachePrefix}-${e}.json`}_(I,`getAccountCacheFileName`);function L(e){g.saveToConfigCache(I(),{account:e})}_(L,`saveAccountToCache`);function R(){return g.getConfigCache(I()).account}_(R,`getAccountFromCache`);async function z(e,n,r){let i=[],a=!0,c=1,l;for(;a;){l=new ae(l),l.set(`page`,String(c));let{response:f,status:p}=await u(e,n,{},o.userAgent,s,l,void 0,r);f.success?(i.push(...f.result),d(f.result_info)?c+=1:a=!1):t(n,f,p)}return i}_(z,`fetchAccountsPaged`);async function B(e,t={}){let{throwOnEmpty:n=!0}=t,i=await A(e);if(!i.loggedIn)throw new r(`Not logged in. ${p[i.reason]}${m}`,{telemetryMessage:`cfetch auth login required`});let o=E(),[s,c]=await Promise.allSettled([z(e,`/accounts`,o),z(e,`/memberships`,o)]);if(s.status===`rejected`)throw s.reason;if(c.status===`rejected`)if(xe(c.reason)){if(s.status===`fulfilled`&&s.value.length>0)return s.value;throw Y(c.reason)===9106?new r(`Failed to automatically retrieve account IDs for the logged in user.
9
+ You may have incorrect permissions on your API token, or an environment variable such as CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, or CLOUDFLARE_EMAIL may be set to an invalid value.
10
+ Check your environment and unset or correct any Cloudflare credential variables, or run \`${a.commands.login}\` to re-authenticate.
11
+ You can also skip this account check by adding an \`account_id\` in your ${a.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`}):new r(`Failed to automatically retrieve account IDs for the logged in user.
12
+ You may have incorrect permissions on your API token, or your authentication may have expired. Try running \`${a.commands.login}\` to re-authenticate. You can also skip this account check by adding an \`account_id\` in your ${a.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`})}else throw c.reason;let l=new Set(c.value.map(e=>e.account.id)),u=s.value.filter(e=>l.has(e.id));if(u.length===0&&n)throw new r(`Failed to automatically retrieve account IDs for the logged in user.
13
+ In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your ${a.getConfigFileLabel()} file.
14
+ Alternatively, try running \`${a.commands.login}\` to re-authenticate.`,{telemetryMessage:`user account fetch empty`});return u}_(B,`fetchAllAccounts`);function V(e){let t=b.getActiveTemporaryAccount();return t?t.account.id:e.account_id?ne(e.account_id,`set as \`account_id\` in your ${a.getConfigFileLabel()} file`):re()||R()?.id}_(V,`getActiveAccountId`);async function H(e){let t=V(e);if(t)return t;let n=await B(e);if(n.length===1)return L({id:n[0].id,name:n[0].name}),n[0].id;try{let e=await o.select(`Select an account`,{choices:n.map(e=>({title:e.name,value:e.id}))}),t=n.find(t=>t.id===e);if(!t)throw Error(`Selected account not found in accounts list`);return L({id:t.id,name:t.name}),e}catch(e){if(o.isNoDefaultValueProvidedError(e)){let e=i();throw new r(`More than one account available but unable to select one in non-interactive mode.
15
+ Please set the appropriate \`account_id\` in your ${a.getConfigFileLabel()} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
16
+ Available accounts are (\`<name>\`: \`<account_id>\`):
17
+ ${n.map(t=>` \`${e?`(redacted)`:t.name}\`: \`${t.id}\``).join(`
18
+ `)}`,{telemetryMessage:`user account selection unavailable`})}throw e}}_(H,`getOrSelectAccountId`);async function U(e){if(b.isTemporaryAllowed()){if(n(e)!==`public`)throw new r(`Temporary accounts aren't available when the compliance region is not set to public.`,{telemetryMessage:`user temporary account unavailable in compliance region`});let t=b.getActiveTemporaryAccount();if(t)return t.account.id;if(T())throw new r("You're already authenticated with Cloudflare, so `--temporary` can't be used. Temporary preview accounts are only for unauthenticated use. Either remove `--temporary` to use your existing account, or log out (and unset CLOUDFLARE_API_TOKEN) first.",{telemetryMessage:`user temporary account already authenticated`});let{account:i,cached:a}=await b.activateTemporaryAccount();return Ce(s,i,a),i.account.id}let t=await A(e);if(!t.loggedIn)throw t.reason===`no-credentials-non-interactive`||t.reason===`token-expired-non-interactive`?new r(`In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for ${f} to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.`,{telemetryMessage:`user auth missing api token non interactive`}):new r(`Did not login, quitting...`,{telemetryMessage:`user login cancelled`});let i=await H(e);if(!i)throw new r(`No account id found, quitting...`,{telemetryMessage:`user auth missing account id`});return i}return _(U,`requireAuth`),{setProfile:x,getActiveProfile:S,getCredentialStore:C,setTemporaryAllowed:w,getAPIToken:T,requireApiToken:E,login:O,logout:k,loginOrRefreshIfRequired:A,getOAuthTokenFromLocalState:M,getScopes:N,readAuthCredentials:P,writeAuthCredentials:F,getActiveAccountId:V,getOrSelectAccountId:H,getAccountFromCache:R,fetchAllAccounts:B,requireAuth:U}}_(we,`createCloudflareAuth`);var Te=`profiles/directory-bindings.json`,Ee=`.enc`;function X(e){let{logger:t,getConfigPath:n,keyringServiceName:r,format:i}=e,a=`.${i}`;function o(e){return p(n(),e,i)}_(o,`plaintextPath`);function s(e){return y(n(),e)}_(s,`encryptedPath`);function c(){return A.dirname(o(`default`))}_(c,`getProfileConfigDirectory`);let l={exists(e){return w(o(e))||w(s(e))},list(){let e=c();if(!w(e))return[];let t=new Set;for(let n of D(e))n.endsWith(a)?t.add(n.slice(0,-a.length)):n.endsWith(Ee)&&t.add(n.slice(0,-Ee.length));return[...t]},delete(e){let{backendAvailable:a,encryptedFileExisted:s}=h({serviceName:r,configPath:n(),profile:e,format:i});J(i,()=>o(e)).clear(),s&&!a&&t.warn(`Removed the credential files for profile "${e}", but the keyring backend was not reachable on this host so its keyring entry could not be cleared. Clear it manually if it persists.`)}};function u(){return A.join(n(),Te)}return _(u,`getDirectoryBindingsPath`),x({configs:l,bindings:{read(){try{let e=E(u(),`utf-8`);return JSON.parse(e)}catch{return{}}},write(e){let t=u();T(A.dirname(t),{recursive:!0}),k(t,JSON.stringify(e,null,` `),`utf-8`)}}})}_(X,`createCloudflareProfileStore`);function De(e){let{loginCommand:t,createProfileCommand:n,keyringServiceName:r,getConfigPath:i,format:a,preferences:o}=e,{readUserPreferences:s,updateUserPreferences:c}=o;function l(e){return e??`default`}_(l,`describeProfile`);function u(e){let t=[];w(y(i()))&&t.push(void 0);let n=X({logger:e,getConfigPath:i,keyringServiceName:r,format:a});for(let e of n.configs.list()){try{b(e)}catch{continue}w(y(i(),e))&&t.push(e)}return t}_(u,`listEncryptedProfiles`);function d(e){let o=u(e);if(o.length===0)return;let s=[],c=[];for(let t of o)try{let{backendAvailable:e}=h({serviceName:r,configPath:i(),profile:t,format:a});s.push(l(t)),e||c.push(l(t))}catch(n){e.warn(`Failed to remove encrypted credentials for profile "${l(t)}": ${n instanceof Error?n.message:String(n)}. You may need to clear them manually.`)}if(s.length>0){let r=n?`Re-authenticate with \`${t}\` (default profile) or \`${n} <name>\` (named profiles).`:`Re-authenticate with \`${t}\`.`;e.log(`Removed encrypted credentials for ${s.map(e=>`"${e}"`).join(`, `)}. ${r}`)}c.length>0&&e.warn(`The keyring backend was not reachable on this host, so the keyring entry for ${c.map(e=>`"${e}"`).join(`, `)} could not be cleared. Clear it manually if it persists.`)}_(d,`scrubAllEncryptedProfiles`);function f(e,t){let{logger:n,getCredentialStore:r}=t,i=s().keyring_enabled===!0,a=m();if(a!==void 0&&a!==e&&n.warn(`CLOUDFLARE_AUTH_USE_KEYRING=${a} overrides ${e?`enabling`:`disabling`} keyring storage for this command.`),!e&&a!==!0&&d(n),c({keyring_enabled:e}),e&&a!==!1)try{r().kind!==`encrypted-file`&&(c({keyring_enabled:i}),n.warn(`Keyring storage isn't available on this host (see warning above), so it was not enabled. Try again once the keyring backend is reachable.`))}catch(e){throw c({keyring_enabled:i}),e}return{enabled:s().keyring_enabled===!0}}return _(f,`setKeyringPreference`),{setKeyringPreference:f}}_(De,`createKeyringPreference`);function Oe(e){let{getConfigPath:t,format:n}=e;function r(e){return p(t(),e,n)}_(r,`getAuthConfigFilePath`);function i(e){return y(t(),e)}_(i,`getEncryptedAuthConfigFilePath`);function a(e){return J(n,()=>r(e))}_(a,`defaultAuthConfigStorage`);function o(e,t){a(t).write(e)}_(o,`writeAuthConfigFile`);function s(e){return a(e).read()}return _(s,`readAuthConfigFile`),{getAuthConfigFilePath:r,getEncryptedAuthConfigFilePath:i,defaultAuthConfigStorage:a,readAuthConfigFile:s,writeAuthConfigFile:o}}_(Oe,`createAuthConfigFileHelpers`);var Z=`cloudflare`,ke=`cf`,Ae=`cf`,je=`http://localhost:8877/oauth/callback`,Me={granted:{url:`https://welcome.developers.workers.dev/cf-oauth-consent-granted`},denied:{url:`https://welcome.developers.workers.dev/cf-oauth-consent-denied`,error:"Error: Consent denied. You must grant consent to cf in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"}},Ne=s({variableName:`CLOUDFLARE_CLIENT_ID`,defaultValue:_(()=>`cbca97e7-c331-4cdd-8fd8-e25a451b98bf`,`defaultValue`)});function Q(){return o({appName:`cloudflare`,leadingDot:!1,useLegacyHomeDir:!1})}_(Q,`getCfConfigPath`);var Pe=`access:read,access:write,account:read,agw:read,agw:run,agw:write,ai:read,ai:write,ai-search:read,ai-search:run,ai-search:write,aiaudit:read,aiaudit:write,aig:read,aig:write,auditlogs:read,billing:read,billing:write,browser:read,browser:write,cfone:read,cfone:write,cloudchamber:write,connectivity:admin,connectivity:bind,connectivity:read,constellation:write,containers:write,d1:write,dex:read,dex:write,dns_analytics:read,dns_records:edit,dns_records:read,dns_settings:read,email_routing:read,email_routing:write,email_sending:read,email_sending:write,firstpartytags:write,images:read,images:write,lb:edit,lb:read,logpush:read,logpush:write,mcp_portals:read,mcp_portals:write,notebook-examples:read,notebook-managed:read,notification:read,notification:write,oauth_account_ssl_and_certificates_write,offline,openid,pages:read,pages:write,pipelines:read,pipelines:setup,pipelines:write,query_cache:write,queues:write,r2_catalog:write,radar:read,rag:read,rag:write,registrar:read,registrar:write,secrets_store:read,secrets_store:write,sso-connector:read,sso-connector:write,ssl_certs:write,teams:pii,teams:read,teams:secure_location,teams:write,url_scanner:read,url_scanner:write,user:read,vectorize:write,workers:read,workers:write,workers_builds:read,workers_builds:write,workers_deployments:read,workers_kv:write,workers_observability:read,workers_observability:write,workers_observability_telemetry:write,workers_routes:write,workers_scripts:write,workers_tail:read,zone:read,account-analytics.read,account-ssl-and-certificates.write,ssl-and-certificates.read,ssl-and-certificates.write,registrar-domains.read,registrar-domains.admin,logs.read,logs.write,websearch.run,snippets.read,snippets.write,access-acct.read,access-acct.revoke,access-acct.write,access-app.read,access-app.revoke,access-app.write,access-audit-log.read,access-certificate.read,access-certificate.write,access-custom-page.read,access-custom-page.write,access-device-posture.read,access-device-posture.write,access-group.read,access-group.write,access-idp.read,access-idp.write,access-key.read,access-key.write,access-org.read,access-org.revoke,access-org.write,access-policy-test.read,access-policy-test.write,access-policy.read,access-policy.write,access-population.read,access-population.write,access-saml-certificate.read,access-saml-certificate.write,access-scim-log.read,access-seats.write,access-service-token.read,access-service-token.write,access-ssh-auditing.read,access-ssh-auditing.write,access-tag.read,access-tag.write,access-users.read,access-users.write,access.read,access.revoke,access.write,account-api-gateway.read,account-api-gateway.write,account-custom-asset.read,account-custom-asset.write,account-custom-error-rules.read,account-custom-error-rules.write,account-custom-pages.read,account-custom-pages.write,account-disable-esc.read,account-disable-esc.write,account-dns-settings.read,account-dns-settings.write,account-firewall-access-rules.read,account-firewall-access-rules.write,account-logs.read,account-logs.write,account-rule-lists.read,account-rule-lists.write,account-rulesets.read,account-rulesets.write,account-security-center-insights.read,account-security-center-insights.write,account-settings.read,account-settings.write,account-ssl-and-certificates.read,account-waf.read,account-waf.write,account-waiting-rooms.read,address-maps.read,address-maps.write,agent-memory.write,agw.read,agw.run,agw.write,ai-search.index,ai-search.metadata_read,ai-search.read,ai-search.run,ai-search.write,ai.read,ai.write,aiaudit.read,aiaudit.write,aig.metadata_read,aig.read,aig.run,aig.write,analytics.read,api-gateway.read,api-gateway.write,apps.write,argotunnel.read,argotunnel.write,artifacts.read,artifacts.write,bot-management-feedback.read,bot-management-feedback.write,bot-management.read,bot-management.write,browser-rendering.read,browser-rendering.write,cache-settings.read,cache-settings.write,cache.purge,calls.read,calls.write,casb.read,casb.write,cf-agents.read,cf-agents.write,challenge-widgets.read,challenge-widgets.write,chinanetwork-steering.read,chinanetwork-steering.write,cloud-connector.read,cloud-connector.write,cloud-email-security.read,cloud-email-security.write,cloudchamber.read,cloudchamber.write,cloudforce-one.read,cloudforce-one.write,config-settings.read,config-settings.write,connectivity-directory.admin,connectivity-directory.bind,connectivity-directory.read,constellation.read,constellation.write,containers.read,containers.write,custom-errors.read,custom-errors.write,custom-pages.read,custom-pages.write,d1.metadata_read,d1.read,d1.write,ddos-botnet-feed.read,ddos-botnet-feed.write,ddos-protection.read,ddos-protection.write,dls.read,dls.write,dns-firewall.read,dns-firewall.write,dns-view.read,dns-view.write,dns.read,dns.write,domain-page-shield.read,domain-page.shield,dynamic-redirect.read,dynamic-redirect.write,email-routing-account-rule.read,email-routing-address.read,email-routing-address.write,email-routing-rule.read,email-routing-rule.write,email-routing-suppression.read,email-routing-suppression.write,email-security-dmarcreports.read,email-security-dmarcreports.write,email-sending.read,email-sending.write,fbm.admin,fbm.read,fbm.write,field-extractor.read,field-extractor.write,firewall-for-ai.read,firewall-for-ai.write,firewall-services.read,firewall-services.write,flagship.evaluate,flagship.read,flagship.write,fraud-detection-pii.read,fraud-detection.read,fraud-detection.write,fraud-events.write,fraud-feedback.read,fraud-feedback.write,healthcheck.read,healthcheck.write,http-applications.read,http-applications.write,http-ddos-managed-ruleset.read,http-ddos-managed-ruleset.write,images.metadata_read,images.read,images.write,integration.write,intel.read,intel.write,iot.read,iot.write,ip-prefix-bgp-on-demand.read,ip-prefix-bgp-on-demand.write,ip-prefix.read,ip-prefix.write,l4-ddos-managed-ruleset.read,l4-ddos-managed-ruleset.write,load-balancers-account.read,load-balancers-account.write,load-balancers.read,load-balancers.write,load-balancing-monitors-and-pools.read,load-balancing-monitors-and-pools.write,magic-firewall.read,magic-firewall.write,magic-transit.read,magic-transit.write,magic-wan.read,magic-wan.write,managed-headers.read,managed-headers.write,mass-url-redirects.read,mass-url-redirects.write,mcp-portals.read,mcp-portals.write,memberships.read,memberships.write,messaging.edit,messaging.metadata_read,messaging.read,moq.read,moq.write,notifications.read,notifications.write,origin.read,origin.write,page-rules.read,page-rules.write,page-shield.read,page.read,page.shield,page.write,pages.metadata_read,payments-gateway.read,payments-gateway.write,pcaps-api.read,pcaps-api.write,pipelines.read,pipelines.send,pipelines.write,precursor.read,precursor.write,pubsub.read,pubsub.write,query-cache.read,query-cache.write,queues.metadata_read,queues.read,queues.write,r2-catalog-sql.read,r2-catalog.read,r2-catalog.write,radar.read,rag.read,rag.run,rag.write,realtime.admin,realtime.read,realtime.write,registrar-sandbox-domains.admin,registrar-sandbox-domains.read,reports-application-security-report.read,request-tracer.read,resource-library.read,resource-library.write,resource-sharing.read,response-compression.read,response-compression.write,sanitize.read,sanitize.write,secrets-store.read,secrets-store.write,select-configuration.read,select-configuration.write,stream.metadata_read,stream.read,stream.write,tag.read,tag.write,teams-cds-compute-account.read,teams-cds-compute-account.write,teams-connector-cloudflared.monitoring,teams-connector-cloudflared.read,teams-connector-cloudflared.write,teams-connector-warp.read,teams-connector-warp.write,teams-connectors.read,teams-connectors.write,teams-dex.read,teams-dex.write,teams-networks.read,teams-networks.write,teams-pii.read,teams-resilience.read,teams-resilience.write,teams-secure.location,teams.read,teams.report,teams.write,transform-rules.read,transform-rules.write,trust-and-safety.read,trust-and-safety.write,url-scanner.read,url-scanner.write,user-details.read,user-details.write,vectorize.read,vectorize.write,waiting-rooms.read,waiting-rooms.write,web3-hostnames.read,web3-hostnames.write,websearch.metadata_read,websearch.read,websearch.write,workers-ci.read,workers-ci.write,workers-kv-storage.metadata_read,workers-kv-storage.read,workers-kv-storage.write,workers-observability-telemetry.write,workers-observability.read,workers-observability.write,workers-r2-bucket-item.read,workers-r2-bucket-item.write,workers-r2.metadata_read,workers-r2.read,workers-r2.write,workers-routes.read,workers-routes.write,workers-scripts.bind,workers-scripts.read,workers-scripts.write,workers-tail.read,workers_ai.metadata_read,zaraz.edit,zaraz.read,zaraz.write,zone-access.read,zone-access.revoke,zone-access.write,zone-custom-asset.read,zone-custom-asset.write,zone-disable-esc.read,zone-disable-esc.write,zone-dns-settings.read,zone-dns-settings.write,zone-security-center-insights.read,zone-security-center-insights.write,zone-settings.read,zone-settings.write,zone-transform-rules.read,zone-transform-rules.write,zone-versioning.read,zone-versioning.write,zone-waf.read,zone-waf.write,zone.read,zone.write`.split(`,`),Fe=new Set([`billing:read`,`billing:write`,`email_routing:read`,`email_sending:read`,`notebook-managed:read`,`oauth_account_ssl_and_certificates_write`]),Ie=Pe.filter(e=>!Fe.has(e)),Le=[...Ie];function Re(e){Le=e}_(Re,`setLoginScopeKeys`);var ze=new Set(Ie);function Be(e){return e.every(e=>ze.has(e))}_(Be,`validateScopeKeys`);function Ve(){let e=a();return e===`production`?`cloudflare-temporary-account.json`:`cloudflare-temporary-account.${e}.json`}_(Ve,`getTemporaryAccountConfigFile`);function He(){return A.join(Q(),Ve())}_(He,`getCfTemporaryAccountConfigPath`);function Ue(e){return J(`json`,e)}_(Ue,`createJsonFileStorage`);var{getAuthConfigFilePath:We,getEncryptedAuthConfigFilePath:Ge,defaultAuthConfigStorage:Ke,readAuthConfigFile:qe,writeAuthConfigFile:Je}=Oe({getConfigPath:Q,format:`json`}),$={cliName:ke,displayName:Ae,commands:{login:`cf auth login`,whoami:`cf auth whoami`,createProfile:`cf auth create`,deviceLogin:`cf auth login`},keyringServiceName:Z,clientId:Ne,consent:Me,redirectUri:je,useDeviceFlowByDefault:!0,allowGlobalAuthKey:!1,getConfigPath:Q,getTemporaryAccountConfigPath:He,fileFormat:`json`,accountCachePrefix:`cloudflare-account`,cacheNamespace:`cloudflare`,getConfigFileLabel:_(()=>`cf config`,`getConfigFileLabel`),getDefaultScopeKeys:_(()=>Le,`getDefaultScopeKeys`)},Ye=j(Q),{readUserPreferences:Xe,updateUserPreferences:Ze}=Ye;function Qe(e){return we($,e)}_(Qe,`createCfAuth`);function $e(e){return X({logger:e.logger,getConfigPath:Q,keyringServiceName:Z,format:`json`})}_($e,`createCfProfileStore`);var et=De({loginCommand:$.commands.login,createProfileCommand:$.commands.createProfile,keyringServiceName:Z,getConfigPath:Q,format:`json`,preferences:Ye});function tt(e,t){return et.setKeyringPreference(e,t)}_(tt,`setKeyringPreference`);export{Be as a,Q as i,$e as n,Ue as r,Qe as t};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{r as e,t}from"./chunk-vbHwaUoU.mjs";import{Dt as n,I as r,at as i,f as a,k as o}from"./dist-12KzRsBM.mjs";import{createRequire as s}from"node:module";import{readFileSync as c}from"node:fs";import l from"node:assert";import u,{resolve as d}from"node:path";import{spawnSync as f}from"node:child_process";var p=Object.create,m=Object.defineProperty,h=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,y=(e,t)=>m(e,`name`,{value:t,configurable:!0}),b=e===void 0?s(import.meta.url):e,x=(e,t)=>function(){return t||(0,e[g(e)[0]])((t={exports:{}}).exports,t),t.exports},S=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of g(t))!v.call(e,i)&&i!==n&&m(e,i,{get:()=>t[i],enumerable:!(r=h(t,i))||r.enumerable});return e},w=(e,t,n)=>(n=e==null?{}:p(_(e)),C(t||!e||!e.__esModule?m(n,`default`,{value:e,enumerable:!0}):n,e)),T=t(((t,n)=>{var r=e(`child_process`).exec,i=e(`child_process`).execSync,a=e(`fs`),o=e(`path`),s=a.access,c=a.accessSync,l=a.constants||a,u=process.platform==`win32`,d=function(e,t){s(e,l.F_OK,function(e){t(!e)})},f=function(e){try{return c(e,l.F_OK),!1}catch{return!0}},p=function(e,t){s(e,l.F_OK|l.X_OK,function(e){t(null,!e)})},m=function(e){try{return c(e,l.F_OK|l.X_OK),!0}catch{return!1}},h=function(e,t,n){d(e,function(i){if(!i){r(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`,function(e,t,r){n(null,!!t)});return}p(e,n)})},g=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e)){n(null,!1);return}r(`where `+t,function(e){e===null?n(null,!0):n(null,!1)})},_=function(e,t){if(f(e))try{return!!i(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`)}catch{return!1}return m(e)},v=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e))return!1;try{return!!i(`where `+t,{stdio:[]})}catch{return!1}},y=function(e){return/[^A-Za-z0-9_\/:=-]/.test(e)&&(e=`'`+e.replace(/'/g,`'\\''`)+`'`,e=e.replace(/^(?:'')+/g,``).replace(/\\'''/g,`\\'`)),e};u&&(y=function(e){if(/[\\]/.test(e)){var t=`"`+o.dirname(e)+`"`,n=`"`+o.basename(e)+`"`;return t+`:`+n}return`"`+e+`"`}),n.exports=function e(t,n){var r=y(t);if(!n&&typeof Promise<`u`)return new Promise(function(n,r){e(t,function(e,i){i?n(t):r(e)})});u?g(t,r,n):h(t,r,n)},n.exports.sync=function(e){var t=y(e);return u?v(e,t):_(e,t)}})),E=t(((e,t)=>{t.exports=T()})),ee=r(),D=E();function O(e){if(e.compiled_schema)return c(d(e.compiled_schema));let{base_path:t,source_schemas:r}=e,i=(r??[]).map(e=>d(t,e));if(!(0,D.sync)(`capnp`))throw new n(`The capnp compiler is required to upload capnp schemas, but is not present.`,{telemetryMessage:`capnp compiler missing`});let a=f(`capnp`,[`compile`,`-o-`,`--src-prefix=${d(t??`.`)}`,...i],{maxBuffer:3*1024*1024});if(a.error)throw a.error;if(a.stderr.length)throw Error(a.stderr.toString());return a.stdout}y(O,`handleUnsafeCapnp`);var k={esm:`application/javascript+module`,commonjs:`application/javascript`,"compiled-wasm":`application/wasm`,buffer:`application/octet-stream`,text:`text/plain`,python:`text/x-python`,"python-requirement":`text/x-python-requirement`};function A(e){let t=k[e];if(t===void 0)throw TypeError(`Unsupported module: `+e);return t}y(A,`toMimeType`);function j(e){let t=Object.keys(k).find(t=>k[t]===e);if(t===void 0)throw TypeError(`Unsupported mime type: `+e);return t}y(j,`fromMimeType`);function M(e,t,r){let s=new ee.FormData,{main:d,sourceMaps:f,migrations:p,exports:m,compatibility_date:h,compatibility_flags:g,keepVars:_,keepSecrets:v,keepBindings:y,logpush:b,placement:x,tail_consumers:S,streaming_tail_consumers:C,limits:w,annotations:T,keep_assets:E,assets:D,observability:k,cache:j,package_dependencies:M}=e,N={html_handling:D?.assetConfig?.html_handling,not_found_handling:D?.assetConfig?.not_found_handling,run_worker_first:D?.run_worker_first,_redirects:D?._redirects,_headers:D?._headers};if(D&&!D.routerConfig.has_user_worker)return s.set(`metadata`,JSON.stringify({assets:{jwt:D.jwt,config:N},...T&&{annotations:T},...h&&{compatibility_date:h},...g&&{compatibility_flags:g}})),s;let{modules:P}=e,F=[],te=a(`plain_text`,t),ne=a(`json`,t),re=a(`secret_text`,t),ie=a(`kv_namespace`,t),I=a(`send_email`,t),ae=a(`durable_object_namespace`,t),oe=a(`workflow`,t),se=a(`queue`,t),ce=a(`r2_bucket`,t),le=a(`d1`,t),ue=a(`vectorize`,t),de=a(`ai_search_namespace`,t),L=a(`ai_search`,t),R=a(`agent_memory`,t),z=a(`hyperdrive`,t),B=a(`secrets_store_secret`,t),V=a(`artifacts`,t),fe=a(`unsafe_hello_world`,t),pe=a(`flagship`,t),me=a(`ratelimit`,t),he=a(`vpc_service`,t),ge=a(`vpc_network`,t),_e=a(`service`,t),H=a(`analytics_engine`,t),ve=a(`dispatch_namespace`,t),ye=a(`mtls_certificate`,t),be=a(`pipeline`,t),xe=a(`worker_loader`,t),Se=a(`logfwdr`,t),Ce=a(`wasm_module`,t),U=a(`browser`,t)[0],W=a(`ai`,t)[0],G=a(`images`,t)[0],K=a(`stream`,t)[0],q=a(`media`,t)[0],J=a(`version_metadata`,t)[0],Y=a(`assets`,t)[0],we=a(`text_blob`,t),Te=a(`data_blob`,t);a(`inherit`,t).forEach(({binding:e})=>{F.push({name:e,type:`inherit`})}),te.forEach(({binding:e,value:t})=>{F.push({name:e,type:`plain_text`,text:t})}),ne.forEach(({binding:e,value:t})=>{F.push({name:e,type:`json`,json:t})}),re.forEach(({binding:e,value:t})=>{F.push({name:e,type:`secret_text`,text:t})}),ie.forEach(({id:e,binding:t,raw:a})=>{if(r?.dryRun&&(e??=i),e===void 0)throw new n(`${t} bindings must have an "id" field`,{telemetryMessage:`kv namespace binding missing id`});e===i?F.push({name:t,type:`inherit`}):F.push({name:t,type:`kv_namespace`,namespace_id:e,raw:a})}),I.forEach(e=>{let t={name:e.name,type:`send_email`,allowed_sender_addresses:e.allowed_sender_addresses};e.destination_address===void 0?e.allowed_destination_addresses===void 0?F.push(t):F.push({...t,allowed_destination_addresses:e.allowed_destination_addresses}):F.push({...t,destination_address:e.destination_address})}),ae.forEach(({name:e,class_name:t,script_name:n,environment:r})=>{F.push({name:e,type:`durable_object_namespace`,class_name:t,...n&&{script_name:n},...r&&{environment:r}})}),oe.forEach(({binding:e,name:t,class_name:n,script_name:r,raw:i})=>{F.push({type:`workflow`,name:e,workflow_name:t,class_name:n,script_name:r,raw:i})}),se.forEach(({binding:e,queue_name:t,delivery_delay:a,raw:o})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have a "queue" field. Add a "queue" field to the producer in your Worker configuration specifying the name of the Queue to bind to.`,{telemetryMessage:`queue binding missing name`});t===i?F.push({name:e,type:`inherit`}):F.push({type:`queue`,name:e,queue_name:t,delivery_delay:a,raw:o})}),ce.forEach(({binding:e,bucket_name:t,jurisdiction:a,raw:o})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have a "bucket_name" field. Add a "bucket_name" field to the binding in your Worker configuration specifying the name of the R2 bucket to bind to.`,{telemetryMessage:`r2 bucket binding missing bucket_name`});t===i?F.push({name:e,type:`inherit`}):F.push({name:e,type:`r2_bucket`,bucket_name:t,jurisdiction:a,raw:o})}),le.forEach(({binding:e,database_id:t,database_internal_env:a,raw:o})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have a "database_id" field. Add a "database_id" field to the binding in your Worker configuration specifying the ID of the D1 database to bind to.`,{telemetryMessage:`d1 database binding missing database_id`});t===i?F.push({name:e,type:`inherit`}):F.push({name:e,type:`d1`,id:t,internalEnv:a,raw:o})}),ue.forEach(({binding:e,index_name:t,raw:n})=>{F.push({name:e,type:`vectorize`,index_name:t,raw:n})}),de.forEach(({binding:e,namespace:t})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the AI Search namespace to bind to.`,{telemetryMessage:`ai search namespace binding missing namespace`});t===i?F.push({name:e,type:`inherit`}):F.push({name:e,type:`ai_search_namespace`,namespace:t})}),L.forEach(({binding:e,instance_name:t})=>{F.push({name:e,type:`ai_search`,instance_name:t})}),R.forEach(({binding:e,namespace:t})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the namespace to bind to.`,{telemetryMessage:!1});t===i?F.push({name:e,type:`inherit`}):F.push({name:e,type:`agent_memory`,namespace:t})}),z.forEach(({binding:e,id:t})=>{F.push({name:e,type:`hyperdrive`,id:t})}),B.forEach(({binding:e,store_id:t,secret_name:n})=>{F.push({name:e,type:`secrets_store_secret`,store_id:t,secret_name:n})}),V.forEach(({binding:e,namespace:t})=>{F.push({name:e,type:`artifacts`,namespace:t})}),fe.forEach(({binding:e,enable_timer:t})=>{F.push({name:e,type:`unsafe_hello_world`,enable_timer:t})}),pe.forEach(({binding:e,app_id:t})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have an "app_id" field. Add an "app_id" field to the binding in your Worker configuration specifying the Flagship app to bind to.`,{telemetryMessage:`flagship binding missing app id`});F.push(t===i?{name:e,type:`inherit`}:{name:e,type:`flagship`,app_id:t})}),me.forEach(({name:e,namespace_id:t,simple:n})=>{F.push({name:e,type:`ratelimit`,namespace_id:t,simple:n})}),he.forEach(({binding:e,service_id:t})=>{F.push({name:e,type:`vpc_service`,service_id:t})}),ge.forEach(({binding:e,tunnel_id:t,network_id:n})=>{F.push({name:e,type:`vpc_network`,...t===void 0?{network_id:n}:{tunnel_id:t}})}),_e.forEach(({binding:e,service:t,environment:n,entrypoint:r,props:i,cross_account_grant:a})=>{F.push({name:e,type:`service`,service:t,cross_account_grant:a,...n&&{environment:n},...r&&{entrypoint:r},...i&&{props:i}})}),H.forEach(({binding:e,dataset:t})=>{F.push({name:e,type:`analytics_engine`,dataset:t})}),ve.forEach(({binding:e,namespace:t,outbound:a})=>{if(r?.dryRun&&(t??=i),t===void 0)throw new n(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the dispatch namespace to bind to.`,{telemetryMessage:`dispatch namespace binding missing namespace`});t===i?F.push({name:e,type:`inherit`}):F.push({name:e,type:`dispatch_namespace`,namespace:t,...a&&{outbound:{worker:{service:a.service,environment:a.environment},params:a.parameters?.map(e=>({name:e}))}}})}),ye.forEach(({binding:e,certificate_id:t})=>{F.push({name:e,type:`mtls_certificate`,certificate_id:t})}),be.forEach(({binding:e,stream:t,pipeline:n})=>{if(t)F.push({name:e,type:`pipelines`,stream:t});else if(n)F.push({name:e,type:`pipelines`,pipeline:n});else throw Error(`Pipeline binding must specify a stream or pipeline`)}),xe.forEach(({binding:e})=>{F.push({name:e,type:`worker_loader`})}),Se.forEach(({name:e,destination:t})=>{F.push({name:e,type:`logfwdr`,destination:t})}),Ce.forEach(({binding:e,source:t})=>{F.push({name:e,type:`wasm_module`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/wasm`}))}),U!==void 0&&F.push({name:U.binding,type:`browser`,raw:U.raw}),W!==void 0&&F.push({name:W.binding,staging:W.staging,type:`ai`,raw:W.raw}),G!==void 0&&F.push({name:G.binding,type:`images`,raw:G.raw}),K!==void 0&&F.push({name:K.binding,type:`stream`}),q!==void 0&&F.push({name:q.binding,type:`media`}),J!==void 0&&F.push({name:J.binding,type:`version_metadata`}),Y!==void 0&&F.push({name:Y.binding,type:`assets`}),we.forEach(({binding:e,source:t})=>{F.push({name:e,type:`text_blob`,part:e}),e!==`__STATIC_CONTENT_MANIFEST`&&(`contents`in t?s.set(e,new File([t.contents],t.path??e,{type:`text/plain`})):s.set(e,new File([c(t.path)],t.path,{type:`text/plain`})))}),Te.forEach(({binding:e,source:t})=>{F.push({name:e,type:`data_blob`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/octet-stream`}))});for(let[e,n]of Object.entries(t??{}))if(o(n.type)&&n.type!==`unsafe_hello_world`){let{type:t,...r}=n;F.push({name:e,type:t.slice(7),...r})}let X=`__STATIC_CONTENT_MANIFEST`;if(P?.some(({name:e})=>e===X)&&d.type===`esm`){l(P!==void 0);let e=new Set(P.map(e=>u.posix.dirname(e.name)));for(let t of e){if(t===`.`)continue;let e=u.posix.relative(t,X),n=u.posix.join(t,X);P.push({name:n,filePath:n,content:`export { default } from ${JSON.stringify(e)};`,type:`esm`})}}if(d.type===`commonjs`){for(let e of Object.values([...P||[]]))if(e.name===`__STATIC_CONTENT_MANIFEST`)s.set(e.name,new File([e.content],e.name,{type:`text/plain`})),P=P?.filter(t=>t!==e);else if(e.type===`compiled-wasm`||e.type===`text`||e.type===`buffer`){let t=e.name.replace(/[^a-zA-Z0-9_$]/g,`_`);F.push({name:t,type:e.type===`compiled-wasm`?`wasm_module`:e.type===`text`?`text_blob`:`data_blob`,part:t}),s.set(t,new File([e.content],e.name,{type:e.type===`compiled-wasm`?`application/wasm`:e.type===`text`?`text/plain`:`application/octet-stream`})),P=P?.filter(t=>t!==e)}}let Z;if(r?.unsafe?.capnp){let e=O(r.unsafe.capnp);Z=`./capnp-${Date.now()}.compiled`,s.set(Z,new File([e],Z,{type:`application/octet-stream`}))}let Q;_&&(Q??=[],Q.push(`plain_text`,`json`)),v&&(Q??=[],Q.push(`secret_text`,`secret_key`)),y&&(Q??=[],Q.push(...y));let $={...d.type===`commonjs`?{body_part:d.name}:{main_module:d.name},bindings:F,containers:e.containers===void 0?void 0:e.containers.map(e=>({...e.name!==void 0&&{name:e.name},...e.class_name!==void 0&&{class_name:e.class_name},...e.images!==void 0&&{images:e.images}})),...h&&{compatibility_date:h},...g&&{compatibility_flags:g},...p&&{migrations:p},...m&&Object.keys(m).length>0&&{exports:m},capnp_schema:Z,...Q&&{keep_bindings:Q},...b!==void 0&&{logpush:b},...x&&{placement:x},...S&&{tail_consumers:S},...C&&{streaming_tail_consumers:C},...w&&{limits:w},...T&&{annotations:T},...E!==void 0&&{keep_assets:E},...D&&{assets:{jwt:D.jwt,config:N}},...k&&{observability:k},...j&&{cache_options:j},...M?.length&&{package_dependencies:M}};if(r?.unsafe?.metadata!==void 0)for(let e of Object.keys(r.unsafe.metadata))$[e]=r.unsafe.metadata[e];if(s.set(`metadata`,JSON.stringify($)),d.type===`commonjs`&&P&&P.length>0)throw TypeError(`More than one module can only be specified when type = 'esm'`);for(let e of[d].concat(P||[]))s.set(e.name,new File([e.content],e.name,{type:A(e.type??d.type??`esm`)}));for(let e of f||[])s.set(e.name,new File([e.content],e.name,{type:`application/source-map`}));return s}y(M,`createWorkerUploadForm`);export{S as a,w as c,x as i,j as n,y as o,k as r,b as s,M as t};
2
+ import{r as e,t}from"./chunk-vbHwaUoU.mjs";import{L as n,Ot as r,f as i,k as a,ot as o}from"./dist-CyisSore.mjs";import{createRequire as s}from"node:module";import{readFileSync as c}from"node:fs";import l,{resolve as u}from"node:path";import d from"node:assert";import{spawnSync as f}from"node:child_process";var p=Object.create,m=Object.defineProperty,h=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,y=(e,t)=>m(e,`name`,{value:t,configurable:!0}),b=e===void 0?s(import.meta.url):e,x=(e,t)=>function(){return t||(0,e[g(e)[0]])((t={exports:{}}).exports,t),t.exports},S=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of g(t))!v.call(e,i)&&i!==n&&m(e,i,{get:()=>t[i],enumerable:!(r=h(t,i))||r.enumerable});return e},w=(e,t,n)=>(n=e==null?{}:p(_(e)),C(t||!e||!e.__esModule?m(n,`default`,{value:e,enumerable:!0}):n,e)),T=t(((t,n)=>{var r=e(`child_process`).exec,i=e(`child_process`).execSync,a=e(`fs`),o=e(`path`),s=a.access,c=a.accessSync,l=a.constants||a,u=process.platform==`win32`,d=function(e,t){s(e,l.F_OK,function(e){t(!e)})},f=function(e){try{return c(e,l.F_OK),!1}catch{return!0}},p=function(e,t){s(e,l.F_OK|l.X_OK,function(e){t(null,!e)})},m=function(e){try{return c(e,l.F_OK|l.X_OK),!0}catch{return!1}},h=function(e,t,n){d(e,function(i){if(!i){r(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`,function(e,t,r){n(null,!!t)});return}p(e,n)})},g=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e)){n(null,!1);return}r(`where `+t,function(e){e===null?n(null,!0):n(null,!1)})},_=function(e,t){if(f(e))try{return!!i(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`)}catch{return!1}return m(e)},v=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e))return!1;try{return!!i(`where `+t,{stdio:[]})}catch{return!1}},y=function(e){return/[^A-Za-z0-9_\/:=-]/.test(e)&&(e=`'`+e.replace(/'/g,`'\\''`)+`'`,e=e.replace(/^(?:'')+/g,``).replace(/\\'''/g,`\\'`)),e};u&&(y=function(e){if(/[\\]/.test(e)){var t=`"`+o.dirname(e)+`"`,n=`"`+o.basename(e)+`"`;return t+`:`+n}return`"`+e+`"`}),n.exports=function e(t,n){var r=y(t);if(!n&&typeof Promise<`u`)return new Promise(function(n,r){e(t,function(e,i){i?n(t):r(e)})});u?g(t,r,n):h(t,r,n)},n.exports.sync=function(e){var t=y(e);return u?v(e,t):_(e,t)}})),E=t(((e,t)=>{t.exports=T()})),ee=n(),D=E();function O(e){if(e.compiled_schema)return c(u(e.compiled_schema));let{base_path:t,source_schemas:n}=e,i=(n??[]).map(e=>u(t,e));if(!(0,D.sync)(`capnp`))throw new r(`The capnp compiler is required to upload capnp schemas, but is not present.`,{telemetryMessage:`capnp compiler missing`});let a=f(`capnp`,[`compile`,`-o-`,`--src-prefix=${u(t??`.`)}`,...i],{maxBuffer:3*1024*1024});if(a.error)throw a.error;if(a.stderr.length)throw Error(a.stderr.toString());return a.stdout}y(O,`handleUnsafeCapnp`);var k={esm:`application/javascript+module`,commonjs:`application/javascript`,"compiled-wasm":`application/wasm`,buffer:`application/octet-stream`,text:`text/plain`,python:`text/x-python`,"python-requirement":`text/x-python-requirement`};function A(e){let t=k[e];if(t===void 0)throw TypeError(`Unsupported module: `+e);return t}y(A,`toMimeType`);function j(e){let t=Object.keys(k).find(t=>k[t]===e);if(t===void 0)throw TypeError(`Unsupported mime type: `+e);return t}y(j,`fromMimeType`);function M(e,t,n){let s=new ee.FormData,{main:u,sourceMaps:f,migrations:p,exports:m,compatibility_date:h,compatibility_flags:g,keepVars:_,keepSecrets:v,keepBindings:y,logpush:b,placement:x,tail_consumers:S,streaming_tail_consumers:C,limits:w,annotations:T,keep_assets:E,assets:D,observability:k,cache:j,package_dependencies:M}=e,N={html_handling:D?.assetConfig?.html_handling,not_found_handling:D?.assetConfig?.not_found_handling,run_worker_first:D?.run_worker_first,_redirects:D?._redirects,_headers:D?._headers};if(D&&!D.routerConfig.has_user_worker)return s.set(`metadata`,JSON.stringify({assets:{jwt:D.jwt,config:N},...T&&{annotations:T},...h&&{compatibility_date:h},...g&&{compatibility_flags:g}})),s;let{modules:P}=e,F=[],te=i(`plain_text`,t),ne=i(`json`,t),re=i(`secret_text`,t),I=i(`kv_namespace`,t),ie=i(`send_email`,t),ae=i(`durable_object_namespace`,t),oe=i(`workflow`,t),se=i(`queue`,t),ce=i(`r2_bucket`,t),le=i(`d1`,t),ue=i(`vectorize`,t),de=i(`ai_search_namespace`,t),L=i(`ai_search`,t),R=i(`agent_memory`,t),z=i(`hyperdrive`,t),B=i(`secrets_store_secret`,t),V=i(`artifacts`,t),fe=i(`unsafe_hello_world`,t),pe=i(`flagship`,t),me=i(`ratelimit`,t),he=i(`vpc_service`,t),ge=i(`vpc_network`,t),H=i(`service`,t),_e=i(`analytics_engine`,t),ve=i(`dispatch_namespace`,t),ye=i(`mtls_certificate`,t),be=i(`pipeline`,t),xe=i(`worker_loader`,t),Se=i(`logfwdr`,t),Ce=i(`wasm_module`,t),U=i(`browser`,t)[0],W=i(`ai`,t)[0],G=i(`images`,t)[0],K=i(`stream`,t)[0],q=i(`media`,t)[0],J=i(`version_metadata`,t)[0],Y=i(`assets`,t)[0],we=i(`text_blob`,t),Te=i(`data_blob`,t);i(`inherit`,t).forEach(({binding:e})=>{F.push({name:e,type:`inherit`})}),te.forEach(({binding:e,value:t})=>{F.push({name:e,type:`plain_text`,text:t})}),ne.forEach(({binding:e,value:t})=>{F.push({name:e,type:`json`,json:t})}),re.forEach(({binding:e,value:t})=>{F.push({name:e,type:`secret_text`,text:t})}),I.forEach(({id:e,binding:t,raw:i})=>{if(n?.dryRun&&(e??=o),e===void 0)throw new r(`${t} bindings must have an "id" field`,{telemetryMessage:`kv namespace binding missing id`});e===o?F.push({name:t,type:`inherit`}):F.push({name:t,type:`kv_namespace`,namespace_id:e,raw:i})}),ie.forEach(e=>{let t={name:e.name,type:`send_email`,allowed_sender_addresses:e.allowed_sender_addresses};e.destination_address===void 0?e.allowed_destination_addresses===void 0?F.push(t):F.push({...t,allowed_destination_addresses:e.allowed_destination_addresses}):F.push({...t,destination_address:e.destination_address})}),ae.forEach(({name:e,class_name:t,script_name:n,environment:r})=>{F.push({name:e,type:`durable_object_namespace`,class_name:t,...n&&{script_name:n},...r&&{environment:r}})}),oe.forEach(({binding:e,name:t,class_name:n,script_name:r,raw:i})=>{F.push({type:`workflow`,name:e,workflow_name:t,class_name:n,script_name:r,raw:i})}),se.forEach(({binding:e,queue_name:t,delivery_delay:i,raw:a})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have a "queue" field. Add a "queue" field to the producer in your Worker configuration specifying the name of the Queue to bind to.`,{telemetryMessage:`queue binding missing name`});t===o?F.push({name:e,type:`inherit`}):F.push({type:`queue`,name:e,queue_name:t,delivery_delay:i,raw:a})}),ce.forEach(({binding:e,bucket_name:t,jurisdiction:i,raw:a})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have a "bucket_name" field. Add a "bucket_name" field to the binding in your Worker configuration specifying the name of the R2 bucket to bind to.`,{telemetryMessage:`r2 bucket binding missing bucket_name`});t===o?F.push({name:e,type:`inherit`}):F.push({name:e,type:`r2_bucket`,bucket_name:t,jurisdiction:i,raw:a})}),le.forEach(({binding:e,database_id:t,database_internal_env:i,raw:a})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have a "database_id" field. Add a "database_id" field to the binding in your Worker configuration specifying the ID of the D1 database to bind to.`,{telemetryMessage:`d1 database binding missing database_id`});t===o?F.push({name:e,type:`inherit`}):F.push({name:e,type:`d1`,id:t,internalEnv:i,raw:a})}),ue.forEach(({binding:e,index_name:t,raw:n})=>{F.push({name:e,type:`vectorize`,index_name:t,raw:n})}),de.forEach(({binding:e,namespace:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the AI Search namespace to bind to.`,{telemetryMessage:`ai search namespace binding missing namespace`});t===o?F.push({name:e,type:`inherit`}):F.push({name:e,type:`ai_search_namespace`,namespace:t})}),L.forEach(({binding:e,instance_name:t})=>{F.push({name:e,type:`ai_search`,instance_name:t})}),R.forEach(({binding:e,namespace:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the namespace to bind to.`,{telemetryMessage:!1});t===o?F.push({name:e,type:`inherit`}):F.push({name:e,type:`agent_memory`,namespace:t})}),z.forEach(({binding:e,id:t})=>{F.push({name:e,type:`hyperdrive`,id:t})}),B.forEach(({binding:e,store_id:t,secret_name:n})=>{F.push({name:e,type:`secrets_store_secret`,store_id:t,secret_name:n})}),V.forEach(({binding:e,namespace:t})=>{F.push({name:e,type:`artifacts`,namespace:t})}),fe.forEach(({binding:e,enable_timer:t})=>{F.push({name:e,type:`unsafe_hello_world`,enable_timer:t})}),pe.forEach(({binding:e,app_id:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have an "app_id" field. Add an "app_id" field to the binding in your Worker configuration specifying the Flagship app to bind to.`,{telemetryMessage:`flagship binding missing app id`});F.push(t===o?{name:e,type:`inherit`}:{name:e,type:`flagship`,app_id:t})}),me.forEach(({name:e,namespace_id:t,simple:n})=>{F.push({name:e,type:`ratelimit`,namespace_id:t,simple:n})}),he.forEach(({binding:e,service_id:t})=>{F.push({name:e,type:`vpc_service`,service_id:t})}),ge.forEach(({binding:e,tunnel_id:t,network_id:n})=>{F.push({name:e,type:`vpc_network`,...t===void 0?{network_id:n}:{tunnel_id:t}})}),H.forEach(({binding:e,service:t,environment:n,entrypoint:r,props:i,cross_account_grant:a})=>{F.push({name:e,type:`service`,service:t,cross_account_grant:a,...n&&{environment:n},...r&&{entrypoint:r},...i&&{props:i}})}),_e.forEach(({binding:e,dataset:t})=>{F.push({name:e,type:`analytics_engine`,dataset:t})}),ve.forEach(({binding:e,namespace:t,outbound:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new r(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the dispatch namespace to bind to.`,{telemetryMessage:`dispatch namespace binding missing namespace`});t===o?F.push({name:e,type:`inherit`}):F.push({name:e,type:`dispatch_namespace`,namespace:t,...i&&{outbound:{worker:{service:i.service,environment:i.environment},params:i.parameters?.map(e=>({name:e}))}}})}),ye.forEach(({binding:e,certificate_id:t})=>{F.push({name:e,type:`mtls_certificate`,certificate_id:t})}),be.forEach(({binding:e,stream:t,pipeline:n})=>{if(t)F.push({name:e,type:`pipelines`,stream:t});else if(n)F.push({name:e,type:`pipelines`,pipeline:n});else throw Error(`Pipeline binding must specify a stream or pipeline`)}),xe.forEach(({binding:e})=>{F.push({name:e,type:`worker_loader`})}),Se.forEach(({name:e,destination:t})=>{F.push({name:e,type:`logfwdr`,destination:t})}),Ce.forEach(({binding:e,source:t})=>{F.push({name:e,type:`wasm_module`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/wasm`}))}),U!==void 0&&F.push({name:U.binding,type:`browser`,raw:U.raw}),W!==void 0&&F.push({name:W.binding,staging:W.staging,type:`ai`,raw:W.raw}),G!==void 0&&F.push({name:G.binding,type:`images`,raw:G.raw}),K!==void 0&&F.push({name:K.binding,type:`stream`}),q!==void 0&&F.push({name:q.binding,type:`media`}),J!==void 0&&F.push({name:J.binding,type:`version_metadata`}),Y!==void 0&&F.push({name:Y.binding,type:`assets`}),we.forEach(({binding:e,source:t})=>{F.push({name:e,type:`text_blob`,part:e}),e!==`__STATIC_CONTENT_MANIFEST`&&(`contents`in t?s.set(e,new File([t.contents],t.path??e,{type:`text/plain`})):s.set(e,new File([c(t.path)],t.path,{type:`text/plain`})))}),Te.forEach(({binding:e,source:t})=>{F.push({name:e,type:`data_blob`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/octet-stream`}))});for(let[e,n]of Object.entries(t??{}))if(a(n.type)&&n.type!==`unsafe_hello_world`){let{type:t,...r}=n;F.push({name:e,type:t.slice(7),...r})}let X=`__STATIC_CONTENT_MANIFEST`;if(P?.some(({name:e})=>e===X)&&u.type===`esm`){d(P!==void 0);let e=new Set(P.map(e=>l.posix.dirname(e.name)));for(let t of e){if(t===`.`)continue;let e=l.posix.relative(t,X),n=l.posix.join(t,X);P.push({name:n,filePath:n,content:`export { default } from ${JSON.stringify(e)};`,type:`esm`})}}if(u.type===`commonjs`){for(let e of Object.values([...P||[]]))if(e.name===`__STATIC_CONTENT_MANIFEST`)s.set(e.name,new File([e.content],e.name,{type:`text/plain`})),P=P?.filter(t=>t!==e);else if(e.type===`compiled-wasm`||e.type===`text`||e.type===`buffer`){let t=e.name.replace(/[^a-zA-Z0-9_$]/g,`_`);F.push({name:t,type:e.type===`compiled-wasm`?`wasm_module`:e.type===`text`?`text_blob`:`data_blob`,part:t}),s.set(t,new File([e.content],e.name,{type:e.type===`compiled-wasm`?`application/wasm`:e.type===`text`?`text/plain`:`application/octet-stream`})),P=P?.filter(t=>t!==e)}}let Z;if(n?.unsafe?.capnp){let e=O(n.unsafe.capnp);Z=`./capnp-${Date.now()}.compiled`,s.set(Z,new File([e],Z,{type:`application/octet-stream`}))}let Q;_&&(Q??=[],Q.push(`plain_text`,`json`)),v&&(Q??=[],Q.push(`secret_text`,`secret_key`)),y&&(Q??=[],Q.push(...y));let $={...u.type===`commonjs`?{body_part:u.name}:{main_module:u.name},bindings:F,containers:e.containers===void 0?void 0:e.containers.map(e=>({...e.name!==void 0&&{name:e.name},...e.class_name!==void 0&&{class_name:e.class_name},...e.images!==void 0&&{images:e.images}})),...h&&{compatibility_date:h},...g&&{compatibility_flags:g},...p&&{migrations:p},...m&&Object.keys(m).length>0&&{exports:m},capnp_schema:Z,...Q&&{keep_bindings:Q},...b!==void 0&&{logpush:b},...x&&{placement:x},...S&&{tail_consumers:S},...C&&{streaming_tail_consumers:C},...w&&{limits:w},...T&&{annotations:T},...E!==void 0&&{keep_assets:E},...D&&{assets:{jwt:D.jwt,config:N}},...k&&{observability:k},...j&&{cache_options:j},...M?.length&&{package_dependencies:M}};if(n?.unsafe?.metadata!==void 0)for(let e of Object.keys(n.unsafe.metadata))$[e]=n.unsafe.metadata[e];if(s.set(`metadata`,JSON.stringify($)),u.type===`commonjs`&&P&&P.length>0)throw TypeError(`More than one module can only be specified when type = 'esm'`);for(let e of[u].concat(P||[]))s.set(e.name,new File([e.content],e.name,{type:A(e.type??u.type??`esm`)}));for(let e of f||[])s.set(e.name,new File([e.content],e.name,{type:`application/source-map`}));return s}y(M,`createWorkerUploadForm`);export{S as a,w as c,x as i,j as n,y as o,k as r,b as s,M as t};