cf 0.1.0 → 0.3.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 (268) hide show
  1. package/dist/_meta/agent-context.json +96 -95
  2. package/dist/_meta/commands.json +16558 -13965
  3. package/dist/_meta/schemas.json +52979 -16753
  4. package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
  5. package/dist/accounts-Kx1epdA1.mjs +22 -0
  6. package/dist/acm-Utu252kC.mjs +3 -0
  7. package/dist/addressing-CBq7Z7Vq.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
  9. package/dist/ai-DOOKLPkG.mjs +2 -0
  10. package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
  11. package/dist/ai-search-CQF_Sn7d.mjs +7 -0
  12. package/dist/ai_gateway-C3fH22C0.mjs +4 -0
  13. package/dist/alerting-CqmEIaKn.mjs +6 -0
  14. package/dist/analytics-Dv-X8x7D.mjs +20 -0
  15. package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
  16. package/dist/api-gateway-CNv0IHTU.mjs +33 -0
  17. package/dist/argo-CX_A4kcn.mjs +2 -0
  18. package/dist/audit-logs-BfBf3oo-.mjs +2 -0
  19. package/dist/auth-SyWhMmPu.mjs +6 -0
  20. package/dist/auth-ffdf9yR0.mjs +135 -0
  21. package/dist/autorag-BuGhGTeZ.mjs +2 -0
  22. package/dist/billing-PoG81XaQ.mjs +2 -0
  23. package/dist/body-parser-DKa8Ipg1.mjs +2 -0
  24. package/dist/bot-management-CFvtVx62.mjs +5 -0
  25. package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
  26. package/dist/brand-protection-D05Eg-_6.mjs +3 -0
  27. package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
  28. package/dist/build-DYkGW4dh.mjs +1054 -0
  29. package/dist/cache-DsoW6Xwv.mjs +5 -0
  30. package/dist/calls-CZbO7TyR.mjs +4 -0
  31. package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
  32. package/dist/cli-types-CRIDdDw3.mjs +2 -0
  33. package/dist/client-certificates-MJcDsTId.mjs +3 -0
  34. package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
  35. package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
  36. package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
  37. package/dist/{config-BIfdEY0E.mjs → config-DYzlVxcB.mjs} +1 -1
  38. package/dist/connectivity-BX8C7tvK.mjs +3 -0
  39. package/dist/content-scanning-r6uzMO1r.mjs +4 -0
  40. package/dist/context-DGlHRGWM.mjs +2 -0
  41. package/dist/custom-certificates-aAiEguR7.mjs +5 -0
  42. package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
  43. package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
  44. package/dist/custom-pages-DQCi2plU.mjs +4 -0
  45. package/dist/d1-DbnYhw45.mjs +4 -0
  46. package/dist/data-security-D_EtYBfo.mjs +6 -0
  47. package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
  48. package/dist/delegate.mjs +1 -1
  49. package/dist/deploy-CQial3kN.mjs +2 -0
  50. package/dist/{dev-BfKYB-R_.mjs → dev-B38LfCTl.mjs} +1 -1
  51. package/dist/diagnostics-BJQGjVJn.mjs +3 -0
  52. package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
  53. package/dist/{dist-C_bu5HwZ.mjs → dist-AIcZFk0U.mjs} +7 -7
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-VMhQSr5n.mjs +29 -0
  56. package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
  57. package/dist/durable-objects-CTboySEo.mjs +2 -0
  58. package/dist/email-routing-tIR2SFu-.mjs +10 -0
  59. package/dist/email-security-Ca1id3rZ.mjs +8 -0
  60. package/dist/email-sending-DwWKc5jC.mjs +3 -0
  61. package/dist/filters-A4dg_a68.mjs +4 -0
  62. package/dist/firewall-DWPQgYd9.mjs +11 -0
  63. package/dist/fraud-BMkSsJGU.mjs +20 -0
  64. package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
  65. package/dist/healthchecks-CtIfrFql.mjs +4 -0
  66. package/dist/hostnames-BiomxukN.mjs +3 -0
  67. package/dist/hyperdrive-Da104VaQ.mjs +18 -0
  68. package/dist/iam-BIGKo0WW.mjs +6 -0
  69. package/dist/images-BO8FbDAa.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/intel-CY6_79v8.mjs +3 -0
  72. package/dist/{ips-B0cK7D0_.mjs → ips-K4bzaGqd.mjs} +1 -1
  73. package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
  74. package/dist/kv-8o27w_pY.mjs +5 -0
  75. package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
  76. package/dist/load-balancers-DtG8nj25.mjs +6 -0
  77. package/dist/logpush-4L0njy1d.mjs +4 -0
  78. package/dist/logs-B_Yp95hv.mjs +3 -0
  79. package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
  80. package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
  81. package/dist/magic-transit-CXDyvhxq.mjs +90 -0
  82. package/dist/managed-transforms-D15yVbZx.mjs +3 -0
  83. package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
  84. package/dist/network-interconnects-rrr7red3.mjs +36 -0
  85. package/dist/observability-DWvpqnQJ.mjs +4 -0
  86. package/dist/organizations-T77D50Sq.mjs +41 -0
  87. package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
  88. package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
  89. package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
  90. package/dist/output-BJFNwj7b.mjs +2 -0
  91. package/dist/page-rules-CjZPTMQX.mjs +18 -0
  92. package/dist/page-shield-D5RRNJCY.mjs +37 -0
  93. package/dist/pages-CWJtJnL0.mjs +11 -0
  94. package/dist/pipelines-B0L_7j9e.mjs +6 -0
  95. package/dist/{progress-DZfTxbrx.mjs → progress-CrCGTq7N.mjs} +1 -1
  96. package/dist/queues-CN6DPhRR.mjs +6 -0
  97. package/dist/r2-DQIcyRtA.mjs +21 -0
  98. package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
  99. package/dist/radar-Bxb0WX8V.mjs +2 -0
  100. package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
  101. package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
  102. package/dist/realtime-kit-CaquuVOE.mjs +18 -0
  103. package/dist/registrar-Ko-xZemf.mjs +46 -0
  104. package/dist/request-tracers-DOW_reTJ.mjs +2 -0
  105. package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
  106. package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
  107. package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
  108. package/dist/rules-BXRADHL5.mjs +4 -0
  109. package/dist/rulesets-CBgpeSvJ.mjs +8 -0
  110. package/dist/rum-BjPptTUP.mjs +4 -0
  111. package/dist/{schema-D0_cbcDt.mjs → schema-D16TgWBg.mjs} +1 -1
  112. package/dist/schema-validation-Dgv_opM3.mjs +24 -0
  113. package/dist/scim-DdSEr4kZ.mjs +3 -0
  114. package/dist/secrets-store-7BfyvJLb.mjs +25 -0
  115. package/dist/security-center-DAy6AKtT.mjs +2 -0
  116. package/dist/security-txt-xAMb7K6Y.mjs +3 -0
  117. package/dist/session-COHHdS7A.mjs +5 -0
  118. package/dist/shared-AGtpXwwL.mjs +2 -0
  119. package/dist/smart-shield-TeWZFnH2.mjs +3 -0
  120. package/dist/snippets-CCSsCXVs.mjs +4 -0
  121. package/dist/{spawn-D_cjG87Z.mjs → spawn-DcppKGI5.mjs} +1 -1
  122. package/dist/spectrum-CTTZID8u.mjs +63 -0
  123. package/dist/speed-CuzTE0AL.mjs +4 -0
  124. package/dist/{src-C5qivNKH.mjs → src-BW6vfAwE.mjs} +15 -15
  125. package/dist/ssl-BWA2LdwC.mjs +15 -0
  126. package/dist/stream-GFsIZ-pP.mjs +14 -0
  127. package/dist/tenants-Bd7NGQ_m.mjs +2 -0
  128. package/dist/token-validation-DAgtFOvs.mjs +10 -0
  129. package/dist/{tools-CtKbk6VS.mjs → tools-DXQmfFuE.mjs} +1 -1
  130. package/dist/turnstile-cfdaO4ca.mjs +23 -0
  131. package/dist/{ui-mP_arYIg.mjs → ui-D4KtlMh9.mjs} +1 -1
  132. package/dist/url-normalization-B5RN4nLD.mjs +3 -0
  133. package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
  134. package/dist/user-CAo-yCJA.mjs +10 -0
  135. package/dist/vectorize-C7_oQlaI.mjs +4 -0
  136. package/dist/versions-CUwWJWmy.mjs +2 -0
  137. package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
  138. package/dist/web3-HQJRm38W.mjs +4 -0
  139. package/dist/workers-Dg7ddG2Q.mjs +18 -0
  140. package/dist/workers-builds-AVfx8IyL.mjs +7 -0
  141. package/dist/workflows-VquuSh2J.mjs +4 -0
  142. package/dist/zaraz-xYSWIV4P.mjs +2 -0
  143. package/dist/zero-trust-CP96wnSh.mjs +118 -0
  144. package/dist/zones-BSgmZ9WC.mjs +21 -0
  145. package/package.json +7 -6
  146. package/dist/abuse-reports-ChV_yD7f.mjs +0 -8
  147. package/dist/accounts-BCYecXFh.mjs +0 -21
  148. package/dist/acm-DD8zSds2.mjs +0 -3
  149. package/dist/addressing-D4Eqw5Bi.mjs +0 -13
  150. package/dist/ai-DfXMOMx_.mjs +0 -2
  151. package/dist/ai-gateway-DdRFthMo.mjs +0 -8
  152. package/dist/ai-search-C_68CDj1.mjs +0 -7
  153. package/dist/alerting-DbhqhVCp.mjs +0 -6
  154. package/dist/analytics-BSBBc7ep.mjs +0 -20
  155. package/dist/api-gateway-CZ4swbkQ.mjs +0 -33
  156. package/dist/argo-tms9ZwHO.mjs +0 -2
  157. package/dist/audit-logs-24qyW8cl.mjs +0 -2
  158. package/dist/auth-BlSmtIKd.mjs +0 -112
  159. package/dist/auth-DQ8miey6.mjs +0 -6
  160. package/dist/autorag-kgNt06GD.mjs +0 -2
  161. package/dist/billing-lwBHNTXC.mjs +0 -2
  162. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  163. package/dist/bot-management-LKf7BqUr.mjs +0 -5
  164. package/dist/botnet-feed-nQ-gErTS.mjs +0 -3
  165. package/dist/brand-protection-DOKv9GRr.mjs +0 -3
  166. package/dist/browser-rendering-CBExtgGt.mjs +0 -4
  167. package/dist/build-C_48VvoK.mjs +0 -1056
  168. package/dist/builds-C_ySULja.mjs +0 -2
  169. package/dist/cache-BBiiNZHP.mjs +0 -5
  170. package/dist/calls-DA5Xzwev.mjs +0 -4
  171. package/dist/certificate-authorities-sXyR_yGp.mjs +0 -2
  172. package/dist/client-certificates-tV0aCLQJ.mjs +0 -3
  173. package/dist/cloud-connector-DZfHcSso.mjs +0 -2
  174. package/dist/cloudforce-one-y1PgQmI9.mjs +0 -21
  175. package/dist/connectivity-8SOqaFDn.mjs +0 -3
  176. package/dist/content-scanning-B9y6K_G5.mjs +0 -4
  177. package/dist/context-DTIbtQn5.mjs +0 -2
  178. package/dist/custom-certificates-sWksR8Ys.mjs +0 -5
  179. package/dist/custom-hostnames-91QZkdqN.mjs +0 -5
  180. package/dist/custom-nameservers-DajZaZvE.mjs +0 -3
  181. package/dist/custom-pages-Cu7gmwzT.mjs +0 -4
  182. package/dist/d1-H_VRsVmF.mjs +0 -3
  183. package/dist/dcv-delegation-C-qhEYEZ.mjs +0 -2
  184. package/dist/deploy--9wYOkHg.mjs +0 -2
  185. package/dist/diagnostics-D2B2LPZZ.mjs +0 -3
  186. package/dist/dispatch-namespaces-CyrXBU_w.mjs +0 -7
  187. package/dist/dist-DvKjT2TT.mjs +0 -303
  188. package/dist/dns-Bn9Uz_Nj.mjs +0 -29
  189. package/dist/dns-firewall-BslP4p-j.mjs +0 -57
  190. package/dist/durable-objects-BN1ZnHhm.mjs +0 -2
  191. package/dist/email-routing-n2TnTaRR.mjs +0 -10
  192. package/dist/email-security-C9SEx0kh.mjs +0 -60
  193. package/dist/email-sending-DayZ7u3I.mjs +0 -3
  194. package/dist/filters-CI_XTgfQ.mjs +0 -4
  195. package/dist/firewall-CcaayGig.mjs +0 -11
  196. package/dist/fraud-Cr7aPCV8.mjs +0 -8
  197. package/dist/google-tag-gateway-B3GpYgQ4.mjs +0 -2
  198. package/dist/healthchecks-CVTsR_OC.mjs +0 -4
  199. package/dist/hostnames-Bd_Wa5l6.mjs +0 -3
  200. package/dist/hyperdrive-BBJhEDZd.mjs +0 -18
  201. package/dist/iam-D_FN0pDF.mjs +0 -6
  202. package/dist/images-CAP2hAlZ.mjs +0 -5
  203. package/dist/intel-CkxfzqmJ.mjs +0 -3
  204. package/dist/keyless-certificates-LcLmHZsX.mjs +0 -3
  205. package/dist/kv-_TkUQ6fs.mjs +0 -5
  206. package/dist/leaked-credential-checks-Dhvaen22.mjs +0 -3
  207. package/dist/load-balancers-Ckr0UIpk.mjs +0 -6
  208. package/dist/logpush-Cj946hxT.mjs +0 -4
  209. package/dist/logs-DgC9hjvJ.mjs +0 -3
  210. package/dist/magic-cloud-networking-WbDvPzuG.mjs +0 -5
  211. package/dist/magic-network-monitoring-BcHShvGQ.mjs +0 -4
  212. package/dist/magic-transit-B8sCOkt_.mjs +0 -89
  213. package/dist/managed-transforms-BpOr-8HY.mjs +0 -3
  214. package/dist/mtls-certificates-fOul8D5g.mjs +0 -3
  215. package/dist/network-interconnects-BSW65xlh.mjs +0 -36
  216. package/dist/organizations-T4vKGFAb.mjs +0 -41
  217. package/dist/origin-ca-certificates-ChM0lZ64.mjs +0 -3
  218. package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +0 -2
  219. package/dist/origin-tls-client-auth-D32dpZk_.mjs +0 -5
  220. package/dist/output-D7_yAFVR.mjs +0 -2
  221. package/dist/page-rules-RFoj8CjN.mjs +0 -18
  222. package/dist/page-shield-VTktzKDN.mjs +0 -37
  223. package/dist/pages-L1ITjXDZ.mjs +0 -10
  224. package/dist/pipelines-BPO0Lnil.mjs +0 -6
  225. package/dist/queues-B0C06L9r.mjs +0 -6
  226. package/dist/r2-DP020Tmq.mjs +0 -21
  227. package/dist/r2-data-catalog-Dmipvz5F.mjs +0 -14
  228. package/dist/radar-DR3VMknH.mjs +0 -2
  229. package/dist/rate-limits-DnHPBPgU.mjs +0 -5
  230. package/dist/raw-fetch-DlXYwVA8.mjs +0 -2
  231. package/dist/realtime-kit-C430aq2d.mjs +0 -6
  232. package/dist/registrar-7Qy50zbW.mjs +0 -46
  233. package/dist/request-tracers-sv99NDIl.mjs +0 -2
  234. package/dist/resource-sharing-uEjC7lnQ.mjs +0 -5
  235. package/dist/resource-tagging-CiODdP3N.mjs +0 -16
  236. package/dist/rules-FXAyTrwk.mjs +0 -4
  237. package/dist/rulesets-B6aUsFFB.mjs +0 -8
  238. package/dist/rum-CyyGJhp5.mjs +0 -4
  239. package/dist/schema-validation-ByU49h--.mjs +0 -4
  240. package/dist/scim-DdTS65_C.mjs +0 -3
  241. package/dist/scm-CilfPOue.mjs +0 -2
  242. package/dist/secrets-store-ClOUVhBJ.mjs +0 -18
  243. package/dist/security-center-4iSBqTrf.mjs +0 -2
  244. package/dist/security-txt-kGxdkDY6.mjs +0 -3
  245. package/dist/session-mW-s8ghP.mjs +0 -2
  246. package/dist/smart-shield-B-SQd2Qp.mjs +0 -3
  247. package/dist/snippets-Aq58ojqw.mjs +0 -4
  248. package/dist/spectrum-0gFvGI6y.mjs +0 -59
  249. package/dist/speed-DAZU8w3T.mjs +0 -4
  250. package/dist/ssl-BRlXa-5w.mjs +0 -15
  251. package/dist/stream-BAxsVeBX.mjs +0 -14
  252. package/dist/tenants-Df6xDqoA.mjs +0 -2
  253. package/dist/token-validation-pO4dCjCy.mjs +0 -4
  254. package/dist/turnstile-B1dmO8wE.mjs +0 -23
  255. package/dist/url-normalization-sUDVmrUt.mjs +0 -3
  256. package/dist/url-scanner-CwOKRkYo.mjs +0 -2
  257. package/dist/user-D_UrIdNq.mjs +0 -10
  258. package/dist/vectorize-BEbBn9G9.mjs +0 -4
  259. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  260. package/dist/waiting-rooms-BQC-urV4.mjs +0 -11
  261. package/dist/web3-CIH2iQeX.mjs +0 -4
  262. package/dist/workers-B9EvrpH3.mjs +0 -16
  263. package/dist/workers-builds-DzWSiRd2.mjs +0 -7
  264. package/dist/workflows-aD81gA4k.mjs +0 -4
  265. package/dist/zaraz-Cg1dsvrZ.mjs +0 -2
  266. package/dist/zero-trust-D-xQXWcy.mjs +0 -119
  267. package/dist/zones-DQzucJDd.mjs +0 -28
  268. /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,E as t,S as n,T as r,n as i}from"./auth-ffdf9yR0.mjs";import{n as a,t as o}from"./body-parser-DKa8Ipg1.mjs";import{t as s}from"./output-BJFNwj7b.mjs";import{n as c,t as l}from"./progress-CrCGTq7N.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";function d(e){return e.option(`description`,{type:`string`,description:`Specify an optional description of the hostname.`}).option(`dnslink`,{type:`string`,description:`Specify the DNSLink value used if the target is ipfs.`}).option(`name`,{type:`string`,description:`Specify the hostname that points to the target gateway via CNAME.`}).option(`target`,{type:`string`,description:`Specify the target gateway of the hostname.`,choices:[`ethereum`,`ipfs`,`ipfs_universal_path`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`create`,describe:`Create Web3 Hostname`,builder:d,handler:async r=>{if(r.dryRun){c({command:`cf web3 hostnames create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/web3/hostnames`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?o({description:u(r.description,`description`,`text`),dnslink:u(r.dnslink,`dnslink`,`text`),name:u(r.name,`name`,`text`),target:u(r.target,`target`,`text`)}):a(r.body)});return}let d=await i(r),f=await n({zone:r.zone},d,{quiet:r.quiet});if(r.zoneId=f,r.body){let e=a(r.body);s(await l(`Creating`,async()=>d.web3.hostnames.create({...e,zone_id:f})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await e(`name`,`Specify the hostname that points to the target gateway via CNAME.`)),r.target===void 0&&(r.target=await t(`target`,`Specify the target gateway of the hostname.`,[`ethereum`,`ipfs`,`ipfs_universal_path`]));let p=o({description:u(r.description,`description`,`text`),dnslink:u(r.dnslink,`dnslink`,`text`),name:u(r.name,`name`,`text`),target:u(r.target,`target`,`text`)});s(await l(`Creating`,async()=>d.web3.hostnames.create({...p,zone_id:f})),{successLabel:`Created`})}};function p(e){return e.positional(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const m={command:`delete <identifier>`,describe:`Delete Web3 Hostname`,builder:p,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await r({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>t.web3.hostnames.delete({zone_id:a,identifier:e.identifier})),{successLabel:`Deleted`})}};function h(e){return e.positional(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`description`,{type:`string`,description:`Specify an optional description of the hostname.`}).option(`dnslink`,{type:`string`,description:`Specify the DNSLink value used if the target is ipfs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`edit <identifier>`,describe:`Edit Web3 Hostname`,builder:h,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({description:u(e.description,`description`,`text`),dnslink:u(e.dnslink,`dnslink`,`text`)}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.web3.hostnames.edit({...n,zone_id:r,identifier:e.identifier})),{successLabel:`Updated`});return}let d=o({description:u(e.description,`description`,`text`),dnslink:u(e.dnslink,`dnslink`,`text`)});s(await l(`Updating`,async()=>t.web3.hostnames.edit({...d,zone_id:r,identifier:e.identifier})),{successLabel:`Updated`})}};function _(e){return e.positional(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <identifier>`,describe:`Web3 Hostname Details`,builder:_,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}`,pathParams:{identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.web3.hostnames.get({zone_id:r,identifier:e.identifier})),{successLabel:`Loaded`})}};function y(e){return e.positional(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`content`,{type:`string`,description:`Specify the CID or content path of content to block.`}).option(`description`,{type:`string`,description:`Specify an optional description of the content list entry.`}).option(`type`,{type:`string`,description:`Specify the type of content list entry to block.`,choices:[`cid`,`content_path`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create <identifier>`,describe:`Create IPFS Universal Path Gateway Content List Entry`,builder:y,handler:async r=>{if(r.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists entries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/web3/hostnames/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/ipfs_universal_path/content_list/entries`,pathParams:{identifier:String(r.identifier??``),"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?o({content:u(r.content,`content`,`text`),description:u(r.description,`description`,`text`),type:u(r.type,`type`,`text`)}):a(r.body)});return}let d=await i(r),f=await n({zone:r.zone},d,{quiet:r.quiet});if(r.zoneId=f,r.body){let e=a(r.body);s(await l(`Creating`,async()=>d.web3.hostnames.ipfsUniversalPaths.contentLists.entries.create({body:e,zone_id:f,identifier:r.identifier})),{successLabel:`Created`});return}r.content===void 0&&(r.content=await e(`content`,`Specify the CID or content path of content to block.`)),r.type===void 0&&(r.type=await t(`type`,`Specify the type of content list entry to block.`,[`cid`,`content_path`]));let p=o({content:u(r.content,`content`,`text`),description:u(r.description,`description`,`text`),type:u(r.type,`type`,`text`)});s(await l(`Creating`,async()=>d.web3.hostnames.ipfsUniversalPaths.contentLists.entries.create({body:p,zone_id:f,identifier:r.identifier})),{successLabel:`Created`})}};function x(e){return e.positional(`content-list-entry-identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete <content-list-entry-identifier>`,describe:`Delete IPFS Universal Path Gateway Content List Entry`,builder:x,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists entries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/ipfs_universal_path/content_list/entries/${e[`content-list-entry-identifier`]==null?`<content-list-entry-identifier>`:encodeURIComponent(String(e[`content-list-entry-identifier`]))}`,pathParams:{"content-list-entry-identifier":String(e[`content-list-entry-identifier`]??``),identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await r({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}s(await l(`Deleting`,async()=>t.web3.hostnames.ipfsUniversalPaths.contentLists.entries.delete({zone_id:a,identifier:e.identifier,content_list_entry_identifier:e[`content-list-entry-identifier`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`content-list-entry-identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <content-list-entry-identifier>`,describe:`IPFS Universal Path Gateway Content List Entry Details`,builder:C,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists entries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/ipfs_universal_path/content_list/entries/${e[`content-list-entry-identifier`]==null?`<content-list-entry-identifier>`:encodeURIComponent(String(e[`content-list-entry-identifier`]))}`,pathParams:{"content-list-entry-identifier":String(e[`content-list-entry-identifier`]??``),identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.web3.hostnames.ipfsUniversalPaths.contentLists.entries.get({zone_id:r,identifier:e.identifier,content_list_entry_identifier:e[`content-list-entry-identifier`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`List IPFS Universal Path Gateway Content List Entries`,builder:T,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists entries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/ipfs_universal_path/content_list/entries`,pathParams:{identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.web3.hostnames.ipfsUniversalPaths.contentLists.entries.list({zone_id:r,identifier:e.identifier})),{successLabel:`Loaded`})}};function D(e){return e.positional(`content-list-entry-identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`content`,{type:`string`,description:`Specify the CID or content path of content to block.`}).option(`description`,{type:`string`,description:`Specify an optional description of the content list entry.`}).option(`type`,{type:`string`,description:`Specify the type of content list entry to block.`,choices:[`cid`,`content_path`]}).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 <content-list-entry-identifier>`,describe:`Edit IPFS Universal Path Gateway Content List Entry`,builder:D,handler:async r=>{if(r.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists entries update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/web3/hostnames/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/ipfs_universal_path/content_list/entries/${r[`content-list-entry-identifier`]==null?`<content-list-entry-identifier>`:encodeURIComponent(String(r[`content-list-entry-identifier`]))}`,pathParams:{"content-list-entry-identifier":String(r[`content-list-entry-identifier`]??``),identifier:String(r.identifier??``),"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?o({content:u(r.content,`content`,`text`),description:u(r.description,`description`,`text`),type:u(r.type,`type`,`text`)}):a(r.body)});return}let d=await i(r),f=await n({zone:r.zone},d,{quiet:r.quiet});if(r.zoneId=f,r.body){let e=a(r.body);s(await l(`Updating`,async()=>d.web3.hostnames.ipfsUniversalPaths.contentLists.entries.update({body:e,zone_id:f,identifier:r.identifier,content_list_entry_identifier:r[`content-list-entry-identifier`]})),{successLabel:`Updated`});return}r.content===void 0&&(r.content=await e(`content`,`Specify the CID or content path of content to block.`)),r.type===void 0&&(r.type=await t(`type`,`Specify the type of content list entry to block.`,[`cid`,`content_path`]));let p=o({content:u(r.content,`content`,`text`),description:u(r.description,`description`,`text`),type:u(r.type,`type`,`text`)});s(await l(`Updating`,async()=>d.web3.hostnames.ipfsUniversalPaths.contentLists.entries.update({body:p,zone_id:f,identifier:r.identifier,content_list_entry_identifier:r[`content-list-entry-identifier`]})),{successLabel:`Updated`})}},k={command:`entries`,describe:`Web3 gateway hostnames with IPFS Universal Path content list management`,builder:e=>e.command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.positional(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <identifier>`,describe:`IPFS Universal Path Gateway Content List Details`,builder:A,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/ipfs_universal_path/content_list`,pathParams:{identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.web3.hostnames.ipfsUniversalPaths.contentLists.get({zone_id:r,identifier:e.identifier})),{successLabel:`Loaded`})}};function M(e){return e.positional(`identifier`,{type:`string`,description:`Specify the identifier of the hostname.`,demandOption:!0}).option(`action`,{type:`string`,description:`Behavior of the content list.`,choices:[`block`]}).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 N={command:`update <identifier>`,describe:`Update IPFS Universal Path Gateway Content List`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames ipfs-universal-paths content-lists update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames/${e.identifier==null?`<identifier>`:encodeURIComponent(String(e.identifier))}/ipfs_universal_path/content_list`,pathParams:{identifier:String(e.identifier??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({action:u(e.action,`action`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.web3.hostnames.ipfsUniversalPaths.contentLists.update({...t,zone_id:d,identifier:e.identifier})),{successLabel:`Updated`});return}e.action===void 0&&(e.action=await t(`action`,`Behavior of the content list.`,[`block`]));let f=o({action:u(e.action,`action`,`text`)});s(await l(`Updating`,async()=>r.web3.hostnames.ipfsUniversalPaths.contentLists.update({...f,zone_id:d,identifier:e.identifier})),{successLabel:`Updated`})}},P={command:`content-lists`,describe:`Web3 gateway hostnames with IPFS Universal Path content list management`,builder:e=>e.command(j).command(N).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`ipfs-universal-paths`,describe:`Operations for hostnames.ipfs-universal-paths`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`List Web3 Hostnames`,builder:I,handler:async e=>{if(e.dryRun){c({command:`cf web3 hostnames list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/web3/hostnames`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.web3.hostnames.list({zone_id:r})),{successLabel:`Loaded`})}},R={command:`hostnames`,describe:`Web3 gateway hostnames with IPFS Universal Path content list management`,builder:e=>e.command(f).command(m).command(g).command(v).command(L).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`web3`,describe:`Web3 gateways — serve IPFS and Ethereum content through custom hostnames on Cloudflare`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,S as r,T as i,_ as a,i as o,n as s,x as c}from"./auth-ffdf9yR0.mjs";import{n as l,r as u,t as d}from"./body-parser-DKa8Ipg1.mjs";import{t as f}from"./output-BJFNwj7b.mjs";import{n as p,t as m}from"./progress-CrCGTq7N.mjs";import{n as h,t as g}from"./input-validation-zEO81MWN.mjs";import{t as _}from"./local-VJaJ3BZ1.mjs";import{t as v}from"./cli-types-CRIDdDw3.mjs";import{n as ee,t as te}from"./raw-fetch-Dlccg0Tr.mjs";function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Fetches Worker account settings for an account.`,builder:y,handler:async t=>{if(t.dryRun){p({command:`cf workers account-settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/account-settings`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.accountSettings.get({account_id:r})),{successLabel:`Loaded`})}};function x(e){return e.option(`default-usage-model`,{type:`string`,description:`The default_usage_model field`}).option(`green-compute`,{type:`boolean`,description:`The green_compute 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 S={command:`update`,describe:`Creates Worker account settings for an account.`,builder:x,handler:async t=>{if(t.dryRun){p({command:`cf workers account-settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/account-settings`,pathParams:{},bodyKind:`json`,body:t.body===void 0?d({default_usage_model:h(t[`default-usage-model`],`default-usage-model`,`text`),green_compute:t[`green-compute`]}):l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,t.body){let e=l(t.body);f(await m(`Updating`,async()=>n.workers.accountSettings.update({body:e,account_id:r})),{successLabel:`Updated`});return}let i=d({default_usage_model:h(t[`default-usage-model`],`default-usage-model`,`text`),green_compute:t[`green-compute`]});f(await m(`Updating`,async()=>n.workers.accountSettings.update({body:i,account_id:r})),{successLabel:`Updated`})}},C={command:`account-settings`,describe:`Operations for account-settings`,builder:e=>e.command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`base64`,{type:`string`,description:"Whether the file contents are base64-encoded. Must be `true`.",choices:[`true`],demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const T={command:`create`,describe:`Upload assets ahead of creating a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.`,builder:v(w),handler:async t=>{let n={base64:t.base64};if(t.dryRun){p({command:`cf workers assets upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/assets/upload`,pathParams:{},query:n,bodyKind:`octet-stream`,body:t.body});return}let r=await s(t),i=t.local?_:await a(r);if(t.accountId=i,t.file){let e=g(t.file),n=new FormData;n.append(`file`,new Blob([e]),t.file.split(/[\\/]/).filter(Boolean).pop()),f(await m(`Creating`,async()=>o(r,`POST`,`/accounts/${i}/workers/assets/upload`,{body:n})),{successLabel:`Created`});return}if(t.body){let e=h(t.body,`body`,`binary`),a=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();f(await m(`Creating`,async()=>o(r,`POST`,`/accounts/${i}/workers/assets/upload${a?`?`+a:``}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}f(await m(`Creating`,async()=>r.workers.assets.upload.create({account_id:i,...n})),{successLabel:`Created`})}},E={command:`upload`,describe:`Operations for assets.upload`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`assets`,describe:`Operations for assets`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.option(`logpush`,{type:`boolean`,description:`Whether logpush is enabled for the Worker.`,default:!1}).option(`name`,{type:`string`,description:`Name of the Worker.`}).option(`observability-enabled`,{type:`boolean`,description:`Whether observability is enabled for the Worker.`,default:!1}).option(`observability-head-sampling-rate`,{type:`number`,description:`The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).`,default:1}).option(`observability-logs-destinations`,{type:`string`,array:!0,description:`A list of destinations where logs will be exported to.`}).option(`observability-logs-enabled`,{type:`boolean`,description:`Whether logs are enabled for the Worker.`,default:!1}).option(`observability-logs-head-sampling-rate`,{type:`number`,description:`The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).`,default:1}).option(`observability-logs-invocation-logs`,{type:`boolean`,description:`Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.`,default:!0}).option(`observability-logs-persist`,{type:`boolean`,description:`Whether log persistence is enabled for the Worker.`,default:!0}).option(`observability-traces-destinations`,{type:`string`,array:!0,description:`A list of destinations where traces will be exported to.`}).option(`observability-traces-enabled`,{type:`boolean`,description:`Whether traces are enabled for the Worker.`,default:!1}).option(`observability-traces-head-sampling-rate`,{type:`number`,description:`The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%).`,default:1}).option(`observability-traces-persist`,{type:`boolean`,description:`Whether trace persistence is enabled for the Worker.`,default:!0}).option(`observability-traces-propagation-policy`,{type:`string`,description:`Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.`,choices:[`authenticated`,`accept`],default:`authenticated`}).option(`subdomain-enabled`,{type:`boolean`,description:`Whether the *.workers.dev subdomain is enabled for the Worker.`,default:!1}).option(`subdomain-previews-enabled`,{type:`boolean`,description:`Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker.`}).option(`tags`,{type:`string`,array:!0,description:`Tags associated with the Worker.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Worker creation parameters.`})}const k={command:`create`,describe:`Create a new Worker.`,builder:O,handler:async n=>{if(n.dryRun){p({command:`cf workers beta workers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers`,pathParams:{},bodyKind:`json`,body:n.body===void 0?d({logpush:n.logpush,name:h(n.name,`name`,`text`),observability:{enabled:n[`observability-enabled`],head_sampling_rate:n[`observability-head-sampling-rate`],logs:{destinations:n[`observability-logs-destinations`],enabled:n[`observability-logs-enabled`],head_sampling_rate:n[`observability-logs-head-sampling-rate`],invocation_logs:n[`observability-logs-invocation-logs`],persist:n[`observability-logs-persist`]},traces:{destinations:n[`observability-traces-destinations`],enabled:n[`observability-traces-enabled`],head_sampling_rate:n[`observability-traces-head-sampling-rate`],persist:n[`observability-traces-persist`],propagation_policy:h(n[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}},subdomain:{enabled:n[`subdomain-enabled`],previews_enabled:n[`subdomain-previews-enabled`]},tags:n.tags}):l(n.body)});return}let r=await s(n),i=n.local?_:await a(r);if(n.accountId=i,n.body){let e=l(n.body);f(await m(`Creating`,async()=>r.workers.beta.workers.create({...e,account_id:i})),{successLabel:`Created`});return}if(n.logpush===void 0)throw Error(`--logpush is required (or pass --body with this field set).`);if(n.name===void 0&&(n.name=await t(`name`,`Name of the Worker.`)),n.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let o=d({logpush:n.logpush,name:h(n.name,`name`,`text`),observability:{enabled:n[`observability-enabled`],head_sampling_rate:n[`observability-head-sampling-rate`],logs:{destinations:n[`observability-logs-destinations`],enabled:n[`observability-logs-enabled`],head_sampling_rate:n[`observability-logs-head-sampling-rate`],invocation_logs:n[`observability-logs-invocation-logs`],persist:n[`observability-logs-persist`]},traces:{destinations:n[`observability-traces-destinations`],enabled:n[`observability-traces-enabled`],head_sampling_rate:n[`observability-traces-head-sampling-rate`],persist:n[`observability-traces-persist`],propagation_policy:h(n[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}},subdomain:{enabled:n[`subdomain-enabled`],previews_enabled:n[`subdomain-previews-enabled`]},tags:n.tags});f(await m(`Creating`,async()=>r.workers.beta.workers.create({...o,account_id:i})),{successLabel:`Created`})}};function A(e){return e.positional(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,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 j={command:`delete <worker-id>`,describe:`Delete a Worker and all its associated resources (versions, deployments, etc.).`,builder:A,handler:async t=>{if(t.dryRun){p({command:`cf workers beta workers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${t[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(t[`worker-id`]))}`,pathParams:{"worker-id":String(t[`worker-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}f(await m(`Deleting`,async()=>n.workers.beta.workers.delete({account_id:r,worker_id:t[`worker-id`]})),{successLabel:`Deleted`})}};function M(e){return e.positional(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`logpush`,{type:`boolean`,description:`Whether logpush is enabled for the Worker.`}).option(`name`,{type:`string`,description:`Name of the Worker.`}).option(`observability-enabled`,{type:`boolean`,description:`Whether observability is enabled for the Worker.`}).option(`observability-head-sampling-rate`,{type:`number`,description:`The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).`}).option(`observability-logs-destinations`,{type:`string`,array:!0,description:`A list of destinations where logs will be exported to.`}).option(`observability-logs-enabled`,{type:`boolean`,description:`Whether logs are enabled for the Worker.`}).option(`observability-logs-head-sampling-rate`,{type:`number`,description:`The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).`}).option(`observability-logs-invocation-logs`,{type:`boolean`,description:`Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.`}).option(`observability-logs-persist`,{type:`boolean`,description:`Whether log persistence is enabled for the Worker.`}).option(`observability-traces-destinations`,{type:`string`,array:!0,description:`A list of destinations where traces will be exported to.`}).option(`observability-traces-enabled`,{type:`boolean`,description:`Whether traces are enabled for the Worker.`}).option(`observability-traces-head-sampling-rate`,{type:`number`,description:`The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%).`}).option(`observability-traces-persist`,{type:`boolean`,description:`Whether trace persistence is enabled for the Worker.`}).option(`observability-traces-propagation-policy`,{type:`string`,description:`Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.`,choices:[`authenticated`,`accept`]}).option(`subdomain-enabled`,{type:`boolean`,description:`Whether the *.workers.dev subdomain is enabled for the Worker.`}).option(`subdomain-previews-enabled`,{type:`boolean`,description:`Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker.`}).option(`tags`,{type:`string`,array:!0,description:`Tags associated with the Worker.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Worker partial update parameters.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const N={command:`edit <worker-id>`,describe:`Perform a partial update on a Worker, where omitted properties are left unchanged from their current values.`,builder:M,handler:async n=>{if(n.dryRun){p({command:`cf workers beta workers edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${n[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(n[`worker-id`]))}`,pathParams:{"worker-id":String(n[`worker-id`]??``)},bodyKind:`json`,body:n.body===void 0?d({logpush:n.logpush,name:h(n.name,`name`,`text`),observability:{enabled:n[`observability-enabled`],head_sampling_rate:n[`observability-head-sampling-rate`],logs:{destinations:n[`observability-logs-destinations`],enabled:n[`observability-logs-enabled`],head_sampling_rate:n[`observability-logs-head-sampling-rate`],invocation_logs:n[`observability-logs-invocation-logs`],persist:n[`observability-logs-persist`]},traces:{destinations:n[`observability-traces-destinations`],enabled:n[`observability-traces-enabled`],head_sampling_rate:n[`observability-traces-head-sampling-rate`],persist:n[`observability-traces-persist`],propagation_policy:h(n[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}},subdomain:{enabled:n[`subdomain-enabled`],previews_enabled:n[`subdomain-previews-enabled`]},tags:n.tags}):l(n.body)});return}let r=await s(n),i=n.local?_:await a(r);if(n.accountId=i,n.file){let e=g(n.file);f(await m(`Updating`,async()=>o(r,`PATCH`,`/accounts/${i}/workers/workers/${encodeURIComponent(String(n[`worker-id`]))}`,{body:e,headers:{"Content-Type":`application/merge-patch+json`}})),{successLabel:`Updated`});return}if(n.body){let e=l(n.body);f(await m(`Updating`,async()=>o(r,`PATCH`,`/accounts/${i}/workers/workers/${encodeURIComponent(String(n[`worker-id`]))}`,{body:e})),{successLabel:`Updated`});return}if(n.logpush===void 0)throw Error(`--logpush is required (or pass --body with this field set).`);if(n.name===void 0&&(n.name=await t(`name`,`Name of the Worker.`)),n.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let c={};n.logpush!==void 0&&u(c,[`logpush`],n.logpush),n.name!==void 0&&u(c,[`name`],h(n.name,`name`,`text`)),n[`observability-enabled`]!==void 0&&u(c,[`observability`,`enabled`],n[`observability-enabled`]),n[`observability-head-sampling-rate`]!==void 0&&u(c,[`observability`,`head_sampling_rate`],n[`observability-head-sampling-rate`]),n[`observability-logs-destinations`]!==void 0&&u(c,[`observability`,`logs`,`destinations`],n[`observability-logs-destinations`]),n[`observability-logs-enabled`]!==void 0&&u(c,[`observability`,`logs`,`enabled`],n[`observability-logs-enabled`]),n[`observability-logs-head-sampling-rate`]!==void 0&&u(c,[`observability`,`logs`,`head_sampling_rate`],n[`observability-logs-head-sampling-rate`]),n[`observability-logs-invocation-logs`]!==void 0&&u(c,[`observability`,`logs`,`invocation_logs`],n[`observability-logs-invocation-logs`]),n[`observability-logs-persist`]!==void 0&&u(c,[`observability`,`logs`,`persist`],n[`observability-logs-persist`]),n[`observability-traces-destinations`]!==void 0&&u(c,[`observability`,`traces`,`destinations`],n[`observability-traces-destinations`]),n[`observability-traces-enabled`]!==void 0&&u(c,[`observability`,`traces`,`enabled`],n[`observability-traces-enabled`]),n[`observability-traces-head-sampling-rate`]!==void 0&&u(c,[`observability`,`traces`,`head_sampling_rate`],n[`observability-traces-head-sampling-rate`]),n[`observability-traces-persist`]!==void 0&&u(c,[`observability`,`traces`,`persist`],n[`observability-traces-persist`]),n[`observability-traces-propagation-policy`]!==void 0&&u(c,[`observability`,`traces`,`propagation_policy`],h(n[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)),n[`subdomain-enabled`]!==void 0&&u(c,[`subdomain`,`enabled`],n[`subdomain-enabled`]),n[`subdomain-previews-enabled`]!==void 0&&u(c,[`subdomain`,`previews_enabled`],n[`subdomain-previews-enabled`]),n.tags!==void 0&&u(c,[`tags`],n.tags),f(await m(`Updating`,async()=>o(r,`PATCH`,`/accounts/${i}/workers/workers/${encodeURIComponent(String(n[`worker-id`]))}`,{body:Object.keys(c).length>0?c:void 0})),{successLabel:`Updated`})}};function P(e){return e.positional(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get <worker-id>`,describe:`Get details about a specific Worker.`,builder:P,handler:async t=>{if(t.dryRun){p({command:`cf workers beta workers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${t[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(t[`worker-id`]))}`,pathParams:{"worker-id":String(t[`worker-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.beta.workers.get({account_id:r,worker_id:t[`worker-id`]})),{successLabel:`Loaded`})}};function I(e){return e.option(`page`,{type:`number`,description:`Current page.`}).option(`per-page`,{type:`number`,description:`Items per-page.`}).option(`order-by`,{type:`string`,description:`Property to sort results by.`,choices:[`deployed_on`,`updated_on`,`created_on`,`name`]}).option(`order`,{type:`string`,description:`Sort direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`List all Workers for an account.`,builder:v(I),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order_by:t[`order-by`],order:t.order};if(t.dryRun){p({command:`cf workers beta workers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i,f(await m(`Loading`,async()=>r.workers.beta.workers.list({account_id:i,...n})),{successLabel:`Loaded`})}};function R(e){return e.positional(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`logpush`,{type:`boolean`,description:`Whether logpush is enabled for the Worker.`}).option(`name`,{type:`string`,description:`Name of the Worker.`}).option(`observability-enabled`,{type:`boolean`,description:`Whether observability is enabled for the Worker.`}).option(`observability-head-sampling-rate`,{type:`number`,description:`The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).`}).option(`observability-logs-destinations`,{type:`string`,array:!0,description:`A list of destinations where logs will be exported to.`}).option(`observability-logs-enabled`,{type:`boolean`,description:`Whether logs are enabled for the Worker.`}).option(`observability-logs-head-sampling-rate`,{type:`number`,description:`The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).`}).option(`observability-logs-invocation-logs`,{type:`boolean`,description:`Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.`}).option(`observability-logs-persist`,{type:`boolean`,description:`Whether log persistence is enabled for the Worker.`}).option(`observability-traces-destinations`,{type:`string`,array:!0,description:`A list of destinations where traces will be exported to.`}).option(`observability-traces-enabled`,{type:`boolean`,description:`Whether traces are enabled for the Worker.`}).option(`observability-traces-head-sampling-rate`,{type:`number`,description:`The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%).`}).option(`observability-traces-persist`,{type:`boolean`,description:`Whether trace persistence is enabled for the Worker.`}).option(`observability-traces-propagation-policy`,{type:`string`,description:`Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.`,choices:[`authenticated`,`accept`]}).option(`subdomain-enabled`,{type:`boolean`,description:`Whether the *.workers.dev subdomain is enabled for the Worker.`}).option(`subdomain-previews-enabled`,{type:`boolean`,description:`Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker.`}).option(`tags`,{type:`string`,array:!0,description:`Tags associated with the Worker.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Worker update parameters.`})}const z={command:`update <worker-id>`,describe:`Perform a complete replacement of a Worker, where omitted properties are set to their default values. This is the exact same as the Create Worker endpoint, but operates on an existing Worker. To perform a partial update instead, use the Edit Worker endpoint.`,builder:R,handler:async n=>{if(n.dryRun){p({command:`cf workers beta workers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${n[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(n[`worker-id`]))}`,pathParams:{"worker-id":String(n[`worker-id`]??``)},bodyKind:`json`,body:n.body===void 0?d({logpush:n.logpush,name:h(n.name,`name`,`text`),observability:{enabled:n[`observability-enabled`],head_sampling_rate:n[`observability-head-sampling-rate`],logs:{destinations:n[`observability-logs-destinations`],enabled:n[`observability-logs-enabled`],head_sampling_rate:n[`observability-logs-head-sampling-rate`],invocation_logs:n[`observability-logs-invocation-logs`],persist:n[`observability-logs-persist`]},traces:{destinations:n[`observability-traces-destinations`],enabled:n[`observability-traces-enabled`],head_sampling_rate:n[`observability-traces-head-sampling-rate`],persist:n[`observability-traces-persist`],propagation_policy:h(n[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}},subdomain:{enabled:n[`subdomain-enabled`],previews_enabled:n[`subdomain-previews-enabled`]},tags:n.tags}):l(n.body)});return}let r=await s(n),i=n.local?_:await a(r);if(n.accountId=i,n.body){let e=l(n.body);f(await m(`Updating`,async()=>r.workers.beta.workers.update({...e,account_id:i,worker_id:n[`worker-id`]})),{successLabel:`Updated`});return}if(n.logpush===void 0)throw Error(`--logpush is required (or pass --body with this field set).`);if(n.name===void 0&&(n.name=await t(`name`,`Name of the Worker.`)),n.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let o=d({logpush:n.logpush,name:h(n.name,`name`,`text`),observability:{enabled:n[`observability-enabled`],head_sampling_rate:n[`observability-head-sampling-rate`],logs:{destinations:n[`observability-logs-destinations`],enabled:n[`observability-logs-enabled`],head_sampling_rate:n[`observability-logs-head-sampling-rate`],invocation_logs:n[`observability-logs-invocation-logs`],persist:n[`observability-logs-persist`]},traces:{destinations:n[`observability-traces-destinations`],enabled:n[`observability-traces-enabled`],head_sampling_rate:n[`observability-traces-head-sampling-rate`],persist:n[`observability-traces-persist`],propagation_policy:h(n[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}},subdomain:{enabled:n[`subdomain-enabled`],previews_enabled:n[`subdomain-previews-enabled`]},tags:n.tags});f(await m(`Updating`,async()=>r.workers.beta.workers.update({...o,account_id:i,worker_id:n[`worker-id`]})),{successLabel:`Updated`})}};function B(e){return e.positional(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`deploy`,{type:`boolean`,description:`If true, a deployment will be created that sends 100% of traffic to the new version.`}).option(`assets-config-html-handling`,{type:`string`,description:`Determines the redirects and rewrites of requests for HTML content.`,choices:[`auto-trailing-slash`,`force-trailing-slash`,`drop-trailing-slash`,`none`],default:`auto-trailing-slash`}).option(`assets-config-not-found-handling`,{type:`string`,description:`Determines the response when a request does not match a static asset, and there is no Worker script.`,choices:[`none`,`404-page`,`single-page-application`],default:`none`}).option(`assets-jwt`,{type:`string`,description:`Token provided upon successful upload of all files from a registered manifest.`}).option(`cache-options-cross-version-cache`,{type:`boolean`,description:`Whether cached responses are shared across Worker version
4
+ uploads. This is independent of \`enabled\`. It can stay true
5
+ while caching is off, so the preference survives turning
6
+ caching off and back on.
7
+ `,default:!1}).option(`cache-options-enabled`,{type:`boolean`,description:`Whether caching is enabled for this Worker.`,default:!1}).option(`compatibility-date`,{type:`string`,description:`Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.`}).option(`compatibility-flags`,{type:`string`,array:!0,description:"Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`."}).option(`limits-cpu-ms`,{type:`number`,description:`CPU time limit in milliseconds.`}).option(`limits-subrequests`,{type:`number`,description:`Subrequest limit per request.`}).option(`main-module`,{type:`string`,description:"The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler)."}).option(`migrations-new-tag`,{type:`string`,description:`Tag to set as the latest migration tag.`}).option(`migrations-old-tag`,{type:`string`,description:`Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.`}).option(`migrations-deleted-classes`,{type:`string`,array:!0,description:`A list of classes to delete Durable Object namespaces from.`}).option(`migrations-new-classes`,{type:`string`,array:!0,description:`A list of classes to create Durable Object namespaces from.`}).option(`migrations-new-sqlite-classes`,{type:`string`,array:!0,description:`A list of classes to create Durable Object namespaces with SQLite from.`}).option(`placement-mode`,{type:`string`,description:`Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).`,choices:[`smart`,`targeted`]}).option(`placement-region`,{type:`string`,description:`Cloud region for targeted placement in format 'provider:region'.`}).option(`placement-hostname`,{type:`string`,description:`HTTP hostname for targeted placement.`}).option(`placement-host`,{type:`string`,description:`TCP host and port for targeted placement.`}).option(`usage-model`,{type:`string`,description:`Usage model for the version.`,choices:[`standard`,`bundled`,`unbound`],default:`standard`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Version creation parameters.`}).conflicts(`placement-mode`,[`placement-region`,`placement-hostname`,`placement-host`]).conflicts(`placement-region`,[`placement-mode`,`placement-hostname`,`placement-host`]).conflicts(`placement-hostname`,[`placement-mode`,`placement-region`,`placement-host`]).conflicts(`placement-host`,[`placement-mode`,`placement-region`,`placement-hostname`])}const V={command:`create <worker-id>`,describe:`Create a new version.`,builder:B,handler:async t=>{let n={deploy:t.deploy};if(t.dryRun){p({command:`cf workers beta workers versions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${t[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(t[`worker-id`]))}/versions`,pathParams:{"worker-id":String(t[`worker-id`]??``)},query:n,bodyKind:`json`,body:t.body===void 0?d({assets:{config:{html_handling:h(t[`assets-config-html-handling`],`assets-config-html-handling`,`text`),not_found_handling:h(t[`assets-config-not-found-handling`],`assets-config-not-found-handling`,`text`)},jwt:h(t[`assets-jwt`],`assets-jwt`,`text`)},cache_options:{cross_version_cache:t[`cache-options-cross-version-cache`],enabled:t[`cache-options-enabled`]},compatibility_date:h(t[`compatibility-date`],`compatibility-date`,`text`),compatibility_flags:t[`compatibility-flags`],limits:{cpu_ms:t[`limits-cpu-ms`],subrequests:t[`limits-subrequests`]},main_module:h(t[`main-module`],`main-module`,`text`),migrations:{new_tag:h(t[`migrations-new-tag`],`migrations-new-tag`,`text`),old_tag:h(t[`migrations-old-tag`],`migrations-old-tag`,`text`),deleted_classes:t[`migrations-deleted-classes`],new_classes:t[`migrations-new-classes`],new_sqlite_classes:t[`migrations-new-sqlite-classes`]},placement:{mode:h(t[`placement-mode`],`placement-mode`,`text`),region:h(t[`placement-region`],`placement-region`,`text`),hostname:h(t[`placement-hostname`],`placement-hostname`,`text`),host:h(t[`placement-host`],`placement-host`,`text`)},usage_model:h(t[`usage-model`],`usage-model`,`text`)}):l(t.body)});return}let r=await s(t),i=t.local?_:await a(r);if(t.accountId=i,t.body){let e=l(t.body);new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),f(await m(`Creating`,async()=>r.workers.beta.workers.versions.create({body:e,account_id:i,worker_id:t[`worker-id`],...n})),{successLabel:`Created`});return}let o=d({assets:{config:{html_handling:h(t[`assets-config-html-handling`],`assets-config-html-handling`,`text`),not_found_handling:h(t[`assets-config-not-found-handling`],`assets-config-not-found-handling`,`text`)},jwt:h(t[`assets-jwt`],`assets-jwt`,`text`)},cache_options:{cross_version_cache:t[`cache-options-cross-version-cache`],enabled:t[`cache-options-enabled`]},compatibility_date:h(t[`compatibility-date`],`compatibility-date`,`text`),compatibility_flags:t[`compatibility-flags`],limits:{cpu_ms:t[`limits-cpu-ms`],subrequests:t[`limits-subrequests`]},main_module:h(t[`main-module`],`main-module`,`text`),migrations:{new_tag:h(t[`migrations-new-tag`],`migrations-new-tag`,`text`),old_tag:h(t[`migrations-old-tag`],`migrations-old-tag`,`text`),deleted_classes:t[`migrations-deleted-classes`],new_classes:t[`migrations-new-classes`],new_sqlite_classes:t[`migrations-new-sqlite-classes`]},placement:{mode:h(t[`placement-mode`],`placement-mode`,`text`),region:h(t[`placement-region`],`placement-region`,`text`),hostname:h(t[`placement-hostname`],`placement-hostname`,`text`),host:h(t[`placement-host`],`placement-host`,`text`)},usage_model:h(t[`usage-model`],`usage-model`,`text`)});new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),f(await m(`Creating`,async()=>r.workers.beta.workers.versions.create({body:o,account_id:i,worker_id:t[`worker-id`],...n})),{successLabel:`Created`})}};function H(e){return e.positional(`version-id`,{type:`string`,description:`Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version.`,demandOption:!0}).option(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,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 U={command:`delete <version-id>`,describe:`Delete a version.`,builder:H,handler:async t=>{if(t.dryRun){p({command:`cf workers beta workers versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${t[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(t[`worker-id`]))}/versions/${t[`version-id`]==null?`<version-id>`:encodeURIComponent(String(t[`version-id`]))}`,pathParams:{"worker-id":String(t[`worker-id`]??``),"version-id":String(t[`version-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
8
+ `);return}f(await m(`Deleting`,async()=>n.workers.beta.workers.versions.delete({account_id:r,worker_id:t[`worker-id`],version_id:t[`version-id`]})),{successLabel:`Deleted`})}};function W(e){return e.positional(`version-id`,{type:`string`,description:`Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version.`,demandOption:!0}).option(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`include`,{type:`string`,description:"Whether to include the `modules` property of the version in the response, which contains code and sourcemap content and may add several megabytes to the response size.",choices:[`modules`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <version-id>`,describe:`Get details about a specific version.`,builder:v(W),handler:async t=>{let n={include:t.include};if(t.dryRun){p({command:`cf workers beta workers versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${t[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(t[`worker-id`]))}/versions/${t[`version-id`]==null?`<version-id>`:encodeURIComponent(String(t[`version-id`]))}`,pathParams:{"worker-id":String(t[`worker-id`]??``),"version-id":String(t[`version-id`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i,f(await m(`Loading`,async()=>r.workers.beta.workers.versions.get({account_id:i,worker_id:t[`worker-id`],version_id:t[`version-id`],...n})),{successLabel:`Loaded`})}};function K(e){return e.option(`worker-id`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`page`,{type:`number`,description:`Current page.`}).option(`per-page`,{type:`number`,description:`Items per-page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`list`,describe:`List all versions for a Worker.`,builder:K,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){p({command:`cf workers beta workers versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/workers/${t[`worker-id`]==null?`<worker-id>`:encodeURIComponent(String(t[`worker-id`]))}/versions`,pathParams:{"worker-id":String(t[`worker-id`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i,f(await m(`Loading`,async()=>r.workers.beta.workers.versions.list({account_id:i,worker_id:t[`worker-id`],...n})),{successLabel:`Loaded`})}},J={command:`versions`,describe:`Operations for beta.workers.versions`,builder:e=>e.command(V).command(U).command(G).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Y={command:`workers`,describe:`Operations for beta.workers`,builder:e=>e.command(k).command(j).command(N).command(F).command(L).command(z).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},X={command:`beta`,describe:`Operations for beta`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`price-usd-microcents`,{type:`number`,description:`Price in microcents 1 USD = 100,000,000 microcents. Must be 0 or a multiple of 100,000 $0.001. Range: $0.001–$9,999.999.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Data for setting flag on zones`})}const Q={command:`create`,describe:`Creates the pay-per-crawl config for a zone.`,builder:Z,handler:async e=>{if(e.dryRun){p({command:`cf workers configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-crawl/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?d({enabled:e.enabled,price_usd_microcents:e[`price-usd-microcents`]}):l(e.body)});return}let t=await s(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);f(await m(`Creating`,async()=>t.workers.configuration.create({body:r,zone_id:n})),{successLabel:`Created`});return}let i=d({enabled:e.enabled,price_usd_microcents:e[`price-usd-microcents`]});f(await m(`Creating`,async()=>t.workers.configuration.create({body:i,zone_id:n})),{successLabel:`Created`})}};function ne(e){return e.option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`price-usd-microcents`,{type:`number`,description:`Price in microcents 1 USD = 100,000,000 microcents. Must be 0 or a multiple of 100,000 $0.001. Range: $0.001–$9,999.999.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Data for setting flag on zones`})}const re={command:`edit`,describe:`Changes the pay-per-crawl config for a zone.`,builder:ne,handler:async e=>{if(e.dryRun){p({command:`cf workers configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-crawl/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?d({enabled:e.enabled,price_usd_microcents:e[`price-usd-microcents`]}):l(e.body)});return}let t=await s(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=l(e.body);f(await m(`Updating`,async()=>t.workers.configuration.edit({body:r,zone_id:n})),{successLabel:`Updated`});return}let i=d({enabled:e.enabled,price_usd_microcents:e[`price-usd-microcents`]});f(await m(`Updating`,async()=>t.workers.configuration.edit({body:i,zone_id:n})),{successLabel:`Updated`})}};function ie(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`get`,describe:`Gets the pay-per-crawl config for a zone including the bot configuration.`,builder:ie,handler:async e=>{if(e.dryRun){p({command:`cf workers configuration get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-crawl/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await s(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,f(await m(`Loading`,async()=>t.workers.configuration.get({zone_id:n})),{successLabel:`Loaded`})}},oe={command:`configuration`,describe:`Configuration operations`,builder:e=>e.command(Q).command(re).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function se(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`create`,describe:`Creates the stripe config for a crawler.`,builder:se,handler:async t=>{if(t.dryRun){p({command:`cf workers crawler stripe create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/crawler/stripe`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Creating`,async()=>n.workers.crawler.stripe.create({account_id:r})),{successLabel:`Created`})}};function le(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ue={command:`delete`,describe:`Deletes the stripe config for a crawler.`,builder:le,handler:async t=>{if(t.dryRun){p({command:`cf workers crawler stripe delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/crawler/stripe`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
9
+ `);return}f(await m(`Deleting`,async()=>n.workers.crawler.stripe.delete({account_id:r})),{successLabel:`Deleted`})}};function de(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get`,describe:`Gets the stripe config for a crawler.`,builder:de,handler:async t=>{if(t.dryRun){p({command:`cf workers crawler stripe get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/crawler/stripe`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.crawler.stripe.get({account_id:r})),{successLabel:`Loaded`})}},pe={command:`stripe`,describe:`Crawler operations`,builder:e=>e.command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},me={command:`crawler`,describe:`Operations for crawler`,builder:e=>e.command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`force`,{type:`boolean`,description:`If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed.`}).option(`strategy`,{type:`string`,description:`The strategy field`,choices:[`percentage`]}).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 ge={command:`create`,describe:`Deployments configure how [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) are deployed to traffic. A deployment can consist of one or two versions of a Worker.`,builder:he,handler:async t=>{let r={force:t.force};if(t.dryRun){p({command:`cf workers deployments create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/deployments`,pathParams:{"script-name":String(t[`script-name`]??``)},query:r,bodyKind:`json`,body:t.body===void 0?d({strategy:h(t.strategy,`strategy`,`text`)}):l(t.body)});return}let i=await s(t),o=t.local?_:await a(i);t.accountId=o;let u=c({scriptName:t.worker});if(t.worker=u,t.body){let e=l(t.body);new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),f(await m(`Creating`,async()=>i.workers.deployments.create({body:e,account_id:o,script_name:u,...r})),{successLabel:`Created`});return}t.strategy===void 0&&(t.strategy=await n(`strategy`,`The strategy field`,[`percentage`]));let g=d({strategy:h(t.strategy,`strategy`,`text`)});new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),f(await m(`Creating`,async()=>i.workers.deployments.create({body:g,account_id:o,script_name:u,...r})),{successLabel:`Created`})}};function _e(e){return e.positional(`deployment-id`,{type:`string`,description:`Deployment ID`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).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 ve={command:`delete <deployment-id>`,describe:`Delete a Worker Deployment. The latest deployment, which is actively serving traffic, cannot be deleted. All other deployments can be deleted.`,builder:_e,handler:async t=>{if(t.dryRun){p({command:`cf workers deployments delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/deployments/${t[`deployment-id`]==null?`<deployment-id>`:encodeURIComponent(String(t[`deployment-id`]))}`,pathParams:{"script-name":String(t[`script-name`]??``),"deployment-id":String(t[`deployment-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let o=c({scriptName:t.worker});if(t.worker=o,!await i({force:!!t.force})){process.stderr.write(`Aborted.
10
+ `);return}f(await m(`Deleting`,async()=>n.workers.deployments.delete({account_id:r,script_name:o,deployment_id:t[`deployment-id`]})),{successLabel:`Deleted`})}};function ye(e){return e.positional(`deployment-id`,{type:`string`,description:`Deployment ID`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`get <deployment-id>`,describe:`Get information about a Worker Deployment.`,builder:ye,handler:async t=>{if(t.dryRun){p({command:`cf workers deployments get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/deployments/${t[`deployment-id`]==null?`<deployment-id>`:encodeURIComponent(String(t[`deployment-id`]))}`,pathParams:{"script-name":String(t[`script-name`]??``),"deployment-id":String(t[`deployment-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.deployments.get({account_id:r,script_name:i,deployment_id:t[`deployment-id`]})),{successLabel:`Loaded`})}};function xe(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`list`,describe:`List of Worker Deployments. The first deployment in the list is the latest deployment actively serving traffic.`,builder:xe,handler:async t=>{if(t.dryRun){p({command:`cf workers deployments list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/deployments`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.deployments.list({account_id:r,script_name:i})),{successLabel:`Loaded`})}},Ce={command:`deployments`,describe:`Operations for deployments`,builder:e=>e.command(ge).command(ve).command(be).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.positional(`domain-id`,{type:`string`,description:`ID of the domain.`,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 Te={command:`delete <domain-id>`,describe:`Detaches a domain from a Worker. Both the Worker and all of its previews are no longer routable using this domain.`,builder:we,handler:async t=>{if(t.dryRun){p({command:`cf workers domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/domains/${t[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(t[`domain-id`]))}`,pathParams:{"domain-id":String(t[`domain-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
11
+ `);return}f(await m(`Deleting`,async()=>n.workers.domains.delete({account_id:r,domain_id:t[`domain-id`]})),{successLabel:`Deleted`})}};function Ee(e){return e.positional(`domain-id`,{type:`string`,description:`ID of the domain.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`get <domain-id>`,describe:`Gets information about a domain.`,builder:Ee,handler:async t=>{if(t.dryRun){p({command:`cf workers domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/domains/${t[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(t[`domain-id`]))}`,pathParams:{"domain-id":String(t[`domain-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.domains.get({account_id:r,domain_id:t[`domain-id`]})),{successLabel:`Loaded`})}};function Oe(e){return e.option(`zone-id`,{type:`string`,description:`ID of the zone containing the domain hostname.`}).option(`zone-name`,{type:`string`,description:`Name of the zone containing the domain hostname.`}).option(`service`,{type:`string`,description:`Name of the Worker associated with the domain.`}).option(`hostname`,{type:`string`,description:`Hostname of the domain.`}).option(`environment`,{type:`string`,description:`Worker environment associated with the domain.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ke={command:`list`,describe:`Lists all domains for an account.`,builder:Oe,handler:async t=>{let n={zone_id:t[`zone-id`],zone_name:t[`zone-name`],service:t.service,hostname:t.hostname,environment:t.environment};if(t.dryRun){p({command:`cf workers domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/domains`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i,f(await m(`Loading`,async()=>r.workers.domains.list({account_id:i,...n})),{successLabel:`Loaded`})}};function Ae(e){return e.option(`hostname`,{type:`string`,description:`Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.`}).option(`service`,{type:`string`,description:`Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.`}).option(`zone-id`,{type:`string`,description:`ID of the zone containing the domain hostname.`}).option(`zone-name`,{type:`string`,description:`Name of the zone containing the domain hostname.`}).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 je={command:`update`,describe:`Attaches a domain that routes traffic to a Worker.`,builder:Ae,handler:async n=>{if(n.dryRun){p({command:`cf workers domains update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/domains`,pathParams:{},bodyKind:`json`,body:n.body===void 0?d({hostname:h(n.hostname,`hostname`,`text`),service:h(n.service,`service`,`text`),zone_id:h(n[`zone-id`],`zone-id`,`text`),zone_name:h(n[`zone-name`],`zone-name`,`text`)}):l(n.body)});return}let r=await s(n),i=n.local?_:await a(r);if(n.accountId=i,n.body){let e=l(n.body);f(await m(`Updating`,async()=>r.workers.domains.update({...e,account_id:i})),{successLabel:`Updated`});return}n.hostname===void 0&&(n.hostname=await t(`hostname`,`Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.`)),n.service===void 0&&(n.service=await t(`service`,`Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.`)),n[`zone-id`]===void 0&&(n[`zone-id`]=await t(`zone-id`,`ID of the zone containing the domain hostname.`)),n[`zone-name`]===void 0&&(n[`zone-name`]=await t(`zone-name`,`Name of the zone containing the domain hostname.`));let o=d({hostname:h(n.hostname,`hostname`,`text`),service:h(n.service,`service`,`text`),zone_id:h(n[`zone-id`],`zone-id`,`text`),zone_name:h(n[`zone-name`],`zone-name`,`text`)});f(await m(`Updating`,async()=>r.workers.domains.update({...o,account_id:i})),{successLabel:`Updated`})}},Me={command:`domains`,describe:`Operations for domains`,builder:e=>e.command(Te).command(De).command(ke).command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ne(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:`Returns a list of available placement regions organized by cloud provider. These regions can be used to configure Smart Placement for Workers.`,builder:Ne,handler:async t=>{if(t.dryRun){p({command:`cf workers placement regions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/placement/regions`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.placement.regions.list({account_id:r})),{successLabel:`Loaded`})}},Fe={command:`regions`,describe:`Operations for placement.regions`,builder:e=>e.command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ie={command:`placement`,describe:`Operations for placement`,builder:e=>e.command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Le(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Re={command:`create`,describe:`Creates the stripe config for a publisher.`,builder:Le,handler:async t=>{if(t.dryRun){p({command:`cf workers publisher stripe create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/publisher/stripe`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Creating`,async()=>n.workers.publisher.stripe.create({account_id:r})),{successLabel:`Created`})}};function ze(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Be={command:`delete`,describe:`Deletes the stripe config for a publisher.`,builder:ze,handler:async t=>{if(t.dryRun){p({command:`cf workers publisher stripe delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/publisher/stripe`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
12
+ `);return}f(await m(`Deleting`,async()=>n.workers.publisher.stripe.delete({account_id:r})),{successLabel:`Deleted`})}};function Ve(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const He={command:`get`,describe:`Gets the stripe config for a publisher.`,builder:Ve,handler:async t=>{if(t.dryRun){p({command:`cf workers publisher stripe get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/publisher/stripe`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.publisher.stripe.get({account_id:r})),{successLabel:`Loaded`})}},Ue={command:`stripe`,describe:`Publisher operations`,builder:e=>e.command(Re).command(Be).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},We={command:`publisher`,describe:`Operations for publisher`,builder:e=>e.command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ge(e){return e.positional(`domain`,{type:`string`,description:`The domain to get credentials for.`,demandOption:!0}).option(`expiration-minutes`,{type:`number`,description:`The minimum number of minutes the token will be valid for. Must be positive. We make a best effort to respect this value, but some registry providers do not let us configure the token lifetime, so the token may be valid for longer.`}).option(`permissions`,{type:`string`,array:!0,description:`The permissions field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Specifies the configuration for the image registry credential to create.`})}const Ke={command:`generate <domain>`,describe:`Generates temporary credentials for accessing Cloudflare's container image registry. Used for pulling and pushing container images.`,builder:Ge,handler:async t=>{if(t.dryRun){p({command:`cf workers registries credentials generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/containers/registries/${t.domain==null?`<domain>`:encodeURIComponent(String(t.domain))}/credentials`,pathParams:{domain:String(t.domain??``)},bodyKind:`json`,body:t.body===void 0?d({expiration_minutes:t[`expiration-minutes`],permissions:t.permissions}):l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,t.body){let e=l(t.body);f(await m(`Creating`,async()=>n.workers.registries.credentials.generate({...e,account_id:r,domain:t.domain})),{successLabel:`Created`});return}if(t[`expiration-minutes`]===void 0)throw Error(`--expiration-minutes is required (or pass --body with this field set).`);if(t.permissions===void 0)throw Error(`--permissions is required (or pass --body with this field set).`);let i=d({expiration_minutes:t[`expiration-minutes`],permissions:t.permissions});f(await m(`Creating`,async()=>n.workers.registries.credentials.generate({...i,account_id:r,domain:t.domain})),{successLabel:`Created`})}},qe={command:`credentials`,describe:`Registries operations`,builder:e=>e.command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Je={command:`registries`,describe:`Operations for registries`,builder:e=>e.command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ye(e){return e.option(`pattern`,{type:`string`,description:`Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).`}).option(`script`,{type:`string`,description:`Name of the script to run if the route matches.`}).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 Xe={command:`create`,describe:`Creates a route that maps a URL pattern to a Worker.`,builder:Ye,handler:async e=>{if(e.dryRun){p({command:`cf workers routes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/workers/routes`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?d({pattern:h(e.pattern,`pattern`,`text`),script:h(e.script,`script`,`text`)}):l(e.body)});return}let n=await s(e),i=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=l(e.body);f(await m(`Creating`,async()=>n.workers.routes.create({body:t,zone_id:i})),{successLabel:`Created`});return}e.pattern===void 0&&(e.pattern=await t(`pattern`,`Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).`));let a=d({pattern:h(e.pattern,`pattern`,`text`),script:h(e.script,`script`,`text`)});f(await m(`Creating`,async()=>n.workers.routes.create({body:a,zone_id:i})),{successLabel:`Created`})}};function Ze(e){return e.positional(`route-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Qe={command:`delete <route-id>`,describe:`Deletes a route.`,builder:Ze,handler:async e=>{if(e.dryRun){p({command:`cf workers routes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/workers/routes/${e[`route-id`]==null?`<route-id>`:encodeURIComponent(String(e[`route-id`]))}`,pathParams:{"route-id":String(e[`route-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await s(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
13
+ `);return}f(await m(`Deleting`,async()=>t.workers.routes.delete({zone_id:n,route_id:e[`route-id`]})),{successLabel:`Deleted`})}};function $e(e){return e.positional(`route-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const et={command:`get <route-id>`,describe:`Returns information about a route, including URL pattern and Worker.`,builder:$e,handler:async e=>{if(e.dryRun){p({command:`cf workers routes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/workers/routes/${e[`route-id`]==null?`<route-id>`:encodeURIComponent(String(e[`route-id`]))}`,pathParams:{"route-id":String(e[`route-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await s(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,f(await m(`Loading`,async()=>t.workers.routes.get({zone_id:n,route_id:e[`route-id`]})),{successLabel:`Loaded`})}};function tt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nt={command:`list`,describe:`Returns routes for a zone.`,builder:tt,handler:async e=>{if(e.dryRun){p({command:`cf workers routes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/workers/routes`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await s(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,f(await m(`Loading`,async()=>t.workers.routes.list({zone_id:n})),{successLabel:`Loaded`})}};function rt(e){return e.positional(`route-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`pattern`,{type:`string`,description:`Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).`}).option(`script`,{type:`string`,description:`Name of the script to run if the route matches.`}).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 it={command:`update <route-id>`,describe:`Updates the URL pattern or Worker associated with a route.`,builder:rt,handler:async e=>{if(e.dryRun){p({command:`cf workers routes update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/workers/routes/${e[`route-id`]==null?`<route-id>`:encodeURIComponent(String(e[`route-id`]))}`,pathParams:{"route-id":String(e[`route-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?d({pattern:h(e.pattern,`pattern`,`text`),script:h(e.script,`script`,`text`)}):l(e.body)});return}let n=await s(e),i=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=l(e.body);f(await m(`Updating`,async()=>n.workers.routes.update({body:t,zone_id:i,route_id:e[`route-id`]})),{successLabel:`Updated`});return}e.pattern===void 0&&(e.pattern=await t(`pattern`,`Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).`));let a=d({pattern:h(e.pattern,`pattern`,`text`),script:h(e.script,`script`,`text`)});f(await m(`Updating`,async()=>n.workers.routes.update({body:a,zone_id:i,route_id:e[`route-id`]})),{successLabel:`Updated`})}},at={command:`routes`,describe:`Operations for routes`,builder:e=>e.command(Xe).command(Qe).command(et).command(nt).command(it).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ot(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).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 st={command:`create`,describe:`Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.`,builder:ot,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts assets upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/assets-upload-session`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});if(t.worker=i,t.body){let e=l(t.body);f(await m(`Creating`,async()=>n.workers.scripts.assets.upload.create({body:e,account_id:r,script_name:i})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ct={command:`upload`,describe:`Operations for scripts.assets.upload`,builder:e=>e.command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},lt={command:`assets`,describe:`Operations for scripts.assets`,builder:e=>e.command(ct).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ut(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dt={command:`get`,describe:`Fetch script content only.`,builder:ut,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/content/v2`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.scripts.content.get({account_id:r,script_name:i})),{successLabel:`Loaded`})}};function ft(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`cf-worker-body-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.`}).option(`cf-worker-main-module-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`files`,{type:`string`,description:"An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`."}).option(`metadata`,{type:`string`,description:`JSON-encoded metadata about the uploaded parts and Worker configuration.`})}const pt={command:`update`,describe:`Put script content without touching config or metadata.`,builder:ft,handler:async t=>{let n={};if(t[`cf-worker-body-part`]!==void 0&&(n[`CF-WORKER-BODY-PART`]=String(t[`cf-worker-body-part`])),t[`cf-worker-main-module-part`]!==void 0&&(n[`CF-WORKER-MAIN-MODULE-PART`]=String(t[`cf-worker-main-module-part`])),t.dryRun){p({command:`cf workers scripts content update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/content`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,files:t.files,metadata:t.metadata}});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i;let l=c({scriptName:t.worker});if(t.worker=l,t.file!==void 0||t.body!==void 0||t.files!==void 0||t.metadata!==void 0){let e=new FormData;if(t.file){let n=g(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.files!==void 0){let n=typeof t.files==`string`?h(t.files,`files`,`text`):t.files;e.append(`files`,typeof n==`string`?n:JSON.stringify(n))}if(t.metadata!==void 0){let n=typeof t.metadata==`string`?h(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}f(await m(`Updating`,async()=>o(r,`PUT`,`/accounts/${i}/workers/scripts/${l}/content`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}if(t.body){let e=h(t.body,`body`,`binary`);f(await m(`Updating`,async()=>o(r,`PUT`,`/accounts/${i}/workers/scripts/${l}/content`,{body:e,headers:{"Content-Type":`multipart/form-data`,...n}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},mt={command:`content`,describe:`Operations for scripts.content`,builder:e=>e.command(dt).command(pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ht(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`force`,{type:`boolean`,description:`If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gt={command:`delete`,describe:`Delete your worker. This call has no response body on a successful delete.`,builder:ht,handler:async t=>{let n={force:t.force};if(t.dryRun){p({command:`cf workers scripts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}`,pathParams:{"script-name":String(t[`script-name`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),o=t.local?_:await a(r);t.accountId=o;let l=c({scriptName:t.worker});if(t.worker=l,!await i({force:!!t.force})){process.stderr.write(`Aborted.
14
+ `);return}f(await m(`Deleting`,async()=>r.workers.scripts.delete({account_id:o,script_name:l,...n})),{successLabel:`Deleted`})}};function _t(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const vt={command:`get`,describe:`Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.`,builder:_t,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i;let o=await m(`Loading`,async()=>te(`/accounts/${r}/workers/scripts/${i}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));ee(t.text===!0?o.toString(`utf-8`):o)}};function yt(e){return e.option(`tags`,{type:`string`,description:`Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bt={command:`list`,describe:`Fetch a list of uploaded workers.`,builder:yt,handler:async t=>{let n={tags:t.tags};if(t.dryRun){p({command:`cf workers scripts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i,f(await m(`Loading`,async()=>r.workers.scripts.list({account_id:i,...n})),{successLabel:`Loaded`})}};function xt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const St={command:`get`,describe:`Fetches Cron Triggers for a Worker.`,builder:xt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts schedules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/schedules`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.scripts.schedules.get({account_id:r,script_name:i})),{successLabel:`Loaded`})}};function Ct(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).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 wt={command:`update`,describe:`Updates Cron Triggers for a Worker.`,builder:Ct,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts schedules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/schedules`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});if(t.worker=i,t.body){let e=l(t.body);f(await m(`Updating`,async()=>n.workers.scripts.schedules.update({body:e,account_id:r,script_name:i})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},Tt={command:`schedules`,describe:`Operations for scripts.schedules`,builder:e=>e.command(St).command(wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Et(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`settings`,{type:`string`,description:`The settings`})}const Dt={command:`edit`,describe:`Patch metadata or config, such as bindings or usage model.`,builder:Et,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts script-and-version-settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/settings`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,settings:t.settings}});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});if(t.worker=i,t.file!==void 0||t.body!==void 0||t.settings!==void 0){let e=new FormData;if(t.file){let n=g(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.settings!==void 0){let n=typeof t.settings==`string`?h(t.settings,`settings`,`text`):t.settings;e.append(`settings`,typeof n==`string`?n:JSON.stringify(n))}f(await m(`Updating`,async()=>o(n,`PATCH`,`/accounts/${r}/workers/scripts/${i}/settings`,{body:e})),{successLabel:`Updated`});return}if(t.body){let e=h(t.body,`body`,`binary`);f(await m(`Updating`,async()=>o(n,`PATCH`,`/accounts/${r}/workers/scripts/${i}/settings`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}f(await m(`Updating`,async()=>n.workers.scripts.scriptAndVersionSettings.edit({account_id:r,script_name:i})),{successLabel:`Updated`})}};function Ot(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kt={command:`get`,describe:`Get metadata and config, such as bindings or usage model.`,builder:Ot,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts script-and-version-settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/settings`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.scripts.scriptAndVersionSettings.get({account_id:r,script_name:i})),{successLabel:`Loaded`})}},At={command:`script-and-version-settings`,describe:`Operations for scripts.script-and-version-settings`,builder:e=>e.command(Dt).command(kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function jt(e){return e.option(`name`,{type:`string`,description:`Worker name to search for. Both exact and partial matches are returned.`}).option(`id`,{type:`string`,description:`Worker ID (also called tag) to search for. Only exact matches are returned.`}).option(`order-by`,{type:`string`,description:`Property to sort results by. Results are sorted in ascending order.`,choices:[`created_on`,`modified_on`,`name`]}).option(`page`,{type:`number`,description:`Current page.`}).option(`per-page`,{type:`number`,description:`Items per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Mt={command:`search`,describe:`Search for Workers in an account.`,builder:v(jt),handler:async t=>{let n={name:t.name,id:t.id,order_by:t[`order-by`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){p({command:`cf workers scripts search`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts-search`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i,f(await m(`Loading`,async()=>r.workers.scripts.search({account_id:i,...n})),{successLabel:`Loaded`})}};function Nt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`logpush`,{type:`boolean`,description:`Whether Logpush is turned on for the Worker.`}).option(`observability-enabled`,{type:`boolean`,description:`Whether observability is enabled for the Worker.`}).option(`observability-head-sampling-rate`,{type:`number`,description:`The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.`}).option(`observability-logs-destinations`,{type:`string`,array:!0,description:`A list of destinations where logs will be exported to.`}).option(`observability-logs-enabled`,{type:`boolean`,description:`Whether logs are enabled for the Worker.`}).option(`observability-logs-head-sampling-rate`,{type:`number`,description:`The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.`}).option(`observability-logs-invocation-logs`,{type:`boolean`,description:`Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.`}).option(`observability-logs-persist`,{type:`boolean`,description:`Whether log persistence is enabled for the Worker.`}).option(`observability-traces-destinations`,{type:`string`,array:!0,description:`A list of destinations where traces will be exported to.`}).option(`observability-traces-enabled`,{type:`boolean`,description:`Whether traces are enabled for the Worker.`}).option(`observability-traces-head-sampling-rate`,{type:`number`,description:`The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.`}).option(`observability-traces-persist`,{type:`boolean`,description:`Whether trace persistence is enabled for the Worker.`}).option(`observability-traces-propagation-policy`,{type:`string`,description:`Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.`,choices:[`authenticated`,`accept`]}).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([`observability-enabled`,`observability-head-sampling-rate`,`observability-logs-destinations`,`observability-logs-enabled`,`observability-logs-head-sampling-rate`,`observability-logs-invocation-logs`,`observability-traces-destinations`,`observability-traces-enabled`,`observability-traces-head-sampling-rate`].some(t=>e[t]!==void 0)){let t=[`observability-enabled`,`observability-logs-enabled`,`observability-logs-invocation-logs`].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 --observability-* flag is set`)}return!0})}const Pt={command:`edit`,describe:`Patch script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Including but not limited to Logpush and Tail Consumers.`,builder:Nt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/script-settings`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`json`,body:t.body===void 0?d({logpush:t.logpush,observability:{enabled:t[`observability-enabled`],head_sampling_rate:t[`observability-head-sampling-rate`],logs:{destinations:t[`observability-logs-destinations`],enabled:t[`observability-logs-enabled`],head_sampling_rate:t[`observability-logs-head-sampling-rate`],invocation_logs:t[`observability-logs-invocation-logs`],persist:t[`observability-logs-persist`]},traces:{destinations:t[`observability-traces-destinations`],enabled:t[`observability-traces-enabled`],head_sampling_rate:t[`observability-traces-head-sampling-rate`],persist:t[`observability-traces-persist`],propagation_policy:h(t[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}}}):l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});if(t.worker=i,t.body){let e=l(t.body);f(await m(`Updating`,async()=>n.workers.scripts.settings.edit({body:e,account_id:r,script_name:i})),{successLabel:`Updated`});return}let o=d({logpush:t.logpush,observability:{enabled:t[`observability-enabled`],head_sampling_rate:t[`observability-head-sampling-rate`],logs:{destinations:t[`observability-logs-destinations`],enabled:t[`observability-logs-enabled`],head_sampling_rate:t[`observability-logs-head-sampling-rate`],invocation_logs:t[`observability-logs-invocation-logs`],persist:t[`observability-logs-persist`]},traces:{destinations:t[`observability-traces-destinations`],enabled:t[`observability-traces-enabled`],head_sampling_rate:t[`observability-traces-head-sampling-rate`],persist:t[`observability-traces-persist`],propagation_policy:h(t[`observability-traces-propagation-policy`],`observability-traces-propagation-policy`,`text`)}}});f(await m(`Updating`,async()=>n.workers.scripts.settings.edit({body:o,account_id:r,script_name:i})),{successLabel:`Updated`})}};function Ft(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const It={command:`get`,describe:`Get script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Includes Logpush and Tail Consumers.`,builder:Ft,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/script-settings`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.scripts.settings.get({account_id:r,script_name:i})),{successLabel:`Loaded`})}},Lt={command:`settings`,describe:`Operations for scripts.settings`,builder:e=>e.command(Pt).command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Rt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`enabled`,{type:`boolean`,description:`Whether the Worker should be available on the workers.dev subdomain.`}).option(`previews-enabled`,{type:`boolean`,description:`Whether the Worker's Preview URLs should be available on the workers.dev subdomain.`}).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 zt={command:`create`,describe:`Enable or disable the Worker on the workers.dev subdomain.`,builder:Rt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts subdomain create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/subdomain`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`json`,body:t.body===void 0?d({enabled:t.enabled,previews_enabled:t[`previews-enabled`]}):l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});if(t.worker=i,t.body){let e=l(t.body);f(await m(`Creating`,async()=>n.workers.scripts.subdomain.create({...e,account_id:r,script_name:i})),{successLabel:`Created`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let o=d({enabled:t.enabled,previews_enabled:t[`previews-enabled`]});f(await m(`Creating`,async()=>n.workers.scripts.subdomain.create({...o,account_id:r,script_name:i})),{successLabel:`Created`})}};function Bt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).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 Vt={command:`delete`,describe:`Disable all workers.dev subdomains for a Worker.`,builder:Bt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts subdomain delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/subdomain`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let o=c({scriptName:t.worker});if(t.worker=o,!await i({force:!!t.force})){process.stderr.write(`Aborted.
15
+ `);return}f(await m(`Deleting`,async()=>n.workers.scripts.subdomain.delete({account_id:r,script_name:o})),{successLabel:`Deleted`})}};function Ht(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ut={command:`get`,describe:`Get if the Worker is available on the workers.dev subdomain.`,builder:Ht,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts subdomain get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/subdomain`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.scripts.subdomain.get({account_id:r,script_name:i})),{successLabel:`Loaded`})}},Wt={command:`subdomain`,describe:`Operations for scripts.subdomain`,builder:e=>e.command(zt).command(Vt).command(Ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Gt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Kt={command:`create`,describe:`Starts a tail that receives logs and exception from a Worker.`,builder:Gt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts tail create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/tails`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Creating`,async()=>n.workers.scripts.tail.create({account_id:r,script_name:i})),{successLabel:`Created`})}};function qt(e){return e.positional(`id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).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 Jt={command:`delete <id>`,describe:`Deletes a tail from a Worker.`,builder:qt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts tail delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/tails/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{"script-name":String(t[`script-name`]??``),id:String(t.id??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let o=c({scriptName:t.worker});if(t.worker=o,!await i({force:!!t.force})){process.stderr.write(`Aborted.
16
+ `);return}f(await m(`Deleting`,async()=>n.workers.scripts.tail.delete({account_id:r,script_name:o,id:t.id})),{successLabel:`Deleted`})}},Yt={command:`tail`,describe:`Operations for scripts.tail`,builder:e=>e.command(Kt).command(Jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Xt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`bindings-inherit`,{type:`string`,description:'When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.',choices:[`strict`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const Zt={command:`update`,describe:`Upload a worker module. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.`,builder:v(Xt),handler:async t=>{let n={bindings_inherit:t[`bindings-inherit`]};if(t.dryRun){p({command:`cf workers scripts update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}`,pathParams:{"script-name":String(t[`script-name`]??``)},query:n,bodyKind:`octet-stream`,body:t.body});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i;let l=c({scriptName:t.worker});if(t.worker=l,t.file){let e=g(t.file);f(await m(`Updating`,async()=>o(r,`PUT`,`/accounts/${i}/workers/scripts/${l}`,{body:e,headers:{"Content-Type":`application/javascript`}})),{successLabel:`Updated`});return}if(t.body){let e=h(t.body,`body`,`binary`),a=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();f(await m(`Updating`,async()=>o(r,`PUT`,`/accounts/${i}/workers/scripts/${l}${a?`?`+a:``}`,{body:e,headers:{"Content-Type":`application/javascript`}})),{successLabel:`Updated`});return}f(await m(`Updating`,async()=>r.workers.scripts.update({account_id:i,script_name:l,...n})),{successLabel:`Updated`})}};function Qt(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $t={command:`get`,describe:`Fetches the Usage Model for a given Worker.`,builder:Qt,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts usage-model get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/usage-model`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.scripts.usageModel.get({account_id:r,script_name:i})),{successLabel:`Loaded`})}};function en(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`usage-model`,{type:`string`,description:`Usage model for the Worker invocations.`,choices:[`standard`,`bundled`,`unbound`]}).option(`user-limits-cpu-ms`,{type:`number`,description:`The amount of CPU time this Worker can use in milliseconds.`}).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 tn={command:`update`,describe:`Updates the Usage Model for a given Worker. Requires a Workers Paid subscription.`,builder:en,handler:async t=>{if(t.dryRun){p({command:`cf workers scripts usage-model update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/usage-model`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`json`,body:t.body===void 0?d({usage_model:h(t[`usage-model`],`usage-model`,`text`),user_limits:{cpu_ms:t[`user-limits-cpu-ms`]}}):l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});if(t.worker=i,t.body){let e=l(t.body);f(await m(`Updating`,async()=>n.workers.scripts.usageModel.update({...e,account_id:r,script_name:i})),{successLabel:`Updated`});return}let o=d({usage_model:h(t[`usage-model`],`usage-model`,`text`),user_limits:{cpu_ms:t[`user-limits-cpu-ms`]}});f(await m(`Updating`,async()=>n.workers.scripts.usageModel.update({...o,account_id:r,script_name:i})),{successLabel:`Updated`})}},nn={command:`usage-model`,describe:`Operations for scripts.usage-model`,builder:e=>e.command($t).command(tn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},rn={command:`scripts`,describe:`Operations for scripts`,builder:e=>e.command(gt).command(vt).command(bt).command(Mt).command(Zt).command(lt).command(mt).command(Tt).command(At).command(Lt).command(Wt).command(Yt).command(nn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function an(e){return e.positional(`secret-name`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`url-encoded`,{type:`boolean`,description:`Flag that indicates whether the secret name is URL encoded.`}).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 on={command:`delete <secret-name>`,describe:`Remove a secret from a script.`,builder:an,handler:async t=>{let n={url_encoded:t[`url-encoded`]};if(t.dryRun){p({command:`cf workers secrets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/secrets/${t[`secret-name`]==null?`<secret-name>`:encodeURIComponent(String(t[`secret-name`]))}`,pathParams:{"script-name":String(t[`script-name`]??``),"secret-name":String(t[`secret-name`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),o=t.local?_:await a(r);t.accountId=o;let l=c({scriptName:t.worker});if(t.worker=l,!await i({force:!!t.force})){process.stderr.write(`Aborted.
17
+ `);return}f(await m(`Deleting`,async()=>r.workers.secrets.delete({account_id:o,script_name:l,secret_name:t[`secret-name`],...n})),{successLabel:`Deleted`})}};function sn(e){return e.positional(`secret-name`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`url-encoded`,{type:`boolean`,description:`Flag that indicates whether the secret name is URL encoded.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const cn={command:`get <secret-name>`,describe:`Get a given secret binding (value omitted) on a script.`,builder:sn,handler:async t=>{let n={url_encoded:t[`url-encoded`]};if(t.dryRun){p({command:`cf workers secrets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/secrets/${t[`secret-name`]==null?`<secret-name>`:encodeURIComponent(String(t[`secret-name`]))}`,pathParams:{"script-name":String(t[`script-name`]??``),"secret-name":String(t[`secret-name`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i;let o=c({scriptName:t.worker});t.worker=o,f(await m(`Loading`,async()=>r.workers.secrets.get({account_id:i,script_name:o,secret_name:t[`secret-name`],...n})),{successLabel:`Loaded`})}};function ln(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const un={command:`list`,describe:`List secrets bound to a script.`,builder:ln,handler:async t=>{if(t.dryRun){p({command:`cf workers secrets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/secrets`,pathParams:{"script-name":String(t[`script-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.secrets.list({account_id:r,script_name:i})),{successLabel:`Loaded`})}};function dn(e){return e.positional(`name`,{type:`string`,description:`A JavaScript variable name for the binding.`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script, used in URLs and route configuration.`}).option(`text`,{type:`string`,description:`The secret value to use.`}).option(`type`,{type:`string`,description:`The kind of resource that the binding provides.`,choices:[`secret_text`,`secret_key`],default:`secret_text`}).option(`format`,{type:`string`,description:`Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).`,choices:[`raw`,`pkcs8`,`spki`,`jwk`]}).option(`key-base64`,{type:`string`,description:'Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".'}).option(`usages`,{type:`string`,array:!0,description:`Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A secret value accessible through a binding.`}).conflicts(`text`,[`format`,`key-base64`,`usages`]).conflicts(`format`,[`text`]).implies(`format`,[`usages`]).conflicts(`key-base64`,[`text`]).conflicts(`usages`,[`text`]).implies(`usages`,[`format`])}const fn={command:`update <name>`,describe:`Add a secret to a script.`,builder:dn,handler:async r=>{if(r.dryRun){p({command:`cf workers secrets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${r.worker??`<worker>`}/secrets`,pathParams:{"script-name":String(r[`script-name`]??``)},bodyKind:`json`,body:r.body===void 0?d({text:h(r.text,`text`,`text`),type:h(r.type,`type`,`text`),format:h(r.format,`format`,`text`),key_base64:h(r[`key-base64`],`key-base64`,`text`),usages:r.usages,name:r.name}):l(r.body)});return}let i=await s(r),o=r.local?_:await a(i);r.accountId=o;let u=c({scriptName:r.worker});if(r.worker=u,r.body){let e=l(r.body);f(await m(`Updating`,async()=>i.workers.secrets.update({body:e,account_id:o,script_name:u})),{successLabel:`Updated`});return}r.type===void 0&&(r.type=await n(`type`,`The kind of resource that the binding provides.`,[`secret_text`,`secret_key`])),r.type===`secret_text`&&r.text===void 0&&(r.text=await t(`text`,`The secret value to use.`,{kind:`secret`,question:`Enter value for --text`})),r.type===`secret_key`&&r.format===void 0&&(r.format=await t(`format`,`Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).`,{question:`Enter value for --format`}));let g=d({text:h(r.text,`text`,`text`),type:h(r.type,`type`,`text`),format:h(r.format,`format`,`text`),key_base64:h(r[`key-base64`],`key-base64`,`text`),usages:r.usages,name:r.name});f(await m(`Updating`,async()=>i.workers.secrets.update({body:g,account_id:o,script_name:u})),{successLabel:`Updated`})}},pn={command:`secrets`,describe:`Operations for secrets`,builder:e=>e.command(on).command(cn).command(un).command(fn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function mn(e){return e.positional(`environment-name`,{type:`string`,description:`Optional environment if the Worker utilizes one.`,demandOption:!0}).option(`service-name`,{type:`string`,description:`Name of Worker to bind to.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const hn={command:`get <environment-name>`,describe:`Get script content from a worker with an environment.`,builder:mn,handler:async t=>{if(t.dryRun){p({command:`cf workers services environments content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/services/${t[`service-name`]==null?`<service-name>`:encodeURIComponent(String(t[`service-name`]))}/environments/${t[`environment-name`]==null?`<environment-name>`:encodeURIComponent(String(t[`environment-name`]))}/content`,pathParams:{"service-name":String(t[`service-name`]??``),"environment-name":String(t[`environment-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.services.environments.content.get({account_id:r,service_name:t[`service-name`],environment_name:t[`environment-name`]})),{successLabel:`Loaded`})}};function gn(e){return e.positional(`environment-name`,{type:`string`,description:`Optional environment if the Worker utilizes one.`,demandOption:!0}).option(`service-name`,{type:`string`,description:`Name of Worker to bind to.`,demandOption:!0}).option(`cf-worker-body-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.`}).option(`cf-worker-main-module-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`files`,{type:`string`,description:"An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`."}).option(`metadata`,{type:`string`,description:`JSON-encoded metadata about the uploaded parts and Worker configuration.`})}const _n={command:`update <environment-name>`,describe:`Put script content from a worker with an environment.`,builder:gn,handler:async t=>{let n={};if(t[`cf-worker-body-part`]!==void 0&&(n[`CF-WORKER-BODY-PART`]=String(t[`cf-worker-body-part`])),t[`cf-worker-main-module-part`]!==void 0&&(n[`CF-WORKER-MAIN-MODULE-PART`]=String(t[`cf-worker-main-module-part`])),t.dryRun){p({command:`cf workers services environments content update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/services/${t[`service-name`]==null?`<service-name>`:encodeURIComponent(String(t[`service-name`]))}/environments/${t[`environment-name`]==null?`<environment-name>`:encodeURIComponent(String(t[`environment-name`]))}/content`,pathParams:{"service-name":String(t[`service-name`]??``),"environment-name":String(t[`environment-name`]??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,files:t.files,metadata:t.metadata}});return}let r=await s(t),i=t.local?_:await a(r);if(t.accountId=i,t.file!==void 0||t.body!==void 0||t.files!==void 0||t.metadata!==void 0){let e=new FormData;if(t.file){let n=g(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.files!==void 0){let n=typeof t.files==`string`?h(t.files,`files`,`text`):t.files;e.append(`files`,typeof n==`string`?n:JSON.stringify(n))}if(t.metadata!==void 0){let n=typeof t.metadata==`string`?h(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}f(await m(`Updating`,async()=>o(r,`PUT`,`/accounts/${i}/workers/services/${encodeURIComponent(String(t[`service-name`]))}/environments/${encodeURIComponent(String(t[`environment-name`]))}/content`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}if(t.body){let e=h(t.body,`body`,`binary`);f(await m(`Updating`,async()=>o(r,`PUT`,`/accounts/${i}/workers/services/${encodeURIComponent(String(t[`service-name`]))}/environments/${encodeURIComponent(String(t[`environment-name`]))}/content`,{body:e,headers:{"Content-Type":`multipart/form-data`,...n}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},vn={command:`content`,describe:`Operations for services.environments.content`,builder:e=>e.command(hn).command(_n).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yn(e){return e.positional(`environment-name`,{type:`string`,description:`Optional environment if the Worker utilizes one.`,demandOption:!0}).option(`service-name`,{type:`string`,description:`Name of Worker to bind to.`,demandOption:!0}).option(`success`,{type:`boolean`,description:`Whether the API call was successful.`}).option(`result-logpush`,{type:`boolean`,description:`Whether Logpush is turned on for the Worker.`}).option(`result-observability-enabled`,{type:`boolean`,description:`Whether observability is enabled for the Worker.`}).option(`result-observability-head-sampling-rate`,{type:`number`,description:`The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.`}).option(`result-observability-logs-destinations`,{type:`string`,array:!0,description:`A list of destinations where logs will be exported to.`}).option(`result-observability-logs-enabled`,{type:`boolean`,description:`Whether logs are enabled for the Worker.`}).option(`result-observability-logs-head-sampling-rate`,{type:`number`,description:`The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.`}).option(`result-observability-logs-invocation-logs`,{type:`boolean`,description:`Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.`}).option(`result-observability-logs-persist`,{type:`boolean`,description:`Whether log persistence is enabled for the Worker.`}).option(`result-observability-traces-destinations`,{type:`string`,array:!0,description:`A list of destinations where traces will be exported to.`}).option(`result-observability-traces-enabled`,{type:`boolean`,description:`Whether traces are enabled for the Worker.`}).option(`result-observability-traces-head-sampling-rate`,{type:`number`,description:`The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.`}).option(`result-observability-traces-persist`,{type:`boolean`,description:`Whether trace persistence is enabled for the Worker.`}).option(`result-observability-traces-propagation-policy`,{type:`string`,description:`Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.`,choices:[`authenticated`,`accept`]}).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 bn={command:`edit <environment-name>`,describe:`Patch script metadata, such as bindings.`,builder:yn,handler:async t=>{if(t.dryRun){p({command:`cf workers services environments settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/services/${t[`service-name`]==null?`<service-name>`:encodeURIComponent(String(t[`service-name`]))}/environments/${t[`environment-name`]==null?`<environment-name>`:encodeURIComponent(String(t[`environment-name`]))}/settings`,pathParams:{"service-name":String(t[`service-name`]??``),"environment-name":String(t[`environment-name`]??``)},bodyKind:`json`,body:t.body===void 0?d({success:t.success,result:{logpush:t[`result-logpush`],observability:{enabled:t[`result-observability-enabled`],head_sampling_rate:t[`result-observability-head-sampling-rate`],logs:{destinations:t[`result-observability-logs-destinations`],enabled:t[`result-observability-logs-enabled`],head_sampling_rate:t[`result-observability-logs-head-sampling-rate`],invocation_logs:t[`result-observability-logs-invocation-logs`],persist:t[`result-observability-logs-persist`]},traces:{destinations:t[`result-observability-traces-destinations`],enabled:t[`result-observability-traces-enabled`],head_sampling_rate:t[`result-observability-traces-head-sampling-rate`],persist:t[`result-observability-traces-persist`],propagation_policy:h(t[`result-observability-traces-propagation-policy`],`result-observability-traces-propagation-policy`,`text`)}}}}):l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,t.body){let e=l(t.body);f(await m(`Updating`,async()=>n.workers.services.environments.settings.edit({...e,account_id:r,service_name:t[`service-name`],environment_name:t[`environment-name`]})),{successLabel:`Updated`});return}if(t.success===void 0)throw Error(`--success is required (or pass --body with this field set).`);if(t[`result-observability-enabled`]===void 0)throw Error(`--result-observability-enabled is required (or pass --body with this field set).`);if(t[`result-observability-logs-enabled`]===void 0)throw Error(`--result-observability-logs-enabled is required (or pass --body with this field set).`);if(t[`result-observability-logs-invocation-logs`]===void 0)throw Error(`--result-observability-logs-invocation-logs is required (or pass --body with this field set).`);let i=d({success:t.success,result:{logpush:t[`result-logpush`],observability:{enabled:t[`result-observability-enabled`],head_sampling_rate:t[`result-observability-head-sampling-rate`],logs:{destinations:t[`result-observability-logs-destinations`],enabled:t[`result-observability-logs-enabled`],head_sampling_rate:t[`result-observability-logs-head-sampling-rate`],invocation_logs:t[`result-observability-logs-invocation-logs`],persist:t[`result-observability-logs-persist`]},traces:{destinations:t[`result-observability-traces-destinations`],enabled:t[`result-observability-traces-enabled`],head_sampling_rate:t[`result-observability-traces-head-sampling-rate`],persist:t[`result-observability-traces-persist`],propagation_policy:h(t[`result-observability-traces-propagation-policy`],`result-observability-traces-propagation-policy`,`text`)}}}});f(await m(`Updating`,async()=>n.workers.services.environments.settings.edit({...i,account_id:r,service_name:t[`service-name`],environment_name:t[`environment-name`]})),{successLabel:`Updated`})}};function xn(e){return e.positional(`environment-name`,{type:`string`,description:`Optional environment if the Worker utilizes one.`,demandOption:!0}).option(`service-name`,{type:`string`,description:`Name of Worker to bind to.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Sn={command:`get <environment-name>`,describe:`Get script settings from a worker with an environment.`,builder:xn,handler:async t=>{if(t.dryRun){p({command:`cf workers services environments settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/services/${t[`service-name`]==null?`<service-name>`:encodeURIComponent(String(t[`service-name`]))}/environments/${t[`environment-name`]==null?`<environment-name>`:encodeURIComponent(String(t[`environment-name`]))}/settings`,pathParams:{"service-name":String(t[`service-name`]??``),"environment-name":String(t[`environment-name`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.services.environments.settings.get({account_id:r,service_name:t[`service-name`],environment_name:t[`environment-name`]})),{successLabel:`Loaded`})}},Cn={command:`settings`,describe:`Operations for services.environments.settings`,builder:e=>e.command(bn).command(Sn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},wn={command:`environments`,describe:`Operations for services.environments`,builder:e=>e.command(vn).command(Cn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Tn={command:`services`,describe:`Operations for services`,builder:e=>e.command(wn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function En(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const $={command:`delete`,describe:`Deletes a Workers subdomain for an account.`,builder:En,handler:async t=>{if(t.dryRun){p({command:`cf workers subdomains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/subdomain`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
18
+ `);return}f(await m(`Deleting`,async()=>n.workers.subdomains.delete({account_id:r})),{successLabel:`Deleted`})}};function Dn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const On={command:`get`,describe:`Returns a Workers subdomain for an account.`,builder:Dn,handler:async t=>{if(t.dryRun){p({command:`cf workers subdomains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/subdomain`,pathParams:{},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r,f(await m(`Loading`,async()=>n.workers.subdomains.get({account_id:r})),{successLabel:`Loaded`})}};function kn(e){return e.option(`subdomain`,{type:`string`,description:`The subdomain 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 An={command:`update`,describe:`Creates a Workers subdomain for an account.`,builder:kn,handler:async n=>{if(n.dryRun){p({command:`cf workers subdomains update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/subdomain`,pathParams:{},bodyKind:`json`,body:n.body===void 0?d({subdomain:h(n.subdomain,`subdomain`,`text`)}):l(n.body)});return}let r=await s(n),i=n.local?_:await a(r);if(n.accountId=i,n.body){let e=l(n.body);f(await m(`Updating`,async()=>r.workers.subdomains.update({body:e,account_id:i})),{successLabel:`Updated`});return}n.subdomain===void 0&&(n.subdomain=await t(`subdomain`,`The subdomain field`));let o=d({subdomain:h(n.subdomain,`subdomain`,`text`)});f(await m(`Updating`,async()=>r.workers.subdomains.update({body:o,account_id:i})),{successLabel:`Updated`})}},jn={command:`subdomains`,describe:`Operations for subdomains`,builder:e=>e.command($).command(On).command(An).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mn(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script.`}).option(`bindings-inherit`,{type:`string`,description:'When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.',choices:[`strict`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`files`,{type:`string`,description:"An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`."}).option(`metadata`,{type:`string`,description:`JSON-encoded metadata about the uploaded parts and Worker configuration.`})}const Nn={command:`create`,describe:`Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.`,builder:Mn,handler:async t=>{let n={bindings_inherit:t[`bindings-inherit`]};if(t.dryRun){p({command:`cf workers versions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/versions`,pathParams:{"script-name":String(t[`script-name`]??``)},query:n,bodyKind:`multipart`,body:{body:t.body,file:t.file,files:t.files,metadata:t.metadata}});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i;let l=c({scriptName:t.worker});if(t.worker=l,t.file!==void 0||t.body!==void 0||t.files!==void 0||t.metadata!==void 0){let e=new FormData;if(t.file){let n=g(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.files!==void 0){let n=typeof t.files==`string`?h(t.files,`files`,`text`):t.files;e.append(`files`,typeof n==`string`?n:JSON.stringify(n))}if(t.metadata!==void 0){let n=typeof t.metadata==`string`?h(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}f(await m(`Creating`,async()=>o(r,`POST`,`/accounts/${i}/workers/scripts/${l}/versions`,{body:e})),{successLabel:`Created`});return}if(t.body){let e=h(t.body,`body`,`binary`),a=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();f(await m(`Creating`,async()=>o(r,`POST`,`/accounts/${i}/workers/scripts/${l}/versions${a?`?`+a:``}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Pn(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fn={command:`get <version-id>`,describe:`Retrieves detailed information about a specific version of a Workers script.`,builder:Pn,handler:async t=>{if(t.dryRun){p({command:`cf workers versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/versions/${t[`version-id`]==null?`<version-id>`:encodeURIComponent(String(t[`version-id`]))}`,pathParams:{"script-name":String(t[`script-name`]??``),"version-id":String(t[`version-id`]??``)},bodyKind:`none`});return}let n=await s(t),r=t.local?_:await a(n);t.accountId=r;let i=c({scriptName:t.worker});t.worker=i,f(await m(`Loading`,async()=>n.workers.versions.get({account_id:r,script_name:i,version_id:t[`version-id`]})),{successLabel:`Loaded`})}};function In(e){return e.option(`worker`,{type:`string`,alias:`script-name`,description:`Name of the script.`}).option(`deployable`,{type:`boolean`,description:`Only return versions that can be used in a deployment. Ignores pagination.`}).option(`page`,{type:`number`,description:`Current page.`}).option(`per-page`,{type:`number`,description:`Items per-page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ln={command:`list`,describe:`List of Worker Versions. The first version in the list is the latest version.`,builder:In,handler:async t=>{let n={deployable:t.deployable,page:t.page,per_page:t[`per-page`]};if(t.dryRun){p({command:`cf workers versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/scripts/${t.worker??`<worker>`}/versions`,pathParams:{"script-name":String(t[`script-name`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?_:await a(r);t.accountId=i;let o=c({scriptName:t.worker});t.worker=o,f(await m(`Loading`,async()=>r.workers.versions.list({account_id:i,script_name:o,...n})),{successLabel:`Loaded`})}},Rn={command:`versions`,describe:`Operations for versions`,builder:e=>e.command(Nn).command(Fn).command(Ln).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function zn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Data for setting flag on zones`})}const Bn={command:`edit`,describe:`Allows an account admin to set the can_be_enabled setting on a list of zones.`,builder:zn,handler:async t=>{if(t.dryRun){p({command:`cf workers zones-can-be-enabled edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/zones_can_be_enabled`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,t.body){let e=l(t.body);f(await m(`Updating`,async()=>n.workers.zonesCanBeEnabled.edit({body:e,account_id:r})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Vn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Data for setting flag on zones`})}const Hn={command:`create`,describe:`Provided a list of pay-per-crawl configured zones this method will return whether they can enable PPC or not.`,builder:Vn,handler:async t=>{if(t.dryRun){p({command:`cf workers zones-can-be-enabled query create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pay-per-crawl/zones_can_be_enabled/query`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:l(t.body)});return}let n=await s(t),r=t.local?_:await a(n);if(t.accountId=r,t.body){let e=l(t.body);f(await m(`Creating`,async()=>n.workers.zonesCanBeEnabled.query.create({body:e,account_id:r})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},Un={command:`query`,describe:`Zones Can Be Enabled operations`,builder:e=>e.command(Hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Wn={command:`zones-can-be-enabled`,describe:`Zones Can Be Enabled operations`,builder:e=>e.command(Bn).command(Un).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Gn={command:`workers`,describe:`Deploy and manage serverless JavaScript/WASM applications on Cloudflare's global network`,builder:e=>e.command(C).command(D).command(X).command(oe).command(me).command(Ce).command(Me).command(Ie).command(We).command(Je).command(at).command(rn).command(pn).command(Tn).command(jn).command(Rn).command(Wn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Gn as default};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{t as p}from"./cli-types-CRIDdDw3.mjs";function m(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 h={command:`cancel <build-uuid>`,describe:`Cancel a running or queued build`,builder:m,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds builds cancel`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/${t[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(t[`build-uuid`]))}/cancel`,pathParams:{"build-uuid":String(t[`build-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Updating`,async()=>n.workersBuilds.builds.cancel({account_id:r,build_uuid:t[`build-uuid`]})),{successLabel:`Updated`})}};function ee(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 g={command:`get <build-uuid>`,describe:`Retrieve detailed information about a specific build`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds builds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/${t[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(t[`build-uuid`]))}`,pathParams:{"build-uuid":String(t[`build-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.builds.get({account_id:r,build_uuid:t[`build-uuid`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`external-script-id`,{type:`string`,description:`System-generated worker script tag.`,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 v={command:`list`,describe:`Get all builds for a specific worker script with pagination`,builder:_,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf workers-builds builds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/workers/${t[`external-script-id`]==null?`<external-script-id>`:encodeURIComponent(String(t[`external-script-id`]))}/builds`,pathParams:{"external-script-id":String(t[`external-script-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.builds.list({account_id:o,external_script_id:t[`external-script-id`],...n})),{successLabel:`Loaded`})}};function y(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 b={command:`get <build-uuid>`,describe:`Retrieve logs for a specific build with cursor-based pagination`,builder:y,handler:async t=>{let n={cursor:t.cursor};if(t.dryRun){l({command:`cf workers-builds builds logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/${t[`build-uuid`]==null?`<build-uuid>`:encodeURIComponent(String(t[`build-uuid`]))}/logs`,pathParams:{"build-uuid":String(t[`build-uuid`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.builds.logs.get({account_id:o,build_uuid:t[`build-uuid`],...n})),{successLabel:`Loaded`})}},x={command:`logs`,describe:`Operations for builds.logs`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`builds`,describe:`Operations for builds`,builder:e=>e.command(h).command(g).command(v).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get-account-limits`,describe:`Retrieve account limits and usage information`,builder:C,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds get-account-limits`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/account/limits`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.getAccountLimits({account_id:r})),{successLabel:`Loaded`})}};function T(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 E={command:`get-builds-by-version`,describe:`Retrieve builds for specific version IDs`,builder:T,handler:async t=>{let n={version_ids:t[`version-ids`]};if(t.dryRun){l({command:`cf workers-builds get-builds-by-version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.getBuildsByVersion({account_id:o,...n})),{successLabel:`Loaded`})}};function D(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 O={command:`get-latest-builds`,describe:`Retrieve the most recent builds for multiple worker scripts`,builder:D,handler:async t=>{let n={external_script_ids:t[`external-script-ids`]};if(t.dryRun){l({command:`cf workers-builds get-latest-builds`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/builds/latest`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.getLatestBuilds({account_id:o,...n})),{successLabel:`Loaded`})}};function k(e){return e.positional(`repo-id`,{type:`string`,description:`Repository identifier.`,demandOption:!0}).option(`provider-type`,{type:`string`,description:`SCM provider type`,demandOption:!0}).option(`provider-account-id`,{type:`string`,description:`Provider account identifier.`,demandOption:!0}).option(`branch`,{type:`string`,description:`Git branch name.`,demandOption:!0}).option(`root-directory`,{type:`string`,description:`Root directory path.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get <repo-id>`,describe:`Analyze repository for automatic configuration detection`,builder:p(k),handler:async t=>{let n={branch:t.branch,root_directory:t[`root-directory`]};if(t.dryRun){l({command:`cf workers-builds repos config-autofill get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/repos/${t[`provider-type`]==null?`<provider-type>`:encodeURIComponent(String(t[`provider-type`]))}/${t[`provider-account-id`]==null?`<provider-account-id>`:encodeURIComponent(String(t[`provider-account-id`]))}/${t[`repo-id`]==null?`<repo-id>`:encodeURIComponent(String(t[`repo-id`]))}/config_autofill`,pathParams:{"provider-type":String(t[`provider-type`]??``),"provider-account-id":String(t[`provider-account-id`]??``),"repo-id":String(t[`repo-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.repos.configAutofill.get({account_id:o,provider_type:t[`provider-type`],provider_account_id:t[`provider-account-id`],repo_id:t[`repo-id`],...n})),{successLabel:`Loaded`})}},j={command:`config-autofill`,describe:`Operations for repos.config-autofill`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(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 N={command:`delete <repo-connection-uuid>`,describe:`Remove a repository connection`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds repos connections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/repos/connections/${t[`repo-connection-uuid`]==null?`<repo-connection-uuid>`:encodeURIComponent(String(t[`repo-connection-uuid`]))}`,pathParams:{"repo-connection-uuid":String(t[`repo-connection-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>n.workersBuilds.repos.connections.delete({account_id:o,repo_connection_uuid:t[`repo-connection-uuid`]})),{successLabel:`Deleted`})}};function P(e){return e.option(`provider-account-id`,{type:`string`,description:`Provider account identifier.`}).option(`provider-account-name`,{type:`string`,description:`The provider_account_name field`}).option(`provider-type`,{type:`string`,description:`The provider_type field`,choices:[`github`,`gitlab`,`gitlab_internal`]}).option(`repo-id`,{type:`string`,description:`Repository identifier.`}).option(`repo-name`,{type:`string`,description:`The repo_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const F={command:`upsert`,describe:`Upsert a repository connection for CI/CD integration`,builder:P,handler:async r=>{if(r.dryRun){l({command:`cf workers-builds repos connections upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/repos/connections`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({provider_account_id:d(r[`provider-account-id`],`provider-account-id`,`text`),provider_account_name:d(r[`provider-account-name`],`provider-account-name`,`text`),provider_type:d(r[`provider-type`],`provider-type`,`text`),repo_id:d(r[`repo-id`],`repo-id`,`text`),repo_name:d(r[`repo-name`],`repo-name`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Updating`,async()=>p.workersBuilds.repos.connections.upsert({...e,account_id:m})),{successLabel:`Updated`});return}r[`provider-account-id`]===void 0&&(r[`provider-account-id`]=await t(`provider-account-id`,`Provider account identifier.`)),r[`provider-account-name`]===void 0&&(r[`provider-account-name`]=await t(`provider-account-name`,`The provider_account_name field`)),r[`provider-type`]===void 0&&(r[`provider-type`]=await n(`provider-type`,`The provider_type field`,[`github`,`gitlab`,`gitlab_internal`])),r[`repo-id`]===void 0&&(r[`repo-id`]=await t(`repo-id`,`Repository identifier.`)),r[`repo-name`]===void 0&&(r[`repo-name`]=await t(`repo-name`,`The repo_name field`));let h=s({provider_account_id:d(r[`provider-account-id`],`provider-account-id`,`text`),provider_account_name:d(r[`provider-account-name`],`provider-account-name`,`text`),provider_type:d(r[`provider-type`],`provider-type`,`text`),repo_id:d(r[`repo-id`],`repo-id`,`text`),repo_name:d(r[`repo-name`],`repo-name`,`text`)});c(await u(`Updating`,async()=>p.workersBuilds.repos.connections.upsert({...h,account_id:m})),{successLabel:`Updated`})}},I={command:`connections`,describe:`Operations for repos.connections`,builder:e=>e.command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`repos`,describe:`Operations for repos`,builder:e=>e.command(j).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(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 z={command:`create`,describe:`Create a new build authentication token`,builder:R,handler:async n=>{if(n.dryRun){l({command:`cf workers-builds tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/tokens`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({build_token_name:d(n[`build-token-name`],`build-token-name`,`text`),build_token_secret:d(n[`build-token-secret`],`build-token-secret`,`text`),cloudflare_token_id:d(n[`cloudflare-token-id`],`cloudflare-token-id`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.workersBuilds.tokens.create({...e,account_id:p})),{successLabel:`Created`});return}n[`build-token-name`]===void 0&&(n[`build-token-name`]=await t(`build-token-name`,`The build_token_name field`)),n[`build-token-secret`]===void 0&&(n[`build-token-secret`]=await t(`build-token-secret`,`The build_token_secret field`)),n[`cloudflare-token-id`]===void 0&&(n[`cloudflare-token-id`]=await t(`cloudflare-token-id`,`The cloudflare_token_id field`));let m=s({build_token_name:d(n[`build-token-name`],`build-token-name`,`text`),build_token_secret:d(n[`build-token-secret`],`build-token-secret`,`text`),cloudflare_token_id:d(n[`cloudflare-token-id`],`cloudflare-token-id`,`text`)});c(await u(`Creating`,async()=>r.workersBuilds.tokens.create({...m,account_id:p})),{successLabel:`Created`})}};function te(e){return e.positional(`build-token-uuid`,{type:`string`,description:`Build token 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 B={command:`delete <build-token-uuid>`,describe:`Remove a build authentication token`,builder:te,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/tokens/${t[`build-token-uuid`]==null?`<build-token-uuid>`:encodeURIComponent(String(t[`build-token-uuid`]))}`,pathParams:{"build-token-uuid":String(t[`build-token-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>n.workersBuilds.tokens.delete({account_id:o,build_token_uuid:t[`build-token-uuid`]})),{successLabel:`Deleted`})}};function V(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 H={command:`list`,describe:`Get all build tokens with pagination`,builder:V,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf workers-builds tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.workersBuilds.tokens.list({account_id:o,...n})),{successLabel:`Loaded`})}},U={command:`tokens`,describe:`Operations for tokens`,builder:e=>e.command(z).command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`seed-repo-branch`,{type:`string`,description:`Git branch name.`}).option(`seed-repo-owner`,{type:`string`,description:`The seed_repo.owner field`}).option(`seed-repo-path`,{type:`string`,description:`The seed_repo.path field`}).option(`seed-repo-provider`,{type:`string`,description:`The seed_repo.provider field`,choices:[`github`,`gitlab`,`gitlab_internal`]}).option(`seed-repo-repository`,{type:`string`,description:`The seed_repo.repository field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`seed-repo-branch`,`seed-repo-owner`,`seed-repo-path`,`seed-repo-provider`,`seed-repo-repository`].some(t=>e[t]!==void 0)){let t=[`seed-repo-branch`,`seed-repo-owner`,`seed-repo-path`,`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-build <trigger-uuid>`,describe:`Trigger a manual build for a specific trigger`,builder:W,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers create-build`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/builds`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`json`,body:t.body===void 0?s({seed_repo:{branch:d(t[`seed-repo-branch`],`seed-repo-branch`,`text`),owner:d(t[`seed-repo-owner`],`seed-repo-owner`,`text`),path:d(t[`seed-repo-path`],`seed-repo-path`,`text`),provider:d(t[`seed-repo-provider`],`seed-repo-provider`,`text`),repository:d(t[`seed-repo-repository`],`seed-repo-repository`,`text`)}}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.workersBuilds.triggers.createBuild({...e,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Created`});return}let p=s({seed_repo:{branch:d(t[`seed-repo-branch`],`seed-repo-branch`,`text`),owner:d(t[`seed-repo-owner`],`seed-repo-owner`,`text`),path:d(t[`seed-repo-path`],`seed-repo-path`,`text`),provider:d(t[`seed-repo-provider`],`seed-repo-provider`,`text`),repository:d(t[`seed-repo-repository`],`seed-repo-repository`,`text`)}});c(await u(`Creating`,async()=>n.workersBuilds.triggers.createBuild({...p,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Created`})}};function K(e){return e.option(`branch-excludes`,{type:`string`,array:!0,description:`The branch_excludes field`}).option(`branch-includes`,{type:`string`,array:!0,description:`The branch_includes field`}).option(`build-caching-enabled`,{type:`boolean`,description:`The build_caching_enabled field`,default:!1}).option(`build-command`,{type:`string`,description:`The build_command field`}).option(`build-token-uuid`,{type:`string`,description:`Build token UUID.`}).option(`deploy-command`,{type:`string`,description:`The deploy_command field`}).option(`external-script-id`,{type:`string`,description:`System-generated worker script tag.`}).option(`path-excludes`,{type:`string`,array:!0,description:`The path_excludes field`}).option(`path-includes`,{type:`string`,array:!0,description:`The path_includes field`}).option(`repo-connection-uuid`,{type:`string`,description:`Repository connection UUID.`}).option(`root-directory`,{type:`string`,description:`Root directory path.`}).option(`trigger-name`,{type:`string`,description:`The trigger_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const q={command:`create`,describe:`Create a new CI/CD trigger`,builder:K,handler:async n=>{if(n.dryRun){l({command:`cf workers-builds triggers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({branch_excludes:n[`branch-excludes`],branch_includes:n[`branch-includes`],build_caching_enabled:n[`build-caching-enabled`],build_command:d(n[`build-command`],`build-command`,`text`),build_token_uuid:d(n[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(n[`deploy-command`],`deploy-command`,`text`),external_script_id:d(n[`external-script-id`],`external-script-id`,`text`),path_excludes:n[`path-excludes`],path_includes:n[`path-includes`],repo_connection_uuid:d(n[`repo-connection-uuid`],`repo-connection-uuid`,`text`),root_directory:d(n[`root-directory`],`root-directory`,`text`),trigger_name:d(n[`trigger-name`],`trigger-name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.workersBuilds.triggers.create({...e,account_id:p})),{successLabel:`Created`});return}if(n[`branch-excludes`]===void 0)throw Error(`--branch-excludes is required (or pass --body with this field set).`);if(n[`branch-includes`]===void 0)throw Error(`--branch-includes is required (or pass --body with this field set).`);if(n[`build-command`]===void 0&&(n[`build-command`]=await t(`build-command`,`The build_command field`)),n[`build-token-uuid`]===void 0&&(n[`build-token-uuid`]=await t(`build-token-uuid`,`Build token UUID.`)),n[`deploy-command`]===void 0&&(n[`deploy-command`]=await t(`deploy-command`,`The deploy_command field`)),n[`external-script-id`]===void 0&&(n[`external-script-id`]=await t(`external-script-id`,`System-generated worker script tag.`)),n[`path-excludes`]===void 0)throw Error(`--path-excludes is required (or pass --body with this field set).`);if(n[`path-includes`]===void 0)throw Error(`--path-includes is required (or pass --body with this field set).`);n[`repo-connection-uuid`]===void 0&&(n[`repo-connection-uuid`]=await t(`repo-connection-uuid`,`Repository connection UUID.`)),n[`root-directory`]===void 0&&(n[`root-directory`]=await t(`root-directory`,`Root directory path.`)),n[`trigger-name`]===void 0&&(n[`trigger-name`]=await t(`trigger-name`,`The trigger_name field`));let m=s({branch_excludes:n[`branch-excludes`],branch_includes:n[`branch-includes`],build_caching_enabled:n[`build-caching-enabled`],build_command:d(n[`build-command`],`build-command`,`text`),build_token_uuid:d(n[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(n[`deploy-command`],`deploy-command`,`text`),external_script_id:d(n[`external-script-id`],`external-script-id`,`text`),path_excludes:n[`path-excludes`],path_includes:n[`path-includes`],repo_connection_uuid:d(n[`repo-connection-uuid`],`repo-connection-uuid`,`text`),root_directory:d(n[`root-directory`],`root-directory`,`text`),trigger_name:d(n[`trigger-name`],`trigger-name`,`text`)});c(await u(`Creating`,async()=>r.workersBuilds.triggers.create({...m,account_id:p})),{successLabel:`Created`})}};function J(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 Y={command:`delete <trigger-uuid>`,describe:`Remove a CI/CD trigger`,builder:J,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}c(await u(`Deleting`,async()=>n.workersBuilds.triggers.delete({account_id:o,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Deleted`})}};function X(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 Z={command:`delete <environment-variable-key>`,describe:`Remove a specific environment variable from a trigger`,builder:X,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers environment-variables delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/environment_variables/${t[`environment-variable-key`]==null?`<environment-variable-key>`:encodeURIComponent(String(t[`environment-variable-key`]))}`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``),"environment-variable-key":String(t[`environment-variable-key`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
6
+ `);return}c(await u(`Deleting`,async()=>n.workersBuilds.triggers.environmentVariables.delete({account_id:o,trigger_uuid:t[`trigger-uuid`],environment_variable_key:t[`environment-variable-key`]})),{successLabel:`Deleted`})}};function Q(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 ne={command:`list`,describe:`Get all environment variables for a trigger`,builder:Q,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers environment-variables list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/environment_variables`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.triggers.environmentVariables.list({account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Loaded`})}};function re(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:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`upsert <trigger-uuid>`,describe:`Create or update environment variables for a trigger`,builder:re,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers environment-variables upsert`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/environment_variables`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.workersBuilds.triggers.environmentVariables.upsert({body:e,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ae={command:`environment-variables`,describe:`Operations for triggers.environment-variables`,builder:e=>e.command(Z).command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`external-script-id`,{type:`string`,description:`System-generated worker script tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Get all triggers for a specific worker script`,builder:oe,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/workers/${t[`external-script-id`]==null?`<external-script-id>`:encodeURIComponent(String(t[`external-script-id`]))}/triggers`,pathParams:{"external-script-id":String(t[`external-script-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.workersBuilds.triggers.list({account_id:r,external_script_id:t[`external-script-id`]})),{successLabel:`Loaded`})}};function se(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 ce={command:`purge-cache <trigger-uuid>`,describe:`Clear the build cache for a specific trigger`,builder:se,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}/purge_build_cache`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force,message:`This operation wipes the workers-build cache.`})){process.stderr.write(`Aborted.
7
+ `);return}c(await u(`Deleting`,async()=>n.workersBuilds.triggers.purgeCache({account_id:o,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Deleted`})}};function le(e){return e.positional(`trigger-uuid`,{type:`string`,description:`Trigger UUID.`,demandOption:!0}).option(`branch-excludes`,{type:`string`,array:!0,description:`The branch_excludes field`}).option(`branch-includes`,{type:`string`,array:!0,description:`The branch_includes field`}).option(`build-caching-enabled`,{type:`boolean`,description:`The build_caching_enabled field`}).option(`build-command`,{type:`string`,description:`The build_command field`}).option(`build-token-uuid`,{type:`string`,description:`Build token UUID.`}).option(`deploy-command`,{type:`string`,description:`The deploy_command field`}).option(`path-excludes`,{type:`string`,array:!0,description:`The path_excludes field`}).option(`path-includes`,{type:`string`,array:!0,description:`The path_includes field`}).option(`root-directory`,{type:`string`,description:`Root directory path.`}).option(`trigger-name`,{type:`string`,description:`The trigger_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`update <trigger-uuid>`,describe:`Update an existing CI/CD trigger`,builder:le,handler:async t=>{if(t.dryRun){l({command:`cf workers-builds triggers update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/builds/triggers/${t[`trigger-uuid`]==null?`<trigger-uuid>`:encodeURIComponent(String(t[`trigger-uuid`]))}`,pathParams:{"trigger-uuid":String(t[`trigger-uuid`]??``)},bodyKind:`json`,body:t.body===void 0?s({branch_excludes:t[`branch-excludes`],branch_includes:t[`branch-includes`],build_caching_enabled:t[`build-caching-enabled`],build_command:d(t[`build-command`],`build-command`,`text`),build_token_uuid:d(t[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(t[`deploy-command`],`deploy-command`,`text`),path_excludes:t[`path-excludes`],path_includes:t[`path-includes`],root_directory:d(t[`root-directory`],`root-directory`,`text`),trigger_name:d(t[`trigger-name`],`trigger-name`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.workersBuilds.triggers.update({...e,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Updated`});return}let p=s({branch_excludes:t[`branch-excludes`],branch_includes:t[`branch-includes`],build_caching_enabled:t[`build-caching-enabled`],build_command:d(t[`build-command`],`build-command`,`text`),build_token_uuid:d(t[`build-token-uuid`],`build-token-uuid`,`text`),deploy_command:d(t[`deploy-command`],`deploy-command`,`text`),path_excludes:t[`path-excludes`],path_includes:t[`path-includes`],root_directory:d(t[`root-directory`],`root-directory`,`text`),trigger_name:d(t[`trigger-name`],`trigger-name`,`text`)});c(await u(`Updating`,async()=>n.workersBuilds.triggers.update({...p,account_id:r,trigger_uuid:t[`trigger-uuid`]})),{successLabel:`Updated`})}},de={command:`triggers`,describe:`Operations for triggers`,builder:e=>e.command(q).command(G).command(Y).command($).command(ce).command(ue).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`workers-builds`,describe:`Automated build and deployment pipeline for Workers — track builds, logs, and repo connections`,builder:e=>e.command(w).command(E).command(O).command(S).command(L).command(U).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{fe as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";import{t as m}from"./cli-types-CRIDdDw3.mjs";function h(e){return e.positional(`workflow-name`,{type:`string`,description:`Workflow name`,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 g={command:`delete <workflow-name>`,describe:`Deletes a Workflow. This only deletes the Workflow and does not delete or modify any Worker associated to this Workflow or bounded to it.`,builder:h,handler:async t=>{if(t.dryRun){u({command:`cf workflows delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}l(await d(`Deleting`,async()=>n.workflows.delete({account_id:a,workflow_name:t[`workflow-name`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <workflow-name>`,describe:`Retrieves configuration and metadata for a specific workflow.`,builder:_,handler:async t=>{if(t.dryRun){u({command:`cf workflows get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.workflows.get({account_id:r,workflow_name:t[`workflow-name`]})),{successLabel:`Loaded`})}};function y(e){return e.positional(`workflow-name`,{type:`string`,description:`Workflow name`,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 b={command:`batch-terminate <workflow-name>`,describe:`Terminates multiple workflow instances in a single batch operation.`,builder:y,handler:async t=>{if(t.dryRun){u({command:`cf workflows instances batch-terminate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances/batch/terminate`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),c=t.local?p:await i(n);if(t.accountId=c,!await r({force:!!t.force,message:`This operation terminates running instances in bulk.`})){process.stderr.write(`Aborted.
4
+ `);return}if(t.body){let e=s(t.body);if(Array.isArray(e)&&e.length>100){let r=Math.ceil(e.length/100),i=null;for(let o=0;o<e.length;o+=100){let s=e.slice(o,o+100);i=await d(`Deleting: batch ${Math.floor(o/100)+1}/${r}`,async()=>a(n,`POST`,`/accounts/${c}/workflows/${encodeURIComponent(String(t[`workflow-name`]))}/instances/batch/terminate`,{body:s}))}l(i,{successLabel:`Deleted`});return}l(await d(`Deleting`,async()=>a(n,`POST`,`/accounts/${c}/workflows/${encodeURIComponent(String(t[`workflow-name`]))}/instances/batch/terminate`,{body:e})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function x(e){return e.option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`bulk`,describe:`Creates multiple workflow instances in a single batch operation.`,builder:x,handler:async t=>{if(t.dryRun){u({command:`cf workflows instances bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances/batch`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);if(Array.isArray(e)&&e.length>100){let i=Math.ceil(e.length/100),o=null;for(let s=0;s<e.length;s+=100){let c=e.slice(s,s+100);o=await d(`Creating: batch ${Math.floor(s/100)+1}/${i}`,async()=>a(n,`POST`,`/accounts/${r}/workflows/${encodeURIComponent(String(t[`workflow-name`]))}/instances/batch`,{body:c}))}l(o,{successLabel:`Created`});return}l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/workflows/${encodeURIComponent(String(t[`workflow-name`]))}/instances/batch`,{body:e})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function C(e){return e.positional(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`The instance_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 w={command:`create <workflow-name>`,describe:`Creates a new instance of a workflow, starting its execution.`,builder:C,handler:async t=>{if(t.dryRun){u({command:`cf workflows instances create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},bodyKind:`json`,body:t.body===void 0?c({instance_id:f(t[`instance-id`],`instance-id`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.workflows.instances.create({...e,account_id:r,workflow_name:t[`workflow-name`]})),{successLabel:`Created`});return}let a=c({instance_id:f(t[`instance-id`],`instance-id`,`text`)});l(await d(`Creating`,async()=>n.workflows.instances.create({...a,account_id:r,workflow_name:t[`workflow-name`]})),{successLabel:`Created`})}};function T(e){return e.positional(`event-type`,{type:`string`,description:`Event type`,demandOption:!0}).option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`instance-id`,{type:`string`,description:"Instance identifier. User-created instances match `^[a-zA-Z0-9_][a-zA-Z0-9-_]*$` (max 100 characters); cron-triggered instances can use a longer, system-generated id derived from the cron expression.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`create <event-type>`,describe:`Sends an event to a running workflow instance to trigger state transitions.`,builder:T,handler:async t=>{if(t.dryRun){u({command:`cf workflows instances events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/events/${t[`event-type`]==null?`<event-type>`:encodeURIComponent(String(t[`event-type`]))}`,pathParams:{"workflow-name":String(t[`workflow-name`]??``),"instance-id":String(t[`instance-id`]??``),"event-type":String(t[`event-type`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Creating`,async()=>n.workflows.instances.events.create({account_id:r,workflow_name:t[`workflow-name`],instance_id:t[`instance-id`],event_type:t[`event-type`]})),{successLabel:`Created`})}},D={command:`events`,describe:`Workflow instance operations`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`instance-id`,{type:`string`,description:"Instance identifier. User-created instances match `^[a-zA-Z0-9_][a-zA-Z0-9-_]*$` (max 100 characters); cron-triggered instances can use a longer, system-generated id derived from the cron expression.",demandOption:!0}).option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`simple`,{type:`string`,description:`When true, omits step details and returns only metadata with step_count.`,choices:[`true`,`false`]}).option(`order`,{type:`string`,description:`Step ordering: "asc" (default, oldest first) or "desc" (newest first).`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <instance-id>`,describe:`Retrieves logs and execution status for a specific workflow instance.`,builder:m(O),handler:async t=>{let n={simple:t.simple,order:t.order};if(t.dryRun){u({command:`cf workflows instances get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"workflow-name":String(t[`workflow-name`]??``),"instance-id":String(t[`instance-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.workflows.instances.get({account_id:a,workflow_name:t[`workflow-name`],instance_id:t[`instance-id`],...n})),{successLabel:`Loaded`})}};function A(e){return e.option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`page`,{type:`number`,description:"Deprecated: use `cursor` for pagination instead."}).option(`per-page`,{type:`number`,description:`Per page`}).option(`cursor`,{type:`string`,description:"Opaque token for cursor-based pagination. Mutually exclusive with `page`."}).option(`direction`,{type:`string`,description:`Defines the direction for cursor-based pagination.`,choices:[`asc`,`desc`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`paused`,`errored`,`terminated`,`complete`,`waitingForPause`,`waiting`,`rollingBack`]}).option(`date-start`,{type:`string`,description:`Accepts ISO 8601 with no timezone offsets and in UTC.`}).option(`date-end`,{type:`string`,description:`Accepts ISO 8601 with no timezone offsets and in UTC.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Lists all instances of a workflow with their execution status.`,builder:m(A),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],cursor:t.cursor,direction:t.direction,status:t.status,date_start:t[`date-start`],date_end:t[`date-end`]};if(t.dryRun){u({command:`cf workflows instances list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.workflows.instances.list({account_id:a,workflow_name:t[`workflow-name`],...n})),{successLabel:`Loaded`})}};function M(e){return e.positional(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`status-terminate <workflow-name>`,describe:`Gets the status of a bulk workflow instance termination job.`,builder:M,handler:async t=>{if(t.dryRun){u({command:`cf workflows instances status-terminate`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances/terminate`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.workflows.instances.statusTerminate({account_id:r,workflow_name:t[`workflow-name`]})),{successLabel:`Loaded`})}};function P(e){return e.positional(`instance-id`,{type:`string`,description:"Instance identifier. User-created instances match `^[a-zA-Z0-9_][a-zA-Z0-9-_]*$` (max 100 characters); cron-triggered instances can use a longer, system-generated id derived from the cron expression.",demandOption:!0}).option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`status`,{type:`string`,description:`The status field`,choices:[`pause`,`resume`,`terminate`,`restart`]}).option(`rollback`,{type:`boolean`,description:`Run rollback before terminating.`}).option(`from-count`,{type:`number`,description:`The from.count field`}).option(`from-name`,{type:`string`,description:`The from.name field`}).option(`from-type`,{type:`string`,description:`The from.type field`,choices:[`do`,`sleep`,`waitForEvent`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`rollback`,[`from-count`,`from-name`,`from-type`]).conflicts(`from-count`,[`rollback`]).conflicts(`from-name`,[`rollback`]).conflicts(`from-type`,[`rollback`]).check(e=>{if([`from-count`,`from-name`,`from-type`].some(t=>e[t]!==void 0)){let t={"from-name":[`rollback`]},n=[`from-name`].filter(n=>e[n]===void 0&&!(t[n]??[]).some(t=>e[t]!==void 0));if(n.length>0)throw Error(`${n.map(e=>`--`+e).join(`, `)} ${n.length===1?`is`:`are`} required when any --from-* flag is set`)}return!0})}const F={command:`edit <instance-id>`,describe:`Changes the execution status of a workflow instance (e.g., pause, resume, terminate).`,builder:P,handler:async t=>{if(t.dryRun){u({command:`cf workflows instances status edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/status`,pathParams:{"workflow-name":String(t[`workflow-name`]??``),"instance-id":String(t[`instance-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({status:f(t.status,`status`,`text`),rollback:t.rollback,from:{count:t[`from-count`],name:f(t[`from-name`],`from-name`,`text`),type:f(t[`from-type`],`from-type`,`text`)}}):s(t.body)});return}let r=await o(t),a=t.local?p:await i(r);if(t.accountId=a,t.body){let e=s(t.body);l(await d(`Updating`,async()=>r.workflows.instances.status.edit({body:e,account_id:a,workflow_name:t[`workflow-name`],instance_id:t[`instance-id`]})),{successLabel:`Updated`});return}t.status===void 0&&(t.status=await n(`status`,`The status field`,[`pause`,`resume`,`terminate`,`restart`]));let m=c({status:f(t.status,`status`,`text`),rollback:t.rollback,from:{count:t[`from-count`],name:f(t[`from-name`],`from-name`,`text`),type:f(t[`from-type`],`from-type`,`text`)}});l(await d(`Updating`,async()=>r.workflows.instances.status.edit({body:m,account_id:a,workflow_name:t[`workflow-name`],instance_id:t[`instance-id`]})),{successLabel:`Updated`})}},I={command:`status`,describe:`Workflow instance operations`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`instances`,describe:`Workflow instance operations`,builder:e=>e.command(b).command(S).command(w).command(k).command(j).command(N).command(D).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`per-page`,{type:`number`,description:`Per page`}).option(`page`,{type:`number`,description:`Page`}).option(`search`,{type:`string`,description:"Allows filtering workflows` name."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`Lists all workflows configured for the account.`,builder:R,handler:async t=>{let n={per_page:t[`per-page`],page:t.page,search:t.search};if(t.dryRun){u({command:`cf workflows list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.workflows.list({account_id:a,...n})),{successLabel:`Loaded`})}};function B(e){return e.positional(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`class-name`,{type:`string`,description:`The class_name field`}).option(`limits-steps`,{type:`number`,description:`The limits.steps field`}).option(`script-name`,{type:`string`,description:`The script_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`update <workflow-name>`,describe:`Creates a new workflow or updates an existing workflow definition.`,builder:B,handler:async n=>{if(n.dryRun){u({command:`cf workflows update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${n[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(n[`workflow-name`]))}`,pathParams:{"workflow-name":String(n[`workflow-name`]??``)},bodyKind:`json`,body:n.body===void 0?c({class_name:f(n[`class-name`],`class-name`,`text`),limits:{steps:n[`limits-steps`]},script_name:f(n[`script-name`],`script-name`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?p:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>r.workflows.update({...e,account_id:a,workflow_name:n[`workflow-name`]})),{successLabel:`Updated`});return}n[`class-name`]===void 0&&(n[`class-name`]=await t(`class-name`,`The class_name field`)),n[`script-name`]===void 0&&(n[`script-name`]=await t(`script-name`,`The script_name field`));let m=c({class_name:f(n[`class-name`],`class-name`,`text`),limits:{steps:n[`limits-steps`]},script_name:f(n[`script-name`],`script-name`,`text`)});l(await d(`Updating`,async()=>r.workflows.update({...m,account_id:a,workflow_name:n[`workflow-name`]})),{successLabel:`Updated`})}};function H(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`dag <version-id>`,describe:`Retrieves the directed acyclic graph (DAG) representation of a workflow version.`,builder:H,handler:async t=>{if(t.dryRun){u({command:`cf workflows versions dag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/versions/${t[`version-id`]==null?`<version-id>`:encodeURIComponent(String(t[`version-id`]))}/dag`,pathParams:{"workflow-name":String(t[`workflow-name`]??``),"version-id":String(t[`version-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.workflows.versions.dag({account_id:r,workflow_name:t[`workflow-name`],version_id:t[`version-id`]})),{successLabel:`Loaded`})}};function W(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <version-id>`,describe:`Retrieves details for a specific deployed workflow version.`,builder:W,handler:async t=>{if(t.dryRun){u({command:`cf workflows versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/versions/${t[`version-id`]==null?`<version-id>`:encodeURIComponent(String(t[`version-id`]))}`,pathParams:{"workflow-name":String(t[`workflow-name`]??``),"version-id":String(t[`version-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.workflows.versions.get({account_id:r,workflow_name:t[`workflow-name`],version_id:t[`version-id`]})),{successLabel:`Loaded`})}};function K(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`graph <version-id>`,describe:`Retrieves the graph visualization of a workflow version.`,builder:K,handler:async t=>{if(t.dryRun){u({command:`cf workflows versions graph`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/versions/${t[`version-id`]==null?`<version-id>`:encodeURIComponent(String(t[`version-id`]))}/graph`,pathParams:{"workflow-name":String(t[`workflow-name`]??``),"version-id":String(t[`version-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.workflows.versions.graph({account_id:r,workflow_name:t[`workflow-name`],version_id:t[`version-id`]})),{successLabel:`Loaded`})}};function J(e){return e.option(`workflow-name`,{type:`string`,description:`Workflow name`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Per page`}).option(`page`,{type:`number`,description:`Page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`list`,describe:`Lists all deployed versions of a workflow.`,builder:J,handler:async t=>{let n={per_page:t[`per-page`],page:t.page};if(t.dryRun){u({command:`cf workflows versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workflows/${t[`workflow-name`]==null?`<workflow-name>`:encodeURIComponent(String(t[`workflow-name`]))}/versions`,pathParams:{"workflow-name":String(t[`workflow-name`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.workflows.versions.list({account_id:a,workflow_name:t[`workflow-name`],...n})),{successLabel:`Loaded`})}},X={command:`versions`,describe:`Workflow version operations`,builder:e=>e.command(U).command(G).command(q).command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Z={command:`workflows`,describe:`Durable, multi-step workflows that run on Workers with automatic retries and state persistence`,builder:e=>e.command(g).command(v).command(z).command(V).command(L).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Z as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,i as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./cli-types-CRIDdDw3.mjs";function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Gets latest Zaraz configuration for a zone. It can be preview or published configuration, whichever was the last updated. Secret variables values will not be included.`,builder:d,handler:async e=>{if(e.dryRun){s({command:`cf zaraz config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.config.get({zone_id:i})),{successLabel:`Loaded`})}};function p(e){return e.option(`analytics-default-purpose`,{type:`string`,description:`Consent purpose assigned to Monitoring.`}).option(`analytics-enabled`,{type:`boolean`,description:`Whether Advanced Monitoring reports are enabled.`}).option(`analytics-session-exp-time`,{type:`number`,description:`Session expiration time (seconds).`}).option(`consent-company-email`,{type:`string`,description:`The consent.companyEmail field`}).option(`consent-company-name`,{type:`string`,description:`The consent.companyName field`}).option(`consent-company-street-address`,{type:`string`,description:`The consent.companyStreetAddress field`}).option(`consent-consent-modal-intro-html`,{type:`string`,description:`The consent.consentModalIntroHTML field`}).option(`consent-cookie-name`,{type:`string`,description:`The consent.cookieName field`}).option(`consent-custom-css`,{type:`string`,description:`The consent.customCSS field`}).option(`consent-custom-intro-disclaimer-dismissed`,{type:`boolean`,description:`The consent.customIntroDisclaimerDismissed field`}).option(`consent-default-language`,{type:`string`,description:`The consent.defaultLanguage field`}).option(`consent-enabled`,{type:`boolean`,description:`The consent.enabled field`}).option(`consent-hide-modal`,{type:`boolean`,description:`The consent.hideModal field`}).option(`consent-tcf-compliant`,{type:`boolean`,description:`The consent.tcfCompliant field`}).option(`data-layer`,{type:`boolean`,description:`Data layer compatibility mode enabled.`}).option(`debug-key`,{type:`string`,description:`The key for Zaraz debug mode.`}).option(`history-change`,{type:`boolean`,description:`Single Page Application support enabled.`}).option(`settings-auto-inject-script`,{type:`boolean`,description:`Automatic injection of Zaraz scripts enabled.`}).option(`settings-context-enricher-escaped-worker-name`,{type:`string`,description:`The settings.contextEnricher.escapedWorkerName field`}).option(`settings-context-enricher-worker-tag`,{type:`string`,description:`The settings.contextEnricher.workerTag field`}).option(`settings-cookie-domain`,{type:`string`,description:`The domain Zaraz will use for writing and reading its cookies.`}).option(`settings-ecommerce`,{type:`boolean`,description:`Ecommerce API enabled.`}).option(`settings-events-api-path`,{type:`string`,description:`Custom endpoint for server-side track events.`}).option(`settings-hide-external-referer`,{type:`boolean`,description:`Hiding external referrer URL enabled.`}).option(`settings-hide-ipaddress`,{type:`boolean`,description:`Trimming IP address enabled.`}).option(`settings-hide-query-params`,{type:`boolean`,description:`Removing URL query params enabled.`}).option(`settings-hide-user-agent`,{type:`boolean`,description:`Removing sensitive data from User Agent string enabled.`}).option(`settings-init-path`,{type:`string`,description:`Custom endpoint for Zaraz init script.`}).option(`settings-inject-iframes`,{type:`boolean`,description:`Injection of Zaraz scripts into iframes enabled.`}).option(`settings-mc-root-path`,{type:`string`,description:`Custom path for Managed Components server functionalities.`}).option(`settings-script-path`,{type:`string`,description:`Custom endpoint for Zaraz main script.`}).option(`settings-track-path`,{type:`string`,description:`Custom endpoint for Zaraz tracking requests.`}).option(`zaraz-version`,{type:`number`,description:`Zaraz internal version of the config.`}).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([`consent-company-email`,`consent-company-name`,`consent-company-street-address`,`consent-consent-modal-intro-html`,`consent-cookie-name`,`consent-custom-css`,`consent-custom-intro-disclaimer-dismissed`,`consent-default-language`,`consent-enabled`,`consent-hide-modal`,`consent-tcf-compliant`].some(t=>e[t]!==void 0)){let t=[`consent-enabled`].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 --consent-* flag is set`)}return!0})}const m={command:`update`,describe:`Updates Zaraz configuration for a zone.`,builder:p,handler:async n=>{if(n.dryRun){s({command:`cf zaraz config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/settings/zaraz/config`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({analytics:{defaultPurpose:l(n[`analytics-default-purpose`],`analytics-default-purpose`,`text`),enabled:n[`analytics-enabled`],sessionExpTime:n[`analytics-session-exp-time`]},consent:{companyEmail:l(n[`consent-company-email`],`consent-company-email`,`text`),companyName:l(n[`consent-company-name`],`consent-company-name`,`text`),companyStreetAddress:l(n[`consent-company-street-address`],`consent-company-street-address`,`text`),consentModalIntroHTML:l(n[`consent-consent-modal-intro-html`],`consent-consent-modal-intro-html`,`text`),cookieName:l(n[`consent-cookie-name`],`consent-cookie-name`,`text`),customCSS:l(n[`consent-custom-css`],`consent-custom-css`,`text`),customIntroDisclaimerDismissed:n[`consent-custom-intro-disclaimer-dismissed`],defaultLanguage:l(n[`consent-default-language`],`consent-default-language`,`text`),enabled:n[`consent-enabled`],hideModal:n[`consent-hide-modal`],tcfCompliant:n[`consent-tcf-compliant`]},dataLayer:n[`data-layer`],debugKey:l(n[`debug-key`],`debug-key`,`text`),historyChange:n[`history-change`],settings:{autoInjectScript:n[`settings-auto-inject-script`],contextEnricher:{escapedWorkerName:l(n[`settings-context-enricher-escaped-worker-name`],`settings-context-enricher-escaped-worker-name`,`text`),workerTag:l(n[`settings-context-enricher-worker-tag`],`settings-context-enricher-worker-tag`,`text`)},cookieDomain:l(n[`settings-cookie-domain`],`settings-cookie-domain`,`text`),ecommerce:n[`settings-ecommerce`],eventsApiPath:l(n[`settings-events-api-path`],`settings-events-api-path`,`text`),hideExternalReferer:n[`settings-hide-external-referer`],hideIPAddress:n[`settings-hide-ipaddress`],hideQueryParams:n[`settings-hide-query-params`],hideUserAgent:n[`settings-hide-user-agent`],initPath:l(n[`settings-init-path`],`settings-init-path`,`text`),injectIframes:n[`settings-inject-iframes`],mcRootPath:l(n[`settings-mc-root-path`],`settings-mc-root-path`,`text`),scriptPath:l(n[`settings-script-path`],`settings-script-path`,`text`),trackPath:l(n[`settings-track-path`],`settings-track-path`,`text`)},zarazVersion:n[`zaraz-version`]}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.zaraz.config.update({...e,zone_id:d})),{successLabel:`Updated`});return}if(n[`data-layer`]===void 0)throw Error(`--data-layer is required (or pass --body with this field set).`);if(n[`debug-key`]===void 0&&(n[`debug-key`]=await e(`debug-key`,`The key for Zaraz debug mode.`)),n[`settings-auto-inject-script`]===void 0)throw Error(`--settings-auto-inject-script is required (or pass --body with this field set).`);if(n[`settings-context-enricher-escaped-worker-name`]===void 0&&(n[`settings-context-enricher-escaped-worker-name`]=await e(`settings-context-enricher-escaped-worker-name`,`The settings.contextEnricher.escapedWorkerName field`)),n[`settings-context-enricher-worker-tag`]===void 0&&(n[`settings-context-enricher-worker-tag`]=await e(`settings-context-enricher-worker-tag`,`The settings.contextEnricher.workerTag field`)),n[`zaraz-version`]===void 0)throw Error(`--zaraz-version is required (or pass --body with this field set).`);let f=a({analytics:{defaultPurpose:l(n[`analytics-default-purpose`],`analytics-default-purpose`,`text`),enabled:n[`analytics-enabled`],sessionExpTime:n[`analytics-session-exp-time`]},consent:{companyEmail:l(n[`consent-company-email`],`consent-company-email`,`text`),companyName:l(n[`consent-company-name`],`consent-company-name`,`text`),companyStreetAddress:l(n[`consent-company-street-address`],`consent-company-street-address`,`text`),consentModalIntroHTML:l(n[`consent-consent-modal-intro-html`],`consent-consent-modal-intro-html`,`text`),cookieName:l(n[`consent-cookie-name`],`consent-cookie-name`,`text`),customCSS:l(n[`consent-custom-css`],`consent-custom-css`,`text`),customIntroDisclaimerDismissed:n[`consent-custom-intro-disclaimer-dismissed`],defaultLanguage:l(n[`consent-default-language`],`consent-default-language`,`text`),enabled:n[`consent-enabled`],hideModal:n[`consent-hide-modal`],tcfCompliant:n[`consent-tcf-compliant`]},dataLayer:n[`data-layer`],debugKey:l(n[`debug-key`],`debug-key`,`text`),historyChange:n[`history-change`],settings:{autoInjectScript:n[`settings-auto-inject-script`],contextEnricher:{escapedWorkerName:l(n[`settings-context-enricher-escaped-worker-name`],`settings-context-enricher-escaped-worker-name`,`text`),workerTag:l(n[`settings-context-enricher-worker-tag`],`settings-context-enricher-worker-tag`,`text`)},cookieDomain:l(n[`settings-cookie-domain`],`settings-cookie-domain`,`text`),ecommerce:n[`settings-ecommerce`],eventsApiPath:l(n[`settings-events-api-path`],`settings-events-api-path`,`text`),hideExternalReferer:n[`settings-hide-external-referer`],hideIPAddress:n[`settings-hide-ipaddress`],hideQueryParams:n[`settings-hide-query-params`],hideUserAgent:n[`settings-hide-user-agent`],initPath:l(n[`settings-init-path`],`settings-init-path`,`text`),injectIframes:n[`settings-inject-iframes`],mcRootPath:l(n[`settings-mc-root-path`],`settings-mc-root-path`,`text`),scriptPath:l(n[`settings-script-path`],`settings-script-path`,`text`),trackPath:l(n[`settings-track-path`],`settings-track-path`,`text`)},zarazVersion:n[`zaraz-version`]});o(await c(`Updating`,async()=>u.zaraz.config.update({...f,zone_id:d})),{successLabel:`Updated`})}},h={command:`config`,describe:`Full Zaraz configuration including tools, triggers, and variables for the zone`,builder:e=>e.command(f).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Gets default Zaraz configuration for a zone.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf zaraz default get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/default`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.default.get({zone_id:i})),{successLabel:`Loaded`})}},v={command:`default`,describe:`Default Zaraz configuration template used as a starting point for new zones`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Exports full current published Zaraz configuration for a zone, secret variables included.`,builder:y,handler:async e=>{if(e.dryRun){s({command:`cf zaraz export get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/export`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.export.get({zone_id:i})),{successLabel:`Loaded`})}},x={command:`export`,describe:`Export the current Zaraz configuration as a portable JSON document`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`ids`,{type:`string`,description:`Comma separated list of Zaraz configuration IDs.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Gets a history of published Zaraz configurations by ID(s) for a zone.`,builder:u(S),handler:async e=>{let n={ids:e.ids};if(e.dryRun){s({command:`cf zaraz history configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/history/configs`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.zaraz.history.configs.get({zone_id:a,...n})),{successLabel:`Loaded`})}},w={command:`configs`,describe:`Configuration version history — browse and restore previous Zaraz configurations`,builder:e=>e.command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.option(`offset`,{type:`number`,description:`Ordinal number to start listing the results with. Default value is 0.`}).option(`limit`,{type:`number`,description:`Maximum amount of results to list. Default value is 10.`}).option(`sort-field`,{type:`string`,description:`The field to sort by. Default is updated_at.`,choices:[`id`,`user_id`,`description`,`created_at`,`updated_at`]}).option(`sort-order`,{type:`string`,description:`Sorting order. Default is DESC.`,choices:[`DESC`,`ASC`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Lists a history of published Zaraz configuration records for a zone.`,builder:u(T),handler:async e=>{let n={offset:e.offset,limit:e.limit,sortField:e[`sort-field`],sortOrder:e[`sort-order`]};if(e.dryRun){s({command:`cf zaraz history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/history`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.zaraz.history.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function D(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`ID of the Zaraz configuration to restore.`})}const O={command:`update`,describe:`Restores a historical published Zaraz configuration by ID for a zone.`,builder:D,handler:async e=>{if(e.dryRun){s({command:`cf zaraz history update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/history`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let a=await r(e),l=await t({zone:e.zone},a,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);o(await c(`Updating`,async()=>a.zaraz.history.update({body:t,zone_id:l})),{successLabel:`Updated`});return}o(await c(`Updating`,async()=>n(a,`PUT`,`/zones/${e.zoneId}/settings/zaraz/history`)),{successLabel:`Updated`})}},k={command:`history`,describe:`Configuration version history — browse and restore previous Zaraz configurations`,builder:e=>e.command(E).command(O).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Zaraz configuration description.`})}const j={command:`create`,describe:`Publish current Zaraz preview configuration for a zone.`,builder:A,handler:async e=>{if(e.dryRun){s({command:`cf zaraz publish create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/publish`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let a=await r(e),l=await t({zone:e.zone},a,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);o(await c(`Creating`,async()=>a.zaraz.publish.create({body:t,zone_id:l})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>n(a,`POST`,`/zones/${e.zoneId}/settings/zaraz/publish`)),{successLabel:`Created`})}},M={command:`publish`,describe:`Publish pending Zaraz configuration changes to make them live on the zone`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Zaraz workflow.`})}const P={command:`update`,describe:`Updates Zaraz workflow for a zone.`,builder:N,handler:async e=>{if(e.dryRun){s({command:`cf zaraz update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/workflow`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let n=await r(e),a=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=a,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.zaraz.update({body:t,zone_id:a})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};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:`Gets Zaraz workflow for a zone.`,builder:F,handler:async e=>{if(e.dryRun){s({command:`cf zaraz workflow get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/zaraz/workflow`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.zaraz.workflow.get({zone_id:i})),{successLabel:`Loaded`})}},L={command:`workflow`,describe:`Workflow state for Zaraz configuration changes (draft vs. published)`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`zaraz`,describe:`Server-side tag manager — load third-party tools (analytics, pixels, etc.) from Cloudflare's edge without client-side JS`,builder:e=>e.command(P).command(h).command(v).command(x).command(k).command(M).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{R as default};