@stacksjs/ts-cloud 0.16.66 → 0.16.68

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 (190) hide show
  1. package/dist/aws/index.js +1 -1
  2. package/dist/bin/{chunk-8bgfn8ek.js → chunk-17ewx21n.js} +11 -11
  3. package/dist/bin/chunk-19dhvnjh.js +1 -0
  4. package/dist/bin/{chunk-ya1413jw.js → chunk-1cb0r1j3.js} +2 -2
  5. package/dist/bin/chunk-1tk64amh.js +1 -0
  6. package/dist/bin/{chunk-tcn6qcc4.js → chunk-2247xk4n.js} +1 -1
  7. package/dist/bin/chunk-37xeqae4.js +1 -0
  8. package/dist/bin/{chunk-zesb85ra.js → chunk-43a60zkj.js} +1 -1
  9. package/dist/bin/chunk-4vz5erjz.js +1 -0
  10. package/dist/bin/{chunk-2avtspqd.js → chunk-55j0x82p.js} +5 -5
  11. package/dist/bin/{chunk-zs0q8sh5.js → chunk-5fde4d44.js} +1 -1
  12. package/dist/bin/{chunk-tw6z2mvh.js → chunk-5gf0je0v.js} +14 -14
  13. package/dist/bin/{chunk-0ejp168p.js → chunk-5t1ky9re.js} +1 -1
  14. package/dist/bin/chunk-6cyr6gcg.js +1 -0
  15. package/dist/bin/chunk-6rwewb7j.js +1 -0
  16. package/dist/bin/{chunk-d38cyam8.js → chunk-6tqzgm9z.js} +5 -5
  17. package/dist/bin/chunk-7d83f6sn.js +1 -0
  18. package/dist/bin/chunk-7v68hpgc.js +2 -0
  19. package/dist/bin/{chunk-nn8k84cd.js → chunk-7y56qyrj.js} +1 -1
  20. package/dist/bin/{chunk-e51cd46z.js → chunk-8escxm7h.js} +1 -1
  21. package/dist/bin/{chunk-6r04kx46.js → chunk-abk97qeq.js} +2 -2
  22. package/dist/bin/{chunk-qpvydcfm.js → chunk-b0r8a5h5.js} +5 -5
  23. package/dist/bin/chunk-bkvxzenb.js +1 -0
  24. package/dist/bin/{chunk-v6jm8dsa.js → chunk-d28q9ath.js} +1 -1
  25. package/dist/bin/chunk-dmm1p4bs.js +1 -0
  26. package/dist/bin/chunk-dycx66c7.js +1 -0
  27. package/dist/bin/{chunk-aekwpste.js → chunk-e4c7ba0g.js} +1 -1
  28. package/dist/bin/chunk-fjx816tt.js +1 -0
  29. package/dist/bin/{chunk-nbqja2ja.js → chunk-fx9zesgx.js} +113 -113
  30. package/dist/bin/{chunk-9pj5r0x0.js → chunk-gga18c4g.js} +1 -1
  31. package/dist/bin/chunk-gmy8p7nr.js +1 -0
  32. package/dist/bin/chunk-h5ccvped.js +1 -0
  33. package/dist/bin/chunk-h9h9dn0r.js +1 -0
  34. package/dist/bin/chunk-ht6s2cwm.js +1 -0
  35. package/dist/bin/{chunk-vbq4ten8.js → chunk-jrxb5sg4.js} +3 -3
  36. package/dist/bin/{chunk-cf2eyje1.js → chunk-krt80e8w.js} +7 -7
  37. package/dist/bin/{chunk-sbjzewvk.js → chunk-m60wwxz1.js} +6 -6
  38. package/dist/bin/{chunk-w4axqmyc.js → chunk-m92m9tx3.js} +84 -84
  39. package/dist/bin/{chunk-d0q93ecd.js → chunk-mjbd4pbz.js} +5 -5
  40. package/dist/bin/chunk-ncr1dwdt.js +1 -0
  41. package/dist/bin/{chunk-tpttr74v.js → chunk-nxsx69p4.js} +4 -4
  42. package/dist/bin/chunk-nzhpva7z.js +1 -0
  43. package/dist/bin/chunk-p40tvp17.js +1 -0
  44. package/dist/bin/{chunk-n667tnf3.js → chunk-pgbtdsj2.js} +3 -3
  45. package/dist/bin/{chunk-5ad4b744.js → chunk-pr96tp0s.js} +2 -2
  46. package/dist/bin/chunk-qe8zh9kn.js +1 -0
  47. package/dist/bin/{chunk-v5x06h8w.js → chunk-qjxd8f5m.js} +5 -5
  48. package/dist/bin/{chunk-favx96qj.js → chunk-qka0e661.js} +5 -5
  49. package/dist/bin/{chunk-pe18g092.js → chunk-rgnmxfvp.js} +3 -3
  50. package/dist/bin/chunk-sn1zde06.js +1 -0
  51. package/dist/bin/{chunk-71b4t3d8.js → chunk-sv7n9ape.js} +2 -2
  52. package/dist/bin/chunk-t6zpvaqr.js +1 -0
  53. package/dist/bin/{chunk-90ds3vw7.js → chunk-tdv5rwjv.js} +1 -1
  54. package/dist/bin/chunk-v4ncs6q2.js +1 -0
  55. package/dist/bin/{chunk-v3j9wgmn.js → chunk-v5js5pz6.js} +186 -186
  56. package/dist/bin/chunk-vrn0akcn.js +1 -0
  57. package/dist/bin/{chunk-mver6psb.js → chunk-w2eezm9z.js} +2 -2
  58. package/dist/bin/{chunk-6da5c33e.js → chunk-wjn2bpdb.js} +2 -2
  59. package/dist/bin/chunk-x00efaxm.js +1 -0
  60. package/dist/bin/{chunk-38qy0dj2.js → chunk-x40sd2m9.js} +3 -3
  61. package/dist/bin/chunk-zred4827.js +1 -0
  62. package/dist/bin/{chunk-tg3vzzc4.js → chunk-zs1cpqhv.js} +2 -2
  63. package/dist/bin/{chunk-kmxkwznm.js → chunk-zz9nj5kn.js} +5 -5
  64. package/dist/bin/cli.js +101 -101
  65. package/dist/bin/dashboard-server.js +1 -1
  66. package/dist/{chunk-y9589qef.js → chunk-040rbk7k.js} +35 -35
  67. package/dist/{chunk-f739f6d2.js → chunk-192rthtb.js} +70 -70
  68. package/dist/{chunk-9w5ncn9s.js → chunk-1wc2zfct.js} +3 -3
  69. package/dist/{chunk-axcxfz8p.js → chunk-1yj07hbw.js} +2 -2
  70. package/dist/{chunk-0kemzwpg.js → chunk-41fwhvp7.js} +1 -1
  71. package/dist/chunk-426k7fgf.js +1 -0
  72. package/dist/chunk-4b0ynr9y.js +1 -0
  73. package/dist/{chunk-a92gvctb.js → chunk-a07kew2q.js} +6 -6
  74. package/dist/chunk-emkp3dsp.js +1 -0
  75. package/dist/{chunk-pymc2aad.js → chunk-h360gwrf.js} +2 -2
  76. package/dist/{chunk-7mpbjr6c.js → chunk-h5yx54ks.js} +3 -3
  77. package/dist/{chunk-q4408fwg.js → chunk-hvttzk9q.js} +2 -2
  78. package/dist/{chunk-q8vvwmka.js → chunk-je8tky8z.js} +1 -1
  79. package/dist/{chunk-03eny26f.js → chunk-kbr9nc8y.js} +2 -2
  80. package/dist/{chunk-3ca6cb1s.js → chunk-p21vbrgk.js} +1 -1
  81. package/dist/chunk-pcagajw1.js +1 -0
  82. package/dist/{chunk-83fy36fn.js → chunk-qb25wesa.js} +2 -2
  83. package/dist/{chunk-hk1frmnn.js → chunk-qrpy0h2n.js} +1 -1
  84. package/dist/{chunk-xd67tr7p.js → chunk-s4wz0csj.js} +1 -1
  85. package/dist/{chunk-157bgr0x.js → chunk-spr6akra.js} +90 -90
  86. package/dist/chunk-sybwn2y6.js +1 -0
  87. package/dist/{chunk-r49ynkag.js → chunk-t8fbwcdk.js} +1 -1
  88. package/dist/{chunk-qgtydqpj.js → chunk-tb8azghz.js} +23 -23
  89. package/dist/{chunk-pah2r8a0.js → chunk-tq7nsdnd.js} +4 -4
  90. package/dist/{chunk-0860mm00.js → chunk-v0s8vpa3.js} +1 -1
  91. package/dist/{chunk-tngsyawj.js → chunk-xyem7g21.js} +1 -1
  92. package/dist/{chunk-zgfzc46r.js → chunk-yh9tmx00.js} +3 -3
  93. package/dist/{chunk-1t3rjvf9.js → chunk-z585dfjz.js} +12 -12
  94. package/dist/deploy/index.js +1 -1
  95. package/dist/dns/index.js +1 -1
  96. package/dist/drivers/index.js +1 -1
  97. package/dist/drivers/shared/releases.d.ts +12 -0
  98. package/dist/index.js +8 -8
  99. package/dist/mail/index.js +2 -2
  100. package/dist/object-storage/index.d.ts +6 -4
  101. package/dist/object-storage/migrate.d.ts +3 -1
  102. package/dist/operations/index.js +1 -1
  103. package/dist/protection/index.js +1 -1
  104. package/dist/spend/index.js +1 -1
  105. package/dist/ui/404.html +1 -1
  106. package/dist/ui/accept-invitation.html +1 -1
  107. package/dist/ui/access-denied.html +1 -1
  108. package/dist/ui/account/automation.html +5 -5
  109. package/dist/ui/account/security.html +2 -2
  110. package/dist/ui/applications/compose.html +6 -6
  111. package/dist/ui/applications/new.html +2 -2
  112. package/dist/ui/data/backups.html +6 -6
  113. package/dist/ui/data/services.html +6 -6
  114. package/dist/ui/data/volumes.html +6 -6
  115. package/dist/ui/index.html +6 -6
  116. package/dist/ui/infrastructure/topology.html +6 -6
  117. package/dist/ui/integrations.html +1 -1
  118. package/dist/ui/operations/alerts.html +6 -6
  119. package/dist/ui/operations/configuration.html +6 -6
  120. package/dist/ui/operations/jobs.html +6 -6
  121. package/dist/ui/operations/maintenance.html +6 -6
  122. package/dist/ui/operations/observability.html +6 -6
  123. package/dist/ui/operations/previews.html +6 -6
  124. package/dist/ui/operations/queue.html +6 -6
  125. package/dist/ui/operations/regions.html +6 -6
  126. package/dist/ui/operations/releases.html +6 -6
  127. package/dist/ui/operations/spend.html +6 -6
  128. package/dist/ui/operations/workloads.html +6 -6
  129. package/dist/ui/security.html +1 -1
  130. package/dist/ui/server/actions.html +6 -6
  131. package/dist/ui/server/activity.html +1 -1
  132. package/dist/ui/server/capacity.html +5 -5
  133. package/dist/ui/server/database.html +6 -6
  134. package/dist/ui/server/deployments.html +5 -5
  135. package/dist/ui/server/diagnostics.html +2 -2
  136. package/dist/ui/server/firewall.html +6 -6
  137. package/dist/ui/server/fleet.html +6 -6
  138. package/dist/ui/server/logs.html +6 -6
  139. package/dist/ui/server/metrics.html +5 -5
  140. package/dist/ui/server/security.html +2 -2
  141. package/dist/ui/server/services.html +1 -1
  142. package/dist/ui/server/sites.html +5 -5
  143. package/dist/ui/server/ssh-keys.html +5 -5
  144. package/dist/ui/server/team.html +5 -5
  145. package/dist/ui/server/terminal.html +1 -1
  146. package/dist/ui/serverless/alarms.html +5 -5
  147. package/dist/ui/serverless/assets.html +1 -1
  148. package/dist/ui/serverless/cost.html +2 -2
  149. package/dist/ui/serverless/data.html +6 -6
  150. package/dist/ui/serverless/deployments.html +2 -2
  151. package/dist/ui/serverless/firewall.html +1 -1
  152. package/dist/ui/serverless/functions.html +6 -6
  153. package/dist/ui/serverless/logs.html +6 -6
  154. package/dist/ui/serverless/metrics.html +2 -2
  155. package/dist/ui/serverless/queues.html +6 -6
  156. package/dist/ui/serverless/secrets.html +6 -6
  157. package/dist/ui/serverless/traces.html +6 -6
  158. package/dist/ui/serverless.html +5 -5
  159. package/package.json +3 -3
  160. package/dist/bin/chunk-0v5tsfx5.js +0 -1
  161. package/dist/bin/chunk-3954zb9r.js +0 -1
  162. package/dist/bin/chunk-3x52axr2.js +0 -1
  163. package/dist/bin/chunk-67mww6gq.js +0 -1
  164. package/dist/bin/chunk-7khzyn7k.js +0 -1
  165. package/dist/bin/chunk-97494wnx.js +0 -1
  166. package/dist/bin/chunk-agmznzms.js +0 -1
  167. package/dist/bin/chunk-ambf5hpg.js +0 -1
  168. package/dist/bin/chunk-b39h9as6.js +0 -1
  169. package/dist/bin/chunk-dfgzav9j.js +0 -1
  170. package/dist/bin/chunk-g0w0jec3.js +0 -1
  171. package/dist/bin/chunk-g514nb80.js +0 -1
  172. package/dist/bin/chunk-hknz7fsr.js +0 -1
  173. package/dist/bin/chunk-j9yq3b4d.js +0 -2
  174. package/dist/bin/chunk-k8qrjnyg.js +0 -1
  175. package/dist/bin/chunk-kqstefmv.js +0 -1
  176. package/dist/bin/chunk-mk2h37pm.js +0 -1
  177. package/dist/bin/chunk-nrtjmzzn.js +0 -1
  178. package/dist/bin/chunk-q3rch5hc.js +0 -1
  179. package/dist/bin/chunk-qqb6h33k.js +0 -1
  180. package/dist/bin/chunk-r1p3k2tn.js +0 -1
  181. package/dist/bin/chunk-t8xq3v3j.js +0 -1
  182. package/dist/bin/chunk-xb48vxmk.js +0 -1
  183. package/dist/bin/chunk-yehb738r.js +0 -1
  184. package/dist/bin/chunk-ythfx8pv.js +0 -1
  185. package/dist/bin/chunk-zynfzzjk.js +0 -1
  186. package/dist/chunk-0c48hvb8.js +0 -1
  187. package/dist/chunk-8crqfe8x.js +0 -1
  188. package/dist/chunk-949tycxj.js +0 -1
  189. package/dist/chunk-s3pe89wj.js +0 -1
  190. package/dist/chunk-wxjd9gyb.js +0 -1
@@ -1,4 +1,4 @@
1
- import{dn,pr}from"./chunk-y9589qef.js";import{zr,d}from"./chunk-0860mm00.js";import{isIP as L}from"node:net";var uo="/etc/rpx/certs",A="/etc/rpx/local-ca",M="rpx-root-ca.crt";function go(e=A){return`${e.replace(/\/+$/,"")}/${M}`}function po(e){if(e.toLowerCase().endsWith(".local"))return!1;return e.split(".").length===2}function mo(e,t={}){let r=new Set;for(let o of Object.values(e)){if(!o?.domain)continue;if(d(o)==="bucket")continue;r.add(o.domain)}let n=new Set;for(let o of Object.values(e)){if(!o?.domain||d(o)==="bucket")continue;for(let u of o.aliases??[]){let i=String(u).trim().toLowerCase();if(i&&i!==o.domain)n.add(i)}}if(t.autoWww!==!1)for(let o of[...r]){if(!po(o))continue;r.add(`www.${o}`)}for(let o of n)r.add(o);return[...r]}var k=["1.1.1.1","8.8.8.8"],I="/var/www/acme-challenge";function W(e){if(typeof e==="string")return{to:e};let t={to:e.to};if(e.status!=null)t.status=e.status;if(e.preservePath!=null)t.preservePath=e.preservePath;return t}function U(e){let t=e.auth;if(!t||t.enabled===!1||!t.password)return;return{username:t.username||"admin",password:t.password,...t.realm?{realm:t.realm}:{}}}function dd(e){if(!e)return;return e.tls??"local-ca"}function bp(e,t){if(e.cloud?.provider!=="ssh")return;let r=e.ssh?.lan;if(!r)return;return{...r.hostname?{hostname:r.hostname}:{},tls:r.tls??"local-ca",...t?{ip:t}:{}}}function Cp(e){if(e.cloud?.provider!=="ssh")return;return e.ssh?.profile}function X(e){let t=e.trim().toLowerCase();if(!t||t.startsWith("*")||t.includes(":")||t.includes("/")||t.includes(" "))return!1;if(L(t)!==0)return!1;return t.endsWith(".local")||!t.includes(".")}function F(e,t,r){let n=[],o=new Set,u=(g,a)=>{let p=g.trim().toLowerCase();if(!p||o.has(p))return;o.add(p),n.push({host:p,source:a})},i=t.hostname?.trim(),c=(i||`${r}.local`).toLowerCase();if(u(c,i?"ssh.lan.hostname":`the ssh provider's default LAN name for project "${r}"`),Object.entries(e).some(([g,a])=>!!a&&pr(g)))u(`dashboard.${c}`,"the management dashboard site");for(let[g,a]of Object.entries(e)){if(!a?.domain)continue;if(d(a)==="bucket")continue;if(!X(a.domain))continue;u(a.domain,`site "${g}"`)}return n}function H(e,t){if(!t?.length)return;return t.find((r)=>{let n=(r.startsWith(".")?r.slice(1):r).toLowerCase();return e===n||e.endsWith(`.${n}`)})}function K(e,t){if(!t?.enabled)return;for(let{host:r,source:n}of e){let o=H(r,t.allowedSuffixes);if(!o)continue;throw Error(`The LAN certificate authority and public on-demand TLS both claim "${r}". LAN source: ${n}. Public source: the on-demand TLS allowed suffix "${o}", which is derived from the site domains. A host is either LAN-only, with a certificate signed by the box's own CA, or public, with one issued by Let's Encrypt, never both. Give the LAN a name no site domain covers (ssh.lan.hostname), or take that domain out of the sites this deploy routes.`)}}function V(e){let t=e.split(".");return t.length>=3&&t[0]==="*"&&t.slice(1).every((r)=>/^[a-z0-9-]+$/i.test(r))}function D(e,t={}){let{wildcardCerts:r,...n}=e;return JSON.stringify({...t,...n},null,2)}function Zh(e){if(!e||e==="/")return;let t=`/${e}`.replace(/\/+/g,"/").replace(/\/+$/,"");if(!t.startsWith("/"))t=`/${t}`;return t===""||t==="/"?void 0:t}function ld(e,t){let n=(t?`${e}${t}`:e).replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,128);return n.length>0?n:"rpx"}function Y(e,t){if(!t||t.length===0)return`localhost:${e}`;return t.map((r)=>`${r.privateIp??r.publicIp}:${e}`)}function N(e,t,r){let n=(t.wwwRoot??"/var/www").replace(/\/+$/,""),o=t.slug??"app",u=t.proxy.certsDir??uo,i=t.proxy.loadBalancer,c=[],f=new Set,g=new Map;for(let[l,s]of Object.entries(e)){if(!s||!s.domain)continue;let w=d(s);if(w==="bucket")continue;let v=c.length,E=[...new Set((s.aliases??[]).map((m)=>String(m).trim().toLowerCase()).filter((m)=>m&&m!==s.domain))],b=()=>{let m=c.slice(v).filter((h)=>h.to===s.domain);for(let h of E){for(let O of m)c.push({...O,to:h,id:ld(h,O.path)});if(V(h)){if(!g.has(h))g.set(h,{domain:h,dnsEnvFile:`${n}/${o}-${l}/shared/.env`})}else f.add(h)}},C=Zh(s.path),S=ld(s.domain,C),y=U(s);if(w==="redirect"){c.push({to:s.domain,path:C,redirect:W(s.redirect),id:S,...y?{auth:y}:{}}),f.add(s.domain),b();continue}if(w==="proxy"){let m=zr(s);if(m.length===0)continue;let h=m.length===1?m[0]:m;c.push({to:s.domain,path:C,from:h,id:S,...y?{auth:y}:{},...Array.isArray(h)&&i?{loadBalancer:i}:{}}),f.add(s.domain),b();continue}if(w==="server-app"){if(typeof s.port!=="number")continue;let m=Y(s.port,r);c.push({to:s.domain,path:C,from:m,id:S,...y?{auth:y}:{},...Array.isArray(m)&&i?{loadBalancer:i}:{}})}else c.push({to:s.domain,path:C,static:{dir:`${n}/${o}-${l}/current`,spa:s.spa??!1,pathRewriteStyle:s.pathRewriteStyle??"directory"},cleanUrls:s.pathRewriteStyle!=="flat",...y?{auth:y}:{},id:S});f.add(s.domain),b()}if(t.proxy.autoWww!==!1)for(let l of[...f]){if(!po(l))continue;let s=`www.${l}`;if(f.has(s))continue;c.push({to:s,redirect:{to:`https://${l}`},id:ld(s)}),f.add(s)}c.sort((l,s)=>{if(l.to!==s.to)return l.to.localeCompare(s.to);return(s.path?.length??0)-(l.path?.length??0)});let a={proxies:c,productionCerts:{certsDir:u,certsDirServerNames:[...f,...g.keys()]},https:!0,hostsManagement:!1,cleanup:{hosts:!1,certs:!1},...g.size>0?{wildcardCerts:[...g.values()]}:{}};if(t.proxy.onDemandTls&&f.size>0)a.onDemandTls={enabled:!0,allowedSuffixes:[...f],email:t.proxy.onDemandTlsEmail,certsDir:u,staging:t.proxy.onDemandTlsStaging??!1};if(t.proxy.onDemandTls)a.acmeChallengeWebroot=t.proxy.acmeWebroot??I;let p=t.proxy.cdn,x=p?.frontedHosts?.length?p.frontedHosts:[...f];if(p?.secret&&x.length>0)a.originGuard={header:p.secretHeader??"X-Origin-Verify",value:p.secret,hosts:x};if(t.lan)if(dd(t.lan)==="off")a.https=!1;else{let l=F(e,t.lan,o);K(l,a.onDemandTls);let s=t.lan.ip&&L(t.lan.ip)!==0?[t.lan.ip]:[];a.localCa={dir:A,hosts:l.map((w)=>w.host),...s.length>0?{ips:s}:{},installTrust:!0}}return a}function B(e,t){return N({...e,...t.mail?dn(t.mail):{}},t)}function tr(e,t,r){return N({...e,...r.mail?dn(r.mail):{}},r,t)}function PI(e){return`// Generated by ts-cloud — rpx reverse-proxy gateway.
1
+ import{dn,mr}from"./chunk-040rbk7k.js";import{zr,d}from"./chunk-v0s8vpa3.js";import{isIP as L}from"node:net";var uo="/etc/rpx/certs",A="/etc/rpx/local-ca",M="rpx-root-ca.crt";function go(e=A){return`${e.replace(/\/+$/,"")}/${M}`}function po(e){if(e.toLowerCase().endsWith(".local"))return!1;return e.split(".").length===2}function mo(e,t={}){let r=new Set;for(let o of Object.values(e)){if(!o?.domain)continue;if(d(o)==="bucket")continue;r.add(o.domain)}let n=new Set;for(let o of Object.values(e)){if(!o?.domain||d(o)==="bucket")continue;for(let u of o.aliases??[]){let i=String(u).trim().toLowerCase();if(i&&i!==o.domain)n.add(i)}}if(t.autoWww!==!1)for(let o of[...r]){if(!po(o))continue;r.add(`www.${o}`)}for(let o of n)r.add(o);return[...r]}var k=["1.1.1.1","8.8.8.8"],I="/var/www/acme-challenge";function W(e){if(typeof e==="string")return{to:e};let t={to:e.to};if(e.status!=null)t.status=e.status;if(e.preservePath!=null)t.preservePath=e.preservePath;return t}function U(e){let t=e.auth;if(!t||t.enabled===!1||!t.password)return;return{username:t.username||"admin",password:t.password,...t.realm?{realm:t.realm}:{}}}function dd(e){if(!e)return;return e.tls??"local-ca"}function bp(e,t){if(e.cloud?.provider!=="ssh")return;let r=e.ssh?.lan;if(!r)return;return{...r.hostname?{hostname:r.hostname}:{},tls:r.tls??"local-ca",...t?{ip:t}:{}}}function Cp(e){if(e.cloud?.provider!=="ssh")return;return e.ssh?.profile}function X(e){let t=e.trim().toLowerCase();if(!t||t.startsWith("*")||t.includes(":")||t.includes("/")||t.includes(" "))return!1;if(L(t)!==0)return!1;return t.endsWith(".local")||!t.includes(".")}function F(e,t,r){let n=[],o=new Set,u=(g,a)=>{let p=g.trim().toLowerCase();if(!p||o.has(p))return;o.add(p),n.push({host:p,source:a})},i=t.hostname?.trim(),c=(i||`${r}.local`).toLowerCase();if(u(c,i?"ssh.lan.hostname":`the ssh provider's default LAN name for project "${r}"`),Object.entries(e).some(([g,a])=>!!a&&mr(g)))u(`dashboard.${c}`,"the management dashboard site");for(let[g,a]of Object.entries(e)){if(!a?.domain)continue;if(d(a)==="bucket")continue;if(!X(a.domain))continue;u(a.domain,`site "${g}"`)}return n}function H(e,t){if(!t?.length)return;return t.find((r)=>{let n=(r.startsWith(".")?r.slice(1):r).toLowerCase();return e===n||e.endsWith(`.${n}`)})}function K(e,t){if(!t?.enabled)return;for(let{host:r,source:n}of e){let o=H(r,t.allowedSuffixes);if(!o)continue;throw Error(`The LAN certificate authority and public on-demand TLS both claim "${r}". LAN source: ${n}. Public source: the on-demand TLS allowed suffix "${o}", which is derived from the site domains. A host is either LAN-only, with a certificate signed by the box's own CA, or public, with one issued by Let's Encrypt, never both. Give the LAN a name no site domain covers (ssh.lan.hostname), or take that domain out of the sites this deploy routes.`)}}function V(e){let t=e.split(".");return t.length>=3&&t[0]==="*"&&t.slice(1).every((r)=>/^[a-z0-9-]+$/i.test(r))}function D(e,t={}){let{wildcardCerts:r,...n}=e;return JSON.stringify({...t,...n},null,2)}function Zh(e){if(!e||e==="/")return;let t=`/${e}`.replace(/\/+/g,"/").replace(/\/+$/,"");if(!t.startsWith("/"))t=`/${t}`;return t===""||t==="/"?void 0:t}function ld(e,t){let n=(t?`${e}${t}`:e).replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,128);return n.length>0?n:"rpx"}function Y(e,t){if(!t||t.length===0)return`localhost:${e}`;return t.map((r)=>`${r.privateIp??r.publicIp}:${e}`)}function N(e,t,r){let n=(t.wwwRoot??"/var/www").replace(/\/+$/,""),o=t.slug??"app",u=t.proxy.certsDir??uo,i=t.proxy.loadBalancer,c=[],f=new Set,g=new Map;for(let[l,s]of Object.entries(e)){if(!s||!s.domain)continue;let w=d(s);if(w==="bucket")continue;let v=c.length,E=[...new Set((s.aliases??[]).map((m)=>String(m).trim().toLowerCase()).filter((m)=>m&&m!==s.domain))],b=()=>{let m=c.slice(v).filter((h)=>h.to===s.domain);for(let h of E){for(let O of m)c.push({...O,to:h,id:ld(h,O.path)});if(V(h)){if(!g.has(h))g.set(h,{domain:h,dnsEnvFile:`${n}/${o}-${l}/shared/.env`})}else f.add(h)}},C=Zh(s.path),S=ld(s.domain,C),y=U(s);if(w==="redirect"){c.push({to:s.domain,path:C,redirect:W(s.redirect),id:S,...y?{auth:y}:{}}),f.add(s.domain),b();continue}if(w==="proxy"){let m=zr(s);if(m.length===0)continue;let h=m.length===1?m[0]:m;c.push({to:s.domain,path:C,from:h,id:S,...y?{auth:y}:{},...Array.isArray(h)&&i?{loadBalancer:i}:{}}),f.add(s.domain),b();continue}if(w==="server-app"){if(typeof s.port!=="number")continue;let m=Y(s.port,r);c.push({to:s.domain,path:C,from:m,id:S,...y?{auth:y}:{},...Array.isArray(m)&&i?{loadBalancer:i}:{}})}else c.push({to:s.domain,path:C,static:{dir:`${n}/${o}-${l}/current`,spa:s.spa??!1,pathRewriteStyle:s.pathRewriteStyle??"directory"},cleanUrls:s.pathRewriteStyle!=="flat",...y?{auth:y}:{},id:S});f.add(s.domain),b()}if(t.proxy.autoWww!==!1)for(let l of[...f]){if(!po(l))continue;let s=`www.${l}`;if(f.has(s))continue;c.push({to:s,redirect:{to:`https://${l}`},id:ld(s)}),f.add(s)}c.sort((l,s)=>{if(l.to!==s.to)return l.to.localeCompare(s.to);return(s.path?.length??0)-(l.path?.length??0)});let a={proxies:c,productionCerts:{certsDir:u,certsDirServerNames:[...f,...g.keys()]},https:!0,hostsManagement:!1,cleanup:{hosts:!1,certs:!1},...g.size>0?{wildcardCerts:[...g.values()]}:{}};if(t.proxy.onDemandTls&&f.size>0)a.onDemandTls={enabled:!0,allowedSuffixes:[...f],email:t.proxy.onDemandTlsEmail,certsDir:u,staging:t.proxy.onDemandTlsStaging??!1};if(t.proxy.onDemandTls)a.acmeChallengeWebroot=t.proxy.acmeWebroot??I;let p=t.proxy.cdn,x=p?.frontedHosts?.length?p.frontedHosts:[...f];if(p?.secret&&x.length>0)a.originGuard={header:p.secretHeader??"X-Origin-Verify",value:p.secret,hosts:x};if(t.lan)if(dd(t.lan)==="off")a.https=!1;else{let l=F(e,t.lan,o);K(l,a.onDemandTls);let s=t.lan.ip&&L(t.lan.ip)!==0?[t.lan.ip]:[];a.localCa={dir:A,hosts:l.map((w)=>w.host),...s.length>0?{ips:s}:{},installTrust:!0}}return a}function B(e,t){return N({...e,...t.mail?dn(t.mail):{}},t)}function rr(e,t,r){return N({...e,...r.mail?dn(r.mail):{}},r,t)}function PI(e){return`// Generated by ts-cloud — rpx reverse-proxy gateway.
2
2
  // Routes are derived from the \`sites\` model on every \`buddy deploy\`.
3
3
  import { startProxies } from '@stacksjs/rpx'
4
4
 
@@ -7,7 +7,7 @@ const config = ${D(e)} as const
7
7
  // Verbose is the hard default for ts-cloud-installed gateways (RPX_VERBOSE=false
8
8
  // opts out) — without it rpx's TLS/routing diagnostics never reach the journal.
9
9
  await startProxies({ verbose: process.env.RPX_VERBOSE !== 'false', ...config } as any)
10
- `}function j(e){return e?.webServer==="rpx"||e?.proxy?.engine==="rpx"}var fo="/etc/rpx",R="/opt/rpx-gateway",Ep="/etc/rpx/gateway.ts",bt="/etc/rpx/gateway",ze="rpx-gateway.service",z="/etc/rpx/sites.d";function J(e=z,t=uo){return`// Generated by ts-cloud — rpx gateway assembler.
10
+ `}function j(e){return e?.webServer==="rpx"||e?.proxy?.engine==="rpx"}var fo="/etc/rpx",R="/opt/rpx-gateway",Ep="/etc/rpx/gateway.ts",Ct="/etc/rpx/gateway",ze="rpx-gateway.service",z="/etc/rpx/sites.d";function J(e=z,t=uo){return`// Generated by ts-cloud — rpx gateway assembler.
11
11
  // Merges every app's fragment in ${e} so independent deploys compose
12
12
  // without clobbering each other. Each deploy writes only its own <slug>.json.
13
13
  import { startProxies } from '@stacksjs/rpx'
@@ -133,6 +133,6 @@ writeFileSync(candidatePath, JSON.stringify(candidate, null, 2) + '\\n', { mode:
133
133
  `.trim();return[`__tsc_fragment_candidate="$(mktemp "${e}.candidate.XXXXXX")"`,`cat > "$__tsc_fragment_candidate" <<'${r}'`,t,r,'chmod 0600 "$__tsc_fragment_candidate"',`if [ -f ${e} ]; then TS_CLOUD_RPX_CURRENT_FRAGMENT=${e} TS_CLOUD_RPX_CANDIDATE_FRAGMENT="$__tsc_fragment_candidate" ${n.bunBin} -e ${q(o)}; fi`,`mv -f "$__tsc_fragment_candidate" ${e}`,`chmod 0600 ${e}`]}var Q={high:"256M",max:"384M"},Z={high:"512M",max:"768M"};function ud(e){return`rpx-cert-renew-${(e||"app").replace(/[^a-z0-9._-]+/gi,"-")}.service`}function gd(e){let t=new Set;for(let r of e.proxies){let n=r.to;if(!n||n.startsWith("*")||n.includes(":")||!n.includes("."))continue;t.add(n)}return[...t]}function ee(e){if(e.length===0)return[];let t=["# Wildcards: dns-01 (Porkbun), keys read from the site's env file for tlsx alone.","dns_env() {",' [ -r "$1" ] || return 0',` sed -n "s/^$2=//p" "$1" | tail -n 1 | sed -e 's/^"\\(.*\\)"$/\\1/' -e "s/^'\\(.*\\)'$/\\1/"`,"}","wildcard() {",' apex="$1"',' envfile="$2"',' name="*.$apex"',' key=$(dns_env "$envfile" PORKBUN_API_KEY)',' secret=$(dns_env "$envfile" PORKBUN_SECRET_KEY)',' if [ -z "$key" ] || [ -z "$secret" ]; then',' echo "wildcard $name skipped: no PORKBUN_API_KEY / PORKBUN_SECRET_KEY in $envfile (non-fatal)"'," return 0"," fi",' if [ ! -s "$CERTS/_wildcard.$apex.crt" ]; then',' PORKBUN_API_KEY="$key" PORKBUN_SECRET_KEY="$secret" $TLSX acme:issue -d "$name" --method dns-01 --dns-provider porkbun --dir "$CERTS" --prod --email "$EMAIL" || echo "issue $name failed (non-fatal)"'," else",' PORKBUN_API_KEY="$key" PORKBUN_SECRET_KEY="$secret" $TLSX acme:renew --domains "$name" --method dns-01 --dir "$CERTS" --days 30 --prod --email "$EMAIL" || echo "renew $name failed (non-fatal)"'," fi","}"];for(let r of e){let n=r.domain.replace(/^\*\./,"");t.push(`wildcard '${n}' '${r.dnsEnvFile.replace(/'/g,"")}'`)}return t}function P(e){let{config:t,proxy:r}=e,n=t.acmeChallengeWebroot,o=gd(t);if(!r.onDemandTls||!n||o.length===0)return[];let u=e.bunBin??"/usr/local/bin/bun",i=r.tlsxVersion??"latest",c=t.productionCerts.certsDir,f=r.onDemandTlsEmail??`webmaster@${o[0]}`,g=`${u} ${R}/node_modules/@stacksjs/tlsx/dist/bin/cli.js`,a=o.join(","),p=o.join(" "),x=(e.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),l=`${fo}/renew-certs-${x}.sh`,s=ud(x),w=`rpx-cert-renew-${x}.timer`,v=t.wildcardCerts??[],E=v.length>0?"tlsx http-01 + dns-01 wildcard":"tlsx http-01",b=["#!/bin/sh",`# Generated by ts-cloud — issue/renew rpx gateway TLS certs via ${E}.`,"# The running gateway serves the challenge from $WEBROOT on :80, so this needs","# no downtime and no DNS credentials. Reloads the gateway only if a cert changed.","set -u",`CERTS='${c}'`,`WEBROOT='${n}'`,`EMAIL='${f}'`,`TLSX="${g}"`,`BUN='${u}'`,`DOMAINS='${a}'`,"DNS_ATTEMPTS='24'","DNS_DELAY_SECONDS='5'",`DNS_RESOLVERS='${k.join(" ")}'`,"dns_resolves() {",' d="$1"'," for ns in $DNS_RESOLVERS; do",` if $BUN --eval "const{Resolver}=require('node:dns');const r=new Resolver();r.setServers([process.argv[1]]);r.resolve4(process.argv[2],e=>process.exit(e?1:0))" "$ns" "$d" >/dev/null 2>&1; then`," return 0"," fi"," done",' getent ahosts "$d" >/dev/null 2>&1',"}","wait_for_dns() {",' d="$1"'," attempt=1",' while ! dns_resolves "$d"; do',' if [ "$attempt" -ge "$DNS_ATTEMPTS" ]; then',' echo "DNS for $d did not become resolvable after $DNS_ATTEMPTS attempts" >&2'," return 1"," fi",' echo "Waiting for public DNS before ACME: $d (attempt $attempt/$DNS_ATTEMPTS)"',' sleep "$DNS_DELAY_SECONDS"'," attempt=$((attempt + 1))"," done","}",'before=$(cat "$CERTS"/*.crt 2>/dev/null | sha256sum)',`for d in ${p}; do`,' if [ ! -s "$CERTS/$d.crt" ]; then',' if wait_for_dns "$d"; then',' $TLSX acme:issue -d "$d" --method http-01 --webroot "$WEBROOT" --dir "$CERTS" --prod --email "$EMAIL" || echo "issue $d failed (non-fatal)"'," else",' echo "issue $d skipped until DNS resolves (non-fatal)"'," fi"," # rpx reloads its SNI set when a PEM appears. Complete that reload"," # before the next hostname starts http-01, or :80 can disappear in"," # the middle of the following challenge on a multi-domain deploy.",` [ -s "$CERTS/$d.crt" ] && systemctl restart ${ze}`," fi","done",'$TLSX acme:renew --domains "$DOMAINS" --method http-01 --webroot "$WEBROOT" --dir "$CERTS" --days 30 --prod --email "$EMAIL" || echo "renew: some domains failed (non-fatal)"',...ee(v),'rm -f "$CERTS"/*.chain.crt','after=$(cat "$CERTS"/*.crt 2>/dev/null | sha256sum)',`[ "$before" = "$after" ] || systemctl restart ${ze}`].join(`
134
134
  `),C=["[Unit]",`Description=Issue/renew rpx gateway TLS certs for ${x} (${E})`,`After=network-online.target ${ze}`,"Wants=network-online.target","","[Service]","Type=oneshot",`ExecStart=${l}`].join(`
135
135
  `),S=["[Unit]",`Description=Daily rpx gateway TLS cert issuance/renewal for ${x}`,"","[Timer]","OnCalendar=*-*-* 03:30:00","RandomizedDelaySec=1h","Persistent=true","","[Install]","WantedBy=timers.target"].join(`
136
- `);return[`mkdir -p ${n}`,...e.tenant?[]:[`(cd ${R} && ${u} add @stacksjs/tlsx@${i}) || true`],..._(l,b,"TS_CLOUD_RENEW_EOF"),`chmod +x ${l}`,..._(`/etc/systemd/system/${s}`,C,"TS_CLOUD_RENEW_SVC_EOF"),..._(`/etc/systemd/system/${w}`,S,"TS_CLOUD_RENEW_TIMER_EOF"),"systemctl daemon-reload",`systemctl enable --now ${w} || true`,`${l} || true`]}function G(e){let{config:t,proxy:r}=e,n=e.bunBin??"/usr/local/bin/bun",o=r.version??"latest",u=t.productionCerts.certsDir,i=(e.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),c=D(t,{slug:i}),f=J(z,u);if(e.tenant)return["set -euo pipefail",`if [ ! -x ${bt} ] || [ ! -d ${R}/node_modules/@stacksjs/rpx ]; then`,` echo "ts-cloud: no rpx gateway on this box. This project attaches to another project's compute, so it does not provision one - deploy the owning project first." >&2`," exit 1","fi",`mkdir -p ${z} ${u}`,`__tsc_rpx_before="$(sha256sum ${z}/${i}.json 2>/dev/null | cut -d' ' -f1 || true)"`,...T(`${z}/${i}.json`,c,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:n,preserveManagementDashboardRoutes:e.preserveManagementDashboardRoutes}),`__tsc_rpx_after="$(sha256sum ${z}/${i}.json 2>/dev/null | cut -d' ' -f1 || true)"`,`if [ "$__tsc_rpx_before" != "$__tsc_rpx_after" ] || ! systemctl is-active --quiet ${ze}; then`,` systemctl restart ${ze}`,"else",` echo "[ts-cloud] rpx routes for ${i} unchanged - leaving the shared gateway alone"`,"fi",...P(e)];let a=[`Environment=RPX_UPSTREAM_TIMEOUT=${r.upstreamTimeout??60}`];if(typeof r.maxUpstreamConns==="number")a.push(`Environment=RPX_MAX_UPSTREAM_CONNS=${r.maxUpstreamConns}`);let p=e.profile==="raspberry-pi"?Q:Z,x=r.memoryHigh??p.high,l=r.memoryMax??p.max;return["set -euo pipefail",`mkdir -p ${fo} ${z} ${u} ${R}`,`rm -rf ${R}.next ${R}.prev`,`mkdir -p ${R}.next`,`(cd ${R}.next && ${n} add @stacksjs/rpx@${o})`,`mv ${R} ${R}.prev`,`mv ${R}.next ${R}`,`rm -rf ${R}.prev`,`ln -sfn ${R}/node_modules ${fo}/node_modules`,...T(`${z}/${i}.json`,c,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:n,preserveManagementDashboardRoutes:e.preserveManagementDashboardRoutes}),..._(Ep,f,"TS_CLOUD_RPX_EOF"),`${n} build --production --compile --outfile ${bt}.next ${Ep}`,`chmod 0755 ${bt}.next`,`mv -f ${bt}.next ${bt}`,..._(`/etc/systemd/system/${ze}`,["[Unit]","Description=rpx reverse-proxy gateway (managed by ts-cloud)","After=network.target network-online.target","Wants=network-online.target","","[Service]","Type=simple",`ExecStart=${bt}`,`WorkingDirectory=${R}`,"Environment=BUN_INSTALL=/root/.bun","Environment=APP_ENV=production","Environment=NODE_ENV=production",...a,"MemoryAccounting=true",`MemoryHigh=${x}`,`MemoryMax=${l}`,"CPUWeight=500","IOWeight=500","OOMPolicy=stop","Restart=always","RestartSec=5","StartLimitIntervalSec=120","StartLimitBurst=5",`ExecStartPre=/bin/sh -c 'for p in 80 443; do fuser -k -n tcp "$p" 2>/dev/null || true; done; sleep 1'`,"LimitNOFILE=1048576","AmbientCapabilities=CAP_NET_BIND_SERVICE","","[Install]","WantedBy=multi-user.target"].join(`
136
+ `);return[`mkdir -p ${n}`,...e.tenant?[]:[`(cd ${R} && ${u} add @stacksjs/tlsx@${i}) || true`],..._(l,b,"TS_CLOUD_RENEW_EOF"),`chmod +x ${l}`,..._(`/etc/systemd/system/${s}`,C,"TS_CLOUD_RENEW_SVC_EOF"),..._(`/etc/systemd/system/${w}`,S,"TS_CLOUD_RENEW_TIMER_EOF"),"systemctl daemon-reload",`systemctl enable --now ${w} || true`,`${l} || true`]}function G(e){let{config:t,proxy:r}=e,n=e.bunBin??"/usr/local/bin/bun",o=r.version??"latest",u=t.productionCerts.certsDir,i=(e.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),c=D(t,{slug:i}),f=J(z,u);if(e.tenant)return["set -euo pipefail",`if [ ! -x ${Ct} ] || [ ! -d ${R}/node_modules/@stacksjs/rpx ]; then`,` echo "ts-cloud: no rpx gateway on this box. This project attaches to another project's compute, so it does not provision one - deploy the owning project first." >&2`," exit 1","fi",`mkdir -p ${z} ${u}`,`__tsc_rpx_before="$(sha256sum ${z}/${i}.json 2>/dev/null | cut -d' ' -f1 || true)"`,...T(`${z}/${i}.json`,c,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:n,preserveManagementDashboardRoutes:e.preserveManagementDashboardRoutes}),`__tsc_rpx_after="$(sha256sum ${z}/${i}.json 2>/dev/null | cut -d' ' -f1 || true)"`,`if [ "$__tsc_rpx_before" != "$__tsc_rpx_after" ] || ! systemctl is-active --quiet ${ze}; then`,` systemctl restart ${ze}`,"else",` echo "[ts-cloud] rpx routes for ${i} unchanged - leaving the shared gateway alone"`,"fi",...P(e)];let a=[`Environment=RPX_UPSTREAM_TIMEOUT=${r.upstreamTimeout??60}`];if(typeof r.maxUpstreamConns==="number")a.push(`Environment=RPX_MAX_UPSTREAM_CONNS=${r.maxUpstreamConns}`);let p=e.profile==="raspberry-pi"?Q:Z,x=r.memoryHigh??p.high,l=r.memoryMax??p.max;return["set -euo pipefail",`mkdir -p ${fo} ${z} ${u} ${R}`,`rm -rf ${R}.next ${R}.prev`,`mkdir -p ${R}.next`,`(cd ${R}.next && ${n} add @stacksjs/rpx@${o})`,`mv ${R} ${R}.prev`,`mv ${R}.next ${R}`,`rm -rf ${R}.prev`,`ln -sfn ${R}/node_modules ${fo}/node_modules`,...T(`${z}/${i}.json`,c,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:n,preserveManagementDashboardRoutes:e.preserveManagementDashboardRoutes}),..._(Ep,f,"TS_CLOUD_RPX_EOF"),`${n} build --production --compile --outfile ${Ct}.next ${Ep}`,`chmod 0755 ${Ct}.next`,`mv -f ${Ct}.next ${Ct}`,..._(`/etc/systemd/system/${ze}`,["[Unit]","Description=rpx reverse-proxy gateway (managed by ts-cloud)","After=network.target network-online.target","Wants=network-online.target","","[Service]","Type=simple",`ExecStart=${Ct}`,`WorkingDirectory=${R}`,"Environment=BUN_INSTALL=/root/.bun","Environment=APP_ENV=production","Environment=NODE_ENV=production",...a,"MemoryAccounting=true",`MemoryHigh=${x}`,`MemoryMax=${l}`,"CPUWeight=500","IOWeight=500","OOMPolicy=stop","Restart=always","RestartSec=5","StartLimitIntervalSec=120","StartLimitBurst=5",`ExecStartPre=/bin/sh -c 'for p in 80 443; do fuser -k -n tcp "$p" 2>/dev/null || true; done; sleep 1'`,"LimitNOFILE=1048576","AmbientCapabilities=CAP_NET_BIND_SERVICE","","[Install]","WantedBy=multi-user.target"].join(`
137
137
  `),"TS_CLOUD_RPX_UNIT_EOF"),"systemctl daemon-reload","systemctl disable --now bun-gateway.service 2>/dev/null || true","systemctl disable --now bun-gateway-renew.timer bun-gateway-renew.service 2>/dev/null || true","rm -f /etc/systemd/system/bun-gateway-renew.timer /etc/systemd/system/bun-gateway-renew.service","systemctl disable --now ts-cloud-nginx.service 2>/dev/null || true",`for timer in /etc/systemd/system/rpx-cert-renew-*.timer; do [ -e "$timer" ] || continue; unit="$(basename "$timer")"; tenant="\${unit#rpx-cert-renew-}"; tenant="\${tenant%.timer}"; [ -f "${z}/$tenant.json" ] && continue; systemctl disable --now "$unit" 2>/dev/null || true; rm -f "$timer" "/etc/systemd/system/rpx-cert-renew-$tenant.service" "${fo}/renew-certs-$tenant.sh"; done`,`systemctl enable ${ze}`,`systemctl restart ${ze}`,...P(e)]}function Ne(e){let t=(e.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),r=D(e.config,{slug:t});return["set -euo pipefail",`mkdir -p ${z}`,...T(`${z}/${t}.json`,r,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:"/usr/local/bin/bun",preserveManagementDashboardRoutes:e.preserveManagementDashboardRoutes}),`systemctl restart ${ze}`]}
138
- export{uo,go,po,mo,dd,bp,Cp,Zh,ld,B,tr,PI,j,fo,R,Ep,bt,ze,z,ud,gd,G,Ne};
138
+ export{uo,go,po,mo,dd,bp,Cp,Zh,ld,B,rr,PI,j,fo,R,Ep,Ct,ze,z,ud,gd,G,Ne};
@@ -1,2 +1,2 @@
1
- import{K,ol}from"./chunk-y9589qef.js";function U(t,s){return`/var/www/${t}-${s}`}var y=new Set(["laravel","php","statamic","wordpress"]);function jr(t){return t.type!=null&&y.has(t.type)}function zr(t){let s=t.proxyTo;if(s==null)return[];return(Array.isArray(s)?s:[s]).map((n)=>String(n).trim()).filter((n)=>n.length>0)}function Ad(t){return zr(t).length>0}function ho(t){if(t.deploy)return t.deploy;if(jr(t))return"server";if(t.start)return"server";return"bucket"}function d(t){if(t.redirect)return"redirect";if(Ad(t))return"proxy";if(jr(t))return"server-php";if(ho(t)==="bucket")return"bucket";return t.start?"server-app":"server-static"}function wA(t){return t.infrastructure?.compute!=null||Boolean(t.cloud?.attachTo?.trim())}function jp(t,s={}){let r=[],n=[],a=t.sites||{},p=wA(t),l=ol(t);if(l)r.push(l);let f=new Map;for(let[o,e]of Object.entries(a)){if(!e)continue;let h=ho(e),c=d(e);if(c==="redirect"){if(!e.domain)r.push(`Site '${o}' is a redirect site but has no \`domain\` to redirect from.`);if(!(typeof e.redirect==="string"?e.redirect:e.redirect?.to))r.push(`Site '${o}' is a redirect site but has no redirect target (\`redirect\` / \`redirect.to\`).`);if(!p)r.push(`Site '${o}' is a redirect site but no \`infrastructure.compute\` is configured to host the gateway that serves the redirect.`);let u=[];if(e.start)u.push("start");if(e.root)u.push("root");if(e.proxyTo)u.push("proxyTo");if(u.length>0)n.push(`Site '${o}' is a redirect site but also sets ${u.join(", ")}. These are ignored.`);continue}if(c==="proxy"){if(!e.domain)r.push(`Site '${o}' is a proxy site but has no \`domain\` to route from.`);if(!p)r.push(`Site '${o}' is a proxy site but no \`infrastructure.compute\` is configured to host the gateway that forwards it.`);let i=[];if(e.start)i.push("start");if(e.root)i.push("root");if(typeof e.port==="number")i.push("port");if(e.build)i.push("build");if(e.preStart&&e.preStart.length>0)i.push("preStart");if(i.length>0)n.push(`Site '${o}' sets \`proxyTo\`, so ts-cloud ships and supervises nothing for it. ${i.join(", ")} ${i.length===1?"is":"are"} ignored — remove ${i.length===1?"it":"them"}, or drop \`proxyTo\` to let ts-cloud own the service.`);continue}if(h==="server"&&!e.start&&!e.root){r.push(`Site '${o}' sets deploy:'server' but declares neither \`start\` (dynamic app) nor \`root\` (static site to serve). Add one.`);continue}if(c==="server-php"){if(!p)r.push(`Site '${o}' is a PHP site (type:'${e.type}') but no \`infrastructure.compute\` is configured. Add a server (infrastructure.compute) with PHP provisioning.`);if(!e.repository?.url)r.push(`Site '${o}' is a PHP site (type:'${e.type}') but has no \`repository.url\` to clone. PHP sites deploy via git.`)}else if(c==="server-app"){if(!p)r.push(`Site '${o}' deploys to a server (deploy:'server'${e.deploy?"":" inferred from `start`"}) but no \`infrastructure.compute\` is configured. Set deploy:'bucket' or add a server (infrastructure.compute).`);if(typeof e.port==="number"){let i=s.occupiedPorts?.get(e.port);if(i)r.push(`Site '${o}' wants port ${e.port}, which project '${i}' already serves on this box. Attached projects share one port namespace. Give '${o}' a free port, or let the attach allocate one.`);let u=f.get(e.port);if(u)r.push(`Sites '${u}' and '${o}' both use port ${e.port}. Server apps sharing a box must use distinct ports.`);else f.set(e.port,o)}}else if(c==="server-static"){if(!e.root)r.push(`Site '${o}' is a server static site (deploy:'server', no \`start\`) but has no \`root\` directory to serve.`);if(!p)r.push(`Site '${o}' deploys to a server (deploy:'server') but no \`infrastructure.compute\` is configured. Set deploy:'bucket' or add a server (infrastructure.compute).`)}else{if(!e.root)r.push(`Site '${o}' deploys to a bucket but has no \`root\` directory to upload.`);let i=[];if(e.start)i.push("start");if(typeof e.port==="number")i.push("port");if(e.preStart&&e.preStart.length>0)i.push("preStart");if(i.length>0)n.push(`Site '${o}' deploys to a bucket but sets server-only field(s): ${i.join(", ")}. These are ignored. Set deploy:'server' to use them.`)}}return{errors:r,warnings:n}}function zp(t){let s=d(t);return s!=="bucket"&&s!=="redirect"&&s!=="proxy"}function kI(t){return d(t)==="bucket"}function NI(t,s){if(K(t)==="serverless")return!0;let r=Object.entries(t.sites??{}).filter(([,a])=>a!=null),n=s?r.filter(([a])=>a===s):r;if(n.length===0)return!0;return!n.every(([,a])=>{let p=d(a);return p==="redirect"||p==="proxy"})}
1
+ import{K,ol}from"./chunk-040rbk7k.js";function U(t,s){return`/var/www/${t}-${s}`}var y=new Set(["laravel","php","statamic","wordpress"]);function jr(t){return t.type!=null&&y.has(t.type)}function zr(t){let s=t.proxyTo;if(s==null)return[];return(Array.isArray(s)?s:[s]).map((n)=>String(n).trim()).filter((n)=>n.length>0)}function Ad(t){return zr(t).length>0}function ho(t){if(t.deploy)return t.deploy;if(jr(t))return"server";if(t.start)return"server";return"bucket"}function d(t){if(t.redirect)return"redirect";if(Ad(t))return"proxy";if(jr(t))return"server-php";if(ho(t)==="bucket")return"bucket";return t.start?"server-app":"server-static"}function wA(t){return t.infrastructure?.compute!=null||Boolean(t.cloud?.attachTo?.trim())}function jp(t,s={}){let r=[],n=[],a=t.sites||{},p=wA(t),l=ol(t);if(l)r.push(l);let f=new Map;for(let[o,e]of Object.entries(a)){if(!e)continue;let h=ho(e),c=d(e);if(c==="redirect"){if(!e.domain)r.push(`Site '${o}' is a redirect site but has no \`domain\` to redirect from.`);if(!(typeof e.redirect==="string"?e.redirect:e.redirect?.to))r.push(`Site '${o}' is a redirect site but has no redirect target (\`redirect\` / \`redirect.to\`).`);if(!p)r.push(`Site '${o}' is a redirect site but no \`infrastructure.compute\` is configured to host the gateway that serves the redirect.`);let u=[];if(e.start)u.push("start");if(e.root)u.push("root");if(e.proxyTo)u.push("proxyTo");if(u.length>0)n.push(`Site '${o}' is a redirect site but also sets ${u.join(", ")}. These are ignored.`);continue}if(c==="proxy"){if(!e.domain)r.push(`Site '${o}' is a proxy site but has no \`domain\` to route from.`);if(!p)r.push(`Site '${o}' is a proxy site but no \`infrastructure.compute\` is configured to host the gateway that forwards it.`);let i=[];if(e.start)i.push("start");if(e.root)i.push("root");if(typeof e.port==="number")i.push("port");if(e.build)i.push("build");if(e.preStart&&e.preStart.length>0)i.push("preStart");if(i.length>0)n.push(`Site '${o}' sets \`proxyTo\`, so ts-cloud ships and supervises nothing for it. ${i.join(", ")} ${i.length===1?"is":"are"} ignored — remove ${i.length===1?"it":"them"}, or drop \`proxyTo\` to let ts-cloud own the service.`);continue}if(h==="server"&&!e.start&&!e.root){r.push(`Site '${o}' sets deploy:'server' but declares neither \`start\` (dynamic app) nor \`root\` (static site to serve). Add one.`);continue}if(c==="server-php"){if(!p)r.push(`Site '${o}' is a PHP site (type:'${e.type}') but no \`infrastructure.compute\` is configured. Add a server (infrastructure.compute) with PHP provisioning.`);if(!e.repository?.url)r.push(`Site '${o}' is a PHP site (type:'${e.type}') but has no \`repository.url\` to clone. PHP sites deploy via git.`)}else if(c==="server-app"){if(!p)r.push(`Site '${o}' deploys to a server (deploy:'server'${e.deploy?"":" inferred from `start`"}) but no \`infrastructure.compute\` is configured. Set deploy:'bucket' or add a server (infrastructure.compute).`);if(typeof e.port==="number"){let i=s.occupiedPorts?.get(e.port);if(i)r.push(`Site '${o}' wants port ${e.port}, which project '${i}' already serves on this box. Attached projects share one port namespace. Give '${o}' a free port, or let the attach allocate one.`);let u=f.get(e.port);if(u)r.push(`Sites '${u}' and '${o}' both use port ${e.port}. Server apps sharing a box must use distinct ports.`);else f.set(e.port,o)}}else if(c==="server-static"){if(!e.root)r.push(`Site '${o}' is a server static site (deploy:'server', no \`start\`) but has no \`root\` directory to serve.`);if(!p)r.push(`Site '${o}' deploys to a server (deploy:'server') but no \`infrastructure.compute\` is configured. Set deploy:'bucket' or add a server (infrastructure.compute).`)}else{if(!e.root)r.push(`Site '${o}' deploys to a bucket but has no \`root\` directory to upload.`);let i=[];if(e.start)i.push("start");if(typeof e.port==="number")i.push("port");if(e.preStart&&e.preStart.length>0)i.push("preStart");if(i.length>0)n.push(`Site '${o}' deploys to a bucket but sets server-only field(s): ${i.join(", ")}. These are ignored. Set deploy:'server' to use them.`)}}return{errors:r,warnings:n}}function zp(t){let s=d(t);return s!=="bucket"&&s!=="redirect"&&s!=="proxy"}function kI(t){return d(t)==="bucket"}function NI(t,s){if(K(t)==="serverless")return!0;let r=Object.entries(t.sites??{}).filter(([,a])=>a!=null),n=s?r.filter(([a])=>a===s):r;if(n.length===0)return!0;return!n.every(([,a])=>{let p=d(a);return p==="redirect"||p==="proxy"})}
2
2
  export{U,jr,zr,Ad,ho,d,wA,jp,zp,kI,NI};
@@ -1,2 +1,2 @@
1
- import{n,u}from"./chunk-9w5ncn9s.js";import{y}from"./chunk-g0bh9atv.js";class ne{client;region;constructor(e="us-east-1"){this.region=e,this.client=new n}async describeDBInstances(e){let r={Action:"DescribeDBInstances",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((o,c)=>{r[`Filters.Filter.${c+1}.Name`]=o.Name,o.Values.forEach((d,l)=>{r[`Filters.Filter.${c+1}.Values.Value.${l+1}`]=d})});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBInstancesResult||t,i=a.DBInstances?.DBInstance||[];if(!Array.isArray(i))i=i?[i]:[];return{DBInstances:i,Marker:a.Marker}}async describeDBInstance(e){return(await this.describeDBInstances({DBInstanceIdentifier:e})).DBInstances?.[0]}async describeDBClusters(e){let r={Action:"DescribeDBClusters",Version:"2014-10-31"};if(e?.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((o,c)=>{r[`Filters.Filter.${c+1}.Name`]=o.Name,o.Values.forEach((d,l)=>{r[`Filters.Filter.${c+1}.Values.Value.${l+1}`]=d})});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBClustersResult||t,i=a.DBClusters?.DBCluster||[];if(!Array.isArray(i))i=i?[i]:[];return{DBClusters:i,Marker:a.Marker}}async describeDBSnapshots(e){let r={Action:"DescribeDBSnapshots",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;if(e?.SnapshotType)r.SnapshotType=e.SnapshotType;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBSnapshotsResult||t,i=a.DBSnapshots?.DBSnapshot||[];if(!Array.isArray(i))i=i?[i]:[];return{DBSnapshots:i,Marker:a.Marker}}async describeDBSubnetGroups(e){let r={Action:"DescribeDBSubnetGroups",Version:"2014-10-31"};if(e?.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBSubnetGroupsResult||t,i=a.DBSubnetGroups?.DBSubnetGroup||[];if(!Array.isArray(i))i=i?[i]:[];return{DBSubnetGroups:i,Marker:a.Marker}}async createDBInstance(e){let r={Action:"CreateDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBInstanceClass:e.DBInstanceClass,Engine:e.Engine};if(e.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DBName)r.DBName=e.DBName;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.LicenseModel)r.LicenseModel=e.LicenseModel;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.StorageType)r.StorageType=e.StorageType;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});if(e.Tags)e.Tags.forEach((i,o)=>{r[`Tags.Tag.${o+1}.Key`]=i.Key,r[`Tags.Tag.${o+1}.Value`]=i.Value});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.CreateDBInstanceResult||t).DBInstance}}async createDBCluster(e){let r={Action:"CreateDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DatabaseName)r.DatabaseName=e.DatabaseName;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;e.VpcSecurityGroupIds?.forEach((a,i)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${i+1}`]=a});let s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()});return{DBCluster:(s.CreateDBClusterResult||s).DBCluster}}async deleteDBInstance(e){let r={Action:"DeleteDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.SkipFinalSnapshot!==void 0)r.SkipFinalSnapshot=e.SkipFinalSnapshot;if(e.FinalDBSnapshotIdentifier)r.FinalDBSnapshotIdentifier=e.FinalDBSnapshotIdentifier;if(e.DeleteAutomatedBackups!==void 0)r.DeleteAutomatedBackups=e.DeleteAutomatedBackups;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.DeleteDBInstanceResult||t).DBInstance}}async modifyDBInstance(e){let r={Action:"ModifyDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.ModifyDBInstanceResult||t).DBInstance}}async modifyDBCluster(e){let r={Action:"ModifyDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier};if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBCluster:(t.ModifyDBClusterResult||t).DBCluster}}async rebootDBCluster(e){let r={Action:"FailoverDBCluster",Version:"2014-10-31",DBClusterIdentifier:e},s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()});return{DBCluster:(s.FailoverDBClusterResult||s).DBCluster}}async createDBClusterSnapshot(e,r){let s={Action:"CreateDBClusterSnapshot",Version:"2014-10-31",DBClusterIdentifier:e,DBClusterSnapshotIdentifier:r};return this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(s)).toString()})}async describeDBClusterSnapshots(e={}){let r={Action:"DescribeDBClusterSnapshots",Version:"2014-10-31",...e},s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()}),t=s.DescribeDBClusterSnapshotsResult||s;return{DBClusterSnapshots:y(t.DBClusterSnapshots?.DBClusterSnapshot)}}async deleteDBClusterSnapshot(e){await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u({Action:"DeleteDBClusterSnapshot",Version:"2014-10-31",DBClusterSnapshotIdentifier:e})).toString()})}async deleteDBCluster(e,r){let s={Action:"DeleteDBCluster",Version:"2014-10-31",DBClusterIdentifier:e,SkipFinalSnapshot:!r};if(r)s.FinalDBSnapshotIdentifier=r;let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(s)).toString()});return{DBCluster:(t.DeleteDBClusterResult||t).DBCluster}}async restoreDBClusterToPointInTime(e){let r={Action:"RestoreDBClusterToPointInTime",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SourceDBClusterIdentifier:e.SourceDBClusterIdentifier};if(e.RestoreToTime)r.RestoreToTime=e.RestoreToTime.toISOString();if(e.UseLatestRestorableTime)r.UseLatestRestorableTime=!0;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBCluster:(t.RestoreDBClusterToPointInTimeResult||t).DBCluster}}async restoreDBClusterFromSnapshot(e){let r={Action:"RestoreDBClusterFromSnapshot",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SnapshotIdentifier:e.SnapshotIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds?.forEach((a,i)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${i+1}`]=a}),e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;let s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()});return{DBCluster:(s.RestoreDBClusterFromSnapshotResult||s).DBCluster}}async startDBInstance(e){let s=new URLSearchParams(u({Action:"StartDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e})).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.StartDBInstanceResult||t).DBInstance}}async stopDBInstance(e){let r={Action:"StopDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.StopDBInstanceResult||t).DBInstance}}async rebootDBInstance(e){let r={Action:"RebootDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.ForceFailover!==void 0)r.ForceFailover=e.ForceFailover;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.RebootDBInstanceResult||t).DBInstance}}async createDBSnapshot(e){let r={Action:"CreateDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.Tags)e.Tags.forEach((i,o)=>{r[`Tags.Tag.${o+1}.Key`]=i.Key,r[`Tags.Tag.${o+1}.Value`]=i.Value});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBSnapshot:(t.CreateDBSnapshotResult||t).DBSnapshot}}async deleteDBSnapshot(e){let s=new URLSearchParams(u({Action:"DeleteDBSnapshot",Version:"2014-10-31",DBSnapshotIdentifier:e})).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBSnapshot:(t.DeleteDBSnapshotResult||t).DBSnapshot}}async restoreDBInstanceFromDBSnapshot(e){let r={Action:"RestoreDBInstanceFromDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.Port)r.Port=e.Port;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});if(e.Tags)e.Tags.forEach((i,o)=>{r[`Tags.Tag.${o+1}.Key`]=i.Key,r[`Tags.Tag.${o+1}.Value`]=i.Value});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.RestoreDBInstanceFromDBSnapshotResult||t).DBInstance}}async waitForDBInstanceAvailable(e,r=60,s=30000){for(let t=0;t<r;t++){let a=await this.describeDBInstance(e);if(a?.DBInstanceStatus==="available")return a;if(["deleted","failed","incompatible-restore","incompatible-parameters"].includes(a?.DBInstanceStatus||""))throw Error(`DB instance ${e} is in terminal state: ${a?.DBInstanceStatus}`);await new Promise((i)=>setTimeout(i,s))}throw Error(`Timeout waiting for DB instance ${e} to become available`)}async waitForDBInstanceDeleted(e,r=60,s=30000){for(let t=0;t<r;t++)try{let a=await this.describeDBInstance(e);if(a?.DBInstanceStatus==="deleting"){await new Promise((i)=>setTimeout(i,s));continue}throw Error(`DB instance ${e} is in state: ${a?.DBInstanceStatus}`)}catch(a){if(a.code==="DBInstanceNotFound"||a.code==="DBInstanceNotFoundFault")return;throw a}throw Error(`Timeout waiting for DB instance ${e} to be deleted`)}}
1
+ import{n,u}from"./chunk-1wc2zfct.js";import{y}from"./chunk-g0bh9atv.js";class ne{client;region;constructor(e="us-east-1"){this.region=e,this.client=new n}async describeDBInstances(e){let r={Action:"DescribeDBInstances",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((o,c)=>{r[`Filters.Filter.${c+1}.Name`]=o.Name,o.Values.forEach((d,l)=>{r[`Filters.Filter.${c+1}.Values.Value.${l+1}`]=d})});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBInstancesResult||t,i=a.DBInstances?.DBInstance||[];if(!Array.isArray(i))i=i?[i]:[];return{DBInstances:i,Marker:a.Marker}}async describeDBInstance(e){return(await this.describeDBInstances({DBInstanceIdentifier:e})).DBInstances?.[0]}async describeDBClusters(e){let r={Action:"DescribeDBClusters",Version:"2014-10-31"};if(e?.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((o,c)=>{r[`Filters.Filter.${c+1}.Name`]=o.Name,o.Values.forEach((d,l)=>{r[`Filters.Filter.${c+1}.Values.Value.${l+1}`]=d})});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBClustersResult||t,i=a.DBClusters?.DBCluster||[];if(!Array.isArray(i))i=i?[i]:[];return{DBClusters:i,Marker:a.Marker}}async describeDBSnapshots(e){let r={Action:"DescribeDBSnapshots",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;if(e?.SnapshotType)r.SnapshotType=e.SnapshotType;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBSnapshotsResult||t,i=a.DBSnapshots?.DBSnapshot||[];if(!Array.isArray(i))i=i?[i]:[];return{DBSnapshots:i,Marker:a.Marker}}async describeDBSubnetGroups(e){let r={Action:"DescribeDBSubnetGroups",Version:"2014-10-31"};if(e?.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=t.DescribeDBSubnetGroupsResult||t,i=a.DBSubnetGroups?.DBSubnetGroup||[];if(!Array.isArray(i))i=i?[i]:[];return{DBSubnetGroups:i,Marker:a.Marker}}async createDBInstance(e){let r={Action:"CreateDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBInstanceClass:e.DBInstanceClass,Engine:e.Engine};if(e.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DBName)r.DBName=e.DBName;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.LicenseModel)r.LicenseModel=e.LicenseModel;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.StorageType)r.StorageType=e.StorageType;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});if(e.Tags)e.Tags.forEach((i,o)=>{r[`Tags.Tag.${o+1}.Key`]=i.Key,r[`Tags.Tag.${o+1}.Value`]=i.Value});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.CreateDBInstanceResult||t).DBInstance}}async createDBCluster(e){let r={Action:"CreateDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DatabaseName)r.DatabaseName=e.DatabaseName;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;e.VpcSecurityGroupIds?.forEach((a,i)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${i+1}`]=a});let s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()});return{DBCluster:(s.CreateDBClusterResult||s).DBCluster}}async deleteDBInstance(e){let r={Action:"DeleteDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.SkipFinalSnapshot!==void 0)r.SkipFinalSnapshot=e.SkipFinalSnapshot;if(e.FinalDBSnapshotIdentifier)r.FinalDBSnapshotIdentifier=e.FinalDBSnapshotIdentifier;if(e.DeleteAutomatedBackups!==void 0)r.DeleteAutomatedBackups=e.DeleteAutomatedBackups;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.DeleteDBInstanceResult||t).DBInstance}}async modifyDBInstance(e){let r={Action:"ModifyDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.ModifyDBInstanceResult||t).DBInstance}}async modifyDBCluster(e){let r={Action:"ModifyDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier};if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBCluster:(t.ModifyDBClusterResult||t).DBCluster}}async rebootDBCluster(e){let r={Action:"FailoverDBCluster",Version:"2014-10-31",DBClusterIdentifier:e},s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()});return{DBCluster:(s.FailoverDBClusterResult||s).DBCluster}}async createDBClusterSnapshot(e,r){let s={Action:"CreateDBClusterSnapshot",Version:"2014-10-31",DBClusterIdentifier:e,DBClusterSnapshotIdentifier:r};return this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(s)).toString()})}async describeDBClusterSnapshots(e={}){let r={Action:"DescribeDBClusterSnapshots",Version:"2014-10-31",...e},s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()}),t=s.DescribeDBClusterSnapshotsResult||s;return{DBClusterSnapshots:y(t.DBClusterSnapshots?.DBClusterSnapshot)}}async deleteDBClusterSnapshot(e){await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u({Action:"DeleteDBClusterSnapshot",Version:"2014-10-31",DBClusterSnapshotIdentifier:e})).toString()})}async deleteDBCluster(e,r){let s={Action:"DeleteDBCluster",Version:"2014-10-31",DBClusterIdentifier:e,SkipFinalSnapshot:!r};if(r)s.FinalDBSnapshotIdentifier=r;let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(s)).toString()});return{DBCluster:(t.DeleteDBClusterResult||t).DBCluster}}async restoreDBClusterToPointInTime(e){let r={Action:"RestoreDBClusterToPointInTime",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SourceDBClusterIdentifier:e.SourceDBClusterIdentifier};if(e.RestoreToTime)r.RestoreToTime=e.RestoreToTime.toISOString();if(e.UseLatestRestorableTime)r.UseLatestRestorableTime=!0;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBCluster:(t.RestoreDBClusterToPointInTimeResult||t).DBCluster}}async restoreDBClusterFromSnapshot(e){let r={Action:"RestoreDBClusterFromSnapshot",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SnapshotIdentifier:e.SnapshotIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds?.forEach((a,i)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${i+1}`]=a}),e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;let s=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(u(r)).toString()});return{DBCluster:(s.RestoreDBClusterFromSnapshotResult||s).DBCluster}}async startDBInstance(e){let s=new URLSearchParams(u({Action:"StartDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e})).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.StartDBInstanceResult||t).DBInstance}}async stopDBInstance(e){let r={Action:"StopDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.StopDBInstanceResult||t).DBInstance}}async rebootDBInstance(e){let r={Action:"RebootDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.ForceFailover!==void 0)r.ForceFailover=e.ForceFailover;let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.RebootDBInstanceResult||t).DBInstance}}async createDBSnapshot(e){let r={Action:"CreateDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.Tags)e.Tags.forEach((i,o)=>{r[`Tags.Tag.${o+1}.Key`]=i.Key,r[`Tags.Tag.${o+1}.Value`]=i.Value});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBSnapshot:(t.CreateDBSnapshotResult||t).DBSnapshot}}async deleteDBSnapshot(e){let s=new URLSearchParams(u({Action:"DeleteDBSnapshot",Version:"2014-10-31",DBSnapshotIdentifier:e})).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBSnapshot:(t.DeleteDBSnapshotResult||t).DBSnapshot}}async restoreDBInstanceFromDBSnapshot(e){let r={Action:"RestoreDBInstanceFromDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.Port)r.Port=e.Port;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((i,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=i});if(e.Tags)e.Tags.forEach((i,o)=>{r[`Tags.Tag.${o+1}.Key`]=i.Key,r[`Tags.Tag.${o+1}.Value`]=i.Value});let s=new URLSearchParams(u(r)).toString(),t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});return{DBInstance:(t.RestoreDBInstanceFromDBSnapshotResult||t).DBInstance}}async waitForDBInstanceAvailable(e,r=60,s=30000){for(let t=0;t<r;t++){let a=await this.describeDBInstance(e);if(a?.DBInstanceStatus==="available")return a;if(["deleted","failed","incompatible-restore","incompatible-parameters"].includes(a?.DBInstanceStatus||""))throw Error(`DB instance ${e} is in terminal state: ${a?.DBInstanceStatus}`);await new Promise((i)=>setTimeout(i,s))}throw Error(`Timeout waiting for DB instance ${e} to become available`)}async waitForDBInstanceDeleted(e,r=60,s=30000){for(let t=0;t<r;t++)try{let a=await this.describeDBInstance(e);if(a?.DBInstanceStatus==="deleting"){await new Promise((i)=>setTimeout(i,s));continue}throw Error(`DB instance ${e} is in state: ${a?.DBInstanceStatus}`)}catch(a){if(a.code==="DBInstanceNotFound"||a.code==="DBInstanceNotFoundFault")return;throw a}throw Error(`Timeout waiting for DB instance ${e} to be deleted`)}}
2
2
  export{ne};
@@ -1,11 +1,11 @@
1
- import{Et,xi,Oi,_i}from"./chunk-pymc2aad.js";function S(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tA(t,e="/var/www"){let n=`${e}/${t}-`;return["set -u",`for TS_CLOUD_DIR in ${n}*; do`,' [ -d "$TS_CLOUD_DIR" ] || continue',' [ -d "$TS_CLOUD_DIR/releases" ] || continue',` TS_CLOUD_SITE="\${TS_CLOUD_DIR#${n}}"`," TS_CLOUD_ACTIVE=no",` for TS_CLOUD_UNIT in $(ls /etc/systemd/system/ 2>/dev/null | grep -E "^${S(t)}-$TS_CLOUD_SITE[-@.]" || true); do`,' systemctl is-active "$TS_CLOUD_UNIT" >/dev/null 2>&1 && TS_CLOUD_ACTIVE=yes'," done",' TS_CLOUD_SIZE="$(du -sh "$TS_CLOUD_DIR" 2>/dev/null | cut -f1)"',' echo "site:$TS_CLOUD_SITE:$TS_CLOUD_ACTIVE:${TS_CLOUD_SIZE:-?}"',"done","exit 0"]}function rA(t){if(!t)return[];let e=[];for(let n of t.split(`
1
+ import{vt,xi,Oi,_i}from"./chunk-h360gwrf.js";function S(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tA(t,e="/var/www"){let n=`${e}/${t}-`;return["set -u",`for TS_CLOUD_DIR in ${n}*; do`,' [ -d "$TS_CLOUD_DIR" ] || continue',' [ -d "$TS_CLOUD_DIR/releases" ] || continue',` TS_CLOUD_SITE="\${TS_CLOUD_DIR#${n}}"`," TS_CLOUD_ACTIVE=no",` for TS_CLOUD_UNIT in $(ls /etc/systemd/system/ 2>/dev/null | grep -E "^${S(t)}-$TS_CLOUD_SITE[-@.]" || true); do`,' systemctl is-active "$TS_CLOUD_UNIT" >/dev/null 2>&1 && TS_CLOUD_ACTIVE=yes'," done",' TS_CLOUD_SIZE="$(du -sh "$TS_CLOUD_DIR" 2>/dev/null | cut -f1)"',' echo "site:$TS_CLOUD_SITE:$TS_CLOUD_ACTIVE:${TS_CLOUD_SIZE:-?}"',"done","exit 0"]}function rA(t){if(!t)return[];let e=[];for(let n of t.split(`
2
2
  `)){let r=n.trim();if(!r.startsWith("site:"))continue;let[,s,o,i]=r.split(":");if(!s||o!=="no")continue;e.push({name:s,size:i||"?"})}return e}function nA(t,e,n){let r=t.map((o)=>` ${e}-${o.name} (${o.size})`).join(`
3
3
  `),s=t.length===1?"it":"them";return`This server still holds ${t.length} site tree${t.length===1?"":"s"} with nothing running for ${s}:
4
4
  ${r}
5
5
  `+"A site moved off this box keeps its files here on purpose — they are the rollback, and they are what makes "+`the move reversible until this server is destroyed. Destroying it now discards that.
6
- Verify the site is serving from its new home first, then re-run with ${n} to destroy it anyway.`}var wp="ts-cloud/project",Rp="ts-cloud/environment",Dp="ts-cloud/role";function d(t){return typeof t==="string"&&t.trim()?t.trim():void 0}function h(t){if(typeof t==="string")return d(t);if(t&&typeof t==="object")return d(t.name);return}function iA(t){let e={};for(let[n,r]of Object.entries(t?.labels??{}))if(typeof r==="string")e[n]=r;return{id:String(t?.id??""),name:d(t?.name)??"(unnamed)",status:d(t?.status)??"unknown",ipv4:d(t?.public_net?.ipv4?.ip)??d(t?.ipv4),ipv6:d(t?.public_net?.ipv6?.ip)??d(t?.ipv6),type:d(t?.server_type?.name)??d(t?.type),location:h(t?.location)??h(t?.datacenter?.location)??h(t?.datacenter),labels:e,project:d(e[wp]),environment:d(e[Rp]),role:d(e[Dp])}}function w(t){return t.slug?.trim()||"app"}function Pp(t){let e=[];for(let n of t){let r=w(n);for(let s of n.proxies??[]){let o=d(s?.to);if(!o)continue;e.push({slug:r,host:o,path:d(s?.path)??"/",...x(s)})}}return e.sort((n,r)=>n.slug.localeCompare(r.slug)||n.host.localeCompare(r.host)||n.path.localeCompare(r.path))}function x(t){let e=t?.from;if(typeof e==="string"&&e.trim())return{target:e.trim(),kind:"app"};if(Array.isArray(e)&&e.length>0)return{target:e.filter((s)=>typeof s==="string").join(", "),kind:"app"};let n=t?.static;if(typeof n==="string"&&n.trim())return{target:n.trim(),kind:"static"};if(n&&typeof n==="object"&&d(n.dir))return{target:d(n.dir),kind:"static"};let r=typeof t?.redirect==="string"?d(t.redirect):d(t?.redirect?.to);if(r)return{target:r,kind:"redirect"};return{target:"(no upstream)",kind:"unknown"}}function kp(t){let e=new Map;for(let n of t){let r=e.get(n.slug);if(r)r.push(n);else e.set(n.slug,[n])}return[...e.entries()].map(([n,r])=>({slug:n,routes:r})).sort((n,r)=>r.routes.length-n.routes.length||n.slug.localeCompare(r.slug))}async function sA(t,e,n=Et){if(!t.ipv4)return{server:t.name,routes:[],unavailable:"no public IPv4 address to reach it on"};if(t.status!=="running")return{server:t.name,ip:t.ipv4,routes:[],unavailable:`server is ${t.status}`};try{let r=await e(t.ipv4,Oi(n));if(r.code!==0){let s=r.stderr.trim().split(`
6
+ Verify the site is serving from its new home first, then re-run with ${n} to destroy it anyway.`}var wp="ts-cloud/project",Rp="ts-cloud/environment",Dp="ts-cloud/role";function d(t){return typeof t==="string"&&t.trim()?t.trim():void 0}function h(t){if(typeof t==="string")return d(t);if(t&&typeof t==="object")return d(t.name);return}function iA(t){let e={};for(let[n,r]of Object.entries(t?.labels??{}))if(typeof r==="string")e[n]=r;return{id:String(t?.id??""),name:d(t?.name)??"(unnamed)",status:d(t?.status)??"unknown",ipv4:d(t?.public_net?.ipv4?.ip)??d(t?.ipv4),ipv6:d(t?.public_net?.ipv6?.ip)??d(t?.ipv6),type:d(t?.server_type?.name)??d(t?.type),location:h(t?.location)??h(t?.datacenter?.location)??h(t?.datacenter),labels:e,project:d(e[wp]),environment:d(e[Rp]),role:d(e[Dp])}}function w(t){return t.slug?.trim()||"app"}function Pp(t){let e=[];for(let n of t){let r=w(n);for(let s of n.proxies??[]){let o=d(s?.to);if(!o)continue;e.push({slug:r,host:o,path:d(s?.path)??"/",...x(s)})}}return e.sort((n,r)=>n.slug.localeCompare(r.slug)||n.host.localeCompare(r.host)||n.path.localeCompare(r.path))}function x(t){let e=t?.from;if(typeof e==="string"&&e.trim())return{target:e.trim(),kind:"app"};if(Array.isArray(e)&&e.length>0)return{target:e.filter((s)=>typeof s==="string").join(", "),kind:"app"};let n=t?.static;if(typeof n==="string"&&n.trim())return{target:n.trim(),kind:"static"};if(n&&typeof n==="object"&&d(n.dir))return{target:d(n.dir),kind:"static"};let r=typeof t?.redirect==="string"?d(t.redirect):d(t?.redirect?.to);if(r)return{target:r,kind:"redirect"};return{target:"(no upstream)",kind:"unknown"}}function kp(t){let e=new Map;for(let n of t){let r=e.get(n.slug);if(r)r.push(n);else e.set(n.slug,[n])}return[...e.entries()].map(([n,r])=>({slug:n,routes:r})).sort((n,r)=>r.routes.length-n.routes.length||n.slug.localeCompare(r.slug))}async function sA(t,e,n=vt){if(!t.ipv4)return{server:t.name,routes:[],unavailable:"no public IPv4 address to reach it on"};if(t.status!=="running")return{server:t.name,ip:t.ipv4,routes:[],unavailable:`server is ${t.status}`};try{let r=await e(t.ipv4,Oi(n));if(r.code!==0){let s=r.stderr.trim().split(`
7
7
  `)[0]||`remote command exited ${r.code}`;return{server:t.name,ip:t.ipv4,routes:[],unavailable:s}}return{server:t.name,ip:t.ipv4,routes:Pp(_i(r.stdout))}}catch(r){let s=r instanceof Error?r.message.split(`
8
- `)[0]:String(r);return{server:t.name,ip:t.ipv4,routes:[],unavailable:s}}}function u(t,e){let n=e==="/"?"/":e.replace(/\/+$/,"");return`${t.toLowerCase()}${n||"/"}`}function oA(t,e,n){let r=new Set(e.filter((a)=>a.slug===n).map((a)=>u(a.host,a.path))),s=[],o=[],i=[];for(let a of t)if(a.loopbackOnly)i.push(a);else if(a.domain&&r.has(u(a.domain,a.path)))s.push(a);else o.push(a);return{present:s,absent:o,loopback:i,foreign:e.filter((a)=>a.slug!==n)}}function Np(t,e,n){let r=new Set;for(let s of e)for(let o of s.routes)if(o.slug===n)r.add(u(o.host,o.path));return t.filter((s)=>!s.loopbackOnly&&s.domain!==void 0&&!r.has(u(s.domain,s.path)))}function aA(t){let{slug:e,servers:n,probes:r,declared:s}=t,o=[];if(o.push(n.length===0?"No servers found.":`${n.length} server${n.length===1?"":"s"}:`),n.length>0)o.push("");let i=new Map(r.map((a)=>[a.server,a]));for(let a of n){let p=[a.ipv4,a.type,a.location,a.status].filter(Boolean);o.push(` ${a.name} ${p.join(" ")}`),o.push(` ${k(a)}`);let c=i.get(a.name);if(!c)o.push(" not probed, so co-tenants on this box are not listed");else if(c.unavailable)o.push(` could not read ${Et}: ${c.unavailable}`);else o.push(...P(c,e));o.push("")}return o.push(...C(t)),o}function k(t){if(!t.project)return"no ts-cloud labels: provisioned outside ts-cloud, or by a version that did not label boxes";let e=[t.environment,t.role&&`role ${t.role}`].filter(Boolean).join(", ");return`owned by '${t.project}'${e?` (${e})`:""}`}function P(t,e){let n=kp(t.routes);if(n.length===0)return[` serves nothing: ${Et} is empty or absent`];let r=[` serves ${t.routes.length} route${t.routes.length===1?"":"s"} for ${n.length} project${n.length===1?"":"s"}:`];for(let s of n){r.push(` ${s.slug}${s.slug===e?" (this project)":""}`);for(let o of s.routes)r.push(` ${o.host}${o.path==="/"?"/":o.path} -> ${O(o)}`)}return r}function O(t){if(t.kind==="redirect")return`redirect to ${t.target}`;if(t.kind==="static")return`static ${t.target}`;return t.target}function C(t){let{slug:e,declared:n,probes:r,servers:s}=t;if(n.length===0)return[`This project ('${e}') declares no sites.`];let o=[`This project ('${e}') declares ${n.length} site${n.length===1?"":"s"}: `+n.map((c)=>c.name).join(", ")],i=n.filter((c)=>c.loopbackOnly);if(i.length>0)o.push(` ${i.length} with no domain, so the gateway never routes ${i.length===1?"it":"them"} (reached through another site's proxy): ${i.map((c)=>c.name).join(", ")}`);let a=r.filter((c)=>!c.unavailable);if(a.length===0)return o.push(" Nothing to reconcile them against: no box reported what it serves."),o;let p=Np(n,a,e);if(o.push(` ${n.length-i.length-p.length} routed by a box above`),p.length>0){o.push(` ${p.length} not routed by any box above: ${p.map((b)=>b.name).join(", ")}`);let c=r.length-a.length,g=s.length-r.length;if(c>0)o.push(` Either they were never deployed, or they are on one of the ${c} server${c===1?"":"s"} that could not be read.`);else if(g>0)o.push(` Either they were never deployed, or they are on one of the ${g} server${g===1?"":"s"} this run did not probe.`);else o.push(" Either they were never deployed, or they are on a server this listing did not cover.")}return o}async function cA(t){let e=[];for(let n of t.steps)try{e.push({step:n,state:await n.satisfied()?"satisfied":"pending"})}catch(r){e.push({step:n,state:"unknown",reason:r instanceof Error?r.message:String(r)})}return e}function md(t){return t.filter((e)=>e.state!=="satisfied")}function Bp(t){return md(t).some((e)=>e.step.destructive===!0)}function dA(t,e){let n=md(e),r=[`${t.operation} ${t.target}`];if(n.length===0)return r.push(" Nothing to do — every step is already satisfied."),r;for(let{step:o,state:i,reason:a}of e){let p=i==="satisfied"?"ok ":i==="unknown"?"? ":"→ ",c=[o.destructive?"DESTRUCTIVE":"",i==="satisfied"?"already done":""].filter(Boolean);if(r.push(` ${p}${o.title}${c.length>0?` [${c.join(", ")}]`:""}`),o.change)r.push(` ${o.change.from} → ${o.change.to}`);if(a)r.push(` could not check: ${a}`)}let s=n.filter((o)=>o.step.destructive).length;return r.push(` ${n.length} step(s) would run`+(s>0?`, ${s} irreversible — re-run with --confirm ${t.target}`:"")),r}async function lA(t,e,n={}){let r={operation:t.operation,target:t.target,steps:[],success:!0};if(Bp(e)&&n.confirm!==t.target)throw Error(`${t.operation} includes an irreversible step. Re-run with --confirm ${t.target} to authorize it.`);for(let{step:s,state:o}of e){if(o==="satisfied"){r.steps.push({id:s.id,title:s.title,state:"skipped"}),n.log?.(`skip ${s.title} (already done)`);continue}n.audit?.({operation:t.operation,target:t.target,step:s.id,state:"started"});try{await s.apply(),r.steps.push({id:s.id,title:s.title,state:"applied"}),n.log?.(`done ${s.title}`),n.audit?.({operation:t.operation,target:t.target,step:s.id,state:"applied"})}catch(i){let a=i instanceof Error?i.message:String(i);return r.steps.push({id:s.id,title:s.title,state:"failed",error:a}),r.success=!1,n.log?.(`FAIL ${s.title}: ${a}`),n.audit?.({operation:t.operation,target:t.target,step:s.id,state:"failed",error:a}),r}}return r}function xp(t){if(t.length===0)throw Error("A server name cannot be empty.");if(t.length>253)throw Error(`'${t}' is longer than the 253 characters a hostname allows.`);for(let e of t.split(".")){if(e.length===0)throw Error(`'${t}' has an empty label — a hostname cannot contain '..'.`);if(e.length>63)throw Error(`'${e}' is longer than the 63 characters a hostname label allows.`);if(!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(e))throw Error(`'${e}' is not a valid hostname label. Use letters, digits and hyphens, not starting or ending with a hyphen.`)}}async function uA(t,e,n){if(xp(e),t===e)throw Error(`'${t}' is already named that.`);if((await n.takenNames()).some((o)=>o===e&&o!==t))throw Error(`'${e}' is already taken. Server names have to be unique within a provider project.`);let s=[];if(n.providerName&&n.renameProvider){let{providerName:o,renameProvider:i}=n;s.push({id:"provider",title:"Rename the server at the provider",change:{from:t,to:e},satisfied:async()=>await o()===e,apply:()=>i(e)})}if(n.stateName&&n.writeStateName){let{stateName:o,writeStateName:i}=n;s.push({id:"state-pin",title:"Update the recorded name in the local driver state",change:{from:t,to:e},satisfied:async()=>{let a=await o();return a===void 0||a===e},apply:()=>i(e)})}if(n.remoteHostname&&n.setRemoteHostname){let{remoteHostname:o,setRemoteHostname:i}=n;s.push({id:"hostname",title:"Set the hostname on the box",change:{from:t,to:e},satisfied:async()=>await o()===e,apply:()=>i(e)})}return s.push({id:"inventory",title:"Rename the fleet inventory record",change:{from:t,to:e},satisfied:async()=>n.inventoryName()===e,apply:async()=>{await n.renameInventory(e)}}),{operation:"server:rename",target:t,steps:s}}function gA(t){let e=`'${t.replace(/'/g,`'"'"'`)}'`;return["set -eu",'TS_CLOUD_OLD="$(hostname)"',`hostnamectl set-hostname ${e} 2>/dev/null || { echo ${e} > /etc/hostname && hostname ${e}; }`,'if grep -q "^127.0.1.1" /etc/hosts; then',` TS_CLOUD_HOSTS="$(sed -E "s/^127\\.0\\.1\\.1.*/127.0.1.1\\t${t}/" /etc/hosts)"`,` printf '%s\\n' "$TS_CLOUD_HOSTS" > /etc/hosts`,"else",` printf '127.0.1.1\\t%s\\n' ${e} >> /etc/hosts`,"fi",'printf "%s -> %s\\n" "$TS_CLOUD_OLD" "$(hostname)"'].join(`
8
+ `)[0]:String(r);return{server:t.name,ip:t.ipv4,routes:[],unavailable:s}}}function u(t,e){let n=e==="/"?"/":e.replace(/\/+$/,"");return`${t.toLowerCase()}${n||"/"}`}function oA(t,e,n){let r=new Set(e.filter((a)=>a.slug===n).map((a)=>u(a.host,a.path))),s=[],o=[],i=[];for(let a of t)if(a.loopbackOnly)i.push(a);else if(a.domain&&r.has(u(a.domain,a.path)))s.push(a);else o.push(a);return{present:s,absent:o,loopback:i,foreign:e.filter((a)=>a.slug!==n)}}function Np(t,e,n){let r=new Set;for(let s of e)for(let o of s.routes)if(o.slug===n)r.add(u(o.host,o.path));return t.filter((s)=>!s.loopbackOnly&&s.domain!==void 0&&!r.has(u(s.domain,s.path)))}function aA(t){let{slug:e,servers:n,probes:r,declared:s}=t,o=[];if(o.push(n.length===0?"No servers found.":`${n.length} server${n.length===1?"":"s"}:`),n.length>0)o.push("");let i=new Map(r.map((a)=>[a.server,a]));for(let a of n){let p=[a.ipv4,a.type,a.location,a.status].filter(Boolean);o.push(` ${a.name} ${p.join(" ")}`),o.push(` ${k(a)}`);let c=i.get(a.name);if(!c)o.push(" not probed, so co-tenants on this box are not listed");else if(c.unavailable)o.push(` could not read ${vt}: ${c.unavailable}`);else o.push(...P(c,e));o.push("")}return o.push(...C(t)),o}function k(t){if(!t.project)return"no ts-cloud labels: provisioned outside ts-cloud, or by a version that did not label boxes";let e=[t.environment,t.role&&`role ${t.role}`].filter(Boolean).join(", ");return`owned by '${t.project}'${e?` (${e})`:""}`}function P(t,e){let n=kp(t.routes);if(n.length===0)return[` serves nothing: ${vt} is empty or absent`];let r=[` serves ${t.routes.length} route${t.routes.length===1?"":"s"} for ${n.length} project${n.length===1?"":"s"}:`];for(let s of n){r.push(` ${s.slug}${s.slug===e?" (this project)":""}`);for(let o of s.routes)r.push(` ${o.host}${o.path==="/"?"/":o.path} -> ${O(o)}`)}return r}function O(t){if(t.kind==="redirect")return`redirect to ${t.target}`;if(t.kind==="static")return`static ${t.target}`;return t.target}function C(t){let{slug:e,declared:n,probes:r,servers:s}=t;if(n.length===0)return[`This project ('${e}') declares no sites.`];let o=[`This project ('${e}') declares ${n.length} site${n.length===1?"":"s"}: `+n.map((c)=>c.name).join(", ")],i=n.filter((c)=>c.loopbackOnly);if(i.length>0)o.push(` ${i.length} with no domain, so the gateway never routes ${i.length===1?"it":"them"} (reached through another site's proxy): ${i.map((c)=>c.name).join(", ")}`);let a=r.filter((c)=>!c.unavailable);if(a.length===0)return o.push(" Nothing to reconcile them against: no box reported what it serves."),o;let p=Np(n,a,e);if(o.push(` ${n.length-i.length-p.length} routed by a box above`),p.length>0){o.push(` ${p.length} not routed by any box above: ${p.map((b)=>b.name).join(", ")}`);let c=r.length-a.length,g=s.length-r.length;if(c>0)o.push(` Either they were never deployed, or they are on one of the ${c} server${c===1?"":"s"} that could not be read.`);else if(g>0)o.push(` Either they were never deployed, or they are on one of the ${g} server${g===1?"":"s"} this run did not probe.`);else o.push(" Either they were never deployed, or they are on a server this listing did not cover.")}return o}async function cA(t){let e=[];for(let n of t.steps)try{e.push({step:n,state:await n.satisfied()?"satisfied":"pending"})}catch(r){e.push({step:n,state:"unknown",reason:r instanceof Error?r.message:String(r)})}return e}function md(t){return t.filter((e)=>e.state!=="satisfied")}function Bp(t){return md(t).some((e)=>e.step.destructive===!0)}function dA(t,e){let n=md(e),r=[`${t.operation} ${t.target}`];if(n.length===0)return r.push(" Nothing to do — every step is already satisfied."),r;for(let{step:o,state:i,reason:a}of e){let p=i==="satisfied"?"ok ":i==="unknown"?"? ":"→ ",c=[o.destructive?"DESTRUCTIVE":"",i==="satisfied"?"already done":""].filter(Boolean);if(r.push(` ${p}${o.title}${c.length>0?` [${c.join(", ")}]`:""}`),o.change)r.push(` ${o.change.from} → ${o.change.to}`);if(a)r.push(` could not check: ${a}`)}let s=n.filter((o)=>o.step.destructive).length;return r.push(` ${n.length} step(s) would run`+(s>0?`, ${s} irreversible — re-run with --confirm ${t.target}`:"")),r}async function lA(t,e,n={}){let r={operation:t.operation,target:t.target,steps:[],success:!0};if(Bp(e)&&n.confirm!==t.target)throw Error(`${t.operation} includes an irreversible step. Re-run with --confirm ${t.target} to authorize it.`);for(let{step:s,state:o}of e){if(o==="satisfied"){r.steps.push({id:s.id,title:s.title,state:"skipped"}),n.log?.(`skip ${s.title} (already done)`);continue}n.audit?.({operation:t.operation,target:t.target,step:s.id,state:"started"});try{await s.apply(),r.steps.push({id:s.id,title:s.title,state:"applied"}),n.log?.(`done ${s.title}`),n.audit?.({operation:t.operation,target:t.target,step:s.id,state:"applied"})}catch(i){let a=i instanceof Error?i.message:String(i);return r.steps.push({id:s.id,title:s.title,state:"failed",error:a}),r.success=!1,n.log?.(`FAIL ${s.title}: ${a}`),n.audit?.({operation:t.operation,target:t.target,step:s.id,state:"failed",error:a}),r}}return r}function xp(t){if(t.length===0)throw Error("A server name cannot be empty.");if(t.length>253)throw Error(`'${t}' is longer than the 253 characters a hostname allows.`);for(let e of t.split(".")){if(e.length===0)throw Error(`'${t}' has an empty label — a hostname cannot contain '..'.`);if(e.length>63)throw Error(`'${e}' is longer than the 63 characters a hostname label allows.`);if(!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(e))throw Error(`'${e}' is not a valid hostname label. Use letters, digits and hyphens, not starting or ending with a hyphen.`)}}async function uA(t,e,n){if(xp(e),t===e)throw Error(`'${t}' is already named that.`);if((await n.takenNames()).some((o)=>o===e&&o!==t))throw Error(`'${e}' is already taken. Server names have to be unique within a provider project.`);let s=[];if(n.providerName&&n.renameProvider){let{providerName:o,renameProvider:i}=n;s.push({id:"provider",title:"Rename the server at the provider",change:{from:t,to:e},satisfied:async()=>await o()===e,apply:()=>i(e)})}if(n.stateName&&n.writeStateName){let{stateName:o,writeStateName:i}=n;s.push({id:"state-pin",title:"Update the recorded name in the local driver state",change:{from:t,to:e},satisfied:async()=>{let a=await o();return a===void 0||a===e},apply:()=>i(e)})}if(n.remoteHostname&&n.setRemoteHostname){let{remoteHostname:o,setRemoteHostname:i}=n;s.push({id:"hostname",title:"Set the hostname on the box",change:{from:t,to:e},satisfied:async()=>await o()===e,apply:()=>i(e)})}return s.push({id:"inventory",title:"Rename the fleet inventory record",change:{from:t,to:e},satisfied:async()=>n.inventoryName()===e,apply:async()=>{await n.renameInventory(e)}}),{operation:"server:rename",target:t,steps:s}}function gA(t){let e=`'${t.replace(/'/g,`'"'"'`)}'`;return["set -eu",'TS_CLOUD_OLD="$(hostname)"',`hostnamectl set-hostname ${e} 2>/dev/null || { echo ${e} > /etc/hostname && hostname ${e}; }`,'if grep -q "^127.0.1.1" /etc/hosts; then',` TS_CLOUD_HOSTS="$(sed -E "s/^127\\.0\\.1\\.1.*/127.0.1.1\\t${t}/" /etc/hosts)"`,` printf '%s\\n' "$TS_CLOUD_HOSTS" > /etc/hosts`,"else",` printf '127.0.1.1\\t%s\\n' ${e} >> /etc/hosts`,"fi",'printf "%s -> %s\\n" "$TS_CLOUD_OLD" "$(hostname)"'].join(`
9
9
  `)}function pA(t,e,n){let r=e.trim();if(!r)return{problem:"No server named."};let[s,...o]=t.filter((c)=>c.name===r);if(s&&o.length===0)return{server:s};let i=t.filter((c)=>c.project===r);if(i.length>1&&n)i=i.filter((c)=>!c.environment||c.environment===n);let[a,...p]=i;if(a&&p.length===0)return{server:a};if(i.length>1)return{problem:`'${r}' owns ${i.length} servers (${i.map((c)=>c.name).join(", ")}). Name one of them, or narrow it by environment.`};return{problem:`No server matched '${r}'. Nothing is named that, and no box carries the label ts-cloud/project=${r}.`}}function mA(t,e){let n=[];if(!e.project)n.push(`'${e.name}' carries no ts-cloud/project label, so it is not a box ts-cloud provisioned. Attaching to it would deploy into a host nothing manages.`);else if(e.project===t)n.push(`This project's slug is '${t}', which is also the slug that owns '${e.name}'. A tenant deploy owns the gateway fragment named after its slug, so attaching would overwrite '${e.project}'s own fragment and take its sites down. Change this project's slug first.`);if(e.status!=="running")n.push(`'${e.name}' is ${e.status}, so what it serves could not be read.`);if(!e.ipv4)n.push(`'${e.name}' has no public IPv4 address, so it cannot be reached to check what it serves.`);return n}function f(t,e){let n=e==="/"?"/":e.replace(/\/+$/,"");return`${t.toLowerCase()}${n||"/"}`}function fA(t,e,n){let r=[],s=xi(n.filter((i)=>i.kind==="app").map((i)=>({slug:i.slug,proxies:[{from:i.target.split(",").map((a)=>a.trim())}]})),{ignoreSlug:t}),o=new Map;for(let i of n)if(i.slug!==t)o.set(f(i.host,i.path),i.slug);for(let i of e){if(i.port!==void 0){let a=s.get(i.port);if(a)r.push({kind:"port",site:i.name,detail:`port ${i.port}`,heldBy:a})}if(i.domain){let a=o.get(f(i.domain,i.path));if(a)r.push({kind:"route",site:i.name,detail:`${i.domain}${i.path==="/"?"/":i.path}`,heldBy:a})}}return r}function hA(t){return t.registryRead&&t.conflicts.length===0}function AA(t){let{slug:e,owner:n,server:r,declared:s,conflicts:o}=t,i=[];i.push(`Attach '${e}' to '${r.name}' (${r.ipv4??"no IPv4"}), owned by '${n}'.`,""),i.push(` ${s.length} site${s.length===1?"":"s"} would deploy onto this box:`);for(let a of s){let p=a.loopbackOnly?`loopback only${a.port?` on :${a.port}`:""}`:`${a.domain}${a.path==="/"?"/":a.path}${a.port?` on :${a.port}`:""}`;i.push(` ${a.name} ${p} -> ${a.installBase??"(install path unresolved)"}`)}if(i.push(""),!t.registryRead)i.push(` Could not read what '${r.name}' already serves: ${t.registryProblem??"unknown reason"}`),i.push(" So this attach is UNCHECKED: a port or hostname already taken by another"),i.push(" project would not error, it would serve that project's site from your domain.");else if(o.length>0){i.push(` ${o.length} conflict${o.length===1?"":"s"} with what the box already serves:`);for(let a of o)i.push(` site '${a.site}' wants ${a.detail}, held by '${a.heldBy}'`);i.push(""),i.push(" Two services on one port do not error: the kernel load-balances, and each"),i.push(" domain serves the other's site about half the time. Pick free ports and"),i.push(" hostnames, then re-run.")}else i.push(` No conflicts with what '${r.name}' already serves.`);return i}function Bi(t,e){return`/tmp/ts-cloud-move-${t}-${e}.tar.gz`}function fd(t,e){return`${t}-${e}*.service`}function l(t){return`'${t.split("'").join("'\\''")}'`}function Op(t,e){return["set -eu",`for unit in $(ls /etc/systemd/system/ 2>/dev/null | grep -E ${l(m(t,e))} || true); do`,' systemctl stop "$unit" 2>/dev/null || true',"done"].join(`
10
10
  `)}function m(t,e){return`^${t}-${e}-((queue|daemon)-.*|scheduler)\\.service$`}function _p(t,e){return y(m(t,e))}function y(t){return[`ls /etc/systemd/system/ 2>/dev/null | grep -E ${l(t)} | while read -r unit; do`,' systemctl is-active "$unit" >/dev/null 2>&1 && echo "active:$unit" || true',"done"].join(`
11
11
  `)}function Lp(t){return!t.split(`
@@ -1,24 +1,24 @@
1
- import{qr,n}from"./chunk-9w5ncn9s.js";import{nt}from"./chunk-83fy36fn.js";import*as d from"node:crypto";import{readFileSync as B}from"node:fs";import{readdir as L}from"node:fs/promises";import{join as z}from"node:path";function Vr(e){if(e){let r=D(e);if(!r)throw Error(`AWS profile '${e}' not found in ~/.aws/credentials`);return r}let t=process.env.AWS_ACCESS_KEY_ID,s=process.env.AWS_SECRET_ACCESS_KEY;if(t&&s)return{accessKeyId:t,secretAccessKey:s,sessionToken:process.env.AWS_SESSION_TOKEN};return D(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function D(e){let{existsSync:t,readFileSync:s}=nt("node:fs"),{homedir:r}=nt("node:os"),{join:i}=nt("node:path"),a=process.env.AWS_SHARED_CREDENTIALS_FILE||i(r(),".aws","credentials");if(!t(a))return null;let c=s(a,"utf-8"),g=null,u,l,p;for(let h of c.split(`
2
- `)){let y=h.trim();if(!y||y.startsWith("#")||y.startsWith(";"))continue;let m=y.match(/^\[([^\]]+)\]$/);if(m){if(g===e&&u&&l)return{accessKeyId:u,secretAccessKey:l,sessionToken:p};g=m[1],u=void 0,l=void 0,p=void 0;continue}if(g===e){let[b,...S]=y.split("="),f=S.join("=").trim();switch(b.trim().toLowerCase()){case"aws_access_key_id":u=f;break;case"aws_secret_access_key":l=f;break;case"aws_session_token":p=f;break}}}if(g===e&&u&&l)return{accessKeyId:u,secretAccessKey:l,sessionToken:p};return null}function U(e){let{buffer:t,byteOffset:s,byteLength:r}=e;if(t instanceof ArrayBuffer)return t.slice(s,s+r);let i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),i}function j(e,t){let s=e?.[t]??e;if(s===null||typeof s!=="object"||Array.isArray(s))return s;let r={...s};return delete r["@_xmlns"],r}class o{client;region;explicitProfile;endpoint;endpointProtocol="https";forcePathStyle;explicitCredentials;constructor(e="us-east-1",t,s){let r=typeof e==="string"?s:e,i=typeof e==="string"?e:e.region??"us-east-1",a=typeof e==="string"?t:e.profile,c=r?.endpoint?qr({region:i,path:"/",endpoint:r.endpoint}):void 0;this.region=i,this.explicitProfile=a,this.endpoint=c?.host,this.endpointProtocol=c?.protocol??"https",this.forcePathStyle=r?.forcePathStyle,this.explicitCredentials=r?.credentials,this.client=new n(r?.credentials,{profile:a,endpoint:r?.endpoint,forcePathStyle:r?.forcePathStyle})}getCredentials(){if(this.explicitCredentials?.accessKeyId&&this.explicitCredentials.secretAccessKey)return this.explicitCredentials;let e=Vr(this.explicitProfile);if(e.accessKeyId&&e.secretAccessKey)return e;throw Error("S3 credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (or pass explicit credentials/profile), or configure ~/.aws/credentials.")}s3BaseHost(){return this.endpoint||`s3.${this.region}.amazonaws.com`}s3VirtualHost(e){return this.forcePathStyle?this.s3BaseHost():`${e}.${this.s3BaseHost()}`}objectPath(e,t){return this.forcePathStyle?`/${e}/${t}`:`/${t}`}objectUrl(e,t){return`${this.endpointProtocol}://${this.s3VirtualHost(e)}${this.objectPath(e,t)}`}async listBuckets(){let e=await this.client.request({service:"s3",region:this.region,method:"GET",path:"/"}),t=[],r=(e?.ListAllMyBucketsResult??e)?.Buckets?.Bucket;if(r){let i=Array.isArray(r)?r:[r];for(let a of i)t.push({Name:a.Name,CreationDate:a.CreationDate})}return{Buckets:t}}async createBucket(e,t){let s={};if(t?.acl)s["x-amz-acl"]=t.acl;let r;if(this.region!=="us-east-1"&&!this.endpoint)r=`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{Ke,n}from"./chunk-1wc2zfct.js";import{it}from"./chunk-qb25wesa.js";import*as d from"node:crypto";import{readFileSync as B}from"node:fs";import{readdir as L}from"node:fs/promises";import{join as z}from"node:path";function qr(e){if(e){let r=D(e);if(!r)throw Error(`AWS profile '${e}' not found in ~/.aws/credentials`);return r}let t=process.env.AWS_ACCESS_KEY_ID,s=process.env.AWS_SECRET_ACCESS_KEY;if(t&&s)return{accessKeyId:t,secretAccessKey:s,sessionToken:process.env.AWS_SESSION_TOKEN};return D(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function D(e){let{existsSync:t,readFileSync:s}=it("node:fs"),{homedir:r}=it("node:os"),{join:i}=it("node:path"),a=process.env.AWS_SHARED_CREDENTIALS_FILE||i(r(),".aws","credentials");if(!t(a))return null;let c=s(a,"utf-8"),g=null,u,l,p;for(let h of c.split(`
2
+ `)){let y=h.trim();if(!y||y.startsWith("#")||y.startsWith(";"))continue;let m=y.match(/^\[([^\]]+)\]$/);if(m){if(g===e&&u&&l)return{accessKeyId:u,secretAccessKey:l,sessionToken:p};g=m[1],u=void 0,l=void 0,p=void 0;continue}if(g===e){let[b,...S]=y.split("="),f=S.join("=").trim();switch(b.trim().toLowerCase()){case"aws_access_key_id":u=f;break;case"aws_secret_access_key":l=f;break;case"aws_session_token":p=f;break}}}if(g===e&&u&&l)return{accessKeyId:u,secretAccessKey:l,sessionToken:p};return null}function U(e){let{buffer:t,byteOffset:s,byteLength:r}=e;if(t instanceof ArrayBuffer)return t.slice(s,s+r);let i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),i}function j(e,t){let s=e?.[t]??e;if(s===null||typeof s!=="object"||Array.isArray(s))return s;let r={...s};return delete r["@_xmlns"],r}class o{client;region;explicitProfile;endpoint;endpointProtocol="https";forcePathStyle;explicitCredentials;constructor(e="us-east-1",t,s){let r=typeof e==="string"?s:e,i=typeof e==="string"?e:e.region??"us-east-1",a=typeof e==="string"?t:e.profile,c=r?.endpoint?Ke({region:i,path:"/",endpoint:r.endpoint}):void 0;this.region=i,this.explicitProfile=a,this.endpoint=c?.host,this.endpointProtocol=c?.protocol??"https",this.forcePathStyle=r?.forcePathStyle,this.explicitCredentials=r?.credentials,this.client=new n(r?.credentials,{profile:a,endpoint:r?.endpoint,forcePathStyle:r?.forcePathStyle})}getCredentials(){if(this.explicitCredentials?.accessKeyId&&this.explicitCredentials.secretAccessKey)return this.explicitCredentials;let e=qr(this.explicitProfile);if(e.accessKeyId&&e.secretAccessKey)return e;throw Error("S3 credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (or pass explicit credentials/profile), or configure ~/.aws/credentials.")}s3BaseHost(){return this.endpoint||`s3.${this.region}.amazonaws.com`}s3VirtualHost(e){return this.forcePathStyle?this.s3BaseHost():`${e}.${this.s3BaseHost()}`}objectPath(e,t){return this.forcePathStyle?`/${e}/${t}`:`/${t}`}objectUrl(e,t){return`${this.endpointProtocol}://${this.s3VirtualHost(e)}${this.objectPath(e,t)}`}async listBuckets(){let e=await this.client.request({service:"s3",region:this.region,method:"GET",path:"/"}),t=[],r=(e?.ListAllMyBucketsResult??e)?.Buckets?.Bucket;if(r){let i=Array.isArray(r)?r:[r];for(let a of i)t.push({Name:a.Name,CreationDate:a.CreationDate})}return{Buckets:t}}async createBucket(e,t){let s={};if(t?.acl)s["x-amz-acl"]=t.acl;let r;if(this.region!=="us-east-1"&&!this.endpoint)r=`<?xml version="1.0" encoding="UTF-8"?>
3
3
  <CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
4
4
  <LocationConstraint>${this.region}</LocationConstraint>
5
5
  </CreateBucketConfiguration>`,s["Content-Type"]="application/xml";await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,headers:s,body:r})}async deleteBucket(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`})}async emptyAndDeleteBucket(e){let t=!0;while(t){let s=await this.listAllObjects({bucket:e});if(s.length===0){t=!1;break}let r=s.map((i)=>i.Key);for(let i=0;i<r.length;i+=1000){let a=r.slice(i,i+1000);await this.deleteObjects(e,a)}}await this.deleteBucket(e)}async listAllObjects(e){let t=[],s;do{let r={"list-type":"2","max-keys":"1000"};if(e.prefix)r.prefix=e.prefix;if(s)r["continuation-token"]=s;let i=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e.bucket}`,queryParams:r}),a=i?.ListBucketResult??i,c=a?.Contents;if(c){let u=Array.isArray(c)?c:[c];for(let l of u)t.push({Key:l.Key,LastModified:l.LastModified||"",Size:Number.parseInt(l.Size||"0"),ETag:l.ETag})}let g=a?.IsTruncated;s=g==="true"||g===!0?a?.NextContinuationToken:void 0}while(s);return t}async list(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e.bucket}`}),s=[],i=(t?.ListBucketResult??t)?.Contents;if(i){let a=Array.isArray(i)?i:[i];for(let c of a){if(e.prefix&&!c.Key?.startsWith(e.prefix))continue;if(s.push({Key:c.Key||"",LastModified:c.LastModified||"",Size:Number.parseInt(c.Size||"0"),ETag:c.ETag}),e.maxKeys&&s.length>=e.maxKeys)break}}return s}async putObject(e){let t={};if(e.acl)t["x-amz-acl"]=e.acl;if(e.cacheControl)t["Cache-Control"]=e.cacheControl;if(e.contentType)t["Content-Type"]=e.contentType;if(e.metadata)for(let[i,a]of Object.entries(e.metadata))t[`x-amz-meta-${i}`]=a;let s=e.key.split("/").map((i)=>encodeURIComponent(i)).join("/"),r=e.body instanceof Uint8Array&&!Buffer.isBuffer(e.body)?Buffer.from(e.body):e.body;if(Buffer.isBuffer(r)||r instanceof Uint8Array){let i=Buffer.isBuffer(r)?r:Buffer.from(r),{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),u=this.s3VirtualHost(e.bucket),l=this.objectPath(e.bucket,s),p=this.objectUrl(e.bucket,s),h=new Date,y=h.toISOString().replace(/[:-]|\.\d{3}/g,""),m=h.toISOString().slice(0,10).replace(/-/g,""),b=d.createHash("sha256").update(i).digest("hex"),S={host:u,"x-amz-date":y,"x-amz-content-sha256":b,...t};if(g)S["x-amz-security-token"]=g;let f=Object.keys(S).sort().map((P)=>`${P.toLowerCase()}:${S[P].trim()}
6
6
  `).join(""),x=Object.keys(S).sort().map((P)=>P.toLowerCase()).join(";"),C=["PUT",l,"",f,x,b].join(`
7
7
  `),w="AWS4-HMAC-SHA256",T=`${m}/${this.region}/s3/aws4_request`,q=[w,y,T,d.createHash("sha256").update(C).digest("hex")].join(`
8
- `),I=d.createHmac("sha256",`AWS4${c}`).update(m).digest(),K=d.createHmac("sha256",I).update(this.region).digest(),H=d.createHmac("sha256",K).update("s3").digest(),E=d.createHmac("sha256",H).update("aws4_request").digest(),v=d.createHmac("sha256",E).update(q).digest("hex"),A=`${w} Credential=${a}/${T}, SignedHeaders=${x}, Signature=${v}`,k=await fetch(p,{method:"PUT",headers:{...S,Authorization:A},body:U(i)});if(!k.ok){let P=await k.text();throw Error(`S3 PUT failed: ${k.status} ${P}`)}return}await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${s}`,bucket:e.bucket,headers:t,body:e.body})}async getObject(e,t){let s=t.split("/").map((i)=>encodeURIComponent(i)).join("/");return await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${s}`,bucket:e,rawResponse:!0})}async getObjectBytes(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:i}=this.getCredentials(),a=this.s3VirtualHost(e),c=t.split("/").map((P)=>encodeURIComponent(P)).join("/"),g=this.objectPath(e,c),u=this.objectUrl(e,c),l=new Date,p=l.toISOString().replace(/[:-]|\.\d{3}/g,""),h=l.toISOString().slice(0,10).replace(/-/g,""),y=d.createHash("sha256").update("").digest("hex"),m={host:a,"x-amz-date":p,"x-amz-content-sha256":y};if(i)m["x-amz-security-token"]=i;let b=Object.keys(m).sort().map((P)=>`${P.toLowerCase()}:${m[P].trim()}
8
+ `),I=d.createHmac("sha256",`AWS4${c}`).update(m).digest(),R=d.createHmac("sha256",I).update(this.region).digest(),H=d.createHmac("sha256",R).update("s3").digest(),E=d.createHmac("sha256",H).update("aws4_request").digest(),v=d.createHmac("sha256",E).update(q).digest("hex"),A=`${w} Credential=${a}/${T}, SignedHeaders=${x}, Signature=${v}`,k=await fetch(p,{method:"PUT",headers:{...S,Authorization:A},body:U(i)});if(!k.ok){let P=await k.text();throw Error(`S3 PUT failed: ${k.status} ${P}`)}return}await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${s}`,bucket:e.bucket,headers:t,body:e.body})}async getObject(e,t){let s=t.split("/").map((i)=>encodeURIComponent(i)).join("/");return await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${s}`,bucket:e,rawResponse:!0})}async getObjectBytes(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:i}=this.getCredentials(),a=this.s3VirtualHost(e),c=t.split("/").map((P)=>encodeURIComponent(P)).join("/"),g=this.objectPath(e,c),u=this.objectUrl(e,c),l=new Date,p=l.toISOString().replace(/[:-]|\.\d{3}/g,""),h=l.toISOString().slice(0,10).replace(/-/g,""),y=d.createHash("sha256").update("").digest("hex"),m={host:a,"x-amz-date":p,"x-amz-content-sha256":y};if(i)m["x-amz-security-token"]=i;let b=Object.keys(m).sort().map((P)=>`${P.toLowerCase()}:${m[P].trim()}
9
9
  `).join(""),S=Object.keys(m).sort().map((P)=>P.toLowerCase()).join(";"),f=["GET",g,"",b,S,y].join(`
10
10
  `),x="AWS4-HMAC-SHA256",C=`${h}/${this.region}/s3/aws4_request`,w=[x,p,C,d.createHash("sha256").update(f).digest("hex")].join(`
11
- `),T=d.createHmac("sha256",`AWS4${r}`).update(h).digest(),q=d.createHmac("sha256",T).update(this.region).digest(),I=d.createHmac("sha256",q).update("s3").digest(),K=d.createHmac("sha256",I).update("aws4_request").digest(),H=d.createHmac("sha256",K).update(w).digest("hex"),E=`${x} Credential=${s}/${C}, SignedHeaders=${S}, Signature=${H}`,v=await fetch(u,{method:"GET",headers:{...m,Authorization:E}});if(!v.ok){let P=await v.text();throw Error(`S3 GET failed: ${v.status} ${P}`)}let A=await v.arrayBuffer(),k=v.headers.get("content-length");return{body:new Uint8Array(A),contentType:v.headers.get("content-type")??void 0,contentLength:k?Number.parseInt(k,10):void 0}}async copyObject(e){let t=(r)=>r.split("/").map((i)=>encodeURIComponent(i)).join("/"),s={"x-amz-copy-source":`/${e.sourceBucket}/${t(e.sourceKey)}`};if(e.metadataDirective)s["x-amz-metadata-directive"]=e.metadataDirective;if(e.contentType)s["Content-Type"]=e.contentType;if(e.metadata)for(let[r,i]of Object.entries(e.metadata))s[`x-amz-meta-${r}`]=i;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e.destinationBucket}/${t(e.destinationKey)}`,headers:s})}async deleteObject(e,t){let s=t.split("/").map((r)=>encodeURIComponent(r)).join("/");await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${s}`,bucket:e})}async deleteObjects(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
11
+ `),T=d.createHmac("sha256",`AWS4${r}`).update(h).digest(),q=d.createHmac("sha256",T).update(this.region).digest(),I=d.createHmac("sha256",q).update("s3").digest(),R=d.createHmac("sha256",I).update("aws4_request").digest(),H=d.createHmac("sha256",R).update(w).digest("hex"),E=`${x} Credential=${s}/${C}, SignedHeaders=${S}, Signature=${H}`,v=await fetch(u,{method:"GET",headers:{...m,Authorization:E}});if(!v.ok){let P=await v.text();throw Error(`S3 GET failed: ${v.status} ${P}`)}let A=await v.arrayBuffer(),k=v.headers.get("content-length");return{body:new Uint8Array(A),contentType:v.headers.get("content-type")??void 0,contentLength:k?Number.parseInt(k,10):void 0}}async copyObject(e){let t=(r)=>r.split("/").map((i)=>encodeURIComponent(i)).join("/"),s={"x-amz-copy-source":`/${e.sourceBucket}/${t(e.sourceKey)}`};if(e.metadataDirective)s["x-amz-metadata-directive"]=e.metadataDirective;if(e.contentType)s["Content-Type"]=e.contentType;if(e.metadata)for(let[r,i]of Object.entries(e.metadata))s[`x-amz-meta-${r}`]=i;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e.destinationBucket}/${t(e.destinationKey)}`,headers:s})}async deleteObject(e,t){let s=t.split("/").map((r)=>encodeURIComponent(r)).join("/");await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${s}`,bucket:e})}async deleteObjects(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
12
12
  <Delete>
13
13
  ${t.map((i)=>`<Object><Key>${i}</Key></Object>`).join(`
14
14
  `)}
15
15
  </Delete>`,r=d.createHash("md5").update(s).digest("base64");await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}`,queryParams:{delete:""},body:s,headers:{"Content-Type":"application/xml","Content-MD5":r}})}async bucketExists(e){try{return await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}`}),!0}catch{return!1}}async copy(e){let t=B(e.source);await this.putObject({bucket:e.bucket,key:e.key,body:t,acl:e.acl,cacheControl:e.cacheControl,contentType:e.contentType,metadata:e.metadata})}async sync(e){let t=await this.listFilesRecursive(e.source);for(let s of t){if(e.exclude&&e.exclude.some((a)=>s.includes(a)))continue;if(e.include&&!e.include.some((a)=>s.includes(a)))continue;let r=s.substring(e.source.length+1),i=e.prefix?`${e.prefix}/${r}`:r;if(!e.dryRun){let a=B(s);await this.putObject({bucket:e.bucket,key:i,body:a,acl:e.acl,cacheControl:e.cacheControl,contentType:e.contentType,metadata:e.metadata})}}}async delete(e,t){await this.deleteObject(e,t)}async deletePrefix(e,t){let r=(await this.list({bucket:e,prefix:t})).map((i)=>i.Key);if(r.length>0)await this.deleteObjects(e,r)}async getBucketSize(e,t){return(await this.list({bucket:e,prefix:t})).reduce((r,i)=>r+i.Size,0)}async listFilesRecursive(e){let t=[],s=await L(e,{withFileTypes:!0});for(let r of s){let i=z(e,r.name);if(r.isDirectory()){let a=await this.listFilesRecursive(i);t.push(...a)}else t.push(i)}return t}async putBucketPolicy(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:i}=this.getCredentials(),a=this.s3BaseHost(),c=typeof t==="string"?t:JSON.stringify(t),g=new Date,u=g.toISOString().replace(/[:-]|\.\d{3}/g,""),l=g.toISOString().slice(0,10).replace(/-/g,""),p=d.createHash("sha256").update(c).digest("hex"),h="/"+e,y="policy=",m={host:a,"x-amz-date":u,"x-amz-content-sha256":p,"content-type":"application/json"};if(i)m["x-amz-security-token"]=i;let b=Object.keys(m).sort().map((k)=>`${k.toLowerCase()}:${m[k].trim()}
16
16
  `).join(""),S=Object.keys(m).sort().map((k)=>k.toLowerCase()).join(";"),f=["PUT",h,"policy=",b,S,p].join(`
17
17
  `),x="AWS4-HMAC-SHA256",C=`${l}/${this.region}/s3/aws4_request`,w=[x,u,C,d.createHash("sha256").update(f).digest("hex")].join(`
18
- `),T=d.createHmac("sha256","AWS4"+r).update(l).digest(),q=d.createHmac("sha256",T).update(this.region).digest(),I=d.createHmac("sha256",q).update("s3").digest(),K=d.createHmac("sha256",I).update("aws4_request").digest(),H=d.createHmac("sha256",K).update(w).digest("hex"),E=`${x} Credential=${s}/${C}, SignedHeaders=${S}, Signature=${H}`,v=`${this.endpointProtocol}://${a}${h}?policy=`,A=await fetch(v,{method:"PUT",headers:{...m,Authorization:E},body:c});if(!A.ok){let k=await A.text();throw Error(`Failed to put bucket policy: ${A.status} ${k}`)}}async getBucketPolicy(e){let{accessKeyId:t,secretAccessKey:s,sessionToken:r}=this.getCredentials(),i=this.s3BaseHost(),a=new Date,c=a.toISOString().replace(/[:-]|\.\d{3}/g,""),g=a.toISOString().slice(0,10).replace(/-/g,""),u=d.createHash("sha256").update("").digest("hex"),l="/"+e,p="policy=",h={host:i,"x-amz-date":c,"x-amz-content-sha256":u};if(r)h["x-amz-security-token"]=r;let y=Object.keys(h).sort().map((A)=>`${A.toLowerCase()}:${h[A].trim()}
18
+ `),T=d.createHmac("sha256","AWS4"+r).update(l).digest(),q=d.createHmac("sha256",T).update(this.region).digest(),I=d.createHmac("sha256",q).update("s3").digest(),R=d.createHmac("sha256",I).update("aws4_request").digest(),H=d.createHmac("sha256",R).update(w).digest("hex"),E=`${x} Credential=${s}/${C}, SignedHeaders=${S}, Signature=${H}`,v=`${this.endpointProtocol}://${a}${h}?policy=`,A=await fetch(v,{method:"PUT",headers:{...m,Authorization:E},body:c});if(!A.ok){let k=await A.text();throw Error(`Failed to put bucket policy: ${A.status} ${k}`)}}async getBucketPolicy(e){let{accessKeyId:t,secretAccessKey:s,sessionToken:r}=this.getCredentials(),i=this.s3BaseHost(),a=new Date,c=a.toISOString().replace(/[:-]|\.\d{3}/g,""),g=a.toISOString().slice(0,10).replace(/-/g,""),u=d.createHash("sha256").update("").digest("hex"),l="/"+e,p="policy=",h={host:i,"x-amz-date":c,"x-amz-content-sha256":u};if(r)h["x-amz-security-token"]=r;let y=Object.keys(h).sort().map((A)=>`${A.toLowerCase()}:${h[A].trim()}
19
19
  `).join(""),m=Object.keys(h).sort().map((A)=>A.toLowerCase()).join(";"),b=["GET",l,"policy=",y,m,u].join(`
20
20
  `),S="AWS4-HMAC-SHA256",f=`${g}/${this.region}/s3/aws4_request`,x=[S,c,f,d.createHash("sha256").update(b).digest("hex")].join(`
21
- `),C=d.createHmac("sha256","AWS4"+s).update(g).digest(),w=d.createHmac("sha256",C).update(this.region).digest(),T=d.createHmac("sha256",w).update("s3").digest(),q=d.createHmac("sha256",T).update("aws4_request").digest(),I=d.createHmac("sha256",q).update(x).digest("hex"),K=`${S} Credential=${t}/${f}, SignedHeaders=${m}, Signature=${I}`,H=`${this.endpointProtocol}://${i}${l}?policy=`,E=await fetch(H,{method:"GET",headers:{...h,Authorization:K}});if(E.status===404)return null;if(!E.ok){let A=await E.text();throw Error(`Failed to get bucket policy: ${E.status} ${A}`)}let v=await E.text();return JSON.parse(v)}async deleteBucketPolicy(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{policy:""}})}async headBucket(e){try{return{exists:!0,region:(await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}`,returnHeaders:!0}))?.headers?.["x-amz-bucket-region"]}}catch(t){if(t.statusCode===404)return{exists:!1};throw t}}async headObject(e,t){try{let s=await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}/${t}`,returnHeaders:!0});return{ContentLength:s?.headers?.["content-length"]?parseInt(s.headers["content-length"]):void 0,ContentType:s?.headers?.["content-type"],ETag:s?.headers?.etag,LastModified:s?.headers?.["last-modified"]}}catch(s){if(s.statusCode===404)return null;throw s}}async getObjectBuffer(e,t){let s=await this.getObject(e,t);return Buffer.from(s)}async getObjectJson(e,t){let s=await this.getObject(e,t);return JSON.parse(s)}async putObjectJson(e,t,s,r){await this.putObject({bucket:e,key:t,body:JSON.stringify(s),contentType:"application/json",...r})}async getBucketVersioning(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{versioning:""}});return{Status:(t?.VersioningConfiguration??t)?.Status}}async putBucketVersioning(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
21
+ `),C=d.createHmac("sha256","AWS4"+s).update(g).digest(),w=d.createHmac("sha256",C).update(this.region).digest(),T=d.createHmac("sha256",w).update("s3").digest(),q=d.createHmac("sha256",T).update("aws4_request").digest(),I=d.createHmac("sha256",q).update(x).digest("hex"),R=`${S} Credential=${t}/${f}, SignedHeaders=${m}, Signature=${I}`,H=`${this.endpointProtocol}://${i}${l}?policy=`,E=await fetch(H,{method:"GET",headers:{...h,Authorization:R}});if(E.status===404)return null;if(!E.ok){let A=await E.text();throw Error(`Failed to get bucket policy: ${E.status} ${A}`)}let v=await E.text();return JSON.parse(v)}async deleteBucketPolicy(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{policy:""}})}async headBucket(e){try{return{exists:!0,region:(await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}`,returnHeaders:!0}))?.headers?.["x-amz-bucket-region"]}}catch(t){if(t.statusCode===404)return{exists:!1};throw t}}async headObject(e,t){try{let s=await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}/${t.split("/").map((r)=>encodeURIComponent(r)).join("/")}`,returnHeaders:!0});return{ContentLength:s?.headers?.["content-length"]?parseInt(s.headers["content-length"]):void 0,ContentType:s?.headers?.["content-type"],ETag:s?.headers?.etag,LastModified:s?.headers?.["last-modified"]}}catch(s){if(s.statusCode===404)return null;throw s}}async getObjectBuffer(e,t){let s=await this.getObjectBytes(e,t);return Buffer.from(s.body)}async getObjectJson(e,t){let s=await this.getObject(e,t);return JSON.parse(s)}async putObjectJson(e,t,s,r){await this.putObject({bucket:e,key:t,body:JSON.stringify(s),contentType:"application/json",...r})}async getBucketVersioning(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{versioning:""}});return{Status:(t?.VersioningConfiguration??t)?.Status}}async putBucketVersioning(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
22
22
  <VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
23
23
  <Status>${t}</Status>
24
24
  </VersioningConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{versioning:""},headers:{"Content-Type":"application/xml"},body:s})}async getBucketLifecycleConfiguration(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{lifecycle:""}});return j(t,"LifecycleConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async putBucketLifecycleConfiguration(e,t){let r=`<?xml version="1.0" encoding="UTF-8"?>
@@ -64,10 +64,10 @@ import{qr,n}from"./chunk-9w5ncn9s.js";import{nt}from"./chunk-83fy36fn.js";import
64
64
  host:${c}
65
65
  `,"content-type;host","UNSIGNED-PAYLOAD"].join(`
66
66
  `),S=["AWS4-HMAC-SHA256",u,p,d.createHash("sha256").update(b).digest("hex")].join(`
67
- `),f=d.createHmac("sha256",`AWS4${a}`).update(l).digest(),x=d.createHmac("sha256",f).update(this.region).digest(),C=d.createHmac("sha256",x).update("s3").digest(),w=d.createHmac("sha256",C).update("aws4_request").digest(),T=d.createHmac("sha256",w).update(S).digest("hex");return m.append("X-Amz-Signature",T),`${this.endpointProtocol}://${c}${this.objectPath(e,y)}?${m.toString()}`}async createMultipartUpload(e,t,s){let r={};if(s?.contentType)r["Content-Type"]=s.contentType;if(s?.metadata)for(let[g,u]of Object.entries(s.metadata))r[`x-amz-meta-${g}`]=u;let i=t.split("/").map((g)=>encodeURIComponent(g)).join("/"),a=await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${i}`,bucket:e,queryParams:{uploads:""},headers:r});return{UploadId:(a?.InitiateMultipartUploadResult??a)?.UploadId}}async uploadPart(e,t,s,r,i){let{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),u=this.s3VirtualHost(e),l=t.split("/").map((O)=>encodeURIComponent(O)).join("/"),p=this.objectPath(e,l),h=`${this.objectUrl(e,l)}?partNumber=${r}&uploadId=${encodeURIComponent(s)}`,y=new Date,m=y.toISOString().replace(/[:-]|\.\d{3}/g,""),b=y.toISOString().slice(0,10).replace(/-/g,""),S=d.createHash("sha256").update(i).digest("hex"),f={host:u,"x-amz-date":m,"x-amz-content-sha256":S};if(g)f["x-amz-security-token"]=g;let x=Object.keys(f).sort().map((O)=>`${O.toLowerCase()}:${f[O].trim()}
68
- `).join(""),C=Object.keys(f).sort().map((O)=>O.toLowerCase()).join(";"),w=["PUT",p,`partNumber=${r}&uploadId=${encodeURIComponent(s)}`,x,C,S].join(`
67
+ `),f=d.createHmac("sha256",`AWS4${a}`).update(l).digest(),x=d.createHmac("sha256",f).update(this.region).digest(),C=d.createHmac("sha256",x).update("s3").digest(),w=d.createHmac("sha256",C).update("aws4_request").digest(),T=d.createHmac("sha256",w).update(S).digest("hex");return m.append("X-Amz-Signature",T),`${this.endpointProtocol}://${c}${this.objectPath(e,y)}?${m.toString()}`}async createMultipartUpload(e,t,s){let r={};if(s?.contentType)r["Content-Type"]=s.contentType;if(s?.metadata)for(let[g,u]of Object.entries(s.metadata))r[`x-amz-meta-${g}`]=u;let i=t.split("/").map((g)=>encodeURIComponent(g)).join("/"),a=await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${i}`,bucket:e,queryParams:{uploads:""},headers:r});return{UploadId:(a?.InitiateMultipartUploadResult??a)?.UploadId}}async uploadPart(e,t,s,r,i){let{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),u=this.s3VirtualHost(e),l=t.split("/").map((K)=>encodeURIComponent(K)).join("/"),p=this.objectPath(e,l),h=`${this.objectUrl(e,l)}?partNumber=${r}&uploadId=${encodeURIComponent(s)}`,y=new Date,m=y.toISOString().replace(/[:-]|\.\d{3}/g,""),b=y.toISOString().slice(0,10).replace(/-/g,""),S=d.createHash("sha256").update(i).digest("hex"),f={host:u,"x-amz-date":m,"x-amz-content-sha256":S};if(g)f["x-amz-security-token"]=g;let x=Object.keys(f).sort().map((K)=>`${K.toLowerCase()}:${f[K].trim()}
68
+ `).join(""),C=Object.keys(f).sort().map((K)=>K.toLowerCase()).join(";"),w=["PUT",p,`partNumber=${r}&uploadId=${encodeURIComponent(s)}`,x,C,S].join(`
69
69
  `),T="AWS4-HMAC-SHA256",q=`${b}/${this.region}/s3/aws4_request`,I=[T,m,q,d.createHash("sha256").update(w).digest("hex")].join(`
70
- `),K=d.createHmac("sha256",`AWS4${c}`).update(b).digest(),H=d.createHmac("sha256",K).update(this.region).digest(),E=d.createHmac("sha256",H).update("s3").digest(),v=d.createHmac("sha256",E).update("aws4_request").digest(),A=d.createHmac("sha256",v).update(I).digest("hex"),k=`${T} Credential=${a}/${q}, SignedHeaders=${C}, Signature=${A}`,P=await fetch(h,{method:"PUT",headers:{...f,Authorization:k},body:U(i)});if(!P.ok){let O=await P.text();throw Error(`Upload part failed: ${P.status} ${O}`)}return{ETag:P.headers.get("etag")||""}}async completeMultipartUpload(e,t,s,r){let i=t.split("/").map((g)=>encodeURIComponent(g)).join("/"),c=`<?xml version="1.0" encoding="UTF-8"?>
70
+ `),R=d.createHmac("sha256",`AWS4${c}`).update(b).digest(),H=d.createHmac("sha256",R).update(this.region).digest(),E=d.createHmac("sha256",H).update("s3").digest(),v=d.createHmac("sha256",E).update("aws4_request").digest(),A=d.createHmac("sha256",v).update(I).digest("hex"),k=`${T} Credential=${a}/${q}, SignedHeaders=${C}, Signature=${A}`,P=await fetch(h,{method:"PUT",headers:{...f,Authorization:k},body:U(i)});if(!P.ok){let K=await P.text();throw Error(`Upload part failed: ${P.status} ${K}`)}return{ETag:P.headers.get("etag")||""}}async completeMultipartUpload(e,t,s,r){let i=t.split("/").map((g)=>encodeURIComponent(g)).join("/"),c=`<?xml version="1.0" encoding="UTF-8"?>
71
71
  <CompleteMultipartUpload>${r.sort((g,u)=>g.PartNumber-u.PartNumber).map((g)=>`<Part><PartNumber>${g.PartNumber}</PartNumber><ETag>${g.ETag}</ETag></Part>`).join("")}</CompleteMultipartUpload>`;await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${i}`,bucket:e,queryParams:{uploadId:s},headers:{"Content-Type":"application/xml"},body:c})}async abortMultipartUpload(e,t,s){let r=t.split("/").map((i)=>encodeURIComponent(i)).join("/");await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${r}`,bucket:e,queryParams:{uploadId:s}})}async listMultipartUploads(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:"/",bucket:e,queryParams:{uploads:""}}),s=(t?.ListMultipartUploadsResult??t)?.Upload;if(!s)return[];return(Array.isArray(s)?s:[s]).map((i)=>({Key:i.Key,UploadId:i.UploadId,Initiated:i.Initiated}))}async restoreObject(e,t,s,r="Standard"){let i=`<?xml version="1.0" encoding="UTF-8"?>
72
72
  <RestoreRequest>
73
73
  <Days>${s}</Days>
@@ -80,13 +80,13 @@ host:${c}
80
80
  <ExpressionType>SQL</ExpressionType>
81
81
  <InputSerialization>${a}</InputSerialization>
82
82
  <OutputSerialization>${c}</OutputSerialization>
83
- </SelectObjectContentRequest>`;return await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}/${t}`,queryParams:{select:"","select-type":"2"},headers:{"Content-Type":"application/xml"},body:g,rawResponse:!0})}async getSignedUrl(e){let{bucket:t,key:s,expiresIn:r=3600,operation:i="getObject"}=e,{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),u=new Date,l=u.toISOString().replace(/[:-]|\.\d{3}/g,""),p=u.toISOString().slice(0,10).replace(/-/g,""),h=this.s3VirtualHost(t),y=i==="putObject"?"PUT":"GET",m="AWS4-HMAC-SHA256",b=`${p}/${this.region}/s3/aws4_request`,f={"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":`${a}/${b}`,"X-Amz-Date":l,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"host"};if(g)f["X-Amz-Security-Token"]=g;let C=Object.keys(f).sort().map((R)=>`${encodeURIComponent(R)}=${encodeURIComponent(f[R])}`).join("&"),w=s.split("/").map((R)=>encodeURIComponent(R)).join("/"),T=this.objectPath(t,w),q=`host:${h}
83
+ </SelectObjectContentRequest>`;return await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}/${t}`,queryParams:{select:"","select-type":"2"},headers:{"Content-Type":"application/xml"},body:g,rawResponse:!0})}async getSignedUrl(e){let{bucket:t,key:s,expiresIn:r=3600,operation:i="getObject"}=e,{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),u=new Date,l=u.toISOString().replace(/[:-]|\.\d{3}/g,""),p=u.toISOString().slice(0,10).replace(/-/g,""),h=this.s3VirtualHost(t),y=i==="putObject"?"PUT":"GET",m="AWS4-HMAC-SHA256",b=`${p}/${this.region}/s3/aws4_request`,f={"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":`${a}/${b}`,"X-Amz-Date":l,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"host"};if(g)f["X-Amz-Security-Token"]=g;let C=Object.keys(f).sort().map((O)=>`${encodeURIComponent(O)}=${encodeURIComponent(f[O])}`).join("&"),w=s.split("/").map((O)=>encodeURIComponent(O)).join("/"),T=this.objectPath(t,w),q=`host:${h}
84
84
  `,H=[y,T,C,q,"host","UNSIGNED-PAYLOAD"].join(`
85
85
  `),E=["AWS4-HMAC-SHA256",l,b,d.createHash("sha256").update(H).digest("hex")].join(`
86
- `),v=d.createHmac("sha256",`AWS4${c}`).update(p).digest(),A=d.createHmac("sha256",v).update(this.region).digest(),k=d.createHmac("sha256",A).update("s3").digest(),P=d.createHmac("sha256",k).update("aws4_request").digest(),O=d.createHmac("sha256",P).update(E).digest("hex");return`${this.endpointProtocol}://${h}${T}?${C}&X-Amz-Signature=${O}`}async listObjects(e){let{bucket:t,prefix:s,delimiter:r,maxKeys:i=1000,continuationToken:a}=e,c={"list-type":"2","max-keys":i.toString()};if(s)c.prefix=s;if(r)c.delimiter=r;if(a)c["continuation-token"]=a;let g=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:c}),u=[],l=g?.ListBucketResult??g;if(l?.Contents){let h=Array.isArray(l.Contents)?l.Contents:[l.Contents];for(let y of h)u.push({Key:String(y.Key??""),LastModified:y.LastModified||"",Size:Number.parseInt(y.Size||"0"),ETag:y.ETag})}let p=[];if(l?.CommonPrefixes){let h=Array.isArray(l.CommonPrefixes)?l.CommonPrefixes:[l.CommonPrefixes];for(let y of h)if(y?.Prefix!==void 0&&y.Prefix!=="")p.push(String(y.Prefix))}return{objects:u,commonPrefixes:p,nextContinuationToken:l?.NextContinuationToken}}async emptyBucket(e){let t=0,s=await this.listAllObjects({bucket:e});if(s.length>0)for(let r=0;r<s.length;r+=1000){let a=s.slice(r,r+1000).map((c)=>c.Key);await this.deleteObjects(e,a),t+=a.length}try{let r,i;do{let a=await this.listObjectVersions({bucket:e,keyMarker:r,versionIdMarker:i,maxKeys:1000}),c=[];if(a.versions)for(let g of a.versions)c.push({Key:g.Key,VersionId:g.VersionId});if(a.deleteMarkers)for(let g of a.deleteMarkers)c.push({Key:g.Key,VersionId:g.VersionId});if(c.length>0)await this.deleteObjectVersions(e,c),t+=c.length;r=a.nextKeyMarker,i=a.nextVersionIdMarker}while(r)}catch{}return{deletedCount:t}}async listObjectVersions(e){let{bucket:t,prefix:s,keyMarker:r,versionIdMarker:i,maxKeys:a=1000}=e,c={versions:"","max-keys":a.toString()};if(s)c.prefix=s;if(r)c["key-marker"]=r;if(i)c["version-id-marker"]=i;let g=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:c}),u=[],l=[];if(g.Version){let p=Array.isArray(g.Version)?g.Version:[g.Version];for(let h of p)u.push({Key:h.Key,VersionId:h.VersionId,IsLatest:h.IsLatest==="true"})}if(g.DeleteMarker){let p=Array.isArray(g.DeleteMarker)?g.DeleteMarker:[g.DeleteMarker];for(let h of p)l.push({Key:h.Key,VersionId:h.VersionId,IsLatest:h.IsLatest==="true"})}return{versions:u,deleteMarkers:l,nextKeyMarker:g.NextKeyMarker,nextVersionIdMarker:g.NextVersionIdMarker}}async deleteObjectVersions(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
86
+ `),v=d.createHmac("sha256",`AWS4${c}`).update(p).digest(),A=d.createHmac("sha256",v).update(this.region).digest(),k=d.createHmac("sha256",A).update("s3").digest(),P=d.createHmac("sha256",k).update("aws4_request").digest(),K=d.createHmac("sha256",P).update(E).digest("hex");return`${this.endpointProtocol}://${h}${T}?${C}&X-Amz-Signature=${K}`}async listObjects(e){let{bucket:t,prefix:s,delimiter:r,maxKeys:i=1000,continuationToken:a}=e,c={"list-type":"2","max-keys":i.toString()};if(s)c.prefix=s;if(r)c.delimiter=r;if(a)c["continuation-token"]=a;let g=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:c}),u=[],l=g?.ListBucketResult??g;if(l?.Contents){let h=Array.isArray(l.Contents)?l.Contents:[l.Contents];for(let y of h)u.push({Key:String(y.Key??""),LastModified:y.LastModified||"",Size:Number.parseInt(y.Size||"0"),ETag:y.ETag})}let p=[];if(l?.CommonPrefixes){let h=Array.isArray(l.CommonPrefixes)?l.CommonPrefixes:[l.CommonPrefixes];for(let y of h)if(y?.Prefix!==void 0&&y.Prefix!=="")p.push(String(y.Prefix))}return{objects:u,commonPrefixes:p,nextContinuationToken:l?.NextContinuationToken}}async emptyBucket(e){let t=0,s=await this.listAllObjects({bucket:e});if(s.length>0)for(let r=0;r<s.length;r+=1000){let a=s.slice(r,r+1000).map((c)=>c.Key);await this.deleteObjects(e,a),t+=a.length}try{let r,i;do{let a=await this.listObjectVersions({bucket:e,keyMarker:r,versionIdMarker:i,maxKeys:1000}),c=[];if(a.versions)for(let g of a.versions)c.push({Key:g.Key,VersionId:g.VersionId});if(a.deleteMarkers)for(let g of a.deleteMarkers)c.push({Key:g.Key,VersionId:g.VersionId});if(c.length>0)await this.deleteObjectVersions(e,c),t+=c.length;r=a.nextKeyMarker,i=a.nextVersionIdMarker}while(r)}catch{}return{deletedCount:t}}async listObjectVersions(e){let{bucket:t,prefix:s,keyMarker:r,versionIdMarker:i,maxKeys:a=1000}=e,c={versions:"","max-keys":a.toString()};if(s)c.prefix=s;if(r)c["key-marker"]=r;if(i)c["version-id-marker"]=i;let g=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:c}),u=[],l=[];if(g.Version){let p=Array.isArray(g.Version)?g.Version:[g.Version];for(let h of p)u.push({Key:h.Key,VersionId:h.VersionId,IsLatest:h.IsLatest==="true"})}if(g.DeleteMarker){let p=Array.isArray(g.DeleteMarker)?g.DeleteMarker:[g.DeleteMarker];for(let h of p)l.push({Key:h.Key,VersionId:h.VersionId,IsLatest:h.IsLatest==="true"})}return{versions:u,deleteMarkers:l,nextKeyMarker:g.NextKeyMarker,nextVersionIdMarker:g.NextVersionIdMarker}}async deleteObjectVersions(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
87
87
  <Delete>
88
88
  <Quiet>true</Quiet>
89
89
  ${t.map((i)=>`<Object><Key>${i.Key}</Key>${i.VersionId?`<VersionId>${i.VersionId}</VersionId>`:""}</Object>`).join(`
90
90
  `)}
91
91
  </Delete>`,r=d.createHash("md5").update(s).digest("base64");await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}`,queryParams:{delete:""},body:s,headers:{"Content-Type":"application/xml","Content-MD5":r}})}}
92
- export{Vr,o};
92
+ export{qr,o};
@@ -1 +1 @@
1
- import{Dn,Pn,Ju,bs,Xu,Yu,Zu,Ja,eg,tg,hh,rg,v,ng,Cs,Me,ig,sg,qS,og,ag,cg,dg,lg,Ah,jS,zS,KS,yh,Sh,WS,JS,Ih,bh,XS,Es,br,Xa,kn,Nn,Cr,ct,Ft,vs,Ch,Bn,ug,gg,Ya,ws,On,Rs,gc}from"../chunk-f739f6d2.js";import{pc,_n,Ln,Ds,Ps,ks,Ns,mc,fc}from"../chunk-7mpbjr6c.js";import{hc}from"../chunk-hk1frmnn.js";import"../chunk-a92gvctb.js";import"../chunk-03eny26f.js";import"../chunk-r49ynkag.js";import"../chunk-3ca6cb1s.js";import"../chunk-tngsyawj.js";import"../chunk-q4408fwg.js";import"../chunk-q8vvwmka.js";import{kg,xc,Ng,De,Oc,Xn,Bg,_c,id,oo,sd,er,Ri,ao}from"../chunk-157bgr0x.js";import"../chunk-pah2r8a0.js";import"../chunk-axcxfz8p.js";import"../chunk-0kemzwpg.js";import"../chunk-1t3rjvf9.js";import"../chunk-9w5ncn9s.js";import{Et,TA,hd,xi,Oi,_i,qp}from"../chunk-pymc2aad.js";import{U,jr,zr,Ad,ho,d,wA,jp,zp,kI,NI}from"../chunk-0860mm00.js";import"../chunk-qgtydqpj.js";import"../chunk-y9589qef.js";import"../chunk-m2a60evh.js";export{TA as DEFAULT_SITE_PORT_RANGE,Et as HOST_SITES_DIR,Oc as IPV6_EXCLUDED_HOST_LABELS,id as MANAGEMENT_DASHBOARD_SITE,Dn as addSiteToCloudConfig,qp as allocateSitePorts,XS as buildAndPushContainerImage,hc as buildAndPushServerlessImage,br as buildFunctionEnv,Oi as buildHostSitePortsScript,ao as buildManagementDashboardArtifact,Ft as buildServerTopology,vs as buildServerlessTopology,Ch as buildTopology,Ya as collectEgressMetrics,kg as collectServerDnsDomains,bh as createContainerImageDependencies,yh as createExistingStaticFullStackDependencies,Ah as createStaticApiOriginDependencies,On as dashboardActions,oo as dashboardCredentialsFile,ig as dashboardPageRoutes,dg as deleteFailoverReplicaBuckets,mc as deleteStaticSite,WS as deployExistingStaticFullStack,Xa as deployServerlessApp,NI as deployShipsFiles,lg as deploySite,jS as deployStaticApiOrigin,Ps as deployStaticSite,fc as deployStaticSiteFull,_n as deployStaticSiteWithExternalDns,Ln as deployStaticSiteWithExternalDnsFull,ug as egressReportMetrics,v as ensureDashboardActor,og as ensureFailoverReplicaBuckets,Ri as ensureManagementDashboard,JS as estimateExistingStaticFullStackMonthlyCost,KS as estimateStaticApiOriginMonthlyCost,gg as fetchEgressReport,Sh as generateExistingStaticFullStackTemplate,pc as generateExternalDnsStaticSiteTemplate,Ds as generateStaticSiteTemplate,ag as grantFailoverReplicaAccess,wA as hasComputeConfigured,Ad as hasProxyUpstream,Ih as hashContainerContext,Xn as hostAcceptsIpv6,Es as infraEnvFromOutputs,ng as initializeDashboardControlPlane,Ns as invalidateCache,jr as isPhpSite,Ja as isValidHostname,De as normalizePublicIpv6,xi as occupiedHostPorts,_i as parseHostSiteFragments,hd as parseUpstreamPort,Bg as reconcileAddressRecords,kn as redeployServerlessApp,Ng as removeAddressRecords,Pn as removeSiteFromCloudConfig,xc as removeStaleServerAddressRecords,eg as renderAliasesValue,Zu as renderEnvValue,tg as renderRedirectsValue,hh as renderSiteSnippet,Xu as renderSslValue,Yu as renderStringValue,Rs as resolveDashboardAction,sd as resolveDashboardAuth,Bn as resolveDashboardData,sg as resolveLegacyDashboardRoute,zr as resolveProxyUpstreams,ho as resolveSiteDeployTarget,d as resolveSiteKind,er as resolveUiSource,Nn as rollbackServerlessApp,qS as routesForDashboard,ct as runRemoteCommand,ws as sanitizeCloudConfig,cg as seedFailoverReplicas,rg as setAttachToInCloudConfig,Cr as setMaintenance,bs as setSitePropertyInCloudConfig,zp as shipsARelease,kI as shipsToBucket,U as siteInstallBase,gc as startLocalDashboardServer,Cs as synchronizeDashboardUsers,Me as trackDashboardOperation,Ju as updateSiteInCloudConfig,ks as uploadStaticFiles,jp as validateDeploymentConfig,_c as verifyAddressRecord,zS as verifyStaticApiOrigin};
1
+ import{Dn,Pn,Ju,bs,Xu,Yu,Zu,Ja,eg,tg,hh,rg,v,ng,Cs,Me,ig,sg,qS,og,ag,cg,dg,lg,Ah,jS,zS,KS,yh,Sh,WS,JS,Ih,bh,XS,Es,Cr,Xa,kn,Nn,Er,dt,Ut,vs,Ch,Bn,ug,gg,Ya,ws,On,Rs,gc}from"../chunk-192rthtb.js";import{pc,_n,Ln,Ds,Ps,ks,Ns,mc,fc}from"../chunk-h5yx54ks.js";import{hc}from"../chunk-qrpy0h2n.js";import"../chunk-a07kew2q.js";import"../chunk-kbr9nc8y.js";import"../chunk-t8fbwcdk.js";import"../chunk-p21vbrgk.js";import"../chunk-xyem7g21.js";import"../chunk-hvttzk9q.js";import"../chunk-je8tky8z.js";import{kg,xc,Ng,De,Oc,Xn,Bg,_c,id,oo,sd,tr,Ri,ao}from"../chunk-spr6akra.js";import"../chunk-tq7nsdnd.js";import"../chunk-1yj07hbw.js";import"../chunk-41fwhvp7.js";import"../chunk-z585dfjz.js";import"../chunk-1wc2zfct.js";import{vt,TA,hd,xi,Oi,_i,qp}from"../chunk-h360gwrf.js";import{U,jr,zr,Ad,ho,d,wA,jp,zp,kI,NI}from"../chunk-v0s8vpa3.js";import"../chunk-tb8azghz.js";import"../chunk-040rbk7k.js";import"../chunk-m2a60evh.js";export{TA as DEFAULT_SITE_PORT_RANGE,vt as HOST_SITES_DIR,Oc as IPV6_EXCLUDED_HOST_LABELS,id as MANAGEMENT_DASHBOARD_SITE,Dn as addSiteToCloudConfig,qp as allocateSitePorts,XS as buildAndPushContainerImage,hc as buildAndPushServerlessImage,Cr as buildFunctionEnv,Oi as buildHostSitePortsScript,ao as buildManagementDashboardArtifact,Ut as buildServerTopology,vs as buildServerlessTopology,Ch as buildTopology,Ya as collectEgressMetrics,kg as collectServerDnsDomains,bh as createContainerImageDependencies,yh as createExistingStaticFullStackDependencies,Ah as createStaticApiOriginDependencies,On as dashboardActions,oo as dashboardCredentialsFile,ig as dashboardPageRoutes,dg as deleteFailoverReplicaBuckets,mc as deleteStaticSite,WS as deployExistingStaticFullStack,Xa as deployServerlessApp,NI as deployShipsFiles,lg as deploySite,jS as deployStaticApiOrigin,Ps as deployStaticSite,fc as deployStaticSiteFull,_n as deployStaticSiteWithExternalDns,Ln as deployStaticSiteWithExternalDnsFull,ug as egressReportMetrics,v as ensureDashboardActor,og as ensureFailoverReplicaBuckets,Ri as ensureManagementDashboard,JS as estimateExistingStaticFullStackMonthlyCost,KS as estimateStaticApiOriginMonthlyCost,gg as fetchEgressReport,Sh as generateExistingStaticFullStackTemplate,pc as generateExternalDnsStaticSiteTemplate,Ds as generateStaticSiteTemplate,ag as grantFailoverReplicaAccess,wA as hasComputeConfigured,Ad as hasProxyUpstream,Ih as hashContainerContext,Xn as hostAcceptsIpv6,Es as infraEnvFromOutputs,ng as initializeDashboardControlPlane,Ns as invalidateCache,jr as isPhpSite,Ja as isValidHostname,De as normalizePublicIpv6,xi as occupiedHostPorts,_i as parseHostSiteFragments,hd as parseUpstreamPort,Bg as reconcileAddressRecords,kn as redeployServerlessApp,Ng as removeAddressRecords,Pn as removeSiteFromCloudConfig,xc as removeStaleServerAddressRecords,eg as renderAliasesValue,Zu as renderEnvValue,tg as renderRedirectsValue,hh as renderSiteSnippet,Xu as renderSslValue,Yu as renderStringValue,Rs as resolveDashboardAction,sd as resolveDashboardAuth,Bn as resolveDashboardData,sg as resolveLegacyDashboardRoute,zr as resolveProxyUpstreams,ho as resolveSiteDeployTarget,d as resolveSiteKind,tr as resolveUiSource,Nn as rollbackServerlessApp,qS as routesForDashboard,dt as runRemoteCommand,ws as sanitizeCloudConfig,cg as seedFailoverReplicas,rg as setAttachToInCloudConfig,Er as setMaintenance,bs as setSitePropertyInCloudConfig,zp as shipsARelease,kI as shipsToBucket,U as siteInstallBase,gc as startLocalDashboardServer,Cs as synchronizeDashboardUsers,Me as trackDashboardOperation,Ju as updateSiteInCloudConfig,ks as uploadStaticFiles,jp as validateDeploymentConfig,_c as verifyAddressRecord,zS as verifyStaticApiOrigin};
package/dist/dns/index.js CHANGED
@@ -1 +1 @@
1
- import{pt,he,Ge,H,Kt,Kn,Us,Qs,Pr,kr,Wn,Nr,Hs,Gs,Vs,qs,ie,js,zs,Ks,Ws,Ae,Js,Xs,Ys,N,Nc,Jn,Bc}from"../chunk-q4408fwg.js";import"../chunk-q8vvwmka.js";import"../chunk-9w5ncn9s.js";export{H as CloudflareProvider,Jn as DnsProviderFactory,Ge as GoDaddyProvider,pt as PROXIABLE_RECORD_TYPES,he as PorkbunProvider,ie as Route53Provider,Ae as UnifiedDnsValidator,Vs as applyDeclaredZoneSettings,Ks as applyZoneMigration,N as createDnsProvider,Xs as createGoDaddyValidator,Js as createPorkbunValidator,Ys as createRoute53Validator,Nr as delegateZone,Hs as delegateZoneFromConfig,Gs as describeDelegation,qs as describeZoneSettings,Nc as detectDnsProvider,Bc as dnsProviders,js as exportRoute53Zone,Pr as isNameserverRegistrar,kr as isZoneHost,zs as planZoneMigration,Kt as policyTag,Kn as qualifyName,Qs as reconcileDeclaredRecords,Us as resolveDeclaredRecords,Wn as sameNameservers,Ws as verifyZoneParity};
1
+ import{mt,he,Ge,H,Wt,Kn,Us,Qs,kr,Nr,Wn,Br,Hs,Gs,Vs,qs,ie,js,zs,Ks,Ws,Ae,Js,Xs,Ys,N,Nc,Jn,Bc}from"../chunk-hvttzk9q.js";import"../chunk-je8tky8z.js";import"../chunk-1wc2zfct.js";export{H as CloudflareProvider,Jn as DnsProviderFactory,Ge as GoDaddyProvider,mt as PROXIABLE_RECORD_TYPES,he as PorkbunProvider,ie as Route53Provider,Ae as UnifiedDnsValidator,Vs as applyDeclaredZoneSettings,Ks as applyZoneMigration,N as createDnsProvider,Xs as createGoDaddyValidator,Js as createPorkbunValidator,Ys as createRoute53Validator,Br as delegateZone,Hs as delegateZoneFromConfig,Gs as describeDelegation,qs as describeZoneSettings,Nc as detectDnsProvider,Bc as dnsProviders,js as exportRoute53Zone,kr as isNameserverRegistrar,Nr as isZoneHost,zs as planZoneMigration,Wt as policyTag,Kn as qualifyName,Qs as reconcileDeclaredRecords,Us as resolveDeclaredRecords,Wn as sameNameservers,Ws as verifyZoneParity};
@@ -1 +1 @@
1
- import{Yn,Wt,xr,Jt,Zn,M,_r,ei,ti,Lr,$r,Fh,Uh,Mg,Fg,Qh,Hh,Gh,Mr,ri,Ug,to,ni,ii,si,oi,ai,Lc,$c,ci,Fr,Se,Mc,ft,Fc,di,Uc,Ur,Hc,Ve,se,Zt,Qg,li,Gc,Vc,qc,jc,ht,qe,je,At,ui,gi,Pe,ro,zc,Hg,Gg,Kc,Vg,yt,pi,Wc,qg,jg,Jc,St,ke,Xc,zg,Kg,no,mi,It,Wg,Jg,Xg,Yg,Zg,ep,tp,rp,np,fi,hi,Ai,yi,Si,Ii,bi,ip,sp,Qr,F,io,op,ap,cp,Yc,dp,lp,Vh,qh,jh,Zc,up,zh,Kh,Wh,Ci,Ei,vi,Ti,ed,td,wi,rd,Jh,so,gp,pp,mp,fp,hp,nd,Xh,co,od,Di,ad,Ap,yp,Sp,Yh}from"../chunk-157bgr0x.js";import{uo,po,mo,Zh,ld,B,tr,PI,fo,Ep,ze,G,Ne}from"../chunk-pah2r8a0.js";import"../chunk-axcxfz8p.js";import"../chunk-0kemzwpg.js";import"../chunk-1t3rjvf9.js";import"../chunk-9w5ncn9s.js";import"../chunk-0860mm00.js";import"../chunk-y9589qef.js";import"../chunk-m2a60evh.js";export{rd as AwsBoxProvisioner,_r as AwsDriver,cp as BOOT_PARTITION_LABEL,gp as BOX_PANTRY_BIN_DIR,so as BOX_PANTRY_CLI_DIR,io as CloudDriverFactory,Fg as DEFAULT_HOST_CLEANUP_ESCALATED,Hh as DEFAULT_HOST_CLEANUP_HIGH_WATER_PERCENT,Qh as DEFAULT_HOST_CLEANUP_LOW_WATER_PERCENT,Mg as DEFAULT_HOST_CLEANUP_RETENTION,Gh as DEFAULT_HOST_CLEANUP_SCHEDULE,uo as DEFAULT_RPX_CERTS_DIR,ap as FIRST_BOOT_SCRIPT_PATH,$r as HOST_ARTIFACT_CACHE_DIR,Fh as HOST_CLEANUP_SCRIPT_PATH,Uh as HOST_CLEANUP_UNIT,wi as HetznerBoxProvisioner,Ur as HetznerClient,Pe as HetznerDriver,jc as LEGACY_DRIVER_STATE_DIR,ro as LocalBoxDriver,yp as MANAGED_CACHE_POLICY_DISABLED,Ap as MANAGED_CACHE_POLICY_OPTIMIZED,Sp as MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,Kg as RASPBERRY_PI_DEFAULT_SWAP_GB,Uc as REMOTE_SCRIPT_RUNNER,fo as RPX_DIR,Ep as RPX_LAUNCHER_PATH,ze as RPX_SERVICE_NAME,Xc as SSH_BOOTSTRAP_MARKER_DIR,ke as SSH_BOOTSTRAP_VERSION,It as SSH_DEFAULTS,bi as SSH_DEPLOY_STORAGE_PATH,Hg as SSH_INSECURE_HOST_KEY_OPTS,Gg as SSH_KEEPALIVE_OPTS,hi as SSH_PREFLIGHT_SCRIPT,ip as SSH_SKIP_BOOTSTRAP_ENV,Qr as SshDriver,St as SystemSshTransport,ed as UBUNTU_2404_AMI_PARAM,Wh as acquireResizeLock,Vh as applyHetznerHostOptimization,gi as applyHetznerVolumes,no as assertArchSupported,sp as assertSshComputeConfig,Lc as buildAwsArtifactFetch,hp as buildBoxConvergeScript,pp as buildBoxSandboxConvergeScript,td as buildBoxUserData,Yh as buildCloudFrontOriginConfig,Yc as buildCloudInitFirstBoot,ti as buildComputeStorageInstallScript,Lr as buildComputeStorageSiteScript,lp as buildHetznerHostOptimizationScript,ni as buildHostCleanupDeployScript,Ug as buildHostCleanupExecutable,to as buildHostCleanupInstallScript,ri as buildHostCleanupScript,$c as buildLocalArtifactFetch,B as buildRpxConfig,Ne as buildRpxFragmentRefreshScript,tr as buildRpxLbConfig,G as buildRpxProvisionScript,Vg as buildScpArgsFor,si as buildSiteDeployScript,ci as buildSshArgs,Kc as buildSshArgsFor,mi as buildSshBootstrapScript,oi as buildStaticSiteDeployScript,op as cloudDrivers,qh as collectHetznerHostOptimizationReport,Gc as collectHetznerResizeManifest,Jh as createBoxProvisioner,F as createCloudDriver,od as deployAllComputeSites,co as deploySiteRelease,ld as deriveRouteId,Yn as describeScriptSyntaxError,ht as driverStateDir,qe as driverStatePath,Ei as ensureFirewall,vi as ensureServer,Ci as ensureSshKey,yi as evaluatePreflight,li as executeHetznerServerResize,jg as findKnownHostKey,Ii as formatPreflightFindings,Wt as formatSshFailure,mo as gatewayHostnames,M as generateUbuntuAppCloudInit,po as hasAutoWwwVariant,zc as isBoxMode,Qg as isHetznerCapacityError,Zn as isLocalDatabase,qg as knownHostsLine,Wc as knownHostsToken,Zh as normalizeRoutePath,Ve as normalizeSshPublicKey,nd as parseBoxReport,Ai as parsePreflightFacts,Zt as planHetznerServerResize,ui as planHetznerVolumes,Si as preflightFailed,Vc as prepareHetznerResize,Xh as provisionBox,je as readDriverState,zh as readResizeCheckpoint,ai as releaseTarballTmpPath,Di as reloadRpxGateway,di as remoteScriptRunner,fp as renderBoxUnit,mp as renderEnvFile,PI as renderRpxLauncher,ad as renewRpxCertificates,Zc as resizeCheckpointPath,up as resizeLockPath,ei as resolveComputeVolumes,ii as resolveExecStart,Hc as resolveHetznerApiToken,dp as resolveHetznerHostOptimizationPlan,Mr as resolveHostCleanupConfig,Zg as resolveSshHostKeyPolicy,Wg as resolveSshHosts,np as resolveSshLan,Xg as resolveSshPort,Yg as resolveSshPrivateKeyPath,tp as resolveSshProfile,rp as resolveSshPublicIp,fi as resolveSshSettings,ep as resolveSshSudo,Jg as resolveSshUser,pi as scanHostKey,Mc as scpUpload,Ti as serverPublicIpv4,zg as sshBootstrapMarkerPath,Fr as sshExec,Se as sshExecOrThrow,yt as sshHostKeyFingerprint,Jc as sshKnownHostsPath,Jt as summarizeRemoteFailures,xr as surfaceRemoteNotices,jh as verifyHetznerHostOptimization,qc as verifyHetznerResize,Fc as waitForCloudInit,ft as waitForSsh,se as wrapCloudInitUserData,At as writeDriverState,Kh as writeResizeCheckpoint};
1
+ import{Yn,Jt,Or,Xt,Zn,M,Lr,ei,ti,$r,Mr,Fh,Uh,Mg,Fg,Qh,Hh,Gh,Fr,ri,Ug,to,ni,ii,si,oi,ai,Lc,$c,ci,Ur,Se,Mc,ht,Fc,di,Uc,Qr,Hc,Ve,se,er,Qg,li,Gc,Vc,qc,jc,At,qe,je,yt,ui,gi,Pe,ro,zc,Hg,Gg,Kc,Vg,St,pi,Wc,qg,jg,Jc,It,ke,Xc,zg,Kg,no,mi,bt,Wg,Jg,Xg,Yg,Zg,ep,tp,rp,np,fi,hi,Ai,yi,Si,Ii,bi,ip,sp,Hr,F,io,op,ap,cp,Yc,dp,lp,Vh,qh,jh,Zc,up,zh,Kh,Wh,Ci,Ei,vi,Ti,ed,td,wi,rd,Jh,so,gp,pp,mp,fp,hp,nd,Xh,co,od,Di,ad,Ap,yp,Sp,Yh}from"../chunk-spr6akra.js";import{uo,po,mo,Zh,ld,B,rr,PI,fo,Ep,ze,G,Ne}from"../chunk-tq7nsdnd.js";import"../chunk-1yj07hbw.js";import"../chunk-41fwhvp7.js";import"../chunk-z585dfjz.js";import"../chunk-1wc2zfct.js";import"../chunk-v0s8vpa3.js";import"../chunk-040rbk7k.js";import"../chunk-m2a60evh.js";export{rd as AwsBoxProvisioner,Lr as AwsDriver,cp as BOOT_PARTITION_LABEL,gp as BOX_PANTRY_BIN_DIR,so as BOX_PANTRY_CLI_DIR,io as CloudDriverFactory,Fg as DEFAULT_HOST_CLEANUP_ESCALATED,Hh as DEFAULT_HOST_CLEANUP_HIGH_WATER_PERCENT,Qh as DEFAULT_HOST_CLEANUP_LOW_WATER_PERCENT,Mg as DEFAULT_HOST_CLEANUP_RETENTION,Gh as DEFAULT_HOST_CLEANUP_SCHEDULE,uo as DEFAULT_RPX_CERTS_DIR,ap as FIRST_BOOT_SCRIPT_PATH,Mr as HOST_ARTIFACT_CACHE_DIR,Fh as HOST_CLEANUP_SCRIPT_PATH,Uh as HOST_CLEANUP_UNIT,wi as HetznerBoxProvisioner,Qr as HetznerClient,Pe as HetznerDriver,jc as LEGACY_DRIVER_STATE_DIR,ro as LocalBoxDriver,yp as MANAGED_CACHE_POLICY_DISABLED,Ap as MANAGED_CACHE_POLICY_OPTIMIZED,Sp as MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,Kg as RASPBERRY_PI_DEFAULT_SWAP_GB,Uc as REMOTE_SCRIPT_RUNNER,fo as RPX_DIR,Ep as RPX_LAUNCHER_PATH,ze as RPX_SERVICE_NAME,Xc as SSH_BOOTSTRAP_MARKER_DIR,ke as SSH_BOOTSTRAP_VERSION,bt as SSH_DEFAULTS,bi as SSH_DEPLOY_STORAGE_PATH,Hg as SSH_INSECURE_HOST_KEY_OPTS,Gg as SSH_KEEPALIVE_OPTS,hi as SSH_PREFLIGHT_SCRIPT,ip as SSH_SKIP_BOOTSTRAP_ENV,Hr as SshDriver,It as SystemSshTransport,ed as UBUNTU_2404_AMI_PARAM,Wh as acquireResizeLock,Vh as applyHetznerHostOptimization,gi as applyHetznerVolumes,no as assertArchSupported,sp as assertSshComputeConfig,Lc as buildAwsArtifactFetch,hp as buildBoxConvergeScript,pp as buildBoxSandboxConvergeScript,td as buildBoxUserData,Yh as buildCloudFrontOriginConfig,Yc as buildCloudInitFirstBoot,ti as buildComputeStorageInstallScript,$r as buildComputeStorageSiteScript,lp as buildHetznerHostOptimizationScript,ni as buildHostCleanupDeployScript,Ug as buildHostCleanupExecutable,to as buildHostCleanupInstallScript,ri as buildHostCleanupScript,$c as buildLocalArtifactFetch,B as buildRpxConfig,Ne as buildRpxFragmentRefreshScript,rr as buildRpxLbConfig,G as buildRpxProvisionScript,Vg as buildScpArgsFor,si as buildSiteDeployScript,ci as buildSshArgs,Kc as buildSshArgsFor,mi as buildSshBootstrapScript,oi as buildStaticSiteDeployScript,op as cloudDrivers,qh as collectHetznerHostOptimizationReport,Gc as collectHetznerResizeManifest,Jh as createBoxProvisioner,F as createCloudDriver,od as deployAllComputeSites,co as deploySiteRelease,ld as deriveRouteId,Yn as describeScriptSyntaxError,At as driverStateDir,qe as driverStatePath,Ei as ensureFirewall,vi as ensureServer,Ci as ensureSshKey,yi as evaluatePreflight,li as executeHetznerServerResize,jg as findKnownHostKey,Ii as formatPreflightFindings,Jt as formatSshFailure,mo as gatewayHostnames,M as generateUbuntuAppCloudInit,po as hasAutoWwwVariant,zc as isBoxMode,Qg as isHetznerCapacityError,Zn as isLocalDatabase,qg as knownHostsLine,Wc as knownHostsToken,Zh as normalizeRoutePath,Ve as normalizeSshPublicKey,nd as parseBoxReport,Ai as parsePreflightFacts,er as planHetznerServerResize,ui as planHetznerVolumes,Si as preflightFailed,Vc as prepareHetznerResize,Xh as provisionBox,je as readDriverState,zh as readResizeCheckpoint,ai as releaseTarballTmpPath,Di as reloadRpxGateway,di as remoteScriptRunner,fp as renderBoxUnit,mp as renderEnvFile,PI as renderRpxLauncher,ad as renewRpxCertificates,Zc as resizeCheckpointPath,up as resizeLockPath,ei as resolveComputeVolumes,ii as resolveExecStart,Hc as resolveHetznerApiToken,dp as resolveHetznerHostOptimizationPlan,Fr as resolveHostCleanupConfig,Zg as resolveSshHostKeyPolicy,Wg as resolveSshHosts,np as resolveSshLan,Xg as resolveSshPort,Yg as resolveSshPrivateKeyPath,tp as resolveSshProfile,rp as resolveSshPublicIp,fi as resolveSshSettings,ep as resolveSshSudo,Jg as resolveSshUser,pi as scanHostKey,Mc as scpUpload,Ti as serverPublicIpv4,zg as sshBootstrapMarkerPath,Ur as sshExec,Se as sshExecOrThrow,St as sshHostKeyFingerprint,Jc as sshKnownHostsPath,Xt as summarizeRemoteFailures,Or as surfaceRemoteNotices,jh as verifyHetznerHostOptimization,qc as verifyHetznerResize,Fc as waitForCloudInit,ht as waitForSsh,se as wrapCloudInitUserData,yt as writeDriverState,Kh as writeResizeCheckpoint};
@@ -56,6 +56,18 @@ export interface ReleasePaths {
56
56
  * starts warm. Handed to the server as `STX_IMAGE_CACHE_DIR`.
57
57
  */
58
58
  export declare function stxImageCacheDir(paths: ReleasePaths): string;
59
+ /**
60
+ * Where stx keeps its client script bundles, shared by every release.
61
+ *
62
+ * A page's first render bundles its client scripts, one build at a time, and
63
+ * a production server renders every page before it joins a deploy's shared
64
+ * port. Inside the release directory that started from nothing on every
65
+ * deploy, so a site with a hundred interactive pages warmed for minutes.
66
+ * stx keys the entries by project-relative path and validates them by
67
+ * content (stx >= 0.2.620), so an unchanged page in the next release is a
68
+ * cache hit. Handed to the server as `STX_BUNDLE_CACHE_DIR`.
69
+ */
70
+ export declare function stxBundleCacheDir(paths: ReleasePaths): string;
59
71
  export declare function releasePaths(base: string, releaseId: string): ReleasePaths;
60
72
  /** The release-relative path an entry links, whichever form it takes. */
61
73
  export declare function sharedPathOf(entry: SharedPathEntry): string;