cf 0.0.6 → 0.1.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 (273) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +7 -7
  4. package/dist/_meta/commands.json +9051 -1085
  5. package/dist/abuse-reports-ChV_yD7f.mjs +8 -0
  6. package/dist/accounts-BCYecXFh.mjs +21 -0
  7. package/dist/acm-DD8zSds2.mjs +3 -0
  8. package/dist/addressing-D4Eqw5Bi.mjs +13 -0
  9. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  10. package/dist/ai-DfXMOMx_.mjs +2 -0
  11. package/dist/ai-gateway-DdRFthMo.mjs +8 -0
  12. package/dist/ai-search-C_68CDj1.mjs +7 -0
  13. package/dist/alerting-DbhqhVCp.mjs +6 -0
  14. package/dist/analytics-BSBBc7ep.mjs +20 -0
  15. package/dist/api-gateway-CZ4swbkQ.mjs +33 -0
  16. package/dist/argo-tms9ZwHO.mjs +2 -0
  17. package/dist/audit-logs-24qyW8cl.mjs +2 -0
  18. package/dist/auth-BlSmtIKd.mjs +112 -0
  19. package/dist/auth-DQ8miey6.mjs +6 -0
  20. package/dist/autorag-kgNt06GD.mjs +2 -0
  21. package/dist/billing-lwBHNTXC.mjs +2 -0
  22. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  23. package/dist/bot-management-LKf7BqUr.mjs +5 -0
  24. package/dist/botnet-feed-nQ-gErTS.mjs +3 -0
  25. package/dist/brand-protection-DOKv9GRr.mjs +3 -0
  26. package/dist/browser-rendering-CBExtgGt.mjs +4 -0
  27. package/dist/build-C_48VvoK.mjs +1056 -0
  28. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  29. package/dist/cache-BBiiNZHP.mjs +5 -0
  30. package/dist/calls-DA5Xzwev.mjs +4 -0
  31. package/dist/certificate-authorities-sXyR_yGp.mjs +2 -0
  32. package/dist/chunk-DH-VkVmc.mjs +2 -0
  33. package/dist/client-certificates-tV0aCLQJ.mjs +3 -0
  34. package/dist/cloud-connector-DZfHcSso.mjs +2 -0
  35. package/dist/cloudforce-one-y1PgQmI9.mjs +21 -0
  36. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  37. package/dist/config-BIfdEY0E.mjs +2 -0
  38. package/dist/connectivity-8SOqaFDn.mjs +3 -0
  39. package/dist/content-scanning-B9y6K_G5.mjs +4 -0
  40. package/dist/context-DTIbtQn5.mjs +2 -0
  41. package/dist/custom-certificates-sWksR8Ys.mjs +5 -0
  42. package/dist/custom-hostnames-91QZkdqN.mjs +5 -0
  43. package/dist/custom-nameservers-DajZaZvE.mjs +3 -0
  44. package/dist/custom-pages-Cu7gmwzT.mjs +4 -0
  45. package/dist/d1-H_VRsVmF.mjs +3 -0
  46. package/dist/dcv-delegation-C-qhEYEZ.mjs +2 -0
  47. package/dist/delegate.mjs +2 -0
  48. package/dist/deploy--9wYOkHg.mjs +2 -0
  49. package/dist/dev-BfKYB-R_.mjs +6 -0
  50. package/dist/diagnostics-D2B2LPZZ.mjs +3 -0
  51. package/dist/dispatch-namespaces-CyrXBU_w.mjs +7 -0
  52. package/dist/dist-C_bu5HwZ.mjs +82 -0
  53. package/dist/dist-DvKjT2TT.mjs +303 -0
  54. package/dist/dns-Bn9Uz_Nj.mjs +29 -0
  55. package/dist/dns-firewall-BslP4p-j.mjs +57 -0
  56. package/dist/durable-objects-BN1ZnHhm.mjs +2 -0
  57. package/dist/email-routing-n2TnTaRR.mjs +10 -0
  58. package/dist/email-security-C9SEx0kh.mjs +60 -0
  59. package/dist/email-sending-DayZ7u3I.mjs +3 -0
  60. package/dist/filters-CI_XTgfQ.mjs +4 -0
  61. package/dist/firewall-CcaayGig.mjs +11 -0
  62. package/dist/fraud-Cr7aPCV8.mjs +8 -0
  63. package/dist/google-tag-gateway-B3GpYgQ4.mjs +2 -0
  64. package/dist/healthchecks-CVTsR_OC.mjs +4 -0
  65. package/dist/hostnames-Bd_Wa5l6.mjs +3 -0
  66. package/dist/hyperdrive-BBJhEDZd.mjs +18 -0
  67. package/dist/iam-D_FN0pDF.mjs +6 -0
  68. package/dist/images-CAP2hAlZ.mjs +5 -0
  69. package/dist/index.mjs +1 -1
  70. package/dist/input-validation-zEO81MWN.mjs +2 -0
  71. package/dist/intel-CkxfzqmJ.mjs +3 -0
  72. package/dist/ips-B0cK7D0_.mjs +2 -0
  73. package/dist/keyless-certificates-LcLmHZsX.mjs +3 -0
  74. package/dist/kv-_TkUQ6fs.mjs +5 -0
  75. package/dist/leaked-credential-checks-Dhvaen22.mjs +3 -0
  76. package/dist/lib-Eu1wXxuh.mjs +68 -0
  77. package/dist/load-balancers-Ckr0UIpk.mjs +6 -0
  78. package/dist/local-VJaJ3BZ1.mjs +2 -0
  79. package/dist/logpush-Cj946hxT.mjs +4 -0
  80. package/dist/logs-DgC9hjvJ.mjs +3 -0
  81. package/dist/magic-cloud-networking-WbDvPzuG.mjs +5 -0
  82. package/dist/magic-network-monitoring-BcHShvGQ.mjs +4 -0
  83. package/dist/magic-transit-B8sCOkt_.mjs +89 -0
  84. package/dist/managed-transforms-BpOr-8HY.mjs +3 -0
  85. package/dist/mtls-certificates-fOul8D5g.mjs +3 -0
  86. package/dist/network-interconnects-BSW65xlh.mjs +36 -0
  87. package/dist/organizations-T4vKGFAb.mjs +41 -0
  88. package/dist/origin-ca-certificates-ChM0lZ64.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +2 -0
  90. package/dist/origin-tls-client-auth-D32dpZk_.mjs +5 -0
  91. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  92. package/dist/page-rules-RFoj8CjN.mjs +18 -0
  93. package/dist/page-shield-VTktzKDN.mjs +37 -0
  94. package/dist/pages-L1ITjXDZ.mjs +10 -0
  95. package/dist/pipelines-BPO0Lnil.mjs +6 -0
  96. package/dist/progress-DZfTxbrx.mjs +2 -0
  97. package/dist/queues-B0C06L9r.mjs +6 -0
  98. package/dist/r2-DP020Tmq.mjs +21 -0
  99. package/dist/r2-data-catalog-Dmipvz5F.mjs +14 -0
  100. package/dist/radar-DR3VMknH.mjs +2 -0
  101. package/dist/rate-limits-DnHPBPgU.mjs +5 -0
  102. package/dist/raw-fetch-DlXYwVA8.mjs +2 -0
  103. package/dist/realtime-kit-C430aq2d.mjs +6 -0
  104. package/dist/registrar-7Qy50zbW.mjs +46 -0
  105. package/dist/request-tracers-sv99NDIl.mjs +2 -0
  106. package/dist/resolve-BuJRWSk0.mjs +2 -0
  107. package/dist/resource-sharing-uEjC7lnQ.mjs +5 -0
  108. package/dist/resource-tagging-CiODdP3N.mjs +16 -0
  109. package/dist/rules-FXAyTrwk.mjs +4 -0
  110. package/dist/rulesets-B6aUsFFB.mjs +8 -0
  111. package/dist/rum-CyyGJhp5.mjs +4 -0
  112. package/dist/{schema-qJlCfmo8.mjs → schema-D0_cbcDt.mjs} +1 -1
  113. package/dist/schema-validation-ByU49h--.mjs +4 -0
  114. package/dist/scim-DdTS65_C.mjs +3 -0
  115. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  116. package/dist/secrets-store-ClOUVhBJ.mjs +18 -0
  117. package/dist/security-center-4iSBqTrf.mjs +2 -0
  118. package/dist/security-txt-kGxdkDY6.mjs +3 -0
  119. package/dist/session-mW-s8ghP.mjs +2 -0
  120. package/dist/smart-shield-B-SQd2Qp.mjs +3 -0
  121. package/dist/snippets-Aq58ojqw.mjs +4 -0
  122. package/dist/spawn-D_cjG87Z.mjs +10 -0
  123. package/dist/spectrum-0gFvGI6y.mjs +59 -0
  124. package/dist/speed-DAZU8w3T.mjs +4 -0
  125. package/dist/src-C5qivNKH.mjs +108 -0
  126. package/dist/ssl-BRlXa-5w.mjs +15 -0
  127. package/dist/stream-BAxsVeBX.mjs +14 -0
  128. package/dist/tenants-Df6xDqoA.mjs +2 -0
  129. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  130. package/dist/token-validation-pO4dCjCy.mjs +4 -0
  131. package/dist/{tools-CawscCBu.mjs → tools-CtKbk6VS.mjs} +1 -1
  132. package/dist/turnstile-B1dmO8wE.mjs +23 -0
  133. package/dist/{ui-Dj3No2vN.mjs → ui-mP_arYIg.mjs} +1 -1
  134. package/dist/url-normalization-sUDVmrUt.mjs +3 -0
  135. package/dist/url-scanner-CwOKRkYo.mjs +2 -0
  136. package/dist/user-D_UrIdNq.mjs +10 -0
  137. package/dist/vectorize-BEbBn9G9.mjs +4 -0
  138. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  139. package/dist/waiting-rooms-BQC-urV4.mjs +11 -0
  140. package/dist/web3-CIH2iQeX.mjs +4 -0
  141. package/dist/workers-B9EvrpH3.mjs +16 -0
  142. package/dist/workers-builds-DzWSiRd2.mjs +7 -0
  143. package/dist/workflows-aD81gA4k.mjs +4 -0
  144. package/dist/zaraz-Cg1dsvrZ.mjs +2 -0
  145. package/dist/zero-trust-D-xQXWcy.mjs +119 -0
  146. package/dist/zones-DQzucJDd.mjs +28 -0
  147. package/package.json +13 -3
  148. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  149. package/dist/accounts-BjGtCB8T.mjs +0 -6
  150. package/dist/acm-h4YPDN7k.mjs +0 -3
  151. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  152. package/dist/ai-BPln2Yka.mjs +0 -2
  153. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  154. package/dist/ai-search-EjrONI5a.mjs +0 -7
  155. package/dist/alerting-CPWMKr-m.mjs +0 -6
  156. package/dist/analytics-3dX9-scQ.mjs +0 -2
  157. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  158. package/dist/argo-Dxz9P37E.mjs +0 -2
  159. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  160. package/dist/auth-BHD_B2p9.mjs +0 -277
  161. package/dist/auth-caVo2j1K.mjs +0 -6
  162. package/dist/autorag-D7nMweNF.mjs +0 -2
  163. package/dist/billing-yaIBp1Xq.mjs +0 -2
  164. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  165. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  166. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  167. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  168. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  169. package/dist/cache-B6M_pm_D.mjs +0 -5
  170. package/dist/calls-C5XCC0i1.mjs +0 -4
  171. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  172. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  173. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  174. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  175. package/dist/config-BmTd_qeU.mjs +0 -2
  176. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  177. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  178. package/dist/context-6lBIck1r.mjs +0 -2
  179. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  180. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  181. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  182. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  183. package/dist/d1-c_zhZGWf.mjs +0 -3
  184. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  185. package/dist/dev-Bu26u5Jm.mjs +0 -14
  186. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  187. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  188. package/dist/dns-CrvIxztB.mjs +0 -11
  189. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  190. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  191. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  192. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  193. package/dist/email-security-CnpAHWpj.mjs +0 -8
  194. package/dist/email-sending-MeCKsktR.mjs +0 -3
  195. package/dist/filters-Sx2Po1UP.mjs +0 -4
  196. package/dist/firewall-B0_012XO.mjs +0 -9
  197. package/dist/fraud-CG0G_VG-.mjs +0 -2
  198. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  199. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  200. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  201. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  202. package/dist/iam-4LhJianW.mjs +0 -6
  203. package/dist/images-BqXyIycX.mjs +0 -5
  204. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  205. package/dist/intel-CiO3Sy4x.mjs +0 -3
  206. package/dist/ips-DLuGN7Mr.mjs +0 -2
  207. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  208. package/dist/kv-CVYCrk7L.mjs +0 -5
  209. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  210. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  211. package/dist/local-OqhVQbv0.mjs +0 -2
  212. package/dist/logpush-BX7z2xWz.mjs +0 -4
  213. package/dist/logs-C7vxr6Kp.mjs +0 -3
  214. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  215. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  216. package/dist/magic-transit-troGMFb9.mjs +0 -30
  217. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  218. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  219. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  220. package/dist/organizations-BtlEchi-.mjs +0 -4
  221. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  222. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  223. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  224. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  225. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  226. package/dist/pages-F1vdzqgC.mjs +0 -6
  227. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  228. package/dist/progress-5sHFvwez.mjs +0 -2
  229. package/dist/queues-BuvkxFPX.mjs +0 -6
  230. package/dist/r2-Du-fgHiT.mjs +0 -9
  231. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  232. package/dist/radar-C0eqNmWR.mjs +0 -2
  233. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  234. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  235. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  236. package/dist/registrar-B7V7i89n.mjs +0 -2
  237. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  238. package/dist/resolve-GtphSYWh.mjs +0 -2
  239. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  240. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  241. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  242. package/dist/rules-DzJFHGW1.mjs +0 -4
  243. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  244. package/dist/rum-CQ_rJ96u.mjs +0 -4
  245. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  246. package/dist/scim-ByZ5kqXS.mjs +0 -3
  247. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  248. package/dist/security-center-OUrILUnx.mjs +0 -2
  249. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  250. package/dist/session-Dxi_LbAk.mjs +0 -2
  251. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  252. package/dist/snippets-FDPiBMWc.mjs +0 -4
  253. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  254. package/dist/speed-BuEappVX.mjs +0 -4
  255. package/dist/src-D8_cWUwt.mjs +0 -104
  256. package/dist/ssl-bJbzEoRv.mjs +0 -3
  257. package/dist/stream-DuYGiGk6.mjs +0 -13
  258. package/dist/tenants-BYqEutrr.mjs +0 -2
  259. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  260. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  261. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  262. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  263. package/dist/user-Cduf3VRi.mjs +0 -7
  264. package/dist/vectorize-CMLobU9V.mjs +0 -4
  265. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  266. package/dist/web3-Bcx68Kq3.mjs +0 -4
  267. package/dist/workers-D5fOQsUA.mjs +0 -16
  268. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  269. package/dist/workflows-qFD80noW.mjs +0 -4
  270. package/dist/zaraz-C0iJimA4.mjs +0 -2
  271. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  272. package/dist/zones-Nu3wMtds.mjs +0 -5
  273. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{f as e,l as t,m as n,t as r}from"./auth-BlSmtIKd.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-DZfTxbrx.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or certificate and the intermediate(s).`}).option(`custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`deploy`,{type:`string`,description:`The environment to deploy the certificate to, defaults to production`,choices:[`staging`,`production`],default:`production`}).option(`geo-restrictions-label`,{type:`string`,description:`The geo_restrictions.label field`,choices:[`us`,`eu`,`highest_security`]}).option(`policy`,{type:`string`,description:`Specify the policy that determines the region where your private key will be held locally. HTTPS connections to any excluded data center will still be fully encrypted, but will incur some latency while Keyless SSL is used to complete the handshake with the nearest allowed data center. Any combination of countries, specified by their two letter country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) can be chosen, such as 'country: IN', as well as 'region: EU' which refers to the EU region. If there are too few data centers satisfying the policy, it will be rejected.
3
+ Note: The API accepts this field as either "policy" or "policy_restrictions" in requests. Responses return this field as "policy_restrictions".`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).option(`type`,{type:`string`,description:`The type 'legacy_custom' enables support for legacy clients which do not include SNI in the TLS handshake.`,choices:[`legacy_custom`,`sni_custom`],default:`legacy_custom`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Upload a new SSL certificate for a zone.`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf custom-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{bundleMethod:e.bundleMethod,certificate:e.certificate,customCsrId:e.customCsrId,deploy:e.deploy,geoRestrictionsLabel:e.geoRestrictionsLabel,policy:e.policy,privateKey:e.privateKey,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/custom_certificates`,{body:t})),{successLabel:`Created`});return}e.certificate===void 0&&(e.certificate=await n(`certificate`,`The zone's SSL certificate or certificate and the intermediate(s).`)),e.privateKey===void 0&&(e.privateKey=await n(`private-key`,`The zone's private key.`,{kind:`secret`}));let d={};e.bundleMethod!==void 0&&i(d,[`bundle_method`],l(e.bundleMethod,`bundleMethod`,`text`)),e.certificate!==void 0&&i(d,[`certificate`],l(e.certificate,`certificate`,`text`)),e.customCsrId!==void 0&&i(d,[`custom_csr_id`],l(e.customCsrId,`customCsrId`,`text`)),e.deploy!==void 0&&i(d,[`deploy`],l(e.deploy,`deploy`,`text`)),e.geoRestrictionsLabel!==void 0&&i(d,[`geo_restrictions`,`label`],l(e.geoRestrictionsLabel,`geoRestrictionsLabel`,`text`)),e.policy!==void 0&&i(d,[`policy`],l(e.policy,`policy`,`text`)),e.privateKey!==void 0&&i(d,[`private_key`],l(e.privateKey,`privateKey`,`text`)),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/custom_certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function f(e){return e.positional(`customCertificateId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`delete <customCertificateId>`,describe:`Remove a SSL certificate from a zone.`,builder:f,handler:async n=>{if(n.dryRun){s({command:`cf custom-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zoneId??`<zoneId>`}/custom_certificates/${n.customCertificateId??`<customCertificateId>`}`,pathParams:{customCertificateId:String(n.customCertificateId??``),zoneId:String(n.zoneId??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),l=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=l,!await e({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}if(n.body){let e=a(n.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/custom_certificates/${n.customCertificateId}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.customCertificates.delete(n.customCertificateId,l)),{successLabel:`Deleted`})}};function m(e){return e.positional(`customCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or certificate and the intermediate(s).`}).option(`custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`deploy`,{type:`string`,description:`The environment to deploy the certificate to, defaults to production`,choices:[`staging`,`production`],default:`production`}).option(`geo-restrictions-label`,{type:`string`,description:`The geo_restrictions.label field`,choices:[`us`,`eu`,`highest_security`]}).option(`policy`,{type:`string`,description:`Specify the policy that determines the region where your private key will be held locally. HTTPS connections to any excluded data center will still be fully encrypted, but will incur some latency while Keyless SSL is used to complete the handshake with the nearest allowed data center. Any combination of countries, specified by their two letter country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) can be chosen, such as 'country: IN', as well as 'region: EU' which refers to the EU region. If there are too few data centers satisfying the policy, it will be rejected.
5
+ Note: The API accepts this field as either "policy" or "policy_restrictions" in requests. Responses return this field as "policy_restrictions".`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <customCertificateId>`,describe:`Upload a new private key and/or PEM/CRT for the SSL certificate. Note: PATCHing a configuration for sni_custom certificates will result in a new resource id being returned, and the previous one being deleted.`,builder:m,handler:async e=>{if(e.dryRun){s({command:`cf custom-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates/${e.customCertificateId??`<customCertificateId>`}`,pathParams:{customCertificateId:String(e.customCertificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{bundleMethod:e.bundleMethod,certificate:e.certificate,customCsrId:e.customCsrId,deploy:e.deploy,geoRestrictionsLabel:e.geoRestrictionsLabel,policy:e.policy,privateKey:e.privateKey,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/custom_certificates/${e.customCertificateId}`,{body:t})),{successLabel:`Updated`});return}let u={};e.bundleMethod!==void 0&&i(u,[`bundle_method`],l(e.bundleMethod,`bundleMethod`,`text`)),e.certificate!==void 0&&i(u,[`certificate`],l(e.certificate,`certificate`,`text`)),e.customCsrId!==void 0&&i(u,[`custom_csr_id`],l(e.customCsrId,`customCsrId`,`text`)),e.deploy!==void 0&&i(u,[`deploy`],l(e.deploy,`deploy`,`text`)),e.geoRestrictionsLabel!==void 0&&i(u,[`geo_restrictions`,`label`],l(e.geoRestrictionsLabel,`geoRestrictionsLabel`,`text`)),e.policy!==void 0&&i(u,[`policy`],l(e.policy,`policy`,`text`)),e.privateKey!==void 0&&i(u,[`private_key`],l(e.privateKey,`privateKey`,`text`)),o(await c(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/custom_certificates/${e.customCertificateId}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function g(e){return e.positional(`customCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <customCertificateId>`,describe:`Retrieves details for a specific custom SSL certificate, including certificate metadata, bundle method, geographic restrictions, and associated keyless server configuration.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf custom-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates/${e.customCertificateId??`<customCertificateId>`}`,pathParams:{customCertificateId:String(e.customCertificateId??``),zoneId:String(e.zoneId??``)},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.customCertificates.get(e.customCertificateId,i)),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of zones per page.`}).option(`match`,{type:`string`,description:`Whether to match all search requirements or at least one (any).`,choices:[`any`,`all`]}).option(`status`,{type:`string`,description:`Status of the zone's custom SSL.`,choices:[`active`,`expired`,`deleted`,`pending`,`initializing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List, search, and filter all of your custom SSL certificates. The higher priority will break ties across overlapping 'legacy_custom' certificates, but 'legacy_custom' certificates will always supercede 'sni_custom' certificates.`,builder:v,handler:async e=>{let n={page:e.page,per_page:e.perPage,match:e.match,status:e.status};if(e.dryRun){s({command:`cf custom-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates`,pathParams:{zoneId:String(e.zoneId??``)},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.customCertificates.list(a,n)),{successLabel:`Loaded`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`update`,describe:`If a zone has multiple SSL certificates, you can set the order in which they should be used during a request. The higher priority will break ties across overlapping 'legacy_custom' certificates.`,builder:b,handler:async e=>{if(e.dryRun){s({command:`cf custom-certificates prioritize update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_certificates/prioritize`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body}});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=a(e.body);o(await c(`Updating`,async()=>n.put(`/zones/${e.zoneId}/custom_certificates/prioritize`,{body:t})),{successLabel:`Updated`});return}o(await c(`Updating`,async()=>n.customCertificates.prioritize.update(i)),{successLabel:`Updated`})}},S={command:`prioritize`,describe:`Reorder the priority of custom SSL certificates to control which one is served first`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},C={command:`custom-certificates`,describe:`Upload and manage your own SSL/TLS certificates for a zone, with priority ordering`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{C as default};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{f as e,l as t,m as n,t as r}from"./auth-BlSmtIKd.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-DZfTxbrx.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-hostname-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`certificate-pack-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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`delete <certificateId>`,describe:`Delete a single custom certificate from a certificate pack that contains two bundled certificates. Deletion is subject to the following constraints. You cannot delete a certificate if it is the only remaining certificate in the pack. At least one certificate must remain in the pack.`,builder:u,handler:async n=>{if(n.dryRun){s({command:`cf custom-hostnames certificate-pack certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zoneId??`<zoneId>`}/custom_hostnames/${n.customHostnameId??`<customHostnameId>`}/certificate_pack/${n.certificatePackId??`<certificatePackId>`}/certificates/${n.certificateId??`<certificateId>`}`,pathParams:{customHostnameId:String(n.customHostnameId??``),certificatePackId:String(n.certificatePackId??``),certificateId:String(n.certificateId??``),zoneId:String(n.zoneId??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),l=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=l,!await e({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}if(n.body){let e=a(n.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/custom_hostnames/${n.customHostnameId}/certificate_pack/${n.certificatePackId}/certificates/${n.certificateId}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.customHostnames.certificatePack.certificates.delete(n.customHostnameId,n.certificatePackId,n.certificateId,l)),{successLabel:`Deleted`})}};function f(e){return e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-hostname-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`certificate-pack-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-certificate`,{type:`string`,description:`If a custom uploaded certificate is used.`}).option(`custom-key`,{type:`string`,description:`The key for a custom uploaded certificate.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`update <certificateId>`,describe:`Replace a single custom certificate within a certificate pack that contains two bundled certificates. The replacement must adhere to the following constraints. You can only replace an RSA certificate with another RSA certificate or an ECDSA certificate with another ECDSA certificate.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf custom-hostnames certificate-pack certificates update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/${e.customHostnameId??`<customHostnameId>`}/certificate_pack/${e.certificatePackId??`<certificatePackId>`}/certificates/${e.certificateId??`<certificateId>`}`,pathParams:{customHostnameId:String(e.customHostnameId??``),certificatePackId:String(e.certificatePackId??``),certificateId:String(e.certificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{customCertificate:e.customCertificate,customKey:e.customKey,body:e.body}});return}let u=await r(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}/certificate_pack/${e.certificatePackId}/certificates/${e.certificateId}`,{body:t})),{successLabel:`Updated`});return}e.customCertificate===void 0&&(e.customCertificate=await n(`custom-certificate`,`If a custom uploaded certificate is used.`)),e.customKey===void 0&&(e.customKey=await n(`custom-key`,`The key for a custom uploaded certificate.`,{kind:`secret`}));let d={};e.customCertificate!==void 0&&i(d,[`custom_certificate`],l(e.customCertificate,`customCertificate`,`text`)),e.customKey!==void 0&&i(d,[`custom_key`],l(e.customKey,`customKey`,`text`)),o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}/certificate_pack/${e.certificatePackId}/certificates/${e.certificateId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},m={command:`certificates`,describe:`SSL certificates attached to individual custom hostnames`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},h={command:`certificate-pack`,describe:`Operations for certificate-pack`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`hostname`,{type:`string`,description:`The custom hostname that will point to your hostname via CNAME.`}).option(`ssl-bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`ssl-certificate-authority`,{type:`string`,description:`The Certificate Authority that will issue the certificate`,choices:[`digicert`,`google`,`lets_encrypt`,`ssl_com`]}).option(`ssl-cloudflare-branding`,{type:`boolean`,description:`Whether or not to add Cloudflare Branding for the order. This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to true`}).option(`ssl-custom-certificate`,{type:`string`,description:`If a custom uploaded certificate is used.`}).option(`ssl-custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`ssl-custom-key`,{type:`string`,description:`The key for a custom uploaded certificate.`}).option(`ssl-method`,{type:`string`,description:`Domain control validation (DCV) method used for this hostname.`,choices:[`http`,`txt`,`email`]}).option(`ssl-settings-ciphers`,{type:`string`,array:!0,description:`An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.`}).option(`ssl-settings-early-hints`,{type:`string`,description:`Whether or not Early Hints is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-http2`,{type:`string`,description:`Whether or not HTTP2 is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-min-tls-version`,{type:`string`,description:`The minimum TLS version supported.`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`ssl-settings-tls-1-3`,{type:`string`,description:`Whether or not TLS 1.3 is enabled.`,choices:[`on`,`off`]}).option(`ssl-type`,{type:`string`,description:`Level of validation to be used for this hostname. Domain validation (dv) must be used.`,choices:[`dv`]}).option(`ssl-wildcard`,{type:`boolean`,description:`Indicates whether the certificate covers a wildcard.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`create`,describe:`Add a new custom hostname and request that an SSL certificate be issued for it. One of three validation methods—http, txt, email—should be used, with 'http' recommended if the CNAME is already in place (or will be soon). Specifying 'email' will send an email to the WHOIS contacts on file for the base domain plus hostmaster, postmaster, webmaster, admin, administrator. If http is used and the domain is not already pointing to the Managed CNAME host, the PATCH method must be used once it is (to complete validation). Enable bundling of certificates using the custom_cert_bundle field. The bundling process requires the following condition One certificate in the bundle must use an RSA, and the other must use an ECDSA.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf custom-hostnames create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{hostname:e.hostname,sslBundleMethod:e.sslBundleMethod,sslCertificateAuthority:e.sslCertificateAuthority,sslCloudflareBranding:e.sslCloudflareBranding,sslCustomCertificate:e.sslCustomCertificate,sslCustomCsrId:e.sslCustomCsrId,sslCustomKey:e.sslCustomKey,sslMethod:e.sslMethod,sslSettingsCiphers:e.sslSettingsCiphers,sslSettingsEarlyHints:e.sslSettingsEarlyHints,sslSettingsHttp2:e.sslSettingsHttp2,sslSettingsMinTlsVersion:e.sslSettingsMinTlsVersion,sslSettingsTls13:e.sslSettingsTls13,sslType:e.sslType,sslWildcard:e.sslWildcard,body:e.body}});return}let u=await r(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/custom_hostnames`,{body:t})),{successLabel:`Created`});return}e.hostname===void 0&&(e.hostname=await n(`hostname`,`The custom hostname that will point to your hostname via CNAME.`));let d={};e.hostname!==void 0&&i(d,[`hostname`],l(e.hostname,`hostname`,`text`)),e.sslBundleMethod!==void 0&&i(d,[`ssl`,`bundle_method`],l(e.sslBundleMethod,`sslBundleMethod`,`text`)),e.sslCertificateAuthority!==void 0&&i(d,[`ssl`,`certificate_authority`],l(e.sslCertificateAuthority,`sslCertificateAuthority`,`text`)),e.sslCloudflareBranding!==void 0&&i(d,[`ssl`,`cloudflare_branding`],e.sslCloudflareBranding),e.sslCustomCertificate!==void 0&&i(d,[`ssl`,`custom_certificate`],l(e.sslCustomCertificate,`sslCustomCertificate`,`text`)),e.sslCustomCsrId!==void 0&&i(d,[`ssl`,`custom_csr_id`],l(e.sslCustomCsrId,`sslCustomCsrId`,`text`)),e.sslCustomKey!==void 0&&i(d,[`ssl`,`custom_key`],l(e.sslCustomKey,`sslCustomKey`,`text`)),e.sslMethod!==void 0&&i(d,[`ssl`,`method`],l(e.sslMethod,`sslMethod`,`text`)),e.sslSettingsCiphers!==void 0&&i(d,[`ssl`,`settings`,`ciphers`],e.sslSettingsCiphers),e.sslSettingsEarlyHints!==void 0&&i(d,[`ssl`,`settings`,`early_hints`],l(e.sslSettingsEarlyHints,`sslSettingsEarlyHints`,`text`)),e.sslSettingsHttp2!==void 0&&i(d,[`ssl`,`settings`,`http2`],l(e.sslSettingsHttp2,`sslSettingsHttp2`,`text`)),e.sslSettingsMinTlsVersion!==void 0&&i(d,[`ssl`,`settings`,`min_tls_version`],l(e.sslSettingsMinTlsVersion,`sslSettingsMinTlsVersion`,`text`)),e.sslSettingsTls13!==void 0&&i(d,[`ssl`,`settings`,`tls_1_3`],l(e.sslSettingsTls13,`sslSettingsTls13`,`text`)),e.sslType!==void 0&&i(d,[`ssl`,`type`],l(e.sslType,`sslType`,`text`)),e.sslWildcard!==void 0&&i(d,[`ssl`,`wildcard`],e.sslWildcard),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/custom_hostnames`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function v(e){return e.positional(`customHostnameId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`delete <customHostnameId>`,describe:`Permanently deletes a custom hostname and revokes any SSL certificates that were issued for it. This action cannot be undone.`,builder:v,handler:async n=>{if(n.dryRun){s({command:`cf custom-hostnames delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zoneId??`<zoneId>`}/custom_hostnames/${n.customHostnameId??`<customHostnameId>`}`,pathParams:{customHostnameId:String(n.customHostnameId??``),zoneId:String(n.zoneId??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),l=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=l,!await e({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}if(n.body){let e=a(n.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/custom_hostnames/${n.customHostnameId}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.customHostnames.delete(n.customHostnameId,l)),{successLabel:`Deleted`})}};function b(e){return e.positional(`customHostnameId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-origin-server`,{type:`string`,description:`a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME record.`}).option(`custom-origin-sni`,{type:`string`,description:`A hostname that will be sent to your custom origin server as SNI for TLS handshake. This can be a valid subdomain of the zone or custom origin server name or the string ':request_host_header:' which will cause the host header in the request to be used as SNI. Not configurable with default/fallback origin server.`}).option(`ssl-bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`ssl-certificate-authority`,{type:`string`,description:`The Certificate Authority that will issue the certificate`,choices:[`digicert`,`google`,`lets_encrypt`,`ssl_com`]}).option(`ssl-cloudflare-branding`,{type:`boolean`,description:`Whether or not to add Cloudflare Branding for the order. This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to true`}).option(`ssl-custom-certificate`,{type:`string`,description:`If a custom uploaded certificate is used.`}).option(`ssl-custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`ssl-custom-key`,{type:`string`,description:`The key for a custom uploaded certificate.`}).option(`ssl-method`,{type:`string`,description:`Domain control validation (DCV) method used for this hostname.`,choices:[`http`,`txt`,`email`]}).option(`ssl-settings-ciphers`,{type:`string`,array:!0,description:`An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.`}).option(`ssl-settings-early-hints`,{type:`string`,description:`Whether or not Early Hints is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-http2`,{type:`string`,description:`Whether or not HTTP2 is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-min-tls-version`,{type:`string`,description:`The minimum TLS version supported.`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`ssl-settings-tls-1-3`,{type:`string`,description:`Whether or not TLS 1.3 is enabled.`,choices:[`on`,`off`]}).option(`ssl-type`,{type:`string`,description:`Level of validation to be used for this hostname. Domain validation (dv) must be used.`,choices:[`dv`]}).option(`ssl-wildcard`,{type:`boolean`,description:`Indicates whether the certificate covers a wildcard.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`edit <customHostnameId>`,describe:`Modify SSL configuration for a custom hostname. When sent with SSL config that matches existing config, used to indicate that hostname should pass domain control validation (DCV). Can also be used to change validation type, e.g., from 'http' to 'email'. Bundle an existing certificate with another certificate by using the "custom_cert_bundle" field. The bundling process supports combining certificates as long as the following condition is met. One certificate must use the RSA algorithm, and the other must use the ECDSA algorithm.`,builder:b,handler:async e=>{if(e.dryRun){s({command:`cf custom-hostnames edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/${e.customHostnameId??`<customHostnameId>`}`,pathParams:{customHostnameId:String(e.customHostnameId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{customOriginServer:e.customOriginServer,customOriginSni:e.customOriginSni,sslBundleMethod:e.sslBundleMethod,sslCertificateAuthority:e.sslCertificateAuthority,sslCloudflareBranding:e.sslCloudflareBranding,sslCustomCertificate:e.sslCustomCertificate,sslCustomCsrId:e.sslCustomCsrId,sslCustomKey:e.sslCustomKey,sslMethod:e.sslMethod,sslSettingsCiphers:e.sslSettingsCiphers,sslSettingsEarlyHints:e.sslSettingsEarlyHints,sslSettingsHttp2:e.sslSettingsHttp2,sslSettingsMinTlsVersion:e.sslSettingsMinTlsVersion,sslSettingsTls13:e.sslSettingsTls13,sslType:e.sslType,sslWildcard:e.sslWildcard,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}`,{body:t})),{successLabel:`Updated`});return}let u={};e.customOriginServer!==void 0&&i(u,[`custom_origin_server`],l(e.customOriginServer,`customOriginServer`,`text`)),e.customOriginSni!==void 0&&i(u,[`custom_origin_sni`],l(e.customOriginSni,`customOriginSni`,`text`)),e.sslBundleMethod!==void 0&&i(u,[`ssl`,`bundle_method`],l(e.sslBundleMethod,`sslBundleMethod`,`text`)),e.sslCertificateAuthority!==void 0&&i(u,[`ssl`,`certificate_authority`],l(e.sslCertificateAuthority,`sslCertificateAuthority`,`text`)),e.sslCloudflareBranding!==void 0&&i(u,[`ssl`,`cloudflare_branding`],e.sslCloudflareBranding),e.sslCustomCertificate!==void 0&&i(u,[`ssl`,`custom_certificate`],l(e.sslCustomCertificate,`sslCustomCertificate`,`text`)),e.sslCustomCsrId!==void 0&&i(u,[`ssl`,`custom_csr_id`],l(e.sslCustomCsrId,`sslCustomCsrId`,`text`)),e.sslCustomKey!==void 0&&i(u,[`ssl`,`custom_key`],l(e.sslCustomKey,`sslCustomKey`,`text`)),e.sslMethod!==void 0&&i(u,[`ssl`,`method`],l(e.sslMethod,`sslMethod`,`text`)),e.sslSettingsCiphers!==void 0&&i(u,[`ssl`,`settings`,`ciphers`],e.sslSettingsCiphers),e.sslSettingsEarlyHints!==void 0&&i(u,[`ssl`,`settings`,`early_hints`],l(e.sslSettingsEarlyHints,`sslSettingsEarlyHints`,`text`)),e.sslSettingsHttp2!==void 0&&i(u,[`ssl`,`settings`,`http2`],l(e.sslSettingsHttp2,`sslSettingsHttp2`,`text`)),e.sslSettingsMinTlsVersion!==void 0&&i(u,[`ssl`,`settings`,`min_tls_version`],l(e.sslSettingsMinTlsVersion,`sslSettingsMinTlsVersion`,`text`)),e.sslSettingsTls13!==void 0&&i(u,[`ssl`,`settings`,`tls_1_3`],l(e.sslSettingsTls13,`sslSettingsTls13`,`text`)),e.sslType!==void 0&&i(u,[`ssl`,`type`],l(e.sslType,`sslType`,`text`)),e.sslWildcard!==void 0&&i(u,[`ssl`,`wildcard`],e.sslWildcard),o(await c(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`delete`,describe:`Removes the fallback origin configuration for custom hostnames on a zone. Custom hostnames without specific origins will no longer have a fallback.`,builder:S,handler:async n=>{if(n.dryRun){s({command:`cf custom-hostnames fallback-origin delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zoneId??`<zoneId>`}/custom_hostnames/fallback_origin`,pathParams:{zoneId:String(n.zoneId??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),l=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=l,!await e({force:!!n.force})){process.stderr.write(`Aborted.
5
+ `);return}if(n.body){let e=a(n.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/custom_hostnames/fallback_origin`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.customHostnames.fallbackOrigin.delete(l)),{successLabel:`Deleted`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Retrieves the current fallback origin configuration for custom hostnames on a zone. The fallback origin handles traffic when specific custom hostname origins are unavailable.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf custom-hostnames fallback-origin get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/fallback_origin`,pathParams:{zoneId:String(e.zoneId??``)},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.customHostnames.fallbackOrigin.get(i)),{successLabel:`Loaded`})}};function E(e){return e.option(`origin`,{type:`string`,description:`Your origin hostname that requests to your custom hostnames will be sent to.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`update`,describe:`Updates the fallback origin configuration for custom hostnames on a zone. Sets the default origin server for custom hostname traffic.`,builder:E,handler:async e=>{if(e.dryRun){s({command:`cf custom-hostnames fallback-origin update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/fallback_origin`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{origin:e.origin,body:e.body}});return}let u=await r(e);if(e.zoneId=await t({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/custom_hostnames/fallback_origin`,{body:t})),{successLabel:`Updated`});return}e.origin===void 0&&(e.origin=await n(`origin`,`Your origin hostname that requests to your custom hostnames will be sent to.`));let d={};e.origin!==void 0&&i(d,[`origin`],l(e.origin,`origin`,`text`)),o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/custom_hostnames/fallback_origin`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},O={command:`fallback-origin`,describe:`Default origin server used when a custom hostname does not have its own specific origin`,builder:e=>e.command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`customHostnameId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get <customHostnameId>`,describe:`Retrieves detailed information about a specific custom hostname, including SSL certificate status, ownership verification, and origin configuration.`,builder:k,handler:async e=>{if(e.dryRun){s({command:`cf custom-hostnames get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/${e.customHostnameId??`<customHostnameId>`}`,pathParams:{customHostnameId:String(e.customHostnameId??``),zoneId:String(e.zoneId??``)},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.customHostnames.get(e.customHostnameId,i)),{successLabel:`Loaded`})}};function j(e){return e.option(`hostname`,{type:`string`,description:`Fully qualified domain name to match against. This parameter cannot be used with the 'id' parameter.`}).option(`hostname-contain`,{type:`string`,description:`Filters hostnames by a substring match on the hostname value. This parameter cannot be used with the 'id' parameter.`}).option(`id`,{type:`string`,description:`Hostname ID to match against. This ID was generated and returned during the initial custom_hostname creation. This parameter cannot be used with the 'hostname' parameter.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of hostnames per page.`}).option(`order`,{type:`string`,description:`Field to order hostnames by.`,choices:[`ssl`,`ssl_status`]}).option(`direction`,{type:`string`,description:`Direction to order hostnames.`,choices:[`asc`,`desc`]}).option(`ssl-status`,{type:`string`,description:`Filter by SSL certificate status.`,choices:[`initializing`,`pending_validation`,`deleted`,`pending_issuance`,`pending_deployment`,`pending_deletion`,`pending_expiration`,`expired`,`active`,`initializing_timed_out`,`validation_timed_out`,`issuance_timed_out`,`deployment_timed_out`,`deletion_timed_out`,`pending_cleanup`,`staging_deployment`,`staging_active`,`deactivating`,`inactive`,`backup_issued`,`holding_deployment`]}).option(`hostname-status`,{type:`string`,description:`Filter by the hostname's activation status.`,choices:[`active`,`pending`,`active_redeploying`,`moved`,`pending_deletion`,`deleted`,`pending_blocked`,`pending_migration`,`pending_provisioned`,`test_pending`,`test_active`,`test_active_apex`,`test_blocked`,`test_failed`,`provisioned`,`blocked`]}).option(`certificate-authority`,{type:`string`,description:`Filter by the certificate authority that issued the SSL certificate.`,choices:[`google`,`lets_encrypt`,`ssl_com`]}).option(`wildcard`,{type:`boolean`,description:`Filter by whether the custom hostname is a wildcard hostname.`,default:!1}).option(`custom-origin-server`,{type:`string`,description:`Filter by custom origin server name.`}).option(`ssl`,{type:`string`,description:`Whether to filter hostnames based on if they have SSL enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list`,describe:`List, search, sort, and filter all of your custom hostnames.`,builder:j,handler:async e=>{let n={hostname:e.hostname,"hostname.contain":e.hostnameContain,id:e.id,page:e.page,per_page:e.perPage,order:e.order,direction:e.direction,ssl_status:e.sslStatus,hostname_status:e.hostnameStatus,certificate_authority:e.certificateAuthority,wildcard:e.wildcard,custom_origin_server:e.customOriginServer,ssl:e.ssl};if(e.dryRun){s({command:`cf custom-hostnames list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames`,pathParams:{zoneId:String(e.zoneId??``)},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.customHostnames.list(a,n)),{successLabel:`Loaded`})}},N={command:`custom-hostnames`,describe:`Bring custom vanity domains to your SaaS zone with per-hostname SSL and origin mapping`,builder:e=>e.command(_).command(y).command(x).command(A).command(M).command(h).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,f as t,m as n,t as r,u as i}from"./auth-BlSmtIKd.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-DZfTxbrx.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";function f(e){return e.option(`ns-name`,{type:`string`,description:`The FQDN of the name server.`}).option(`ns-set`,{type:`number`,description:`The number of the set that this name server belongs to.`,default:1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`create`,describe:`Adds a custom nameserver to the account for use as a vanity nameserver on zones.`,builder:f,handler:async t=>{if(t.dryRun){c({command:`cf custom-nameservers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/custom_ns`,pathParams:{},bodyKind:`json`,body:{nsName:t.nsName,nsSet:t.nsSet,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/custom_ns`,{body:e})),{successLabel:`Created`});return}t.nsName===void 0&&(t.nsName=await n(`ns-name`,`The FQDN of the name server.`));let m={};t.nsName!==void 0&&a(m,[`ns_name`],u(t.nsName,`nsName`,`text`)),t.nsSet!==void 0&&a(m,[`ns_set`],t.nsSet),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/custom_ns`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function m(e){return e.positional(`customNsId`,{type:`string`,description:`The FQDN of the name server.`,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 h={command:`delete <customNsId>`,describe:`Removes a custom nameserver from the account.`,builder:m,handler:async n=>{if(n.dryRun){c({command:`cf custom-nameservers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/custom_ns/${n.customNsId??`<customNsId>`}`,pathParams:{customNsId:String(n.customNsId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/custom_ns/${n.customNsId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.customNameservers.delete(n.customNsId,u)),{successLabel:`Deleted`})}};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:`List an account's custom nameservers.`,builder:g,handler:async t=>{if(t.dryRun){c({command:`cf custom-nameservers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/custom_ns`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.customNameservers.get(a)),{successLabel:`Loaded`})}},v={command:`custom-nameservers`,describe:`Vanity nameservers that use your own domain instead of Cloudflare-assigned NS records`,builder:e=>e.command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,f as t,l as n,m as r,p as i,t as a,u as o}from"./auth-BlSmtIKd.mjs";import{n as s,t as c}from"./body-parser-Br-BoYk-.mjs";import{t as l}from"./output-D7_yAFVR.mjs";import{n as u,t as d}from"./progress-DZfTxbrx.mjs";import{n as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";function m(e){return e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`state`,{type:`string`,description:`The custom page state.`,choices:[`default`,`customized`]}).option(`url`,{type:`string`,description:`The URL associated with the custom page.`,default:``}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`update <identifier>`,describe:`Updates the configuration of an existing custom page.`,builder:m,handler:async t=>{if(t.dryRun){o(),u({command:`cf custom-pages account-custom-pages update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/${t.identifier??`<identifier>`}`,pathParams:{identifier:String(t.identifier??``),accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`json`,body:{state:t.state,url:t.url,body:t.body}});return}let n=await a(t);if(t.accountId=t.local?p:await e(n),t.body){let e=c(t.body);l(await d(`Updating`,async()=>n.put(`/accounts/${t.accountIdentifier}/custom_pages/${t.identifier}`,{body:e})),{successLabel:`Updated`});return}t.state===void 0&&(t.state=await i(`state`,`The custom page state.`,[`default`,`customized`])),t.url===void 0&&(t.url=await r(`url`,`The URL associated with the custom page.`));let m={};t.state!==void 0&&s(m,[`state`],f(t.state,`state`,`text`)),t.url!==void 0&&s(m,[`url`],f(t.url,`url`,`text`)),l(await d(`Updating`,async()=>n.put(`/accounts/${t.accountIdentifier}/custom_pages/${t.identifier}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},g={command:`account-custom-pages`,describe:`Account-scoped custom page operations`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`name`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).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:`asset`,describe:`Creates a new custom asset at the account level.`,builder:_,handler:async t=>{if(t.dryRun){o(),u({command:`cf custom-pages assets create custom asset`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets`,pathParams:{accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`json`,body:{description:t.description,name:t.name,url:t.url,body:t.body}});return}let n=await a(t);if(t.accountId=t.local?p:await e(n),t.body){let e=c(t.body);l(await d(`Creating`,async()=>n.post(`/accounts/${t.accountIdentifier}/custom_pages/assets`,{body:e})),{successLabel:`Created`});return}t.description===void 0&&(t.description=await r(`description`,`A short description of the custom asset.`)),t.name===void 0&&(t.name=await r(`name`,`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`)),t.url===void 0&&(t.url=await r(`url`,`The URL where the asset content is fetched from.`));let i={};t.description!==void 0&&s(i,[`description`],f(t.description,`description`,`text`)),t.name!==void 0&&s(i,[`name`],f(t.name,`name`,`text`)),t.url!==void 0&&s(i,[`url`],f(t.url,`url`,`text`)),l(await d(`Creating`,async()=>n.post(`/accounts/${t.accountIdentifier}/custom_pages/assets`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}},y={command:`custom`,describe:`Assets operations`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.positional(`zoneIdentifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`name`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`v2 <zoneIdentifier>`,describe:`Creates a new custom asset at the zone level.`,builder:b,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages assets create v2`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets`,pathParams:{zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`json`,body:{description:e.description,name:e.name,url:e.url,body:e.body}});return}let t=await a(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=c(e.body);l(await d(`Creating`,async()=>t.post(`/zones/${e.zoneIdentifier}/custom_pages/assets`,{body:n})),{successLabel:`Created`});return}e.description===void 0&&(e.description=await r(`description`,`A short description of the custom asset.`)),e.name===void 0&&(e.name=await r(`name`,`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`)),e.url===void 0&&(e.url=await r(`url`,`The URL where the asset content is fetched from.`));let i={};e.description!==void 0&&s(i,[`description`],f(e.description,`description`,`text`)),e.name!==void 0&&s(i,[`name`],f(e.name,`name`,`text`)),e.url!==void 0&&s(i,[`url`],f(e.url,`url`,`text`)),l(await d(`Creating`,async()=>t.post(`/zones/${e.zoneIdentifier}/custom_pages/assets`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}},S={command:`create`,describe:`Assets operations`,builder:e=>e.command(x).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const w={command:`asset <assetName>`,describe:`Deletes an existing custom asset.`,builder:C,handler:async n=>{if(n.dryRun){o(),u({command:`cf custom-pages assets delete custom asset`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets/${n.assetName??`<assetName>`}`,pathParams:{assetName:String(n.assetName??``),accountIdentifier:String(n.accountIdentifier??``)},bodyKind:`none`});return}let r=await a(n);if(n.accountId=n.local?p:await e(r),!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}l(await d(`Deleting`,async()=>r.customPages.assets.delete.custom.asset(n.assetName,n.accountIdentifier)),{successLabel:`Deleted`})}},T={command:`custom`,describe:`Assets operations`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`zone-identifier`,{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 D={command:`v2 <assetName>`,describe:`Deletes an existing custom asset.`,builder:E,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages assets delete v2`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets/${e.assetName??`<assetName>`}`,pathParams:{assetName:String(e.assetName??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,!await t({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}l(await d(`Deleting`,async()=>r.customPages.assets.delete.v2(e.assetName,i)),{successLabel:`Deleted`})}},O={command:`delete`,describe:`Assets operations`,builder:e=>e.command(D).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`asset <assetName>`,describe:`Fetches the details of a custom asset.`,builder:k,handler:async t=>{if(t.dryRun){o(),u({command:`cf custom-pages assets get custom asset`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets/${t.assetName??`<assetName>`}`,pathParams:{assetName:String(t.assetName??``),accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`none`});return}let n=await a(t);t.accountId=t.local?p:await e(n),l(await d(`Loading`,async()=>n.customPages.assets.get.custom.asset(t.assetName,t.accountIdentifier)),{successLabel:`Loaded`})}},j={command:`custom`,describe:`Assets operations`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`v2 <assetName>`,describe:`Fetches the details of a custom asset.`,builder:M,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages assets get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets/${e.assetName??`<assetName>`}`,pathParams:{assetName:String(e.assetName??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.customPages.assets.get.v2(e.assetName,r)),{successLabel:`Loaded`})}},P={command:`get`,describe:`Assets operations`,builder:e=>e.command(N).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`assets`,describe:`Fetches all the custom assets at the account level.`,builder:F,handler:async t=>{let n={page:t.page,per_page:t.perPage};if(t.dryRun){o(),u({command:`cf custom-pages assets list custom assets`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets`,pathParams:{accountIdentifier:String(t.accountIdentifier??``)},query:n,bodyKind:`none`});return}let r=await a(t);t.accountId=t.local?p:await e(r),l(await d(`Loading`,async()=>r.customPages.assets.list.custom.assets(t.accountIdentifier,n)),{successLabel:`Loaded`})}},I={command:`custom`,describe:`Assets operations`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.positional(`zoneIdentifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`v2 <zoneIdentifier>`,describe:`Fetches all the custom assets at the zone level.`,builder:L,handler:async e=>{let t={page:e.page,per_page:e.perPage};if(e.dryRun){u({command:`cf custom-pages assets list v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets`,pathParams:{zoneIdentifier:String(e.zoneIdentifier??``)},query:t,bodyKind:`none`});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.customPages.assets.list.v2(i,t)),{successLabel:`Loaded`})}},z={command:`list`,describe:`Assets operations`,builder:e=>e.command(R).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).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:`asset <assetName>`,describe:`Updates the configuration of an existing custom asset.`,builder:B,handler:async t=>{if(t.dryRun){o(),u({command:`cf custom-pages assets update custom asset`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets/${t.assetName??`<assetName>`}`,pathParams:{assetName:String(t.assetName??``),accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`json`,body:{description:t.description,url:t.url,body:t.body}});return}let n=await a(t);if(t.accountId=t.local?p:await e(n),t.body){let e=c(t.body);l(await d(`Updating`,async()=>n.put(`/accounts/${t.accountIdentifier}/custom_pages/assets/${t.assetName}`,{body:e})),{successLabel:`Updated`});return}t.description===void 0&&(t.description=await r(`description`,`A short description of the custom asset.`)),t.url===void 0&&(t.url=await r(`url`,`The URL where the asset content is fetched from.`));let i={};t.description!==void 0&&s(i,[`description`],f(t.description,`description`,`text`)),t.url!==void 0&&s(i,[`url`],f(t.url,`url`,`text`)),l(await d(`Updating`,async()=>n.put(`/accounts/${t.accountIdentifier}/custom_pages/assets/${t.assetName}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},H={command:`custom`,describe:`Assets operations`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).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:`v2 <assetName>`,describe:`Updates the configuration of an existing custom asset.`,builder:U,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages assets update v2`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets/${e.assetName??`<assetName>`}`,pathParams:{assetName:String(e.assetName??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`json`,body:{description:e.description,url:e.url,body:e.body}});return}let t=await a(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=c(e.body);l(await d(`Updating`,async()=>t.put(`/zones/${e.zoneIdentifier}/custom_pages/assets/${e.assetName}`,{body:n})),{successLabel:`Updated`});return}e.description===void 0&&(e.description=await r(`description`,`A short description of the custom asset.`)),e.url===void 0&&(e.url=await r(`url`,`The URL where the asset content is fetched from.`));let i={};e.description!==void 0&&s(i,[`description`],f(e.description,`description`,`text`)),e.url!==void 0&&s(i,[`url`],f(e.url,`url`,`text`)),l(await d(`Updating`,async()=>t.put(`/zones/${e.zoneIdentifier}/custom_pages/assets/${e.assetName}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},G={command:`update`,describe:`Assets operations`,builder:e=>e.command(W).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},K={command:`assets`,describe:`Operations for assets`,builder:e=>e.command(S).command(O).command(P).command(z).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function q(e){return e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <identifier>`,describe:`Fetches the details of a custom page.`,builder:q,handler:async t=>{if(t.dryRun){o(),u({command:`cf custom-pages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/${t.identifier??`<identifier>`}`,pathParams:{identifier:String(t.identifier??``),accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`none`});return}let n=await a(t);t.accountId=t.local?p:await e(n),l(await d(`Loading`,async()=>n.customPages.get(t.identifier,t.accountIdentifier)),{successLabel:`Loaded`})}};function Y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Fetches all the custom pages at the account level.`,builder:Y,handler:async t=>{if(t.dryRun){o(),u({command:`cf custom-pages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages`,pathParams:{accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`none`});return}let n=await a(t);t.accountId=t.local?p:await e(n),l(await d(`Loading`,async()=>n.customPages.list(t.accountIdentifier)),{successLabel:`Loaded`})}};function Z(e){return e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`state`,{type:`string`,description:`The custom page state.`,choices:[`default`,`customized`]}).option(`url`,{type:`string`,description:`The URL associated with the custom page.`,default:``}).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:`update <identifier>`,describe:`Updates the configuration of an existing custom page.`,builder:Z,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/${e.identifier??`<identifier>`}`,pathParams:{identifier:String(e.identifier??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`json`,body:{state:e.state,url:e.url,body:e.body}});return}let t=await a(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=c(e.body);l(await d(`Updating`,async()=>t.put(`/zones/${e.zoneIdentifier}/custom_pages/${e.identifier}`,{body:n})),{successLabel:`Updated`});return}e.state===void 0&&(e.state=await i(`state`,`The custom page state.`,[`default`,`customized`])),e.url===void 0&&(e.url=await r(`url`,`The URL associated with the custom page.`));let o={};e.state!==void 0&&s(o,[`state`],f(e.state,`state`,`text`)),e.url!==void 0&&s(o,[`url`],f(e.url,`url`,`text`)),l(await d(`Updating`,async()=>t.put(`/zones/${e.zoneIdentifier}/custom_pages/${e.identifier}`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}};function $(e){return e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`get <identifier>`,describe:`Fetches the details of a custom page.`,builder:$,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages zone-custom-pages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/${e.identifier??`<identifier>`}`,pathParams:{identifier:String(e.identifier??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.customPages.zoneCustomPages.get(e.identifier,r)),{successLabel:`Loaded`})}};function ne(e){return e.option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`Fetches all the custom pages at the zone level.`,builder:ne,handler:async e=>{if(e.dryRun){u({command:`cf custom-pages zone-custom-pages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages`,pathParams:{zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.customPages.zoneCustomPages.list(r)),{successLabel:`Loaded`})}},ie={command:`zone-custom-pages`,describe:`Zone-scoped custom page operations`,builder:e=>e.command(te).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ae={command:`custom-pages`,describe:`Custom error and challenge pages (1000s, WAF blocks, captchas) for zones and accounts`,builder:e=>e.command(J).command(X).command(Q).command(g).command(K).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ae as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,f as t,m as n,p as r,t as i,u as a}from"./auth-BlSmtIKd.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-DZfTxbrx.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`jurisdiction`,{type:`string`,description:`Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored.`,choices:[`eu`,`fedramp`]}).option(`name`,{type:`string`,description:`D1 database name.`}).option(`primary-location-hint`,{type:`string`,description:`Specify the region to create the D1 primary, if available. If this option is omitted, the D1 will be created as close as possible to the current user.`,choices:[`wnam`,`enam`,`weur`,`eeur`,`apac`,`oc`]}).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 m={command:`create`,describe:`Returns the created D1 database.`,builder:p,handler:async t=>{if(t.dryRun){l({command:`cf d1 create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database`,pathParams:{},bodyKind:`json`,body:{jurisdiction:t.jurisdiction,name:t.name,primaryLocationHint:t.primaryLocationHint,body:t.body}});return}let r=await i(t),p=t.local?f:await e(r);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Creating`,async()=>r.post(`/accounts/${p}/d1/database`,{body:e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await n(`name`,`D1 database name.`));let m={};t.jurisdiction!==void 0&&o(m,[`jurisdiction`],d(t.jurisdiction,`jurisdiction`,`text`)),t.name!==void 0&&o(m,[`name`],d(t.name,`name`,`text`)),t.primaryLocationHint!==void 0&&o(m,[`primary_location_hint`],d(t.primaryLocationHint,`primaryLocationHint`,`text`)),c(await u(`Creating`,async()=>r.post(`/accounts/${p}/d1/database`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function h(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (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 g={command:`delete <databaseId>`,describe:`Deletes the specified D1 database.`,builder:h,handler:async n=>{if(n.dryRun){l({command:`cf d1 delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${n.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(n.databaseId??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>r.d1.delete(o,n.databaseId)),{successLabel:`Deleted`})}};function _(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).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([`read-replication-mode`].some(t=>e[t]!==void 0)){let t=[`read-replication-mode`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --read_replication-* flag is set`)}return!0})}const v={command:`edit <databaseId>`,describe:`Updates partially the specified D1 database.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf d1 edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{readReplicationMode:t.readReplicationMode,body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/d1/database/${t.databaseId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.readReplicationMode!==void 0&&o(p,[`read_replication`,`mode`],d(t.readReplicationMode,`readReplicationMode`,`text`)),c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/d1/database/${t.databaseId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function y(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`current-bookmark`,{type:`string`,description:`To poll an in-progress export, provide the current bookmark (returned by your first polling response)`}).option(`dump-options-no-data`,{type:`boolean`,description:`Export only the table definitions, not their contents`}).option(`dump-options-no-schema`,{type:`boolean`,description:`Export only each table's contents, not its definition`}).option(`dump-options-tables`,{type:`string`,array:!0,description:`Filter the export to just one or more tables. Passing an empty array is the same as not passing anything and means: export all tables.`}).option(`output-format`,{type:`string`,description:`Specifies that you will poll this endpoint until the export completes`,choices:[`polling`]}).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:`export <databaseId>`,describe:`Returns a URL where the SQL contents of your D1 can be downloaded. Note: this process may take some time for larger DBs, during which your D1 will be unavailable to serve queries. To avoid blocking your DB unnecessarily, an in-progress export must be continually polled or will automatically cancel.`,builder:y,handler:async t=>{if(t.dryRun){l({command:`cf d1 export`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/export`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{currentBookmark:t.currentBookmark,dumpOptionsNoData:t.dumpOptionsNoData,dumpOptionsNoSchema:t.dumpOptionsNoSchema,dumpOptionsTables:t.dumpOptionsTables,outputFormat:t.outputFormat,body:t.body}});return}let n=await i(t),p=t.local?f:await e(n);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Loading`,async()=>n.post(`/accounts/${p}/d1/database/${t.databaseId}/export`,{body:e})),{successLabel:`Loaded`});return}t.outputFormat===void 0&&(t.outputFormat=await r(`output-format`,`Specifies that you will poll this endpoint until the export completes`,[`polling`]));let m={};t.currentBookmark!==void 0&&o(m,[`current_bookmark`],d(t.currentBookmark,`currentBookmark`,`text`)),t.dumpOptionsNoData!==void 0&&o(m,[`dump_options`,`no_data`],t.dumpOptionsNoData),t.dumpOptionsNoSchema!==void 0&&o(m,[`dump_options`,`no_schema`],t.dumpOptionsNoSchema),t.dumpOptionsTables!==void 0&&o(m,[`dump_options`,`tables`],t.dumpOptionsTables),t.outputFormat!==void 0&&o(m,[`output_format`],d(t.outputFormat,`outputFormat`,`text`)),c(await u(`Loading`,async()=>n.post(`/accounts/${p}/d1/database/${t.databaseId}/export`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Loaded`})}};function x(e){return e.positional(`databaseId`,{type:`string`,description:`Database ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <databaseId>`,describe:`Returns the specified D1 database.`,builder:x,handler:async t=>{if(t.dryRun){l({command:`cf d1 get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.d1.get(r,t.databaseId)),{successLabel:`Loaded`})}};function C(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`action`,{type:`string`,description:`Indicates you have a new SQL file to upload.`,choices:[`init`,`ingest`,`poll`]}).option(`etag`,{type:`string`,description:`Required when action is 'init' or 'ingest'. An md5 hash of the file you're uploading. Used to check if it already exists, and validate its contents before ingesting.`}).option(`filename`,{type:`string`,description:`The filename you have successfully uploaded.`}).option(`current-bookmark`,{type:`string`,description:`This identifies the currently-running import, checking its status.`}).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(`etag`,[`current-bookmark`]).conflicts(`filename`,[`current-bookmark`]).implies(`filename`,[`etag`]).conflicts(`current-bookmark`,[`etag`,`filename`])}const w={command:`import <databaseId>`,describe:`Generates a temporary URL for uploading an SQL file to, then instructing the D1 to import it and polling it for status updates. Imports block the D1 for their duration.`,builder:C,handler:async t=>{if(t.dryRun){l({command:`cf d1 import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/import`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{action:t.action,etag:t.etag,filename:t.filename,currentBookmark:t.currentBookmark,body:t.body}});return}let n=await i(t),p=t.local?f:await e(n);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Creating`,async()=>n.post(`/accounts/${p}/d1/database/${t.databaseId}/import`,{body:e})),{successLabel:`Created`});return}t.action===void 0&&(t.action=await r(`action`,`Indicates you have a new SQL file to upload.`,[`init`,`ingest`,`poll`]));let m={};t.action!==void 0&&o(m,[`action`],d(t.action,`action`,`text`)),t.etag!==void 0&&o(m,[`etag`],d(t.etag,`etag`,`text`)),t.filename!==void 0&&o(m,[`filename`],d(t.filename,`filename`,`text`)),t.currentBookmark!==void 0&&o(m,[`current_bookmark`],d(t.currentBookmark,`currentBookmark`,`text`)),c(await u(`Creating`,async()=>n.post(`/accounts/${p}/d1/database/${t.databaseId}/import`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function T(e){return e.option(`name`,{type:`string`,description:`a database name to search for.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Returns a list of D1 databases.`,builder:T,handler:async t=>{let n={name:t.name,page:t.page,per_page:t.perPage};if(t.dryRun){l({command:`cf d1 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database`,pathParams:{},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.d1.list(o,n)),{successLabel:`Loaded`})}};function D(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`params`,{type:`string`,array:!0,description:`The params field`}).option(`sql`,{type:`string`,description:`Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A single query object or a batch query object`})}const O={command:`query <databaseId>`,describe:`Returns the query result as an object.`,builder:D,handler:async t=>{if(t.dryRun){l({command:`cf d1 query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/query`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{params:t.params,sql:t.sql,body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Loading`,async()=>n.post(`/accounts/${r}/d1/database/${t.databaseId}/query`,{body:e})),{successLabel:`Loaded`});return}let p={};t.params!==void 0&&o(p,[`params`],t.params),t.sql!==void 0&&o(p,[`sql`],d(t.sql,`sql`,`text`)),c(await u(`Loading`,async()=>n.post(`/accounts/${r}/d1/database/${t.databaseId}/query`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Loaded`})}};function k(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`params`,{type:`string`,array:!0,description:`The params field`}).option(`sql`,{type:`string`,description:`Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A single query object or a batch query object`})}const A={command:`raw <databaseId>`,describe:`Returns the query result rows as arrays rather than objects. This is a performance-optimized version of the /query endpoint.`,builder:k,handler:async t=>{if(t.dryRun){l({command:`cf d1 raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/raw`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{params:t.params,sql:t.sql,body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Loading`,async()=>n.post(`/accounts/${r}/d1/database/${t.databaseId}/raw`,{body:e})),{successLabel:`Loaded`});return}let p={};t.params!==void 0&&o(p,[`params`],t.params),t.sql!==void 0&&o(p,[`sql`],d(t.sql,`sql`,`text`)),c(await u(`Loading`,async()=>n.post(`/accounts/${r}/d1/database/${t.databaseId}/raw`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Loaded`})}};function j(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`timestamp`,{type:`string`,description:`An optional ISO 8601 timestamp. If provided, returns the nearest available bookmark at or before this timestamp. If omitted, returns the current bookmark.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get-bookmark <databaseId>`,describe:`Retrieves the current bookmark, or the nearest bookmark at or before a provided timestamp. Bookmarks can be used with the restore endpoint to revert the database to a previous point in time.`,builder:j,handler:async t=>{let n={timestamp:t.timestamp};if(t.dryRun){l({command:`cf d1 time-travel get-bookmark`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/time_travel/bookmark`,pathParams:{databaseId:String(t.databaseId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.d1.timeTravel.getBookmark(o,t.databaseId,n)),{successLabel:`Loaded`})}};function N(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`bookmark`,{type:`string`,description:"A bookmark to restore the database to. Required if `timestamp` is not provided."}).option(`timestamp`,{type:`string`,description:"An ISO 8601 timestamp to restore the database to. Required if `bookmark` is not provided."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`restore <databaseId>`,describe:`Restores a D1 database to a previous point in time either via a bookmark or a timestamp.`,builder:N,handler:async t=>{let n={bookmark:t.bookmark,timestamp:t.timestamp};if(t.dryRun){l({command:`cf d1 time-travel restore`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/time_travel/restore`,pathParams:{databaseId:String(t.databaseId??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?f:await e(r);t.accountId=o,c(await u(`Creating`,async()=>r.d1.timeTravel.restore(o,t.databaseId,n)),{successLabel:`Created`})}},F={command:`time-travel`,describe:`use specific point-in-time backups of your D1 database`,builder:e=>e.command(M).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`update <databaseId>`,describe:`Updates the specified D1 database.`,builder:I,handler:async t=>{if(t.dryRun){l({command:`cf d1 update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{readReplicationMode:t.readReplicationMode,body:t.body}});return}let n=await i(t),p=t.local?f:await e(n);if(t.accountId=p,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.put(`/accounts/${p}/d1/database/${t.databaseId}`,{body:e})),{successLabel:`Updated`});return}t.readReplicationMode===void 0&&(t.readReplicationMode=await r(`read-replication-mode`,`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,[`auto`,`disabled`]));let m={};t.readReplicationMode!==void 0&&o(m,[`read_replication`,`mode`],d(t.readReplicationMode,`readReplicationMode`,`text`)),c(await u(`Updating`,async()=>n.put(`/accounts/${p}/d1/database/${t.databaseId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},R={command:`d1`,describe:`D1 is Cloudflare's managed, serverless database with SQLite's SQL semantics, built-in disaster recovery, and Worker and HTTP API access.`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).command(E).command(O).command(A).command(L).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{R as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{l as e,t}from"./auth-BlSmtIKd.mjs";import{t as n}from"./output-D7_yAFVR.mjs";import{n as r,t as i}from"./progress-DZfTxbrx.mjs";function a(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const o={command:`get`,describe:`Retrieve the account and zone specific unique identifier used as part of the CNAME target for DCV Delegation.`,builder:a,handler:async a=>{if(a.dryRun){r({command:`cf dcv-delegation get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zoneId??`<zoneId>`}/dcv_delegation/uuid`,pathParams:{zoneId:String(a.zoneId??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.dcvDelegation.get(s)),{successLabel:`Loaded`})}},s={command:`dcv-delegation`,describe:`Delegate domain control validation (DCV) to Cloudflare so certificates auto-renew without manual DNS changes`,builder:e=>e.command(o).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{s as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire as e}from"node:module";import{existsSync as t,readFileSync as n,realpathSync as r}from"node:fs";import{dirname as i,resolve as a}from"node:path";import{constants as o}from"node:os";import{spawn as s}from"node:child_process";import{fileURLToPath as c}from"node:url";const l=`CF_DELEGATION`;function u(r){if(r.env.CF_DELEGATION||_(r.ownPackageJsonPath))return null;let o;try{o=e(import.meta.url).resolve(`cf/package.json`,{paths:[r.cwd]})}catch{return null}if(r.ownPackageJsonPath&&g(o,r.ownPackageJsonPath))return null;let s;try{s=JSON.parse(n(o,`utf-8`))}catch{return null}let c=h(s.bin);if(!c)return null;let l=a(i(o),c);return t(l)?{packageJsonPath:o,binPath:l,version:typeof s.version==`string`?s.version:`unknown`}:null}async function d(e={}){let t=e.cwd??process.cwd(),n=e.argv??process.argv.slice(2),r=e.env??process.env,i=u({cwd:t,ownPackageJsonPath:e.ownPackageJsonPath===void 0?v():e.ownPackageJsonPath,env:r});return i?{delegated:!0,exitCode:await m(i.binPath,n,r)}:{delegated:!1}}async function f(){let e=process.argv.slice(2);return p(e)?{delegated:!1}:d({argv:e})}function p(e){return e.find(e=>!e.startsWith(`-`))===`complete`}function m(e,t,n){return new Promise((r,i)=>{let a=s(process.execPath,[e,...t],{stdio:[`inherit`,`inherit`,`inherit`,`ipc`],env:{...n,[l]:`1`}});a.on(`message`,e=>{process.send&&process.send(e)});let c=e=>()=>{a.kill(e)},u=c(`SIGINT`),d=c(`SIGTERM`);process.on(`SIGINT`,u),process.on(`SIGTERM`,d);let f=()=>{process.off(`SIGINT`,u),process.off(`SIGTERM`,d)};a.once(`exit`,(e,t)=>{f(),r(e===null?t?128+(o.signals[t]??1):0:e)}),a.once(`error`,e=>{f(),i(e)})})}function h(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e,n=t.cf;if(typeof n==`string`)return n;for(let e of Object.values(t))if(typeof e==`string`)return e}return null}function g(e,t){try{return r(e)===r(t)}catch{return a(e)===a(t)}}function _(e){return e?e.split(/[\\/]/).some(e=>e===`_npx`||e===`dlx`||e.startsWith(`dlx-`)):!1}function v(){let e=i(c(import.meta.url));for(;;){let n=a(e,`package.json`);if(t(n))return n;let r=i(e);if(r===e)return null;e=r}}export{l as DELEGATION_SENTINEL,f as maybeDelegateFromProcess,d as maybeDelegateToLocalInstall,u as resolveDelegateTarget};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{r as e}from"./session-mW-s8ghP.mjs";import{c as t,o as n,s as r,x as i}from"./dist-DvKjT2TT.mjs";import{a,o}from"./theme-BklJDrb2.mjs";import"./ui-mP_arYIg.mjs";import{S as s,a as c,n as l,t as u}from"./auth-BlSmtIKd.mjs";import{i as d,m as f,n as p,o as m,t as h}from"./dist-C_bu5HwZ.mjs";import{a as g,i as _,n as v,r as y,runBuild as b,t as x}from"./build-C_48VvoK.mjs";import{existsSync as S,readFileSync as C,statSync as w}from"node:fs";import T from"node:assert";import{dirname as E,join as D,sep as O}from"node:path";function k(a){let o={apiToken:a},c=`cf-cli/${e}`,l=!!process.env.DEBUG,u={loggerLevel:l?`debug`:`log`,debug:l?(...e)=>p.message(e.join(` `),{spacing:0}):()=>{},debugWithSanitization:l?(e,...t)=>{i()?p.message(`${e} omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data`,{spacing:0}):p.message([e,...t].join(` `),{spacing:0})}:()=>{},log:(...e)=>p.message(e.join(` `),{spacing:0}),info:(...e)=>p.message(e.join(` `),{spacing:0}),warn:(...e)=>p.warn(String(e.join(` `)),{spacing:0}),error:(...e)=>p.error(String(e.join(` `)),{spacing:0})};return{fetchResult:(e,n,r,i,a)=>t(e,n,r,c,u,i,a,o),fetchListResult:(e,t,n,i)=>r(e,t,n,c,u,i,o),fetchPagedListResult:(e,t,n,i)=>r(e,t,n,c,u,i,o),fetchKVGetValue:(e,t,r,i)=>n(e,t,r,i,c,u,o),logger:u,confirm:async(e,t)=>{if(s())return t?.fallbackValue??t?.defaultValue??!1;let n=await h({message:e,initialValue:t?.defaultValue??!1});return f(n)&&process.exit(130),n===!0},prompt:async(e,t)=>{if(s())return t?.defaultValue??``;let n=await m({message:e,defaultValue:t?.defaultValue});return f(n)&&process.exit(130),n},select:async(e,t)=>{let{choices:n,defaultOption:r,fallbackOption:i}=t;if(s()){let e=n[i??r??0]??n[0];if(!e)throw Error(`select() called with no choices`);return e.value}let a=await d({message:e,options:n.map(e=>({value:e.value,label:e.title,...e.description?{hint:e.description}:{}})),initialValue:r===void 0?void 0:n[r]?.value});return f(a)&&process.exit(130),a},isNonInteractiveOrCI:s}}const A={esm:`esm`,cjs:`commonjs`,python:`python`,"python-requirement":`python-requirement`,wasm:`compiled-wasm`,text:`text`,data:`buffer`,json:`text`};function j(e,t,n){let r=process.cwd(),i=t.main??``;return{command:`deploy`,entry:{file:i,projectRoot:r,configPath:e.configPath,format:`modules`,moduleRoot:i?E(i):e.bundlePath,exports:[]},name:e.workerName,compatibilityDate:t.compatibility_date,compatibilityFlags:t.compatibility_flags??[],assetsDir:N(e,t),main:t.main??void 0,keepVars:t.keep_vars??!1,dryRun:!1,env:void 0,outfile:void 0,tag:void 0,message:void 0,secretsFile:void 0,experimentalAutoCreate:!0,accountId:n,sendMetrics:!1,resourcesProvision:!0,skipProvisioningConfigWriteback:!0,skipLastDeployedFromApiCheck:!0,containersRollout:void 0,triggers:t.triggers?.crons,routes:M(t),logpush:t.logpush,dispatchNamespace:void 0,strict:!1,cliVars:{},isWorkersSite:!1,legacyAssetPaths:void 0,oldAssetTtl:void 0,useServiceEnvApiPath:!1}}function M(e){return e.routes?e.routes:e.route?[e.route]:[]}function N(e,t){let n=e.assetsDir??t.assets?.directory;if(!n)return;let r=!!t.main,i=t.assets?.run_worker_first;if(!r&&i)throw new x(`assets.run_worker_first requires a Worker entrypoint, but no main module is configured.`);return{directory:n,binding:t.assets?.binding,directoryExists:S(n)}}function P(e,t,n){let{mainModule:r,modules:i}=t.manifest??{};if(!r)return{modules:[],sourceMaps:void 0,dependencies:{},resolvedEntryPointPath:``,bundleType:`esm`,content:``};F(r,e.bundlePath);let a=D(e.bundlePath,r);if(!S(a))throw new x(`Main module not found: ${a}`);let o=i?.[r]?.type??`esm`;if(o===`sourcemap`)throw new x(`Main module "${r}" cannot be a sourcemap.`);let s=C(a,`utf8`),c=A[o],l=[],u=[],d={};if(d[a]={bytesInOutput:w(a).size},i)for(let[t,a]of Object.entries(i)){if(t===r)continue;F(t,e.bundlePath);let i=D(e.bundlePath,t);if(a.type===`sourcemap`){n&&S(i)&&u.push({name:t,content:C(i,`utf8`)});continue}if(!S(i))throw new x(`Module not found: ${i}`);let o=a.type===`wasm`||a.type===`data`?C(i):C(i,`utf8`);l.push({name:`./${t}`,filePath:i,content:o,type:A[a.type]}),d[i]={bytesInOutput:w(i).size}}return{modules:l,sourceMaps:u.length>0?u:void 0,dependencies:d,resolvedEntryPointPath:a,bundleType:c,content:s}}function F(e,t){let n=D(t,e);if(n!==t&&!n.startsWith(t+O))throw new x(`Module path "${e}" escapes the bundle directory.`)}const I={command:`deploy`,describe:`Deploy a worker to Cloudflare`,builder:e=>e.option(`mode`,{type:`string`,alias:`m`,description:`Deployment mode (e.g. production, staging, preview)`}).option(`prebuilt`,{type:`boolean`,description:`Deploy existing Build Output API files without building`,default:!1}),handler:async e=>{e.prebuilt||(await b(e.mode),p.message(``,{spacing:0}));let t=y(),n=t.workers[0];T(n&&t.workers.length===1,`There should be only one worker`);let{wranglerConfig:r,builtConfig:i}=v(n),s=P(n,i,r.upload_source_maps),d=await l(),f=await c(await u(e));g(k(d));let m=j(n,r,f);p.message(a.bold(`Deploy`),{symbol:o.dim(`├`),spacing:0}),await _(m,r,s,{syncWorkersSite:void 0,getNormalizedContainerOptions:void 0,buildContainer:void 0,deployContainers:void 0,analyseBundle:void 0}),p.success(`Deployment complete`)}};export{I as default};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./src-C5qivNKH.mjs";import{a as t}from"./theme-BklJDrb2.mjs";import"./ui-mP_arYIg.mjs";import{n,t as r}from"./spawn-D_cjG87Z.mjs";const i={command:`dev [implArgs..]`,describe:`Run the project's Cloudflare dev server`,builder:e=>e.positional(`implArgs`,{type:`string`,array:!0,describe:`Arguments forwarded to the dev-server implementation`}).parserConfiguration({"unknown-options-as-args":!0,"camel-case-expansion":!1}).epilogue(`cf dev discovers the installed Cloudflare dev-server in the project's manifest
3
+ (package.json / pyproject.toml / Cargo.toml) and spawns it as a subprocess.
4
+ A project must have exactly one dev-server installed.
5
+
6
+ Use the impl's own --help for its flags (e.g. ${t.brand(`cf dev --help`)}\nfalls through to the impl's help once spawned).`),handler:async t=>{throw new e(await r(n(process.cwd()),`dev`,(t.implArgs??[]).map(String)))}};export{i as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,f as t,m as n,p as r,t as i,u as a}from"./auth-BlSmtIKd.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-DZfTxbrx.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`check-type`,{type:`string`,description:`type of check to perform`,choices:[`icmp`],default:`icmp`}).option(`endpoint`,{type:`string`,description:`the IP address of the host to perform checks against`}).option(`name`,{type:`string`,description:`Optional name associated with this check`}).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 m={command:`create`,describe:`Create Endpoint Health Check.`,builder:p,handler:async t=>{if(t.dryRun){l({command:`cf diagnostics endpoint-healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/diagnostics/endpoint-healthchecks`,pathParams:{},bodyKind:`json`,body:{checkType:t.checkType,endpoint:t.endpoint,name:t.name,body:t.body}});return}let p=await i(t),m=t.local?f:await e(p);if(t.accountId=m,t.body){let e=s(t.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/diagnostics/endpoint-healthchecks`,{body:e})),{successLabel:`Created`});return}t.checkType===void 0&&(t.checkType=await r(`check-type`,`type of check to perform`,[`icmp`])),t.endpoint===void 0&&(t.endpoint=await n(`endpoint`,`the IP address of the host to perform checks against`));let h={};t.checkType!==void 0&&o(h,[`check_type`],d(t.checkType,`checkType`,`text`)),t.endpoint!==void 0&&o(h,[`endpoint`],d(t.endpoint,`endpoint`,`text`)),t.name!==void 0&&o(h,[`name`],d(t.name,`name`,`text`)),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/diagnostics/endpoint-healthchecks`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function h(e){return e.positional(`id`,{type:`string`,description:`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 g={command:`delete <id>`,describe:`Delete Endpoint Health Check.`,builder:h,handler:async n=>{if(n.dryRun){l({command:`cf diagnostics endpoint-healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/diagnostics/endpoint-healthchecks/${n.id??`<id>`}`,pathParams:{id:String(n.id??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?f:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>r.diagnostics.endpointHealthchecks.delete(o,n.id)),{successLabel:`Deleted`})}};function _(e){return e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <id>`,describe:`Get a single Endpoint Health Check.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf diagnostics endpoint-healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/diagnostics/endpoint-healthchecks/${t.id??`<id>`}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.diagnostics.endpointHealthchecks.get(r,t.id)),{successLabel:`Loaded`})}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`List Endpoint Health Checks.`,builder:y,handler:async t=>{if(t.dryRun){l({command:`cf diagnostics endpoint-healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/diagnostics/endpoint-healthchecks`,pathParams:{},bodyKind:`none`});return}let n=await i(t),r=t.local?f:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.diagnostics.endpointHealthchecks.list(r)),{successLabel:`Loaded`})}};function x(e){return e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`check-type`,{type:`string`,description:`type of check to perform`,choices:[`icmp`],default:`icmp`}).option(`endpoint`,{type:`string`,description:`the IP address of the host to perform checks against`}).option(`name`,{type:`string`,description:`Optional name associated with this check`}).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 <id>`,describe:`Update a Endpoint Health Check.`,builder:x,handler:async t=>{if(t.dryRun){l({command:`cf diagnostics endpoint-healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/diagnostics/endpoint-healthchecks/${t.id??`<id>`}`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:{checkType:t.checkType,endpoint:t.endpoint,name:t.name,body:t.body}});return}let p=await i(t),m=t.local?f:await e(p);if(t.accountId=m,t.body){let e=s(t.body);c(await u(`Updating`,async()=>p.put(`/accounts/${m}/diagnostics/endpoint-healthchecks/${t.id}`,{body:e})),{successLabel:`Updated`});return}t.checkType===void 0&&(t.checkType=await r(`check-type`,`type of check to perform`,[`icmp`])),t.endpoint===void 0&&(t.endpoint=await n(`endpoint`,`the IP address of the host to perform checks against`));let h={};t.checkType!==void 0&&o(h,[`check_type`],d(t.checkType,`checkType`,`text`)),t.endpoint!==void 0&&o(h,[`endpoint`],d(t.endpoint,`endpoint`,`text`)),t.name!==void 0&&o(h,[`name`],d(t.name,`name`,`text`)),c(await u(`Updating`,async()=>p.put(`/accounts/${m}/diagnostics/endpoint-healthchecks/${t.id}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}},C={command:`endpoint-healthchecks`,describe:`Monitor external endpoint availability with periodic HTTP/HTTPS health checks`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`colos`,{type:`string`,array:!0,description:`If no source colo names specified, all colos will be used. China colos are unavailable for traceroutes.`}).option(`options-max-ttl`,{type:`number`,description:`Max TTL.`,default:15}).option(`options-packet-type`,{type:`string`,description:`Type of packet sent.`,choices:[`icmp`,`tcp`,`udp`,`gre`,`gre+icmp`],default:`icmp`}).option(`options-packets-per-ttl`,{type:`number`,description:`Number of packets sent at each TTL.`,default:3}).option(`options-port`,{type:`number`,description:`For UDP and TCP, specifies the destination port. For ICMP, specifies the initial ICMP sequence value. Default value 0 will choose the best value to use for each protocol.`,default:0}).option(`options-wait-time`,{type:`number`,description:`Set the time (in seconds) to wait for a response to a probe.`,default:1}).option(`targets`,{type:`string`,array:!0,description:`The targets 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 T={command:`create`,describe:`Run traceroutes from Cloudflare colos.`,builder:w,handler:async t=>{if(t.dryRun){l({command:`cf diagnostics traceroutes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/diagnostics/traceroute`,pathParams:{},bodyKind:`json`,body:{colos:t.colos,optionsMaxTtl:t.optionsMaxTtl,optionsPacketType:t.optionsPacketType,optionsPacketsPerTtl:t.optionsPacketsPerTtl,optionsPort:t.optionsPort,optionsWaitTime:t.optionsWaitTime,targets:t.targets,body:t.body}});return}let n=await i(t),r=t.local?f:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/diagnostics/traceroute`,{body:e})),{successLabel:`Created`});return}if(t.targets===void 0)throw Error(`--targets is required (or pass --body with this field set).`);let p={};t.colos!==void 0&&o(p,[`colos`],t.colos),t.optionsMaxTtl!==void 0&&o(p,[`options`,`max_ttl`],t.optionsMaxTtl),t.optionsPacketType!==void 0&&o(p,[`options`,`packet_type`],d(t.optionsPacketType,`optionsPacketType`,`text`)),t.optionsPacketsPerTtl!==void 0&&o(p,[`options`,`packets_per_ttl`],t.optionsPacketsPerTtl),t.optionsPort!==void 0&&o(p,[`options`,`port`],t.optionsPort),t.optionsWaitTime!==void 0&&o(p,[`options`,`wait_time`],t.optionsWaitTime),t.targets!==void 0&&o(p,[`targets`],t.targets),c(await u(`Creating`,async()=>n.post(`/accounts/${r}/diagnostics/traceroute`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},E={command:`traceroutes`,describe:`Run traceroutes from Cloudflare data centers to diagnose network path issues`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`diagnostics`,describe:`Network diagnostic tools — traceroutes from Cloudflare's edge and endpoint health checks`,builder:e=>e.command(C).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{D as default};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,f as t,m as n,p as r,t as i,u as a}from"./auth-BlSmtIKd.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-DZfTxbrx.mjs";import{n as d,t as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";function m(e){return e.option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`create`,describe:`Create a new Workers for Platforms namespace.`,builder:m,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces`,pathParams:{},bodyKind:`json`,body:{name:t.name,body:t.body}});return}let n=await i(t),r=t.local?p:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/workers/dispatch/namespaces`,{body:e})),{successLabel:`Created`});return}let f={};t.name!==void 0&&o(f,[`name`],d(t.name,`name`,`text`)),c(await u(`Creating`,async()=>n.post(`/accounts/${r}/workers/dispatch/namespaces`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function ee(e){return e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,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 <dispatchNamespace>`,describe:`Delete a Workers for Platforms namespace.`,builder:ee,handler:async n=>{if(n.dryRun){l({command:`cf dispatch-namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${n.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(n.dispatchNamespace??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?p:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>r.dispatchNamespaces.delete(o,n.dispatchNamespace)),{successLabel:`Deleted`})}};function _(e){return e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`trusted-workers`,{type:`boolean`,description:'Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted".',default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <dispatchNamespace>`,describe:`Patch a Workers for Platforms namespace. Omitted fields are left unchanged.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`json`,body:{name:t.name,trustedWorkers:t.trustedWorkers,body:t.body}});return}let n=await i(t),r=t.local?p:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:e})),{successLabel:`Updated`});return}let f={};t.name!==void 0&&o(f,[`name`],d(t.name,`name`,`text`)),t.trustedWorkers!==void 0&&o(f,[`trusted_workers`],t.trustedWorkers),c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function y(e){return e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <dispatchNamespace>`,describe:`Get a Workers for Platforms namespace.`,builder:y,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.get(r,t.dispatchNamespace)),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetch a list of Workers for Platforms namespaces.`,builder:x,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces`,pathParams:{},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.list(r)),{successLabel:`Loaded`})}};function C(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,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 w={command:`create <scriptName>`,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:C,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts asset-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/assets-upload-session`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?p:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Creating`,async()=>n.post(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/assets-upload-session`,{body:e})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>n.dispatchNamespaces.scripts.assetUpload.create(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Created`})}},T={command:`asset-upload`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <scriptName>`,describe:`Fetch script bindings from a script uploaded to a Workers for Platforms namespace.`,builder:E,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts bindings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/bindings`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.scripts.bindings.get(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Loaded`})}},O={command:`bindings`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`tags`,{type:`string`,description:`Filter scripts by tags before deletion. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.`}).option(`limit`,{type:`number`,description:`Limit the number of scripts to delete.`}).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 A={command:`bulk-delete`,describe:`Delete multiple scripts from a Workers for Platforms namespace based on optional tag filters.`,builder:k,handler:async n=>{let r={tags:n.tags,limit:n.limit};if(n.dryRun){l({command:`cf dispatch-namespaces scripts bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${n.dispatchNamespace??`<dispatchNamespace>`}/scripts`,pathParams:{dispatchNamespace:String(n.dispatchNamespace??``)},query:r,bodyKind:`none`});return}let o=await i(n),s=n.local?p:await e(o);if(n.accountId=s,!await t({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>o.dispatchNamespaces.scripts.bulkDelete(s,n.dispatchNamespace,r)),{successLabel:`Deleted`})}};function j(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <scriptName>`,describe:`Fetch script content from a script uploaded to a Workers for Platforms namespace.`,builder:j,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/content`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.scripts.content.get(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Loaded`})}};function N(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,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 P={command:`update <scriptName>`,describe:`Put script content for a script uploaded to a Workers for Platforms namespace.`,builder:N,handler:async t=>{let n={};if(t.cfWorkerBodyPart!==void 0&&(n[`CF-WORKER-BODY-PART`]=String(t.cfWorkerBodyPart)),t.cfWorkerMainModulePart!==void 0&&(n[`CF-WORKER-MAIN-MODULE-PART`]=String(t.cfWorkerMainModulePart)),t.dryRun){l({command:`cf dispatch-namespaces scripts content update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/content`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,files:t.files,metadata:t.metadata}});return}let r=await i(t),o=t.local?p:await e(r);if(t.accountId=o,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=f(t.file);e.append(`file`,new Blob([n]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.files!==void 0){let n=typeof t.files==`string`?d(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`?d(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}c(await u(`Updating`,async()=>r.put(`/accounts/${o}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/content`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}if(t.body){let e=d(t.body,`body`,`binary`);c(await u(`Updating`,async()=>r.put(`/accounts/${o}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/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.`)}},F={command:`content`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(M).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).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.`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`delete <scriptName>`,describe:`Delete a worker from a Workers for Platforms namespace. This call has no response body on a successful delete.`,builder:I,handler:async n=>{let r={force:n.force};if(n.dryRun){l({command:`cf dispatch-namespaces scripts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${n.dispatchNamespace??`<dispatchNamespace>`}/scripts/${n.scriptName??`<scriptName>`}`,pathParams:{dispatchNamespace:String(n.dispatchNamespace??``),scriptName:String(n.scriptName??``)},query:r,bodyKind:`json`,body:{body:n.body}});return}let o=await i(n),d=n.local?p:await e(o);if(n.accountId=d,!await t({force:!!n.force})){process.stderr.write(`Aborted.
5
+ `);return}if(n.body){let e=s(n.body),t=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Deleting`,async()=>o.delete(`/accounts/${d}/workers/dispatch/namespaces/${n.dispatchNamespace}/scripts/${n.scriptName}${t?`?`+t:``}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>o.dispatchNamespaces.scripts.delete(d,n.dispatchNamespace,n.scriptName,r)),{successLabel:`Deleted`})}};function R(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get <scriptName>`,describe:`Fetch information about a script uploaded to a Workers for Platforms namespace.`,builder:R,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.scripts.get(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Loaded`})}};function te(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).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 B={command:`list`,describe:`Fetch a list of scripts uploaded to a Workers for Platforms namespace.`,builder:te,handler:async t=>{let n={tags:t.tags};if(t.dryRun){l({command:`cf dispatch-namespaces scripts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?p:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.dispatchNamespaces.scripts.list(o,t.dispatchNamespace,n)),{successLabel:`Loaded`})}};function V(e){return e.positional(`secretName`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`url-encoded`,{type:`string`,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 H={command:`delete <secretName>`,describe:`Remove a secret from a script uploaded to a Workers for Platforms namespace.`,builder:V,handler:async n=>{let r={url_encoded:n.urlEncoded};if(n.dryRun){l({command:`cf dispatch-namespaces scripts secrets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${n.dispatchNamespace??`<dispatchNamespace>`}/scripts/${n.scriptName??`<scriptName>`}/secrets/${n.secretName??`<secretName>`}`,pathParams:{dispatchNamespace:String(n.dispatchNamespace??``),scriptName:String(n.scriptName??``),secretName:String(n.secretName??``)},query:r,bodyKind:`none`});return}let o=await i(n),s=n.local?p:await e(o);if(n.accountId=s,!await t({force:!!n.force})){process.stderr.write(`Aborted.
6
+ `);return}c(await u(`Deleting`,async()=>o.dispatchNamespaces.scripts.secrets.delete(s,n.dispatchNamespace,n.scriptName,n.secretName,r)),{successLabel:`Deleted`})}};function U(e){return e.positional(`secretName`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`url-encoded`,{type:`string`,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 W={command:`get <secretName>`,describe:`Get a given secret binding (value omitted) on a script uploaded to a Workers for Platforms namespace.`,builder:U,handler:async t=>{let n={url_encoded:t.urlEncoded};if(t.dryRun){l({command:`cf dispatch-namespaces scripts secrets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/secrets/${t.secretName??`<secretName>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``),secretName:String(t.secretName??``)},query:n,bodyKind:`none`});return}let r=await i(t),o=t.local?p:await e(r);t.accountId=o,c(await u(`Loading`,async()=>r.dispatchNamespaces.scripts.secrets.get(o,t.dispatchNamespace,t.scriptName,t.secretName,n)),{successLabel:`Loaded`})}};function G(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`list`,describe:`List secrets bound to a script uploaded to a Workers for Platforms namespace.`,builder:G,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts secrets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/secrets`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.scripts.secrets.list(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Loaded`})}};function q(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`A JavaScript variable name for the binding.`}).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 J={command:`update <scriptName>`,describe:`Add a secret to a script uploaded to a Workers for Platforms namespace.`,builder:q,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts secrets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/secrets`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{name:t.name,text:t.text,type:t.type,format:t.format,keyBase64:t.keyBase64,usages:t.usages,body:t.body}});return}let f=await i(t),m=t.local?p:await e(f);if(t.accountId=m,t.body){let e=s(t.body);c(await u(`Updating`,async()=>f.put(`/accounts/${m}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/secrets`,{body:e})),{successLabel:`Updated`});return}t.name===void 0&&(t.name=await n(`name`,`A JavaScript variable name for the binding.`)),t.type===void 0&&(t.type=await r(`type`,`The kind of resource that the binding provides.`,[`secret_text`,`secret_key`])),t.type===`secret_text`&&t.text===void 0&&(t.text=await n(`text`,`The secret value to use.`,{kind:`secret`,question:`Enter value for --text`})),t.type===`secret_key`&&t.format===void 0&&(t.format=await n(`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 h={};t.name!==void 0&&o(h,[`name`],d(t.name,`name`,`text`)),t.text!==void 0&&o(h,[`text`],d(t.text,`text`,`text`)),t.type!==void 0&&o(h,[`type`],d(t.type,`type`,`text`)),t.format!==void 0&&o(h,[`format`],d(t.format,`format`,`text`)),t.keyBase64!==void 0&&o(h,[`key_base64`],d(t.keyBase64,`keyBase64`,`text`)),t.usages!==void 0&&o(h,[`usages`],t.usages),c(await u(`Updating`,async()=>f.put(`/accounts/${m}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/secrets`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}},Y={command:`secrets`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(H).command(W).command(K).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`settings`,{type:`string`,description:`Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. `})}const Z={command:`edit <scriptName>`,describe:`Patch script metadata, such as bindings.`,builder:X,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/settings`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,settings:t.settings}});return}let n=await i(t),r=t.local?p:await e(n);if(t.accountId=r,t.file!==void 0||t.body!==void 0||t.settings!==void 0){let e=new FormData;if(t.file){let n=f(t.file);e.append(`file`,new Blob([n]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.settings!==void 0){let n=typeof t.settings==`string`?d(t.settings,`settings`,`text`):t.settings;e.append(`settings`,typeof n==`string`?n:JSON.stringify(n))}c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/settings`,{body:e})),{successLabel:`Updated`});return}if(t.body){let e=d(t.body,`body`,`binary`);c(await u(`Updating`,async()=>n.patch(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/settings`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{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 Q(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`get <scriptName>`,describe:`Get script settings from a script uploaded to a Workers for Platforms namespace.`,builder:Q,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/settings`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.scripts.settings.get(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Loaded`})}},re={command:`settings`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(Z).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(e){return e.positional(`tag`,{type:`string`,description:`Tag`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`create <tag>`,describe:`Put a single tag on a script uploaded to a Workers for Platforms namespace.`,builder:ie,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts tags create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/tags/${t.tag??`<tag>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``),tag:String(t.tag??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Updating`,async()=>n.dispatchNamespaces.scripts.tags.create(r,t.dispatchNamespace,t.scriptName,t.tag)),{successLabel:`Updated`})}};function oe(e){return e.positional(`tag`,{type:`string`,description:`Tag`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,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 se={command:`delete <tag>`,describe:`Delete script tag for a script uploaded to a Workers for Platforms namespace.`,builder:oe,handler:async n=>{if(n.dryRun){l({command:`cf dispatch-namespaces scripts tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${n.dispatchNamespace??`<dispatchNamespace>`}/scripts/${n.scriptName??`<scriptName>`}/tags/${n.tag??`<tag>`}`,pathParams:{dispatchNamespace:String(n.dispatchNamespace??``),scriptName:String(n.scriptName??``),tag:String(n.tag??``)},bodyKind:`none`});return}let r=await i(n),o=n.local?p:await e(r);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
7
+ `);return}c(await u(`Deleting`,async()=>r.dispatchNamespaces.scripts.tags.delete(o,n.dispatchNamespace,n.scriptName,n.tag)),{successLabel:`Deleted`})}};function ce(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`list`,describe:`Fetch tags from a script uploaded to a Workers for Platforms namespace.`,builder:ce,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts tags list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/tags`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`none`});return}let n=await i(t),r=t.local?p:await e(n);t.accountId=r,c(await u(`Loading`,async()=>n.dispatchNamespaces.scripts.tags.list(r,t.dispatchNamespace,t.scriptName)),{successLabel:`Loaded`})}};function ue(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Tags associated with the Worker.`})}const de={command:`update <scriptName>`,describe:`Put script tags for a script uploaded to a Workers for Platforms namespace.`,builder:ue,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces scripts tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/tags`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await i(t),r=t.local?p:await e(n);if(t.accountId=r,t.body){let e=s(t.body);if(Array.isArray(e)&&e.length>10){let i=Math.ceil(e.length/10),a=null;for(let o=0;o<e.length;o+=10){let s=e.slice(o,o+10);a=await u(`Updating: batch ${Math.floor(o/10)+1}/${i}`,async()=>n.put(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/tags`,{body:s}))}c(a,{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.put(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/tags`,{body:e})),{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.`)}},fe={command:`tags`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(ae).command(se).command(le).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).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 script. 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)`})}const $={command:`update <scriptName>`,describe:`Upload a worker module to a Workers for Platforms namespace. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.`,builder:pe,handler:async t=>{let n={bindings_inherit:t.bindingsInherit};if(t.dryRun){l({command:`cf dispatch-namespaces scripts update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},query:n,bodyKind:`json`,body:{body:t.body}});return}let r=await i(t),o=t.local?p:await e(r);if(t.accountId=o,t.body){let e=d(t.body,`body`,`binary`),i=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Updating`,async()=>r.put(`/accounts/${o}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}${i?`?`+i:``}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{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.`)}},me={command:`scripts`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(A).command(L).command(z).command(B).command($).command(T).command(O).command(F).command(Y).command(re).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`trusted-workers`,{type:`boolean`,description:'Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted".',default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ge={command:`update <dispatchNamespace>`,describe:`Update a Workers for Platforms namespace.`,builder:he,handler:async t=>{if(t.dryRun){l({command:`cf dispatch-namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`json`,body:{name:t.name,trustedWorkers:t.trustedWorkers,body:t.body}});return}let n=await i(t),r=t.local?p:await e(n);if(t.accountId=r,t.body){let e=s(t.body);c(await u(`Updating`,async()=>n.put(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:e})),{successLabel:`Updated`});return}let f={};t.name!==void 0&&o(f,[`name`],d(t.name,`name`,`text`)),t.trustedWorkers!==void 0&&o(f,[`trusted_workers`],t.trustedWorkers),c(await u(`Updating`,async()=>n.put(`/accounts/${r}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},_e={command:`dispatch-namespaces`,describe:`Workers for Platforms dispatch namespaces — isolate customer Workers for SaaS and multi-tenant deployments`,builder:e=>e.command(h).command(g).command(v).command(b).command(S).command(ge).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{_e as default};