@stacksjs/ts-cloud 0.12.12 → 0.12.14

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 (233) hide show
  1. package/dist/aws/index.js +1 -1
  2. package/dist/bin/chunk-16rs9egs.js +6 -0
  3. package/dist/bin/chunk-1j2sja1j.js +1 -0
  4. package/dist/bin/chunk-1rcsm0px.js +1 -0
  5. package/dist/bin/chunk-1s4dny8d.js +1 -0
  6. package/dist/bin/chunk-1wvrtg42.js +8 -0
  7. package/dist/bin/chunk-1x7mm26k.js +1 -0
  8. package/dist/bin/chunk-2paqksap.js +6 -0
  9. package/dist/bin/chunk-3gwmejhk.js +1 -0
  10. package/dist/bin/chunk-4201mvaj.js +2 -0
  11. package/dist/bin/chunk-49sthm4q.js +2 -0
  12. package/dist/bin/chunk-4yntpqbe.js +1 -0
  13. package/dist/bin/chunk-4zbnwt9b.js +2 -0
  14. package/dist/{chunk-2ybcnrte.js → bin/chunk-57w9nsjk.js} +3 -3
  15. package/dist/bin/chunk-61ysn56t.js +1 -0
  16. package/dist/bin/chunk-6vay4ggv.js +9 -0
  17. package/dist/bin/{chunk-wcem4cqb.js → chunk-7a7n6p2m.js} +2 -2
  18. package/dist/bin/chunk-7x0hrna6.js +1 -0
  19. package/dist/bin/{chunk-e2dnxp8d.js → chunk-80zkjpfz.js} +29 -29
  20. package/dist/bin/chunk-92nng29y.js +1 -0
  21. package/dist/bin/chunk-94cfdvrn.js +2 -0
  22. package/dist/bin/chunk-9q8zjavc.js +725 -0
  23. package/dist/bin/chunk-a929za72.js +2 -0
  24. package/dist/{chunk-ac87ds1k.js → bin/chunk-bckm6fre.js} +6 -6
  25. package/dist/bin/chunk-bj5nq0kn.js +7364 -0
  26. package/dist/bin/chunk-c51xp8f7.js +1 -0
  27. package/dist/bin/chunk-d7r6mhyv.js +34 -0
  28. package/dist/bin/chunk-dbmk60r7.js +60 -0
  29. package/dist/bin/chunk-dhxwmkhz.js +2 -0
  30. package/dist/bin/chunk-f1ke4ygp.js +1 -0
  31. package/dist/bin/chunk-f35pte64.js +44 -0
  32. package/dist/bin/{chunk-t5ngva49.js → chunk-f8mbjwme.js} +8 -8
  33. package/dist/bin/chunk-fnr6k11h.js +1 -0
  34. package/dist/bin/chunk-mzfct5en.js +1 -0
  35. package/dist/bin/chunk-n6qqa2fr.js +511 -0
  36. package/dist/bin/chunk-ngav845g.js +2 -0
  37. package/dist/bin/chunk-nrnq9adz.js +1 -0
  38. package/dist/bin/chunk-p36ns96s.js +1 -0
  39. package/dist/bin/chunk-pega3x2x.js +1 -0
  40. package/dist/bin/chunk-pt2bz3kr.js +1 -0
  41. package/dist/bin/chunk-q5aj280b.js +1 -0
  42. package/dist/bin/chunk-r6cvc2pr.js +1 -0
  43. package/dist/bin/chunk-rh2sqtew.js +1 -0
  44. package/dist/bin/chunk-rpg5k3wt.js +3 -0
  45. package/dist/bin/chunk-tkzpbb7n.js +1 -0
  46. package/dist/bin/chunk-vwyq2s2k.js +1 -0
  47. package/dist/bin/chunk-vx649y7t.js +1 -0
  48. package/dist/bin/chunk-vymg9ywg.js +2 -0
  49. package/dist/bin/chunk-w637s5q0.js +3 -0
  50. package/dist/bin/chunk-wge61ccr.js +2 -0
  51. package/dist/bin/{chunk-jxd3j00s.js → chunk-wr6a423y.js} +13 -13
  52. package/dist/bin/chunk-y7ece16e.js +111 -0
  53. package/dist/bin/chunk-ydpnsp4x.js +3 -0
  54. package/dist/bin/{chunk-t7rcfwqc.js → chunk-yhxpmk29.js} +32 -32
  55. package/dist/bin/chunk-yn34zgr2.js +1 -0
  56. package/dist/bin/chunk-ynr22ma8.js +2 -0
  57. package/dist/bin/chunk-yt8rgkqt.js +2 -0
  58. package/dist/bin/chunk-z2ez8wn9.js +37 -0
  59. package/dist/bin/cli.js +428 -428
  60. package/dist/bin/dashboard-server.js +1 -1
  61. package/dist/chunk-30h9rgfn.js +6 -0
  62. package/dist/chunk-3kapcdpn.js +92 -0
  63. package/dist/chunk-5g1hsrab.js +4 -0
  64. package/dist/chunk-5qqb671d.js +1 -0
  65. package/dist/chunk-5ww7kc5z.js +114 -0
  66. package/dist/chunk-6g81m01r.js +141 -0
  67. package/dist/{chunk-q9a1z53k.js → chunk-6j8f4ahv.js} +51 -51
  68. package/dist/{chunk-6cxb8d6y.js → chunk-6nvn041c.js} +3 -3
  69. package/dist/chunk-7hy9p6xr.js +5 -0
  70. package/dist/chunk-7kwha0fw.js +585 -0
  71. package/dist/chunk-9mhcjht7.js +37 -0
  72. package/dist/chunk-9w32efae.js +1 -0
  73. package/dist/chunk-bqaqkmtr.js +2 -0
  74. package/dist/chunk-djd9xgkz.js +709 -0
  75. package/dist/chunk-e0919h5g.js +2 -0
  76. package/dist/{chunk-dndxwssj.js → chunk-e7ds04wb.js} +2 -2
  77. package/dist/chunk-fdexq9e1.js +1 -0
  78. package/dist/chunk-hw3p6pth.js +1 -0
  79. package/dist/chunk-jb8em9ba.js +2 -0
  80. package/dist/chunk-pkan6evc.js +2 -0
  81. package/dist/chunk-qzwack6w.js +44 -0
  82. package/dist/chunk-r5emv4x8.js +2 -0
  83. package/dist/chunk-thpce63q.js +34 -0
  84. package/dist/chunk-ttq6dvft.js +22 -0
  85. package/dist/chunk-vpy3zjqv.js +1 -0
  86. package/dist/chunk-vva43vnp.js +60 -0
  87. package/dist/{bin/chunk-m9r5jype.js → chunk-wjgnfg6q.js} +6 -6
  88. package/dist/chunk-wrnhbb13.js +1 -0
  89. package/dist/chunk-xxbvjq8g.js +7355 -0
  90. package/dist/chunk-zftpjxkr.js +2 -0
  91. package/dist/deploy/index.js +1 -1
  92. package/dist/dns/index.js +1 -1
  93. package/dist/drivers/index.d.ts +1 -0
  94. package/dist/drivers/index.js +1 -1
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.js +91 -91
  97. package/dist/operations/index.js +1 -1
  98. package/dist/protection/index.js +1 -1
  99. package/dist/push/index.js +1 -1
  100. package/dist/spend/index.js +1 -1
  101. package/dist/ui/404.html +1 -1
  102. package/dist/ui/accept-invitation.html +1 -1
  103. package/dist/ui/access-denied.html +1 -1
  104. package/dist/ui/account/automation.html +6 -6
  105. package/dist/ui/account/security.html +2 -2
  106. package/dist/ui/applications/compose.html +6 -6
  107. package/dist/ui/applications/new.html +1 -1
  108. package/dist/ui/data/backups.html +6 -6
  109. package/dist/ui/data/services.html +7 -7
  110. package/dist/ui/data/volumes.html +6 -6
  111. package/dist/ui/index.html +6 -6
  112. package/dist/ui/infrastructure/topology.html +9 -9
  113. package/dist/ui/integrations.html +1 -1
  114. package/dist/ui/operations/alerts.html +6 -6
  115. package/dist/ui/operations/configuration.html +6 -6
  116. package/dist/ui/operations/jobs.html +6 -6
  117. package/dist/ui/operations/maintenance.html +6 -6
  118. package/dist/ui/operations/observability.html +6 -6
  119. package/dist/ui/operations/previews.html +6 -6
  120. package/dist/ui/operations/queue.html +6 -6
  121. package/dist/ui/operations/regions.html +6 -6
  122. package/dist/ui/operations/releases.html +6 -6
  123. package/dist/ui/operations/spend.html +6 -6
  124. package/dist/ui/operations/workloads.html +9 -9
  125. package/dist/ui/security.html +2 -2
  126. package/dist/ui/server/actions.html +6 -6
  127. package/dist/ui/server/activity.html +1 -1
  128. package/dist/ui/server/capacity.html +6 -6
  129. package/dist/ui/server/database.html +6 -6
  130. package/dist/ui/server/deployments.html +6 -6
  131. package/dist/ui/server/diagnostics.html +2 -2
  132. package/dist/ui/server/firewall.html +6 -6
  133. package/dist/ui/server/fleet.html +6 -6
  134. package/dist/ui/server/logs.html +6 -6
  135. package/dist/ui/server/metrics.html +6 -6
  136. package/dist/ui/server/security.html +2 -2
  137. package/dist/ui/server/services.html +1 -1
  138. package/dist/ui/server/sites.html +17 -17
  139. package/dist/ui/server/ssh-keys.html +6 -6
  140. package/dist/ui/server/team.html +5 -5
  141. package/dist/ui/server/terminal.html +2 -2
  142. package/dist/ui/serverless/alarms.html +5 -5
  143. package/dist/ui/serverless/assets.html +2 -2
  144. package/dist/ui/serverless/cost.html +2 -2
  145. package/dist/ui/serverless/data.html +6 -6
  146. package/dist/ui/serverless/deployments.html +2 -2
  147. package/dist/ui/serverless/firewall.html +2 -2
  148. package/dist/ui/serverless/functions.html +5 -5
  149. package/dist/ui/serverless/logs.html +6 -6
  150. package/dist/ui/serverless/metrics.html +2 -2
  151. package/dist/ui/serverless/queues.html +6 -6
  152. package/dist/ui/serverless/secrets.html +6 -6
  153. package/dist/ui/serverless/traces.html +5 -5
  154. package/dist/ui/serverless.html +6 -6
  155. package/dist/ui-src/src/charts.ts +1141 -1294
  156. package/dist/ui-src/src/topology.ts +3 -3
  157. package/package.json +3 -3
  158. package/dist/bin/chunk-0b49jjgr.js +0 -2
  159. package/dist/bin/chunk-0xnnkeb1.js +0 -1
  160. package/dist/bin/chunk-227jmf2b.js +0 -2
  161. package/dist/bin/chunk-2nyyg44g.js +0 -1
  162. package/dist/bin/chunk-2ztr119n.js +0 -3
  163. package/dist/bin/chunk-43xj5cny.js +0 -1
  164. package/dist/bin/chunk-5w6y9pmz.js +0 -1
  165. package/dist/bin/chunk-5x4rdx8k.js +0 -37
  166. package/dist/bin/chunk-6zc6a6t3.js +0 -725
  167. package/dist/bin/chunk-7aagqqr9.js +0 -1
  168. package/dist/bin/chunk-85qrgshq.js +0 -44
  169. package/dist/bin/chunk-8zk8msx0.js +0 -2
  170. package/dist/bin/chunk-9j83q0r4.js +0 -1
  171. package/dist/bin/chunk-9nhqbes6.js +0 -60
  172. package/dist/bin/chunk-a4js49mx.js +0 -1
  173. package/dist/bin/chunk-a9e0hvwe.js +0 -6
  174. package/dist/bin/chunk-a9tgxf2h.js +0 -1
  175. package/dist/bin/chunk-aahrv359.js +0 -1
  176. package/dist/bin/chunk-bfx23be3.js +0 -1
  177. package/dist/bin/chunk-bpps61am.js +0 -111
  178. package/dist/bin/chunk-bzth6d1s.js +0 -6
  179. package/dist/bin/chunk-ca3taw2m.js +0 -1
  180. package/dist/bin/chunk-cgzp0328.js +0 -1
  181. package/dist/bin/chunk-d2aaef9v.js +0 -1
  182. package/dist/bin/chunk-e0z2t4mf.js +0 -6
  183. package/dist/bin/chunk-empfsmdk.js +0 -2
  184. package/dist/bin/chunk-er3mww4m.js +0 -1
  185. package/dist/bin/chunk-fmp5bv0j.js +0 -3
  186. package/dist/bin/chunk-g3kp5ddx.js +0 -1
  187. package/dist/bin/chunk-grepda40.js +0 -1
  188. package/dist/bin/chunk-h6xqtypj.js +0 -2
  189. package/dist/bin/chunk-hwk9ahms.js +0 -2
  190. package/dist/bin/chunk-k1xw3zbm.js +0 -34
  191. package/dist/bin/chunk-m07s5esk.js +0 -2
  192. package/dist/bin/chunk-n20kbxwb.js +0 -7364
  193. package/dist/bin/chunk-n2fnav53.js +0 -3
  194. package/dist/bin/chunk-nv211m42.js +0 -8
  195. package/dist/bin/chunk-psgjy3z4.js +0 -1
  196. package/dist/bin/chunk-qmnr82da.js +0 -1
  197. package/dist/bin/chunk-qqpb82ty.js +0 -2
  198. package/dist/bin/chunk-rqc8btkj.js +0 -2
  199. package/dist/bin/chunk-rs85xvt7.js +0 -1
  200. package/dist/bin/chunk-sj5csg49.js +0 -2
  201. package/dist/bin/chunk-tjgy10zm.js +0 -9
  202. package/dist/bin/chunk-v0beqdna.js +0 -1
  203. package/dist/bin/chunk-vf2s3tba.js +0 -1
  204. package/dist/bin/chunk-vzkfjrx2.js +0 -511
  205. package/dist/bin/chunk-wsh5ervz.js +0 -1
  206. package/dist/bin/chunk-xenhbdmr.js +0 -1
  207. package/dist/bin/chunk-xrdpxwbf.js +0 -1
  208. package/dist/bin/chunk-y68m9bx7.js +0 -2
  209. package/dist/chunk-4884der5.js +0 -1
  210. package/dist/chunk-4wdxsnn2.js +0 -44
  211. package/dist/chunk-5hhyyhjt.js +0 -1
  212. package/dist/chunk-5zkacdw1.js +0 -1
  213. package/dist/chunk-6f68caq0.js +0 -1
  214. package/dist/chunk-7z50g5xz.js +0 -4
  215. package/dist/chunk-8fh4m5ge.js +0 -1
  216. package/dist/chunk-97pb7wb1.js +0 -1
  217. package/dist/chunk-ea7tn8nn.js +0 -709
  218. package/dist/chunk-ess6vxfj.js +0 -2
  219. package/dist/chunk-j06r5rwv.js +0 -2
  220. package/dist/chunk-j1g67djb.js +0 -92
  221. package/dist/chunk-k8x8mrkr.js +0 -2
  222. package/dist/chunk-mnmz8t7q.js +0 -34
  223. package/dist/chunk-n1fyryha.js +0 -141
  224. package/dist/chunk-n1hg0jxs.js +0 -2
  225. package/dist/chunk-n5xmh0ma.js +0 -37
  226. package/dist/chunk-q22qfwsc.js +0 -22
  227. package/dist/chunk-r8t25tbm.js +0 -7355
  228. package/dist/chunk-t8hzekmk.js +0 -585
  229. package/dist/chunk-whyttetx.js +0 -5
  230. package/dist/chunk-yf8stygs.js +0 -114
  231. package/dist/chunk-ze5x2bpm.js +0 -2
  232. package/dist/chunk-zh0apedk.js +0 -60
  233. package/dist/chunk-zjyz926j.js +0 -2
@@ -1,24 +1,24 @@
1
- import{oh as U,ph as L}from"./chunk-bzth6d1s.js";import{Bp as K}from"./chunk-m07s5esk.js";import*as c from"node:crypto";import{readFileSync as D}from"node:fs";import{readdir as z}from"node:fs/promises";import{join as M}from"node:path";function R(e){if(e){let r=O(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 O(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function O(e){let{existsSync:t,readFileSync:s}=K("node:fs"),{homedir:r}=K("node:os"),{join:n}=K("node:path"),i=process.env.AWS_SHARED_CREDENTIALS_FILE||n(r(),".aws","credentials");if(!t(i))return null;let o=s(i,"utf-8"),a=null,g,l,u;for(let d of o.split(`
2
- `)){let y=d.trim();if(!y||y.startsWith("#")||y.startsWith(";"))continue;let h=y.match(/^\[([^\]]+)\]$/);if(h){if(a===e&&g&&l)return{accessKeyId:g,secretAccessKey:l,sessionToken:u};a=h[1],g=void 0,l=void 0,u=void 0;continue}if(a===e){let[S,...m]=y.split("="),p=m.join("=").trim();switch(S.trim().toLowerCase()){case"aws_access_key_id":g=p;break;case"aws_secret_access_key":l=p;break;case"aws_session_token":u=p;break}}}if(a===e&&g&&l)return{accessKeyId:g,secretAccessKey:l,sessionToken:u};return null}function B(e){let{buffer:t,byteOffset:s,byteLength:r}=e;if(t instanceof ArrayBuffer)return t.slice(s,s+r);let n=new ArrayBuffer(r);return new Uint8Array(n).set(new Uint8Array(e)),n}class V{client;region;explicitProfile;endpoint;endpointProtocol="https";forcePathStyle;explicitCredentials;constructor(e="us-east-1",t,s){let r=typeof e==="string"?s:e,n=typeof e==="string"?e:e.region??"us-east-1",i=typeof e==="string"?t:e.profile,o=r?.endpoint?U({region:n,path:"/",endpoint:r.endpoint}):void 0;this.region=n,this.explicitProfile=i,this.endpoint=o?.host,this.endpointProtocol=o?.protocol??"https",this.forcePathStyle=r?.forcePathStyle,this.explicitCredentials=r?.credentials,this.client=new L(r?.credentials,{profile:i,endpoint:r?.endpoint,forcePathStyle:r?.forcePathStyle})}getCredentials(){if(this.explicitCredentials?.accessKeyId&&this.explicitCredentials.secretAccessKey)return this.explicitCredentials;let e=R(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 n=Array.isArray(r)?r:[r];for(let i of n)t.push({Name:i.Name,CreationDate:i.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{di,u}from"./chunk-bckm6fre.js";import{li}from"./chunk-wge61ccr.js";import*as c from"node:crypto";import{readFileSync as D}from"node:fs";import{readdir as U}from"node:fs/promises";import{join as L}from"node:path";function yt(e){if(e){let r=R(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 R(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function R(e){let{existsSync:t,readFileSync:s}=li("node:fs"),{homedir:r}=li("node:os"),{join:n}=li("node:path"),i=process.env.AWS_SHARED_CREDENTIALS_FILE||n(r(),".aws","credentials");if(!t(i))return null;let o=s(i,"utf-8"),a=null,g,l,h;for(let d of o.split(`
2
+ `)){let p=d.trim();if(!p||p.startsWith("#")||p.startsWith(";"))continue;let y=p.match(/^\[([^\]]+)\]$/);if(y){if(a===e&&g&&l)return{accessKeyId:g,secretAccessKey:l,sessionToken:h};a=y[1],g=void 0,l=void 0,h=void 0;continue}if(a===e){let[b,...S]=p.split("="),m=S.join("=").trim();switch(b.trim().toLowerCase()){case"aws_access_key_id":g=m;break;case"aws_secret_access_key":l=m;break;case"aws_session_token":h=m;break}}}if(a===e&&g&&l)return{accessKeyId:g,secretAccessKey:l,sessionToken:h};return null}function B(e){let{buffer:t,byteOffset:s,byteLength:r}=e;if(t instanceof ArrayBuffer)return t.slice(s,s+r);let n=new ArrayBuffer(r);return new Uint8Array(n).set(new Uint8Array(e)),n}class f{client;region;explicitProfile;endpoint;endpointProtocol="https";forcePathStyle;explicitCredentials;constructor(e="us-east-1",t,s){let r=typeof e==="string"?s:e,n=typeof e==="string"?e:e.region??"us-east-1",i=typeof e==="string"?t:e.profile,o=r?.endpoint?di({region:n,path:"/",endpoint:r.endpoint}):void 0;this.region=n,this.explicitProfile=i,this.endpoint=o?.host,this.endpointProtocol=o?.protocol??"https",this.forcePathStyle=r?.forcePathStyle,this.explicitCredentials=r?.credentials,this.client=new u(r?.credentials,{profile:i,endpoint:r?.endpoint,forcePathStyle:r?.forcePathStyle})}getCredentials(){if(this.explicitCredentials?.accessKeyId&&this.explicitCredentials.secretAccessKey)return this.explicitCredentials;let e=yt(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 n=Array.isArray(r)?r:[r];for(let i of n)t.push({Name:i.Name,CreationDate:i.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
- </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((n)=>n.Key);for(let n=0;n<r.length;n+=1000){let i=r.slice(n,n+1000);await this.deleteObjects(e,i)}}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 n=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e.bucket}`,queryParams:r}),i=n?.ListBucketResult??n,o=i?.Contents;if(o){let g=Array.isArray(o)?o:[o];for(let l of g)t.push({Key:l.Key,LastModified:l.LastModified||"",Size:Number.parseInt(l.Size||"0"),ETag:l.ETag})}let a=i?.IsTruncated;s=a==="true"||a===!0?i?.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=[],n=(t?.ListBucketResult??t)?.Contents;if(n){let i=Array.isArray(n)?n:[n];for(let o of i){if(e.prefix&&!o.Key?.startsWith(e.prefix))continue;if(s.push({Key:o.Key||"",LastModified:o.LastModified||"",Size:Number.parseInt(o.Size||"0"),ETag:o.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[n,i]of Object.entries(e.metadata))t[`x-amz-meta-${n}`]=i;let s=e.key.split("/").map((n)=>encodeURIComponent(n)).join("/"),r=e.body instanceof Uint8Array&&!Buffer.isBuffer(e.body)?Buffer.from(e.body):e.body;if(Buffer.isBuffer(r)||r instanceof Uint8Array){let n=Buffer.isBuffer(r)?r:Buffer.from(r),{accessKeyId:i,secretAccessKey:o,sessionToken:a}=this.getCredentials(),g=this.s3VirtualHost(e.bucket),l=this.objectPath(e.bucket,s),u=this.objectUrl(e.bucket,s),d=new Date,y=d.toISOString().replace(/[:-]|\.\d{3}/g,""),h=d.toISOString().slice(0,10).replace(/-/g,""),S=c.createHash("sha256").update(n).digest("hex"),m={host:g,"x-amz-date":y,"x-amz-content-sha256":S,...t};if(a)m["x-amz-security-token"]=a;let p=Object.keys(m).sort().map((f)=>`${f.toLowerCase()}:${m[f].trim()}
6
- `).join(""),C=Object.keys(m).sort().map((f)=>f.toLowerCase()).join(";"),P=["PUT",l,"",p,C,S].join(`
7
- `),k="AWS4-HMAC-SHA256",b=`${h}/${this.region}/s3/aws4_request`,v=[k,y,b,c.createHash("sha256").update(P).digest("hex")].join(`
8
- `),q=c.createHmac("sha256",`AWS4${o}`).update(h).digest(),H=c.createHmac("sha256",q).update(this.region).digest(),E=c.createHmac("sha256",H).update("s3").digest(),w=c.createHmac("sha256",E).update("aws4_request").digest(),x=c.createHmac("sha256",w).update(v).digest("hex"),T=`${k} Credential=${i}/${b}, SignedHeaders=${C}, Signature=${x}`,A=await fetch(u,{method:"PUT",headers:{...m,Authorization:T},body:B(n)});if(!A.ok){let f=await A.text();throw Error(`S3 PUT failed: ${A.status} ${f}`)}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((n)=>encodeURIComponent(n)).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:n}=this.getCredentials(),i=this.s3VirtualHost(e),o=t.split("/").map((f)=>encodeURIComponent(f)).join("/"),a=this.objectPath(e,o),g=this.objectUrl(e,o),l=new Date,u=l.toISOString().replace(/[:-]|\.\d{3}/g,""),d=l.toISOString().slice(0,10).replace(/-/g,""),y=c.createHash("sha256").update("").digest("hex"),h={host:i,"x-amz-date":u,"x-amz-content-sha256":y};if(n)h["x-amz-security-token"]=n;let S=Object.keys(h).sort().map((f)=>`${f.toLowerCase()}:${h[f].trim()}
9
- `).join(""),m=Object.keys(h).sort().map((f)=>f.toLowerCase()).join(";"),p=["GET",a,"",S,m,y].join(`
10
- `),C="AWS4-HMAC-SHA256",P=`${d}/${this.region}/s3/aws4_request`,k=[C,u,P,c.createHash("sha256").update(p).digest("hex")].join(`
11
- `),b=c.createHmac("sha256",`AWS4${r}`).update(d).digest(),v=c.createHmac("sha256",b).update(this.region).digest(),q=c.createHmac("sha256",v).update("s3").digest(),H=c.createHmac("sha256",q).update("aws4_request").digest(),E=c.createHmac("sha256",H).update(k).digest("hex"),w=`${C} Credential=${s}/${P}, SignedHeaders=${m}, Signature=${E}`,x=await fetch(g,{method:"GET",headers:{...h,Authorization:w}});if(!x.ok){let f=await x.text();throw Error(`S3 GET failed: ${x.status} ${f}`)}let T=await x.arrayBuffer(),A=x.headers.get("content-length");return{body:new Uint8Array(T),contentType:x.headers.get("content-type")??void 0,contentLength:A?Number.parseInt(A,10):void 0}}async copyObject(e){let t={"x-amz-copy-source":`/${e.sourceBucket}/${e.sourceKey}`};if(e.metadataDirective)t["x-amz-metadata-directive"]=e.metadataDirective;if(e.contentType)t["Content-Type"]=e.contentType;if(e.metadata)for(let[s,r]of Object.entries(e.metadata))t[`x-amz-meta-${s}`]=r;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e.destinationBucket}/${e.destinationKey}`,headers:t})}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"?>
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((n)=>n.Key);for(let n=0;n<r.length;n+=1000){let i=r.slice(n,n+1000);await this.deleteObjects(e,i)}}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 n=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e.bucket}`,queryParams:r}),i=n?.ListBucketResult??n,o=i?.Contents;if(o){let g=Array.isArray(o)?o:[o];for(let l of g)t.push({Key:l.Key,LastModified:l.LastModified||"",Size:Number.parseInt(l.Size||"0"),ETag:l.ETag})}let a=i?.IsTruncated;s=a==="true"||a===!0?i?.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=[],n=(t?.ListBucketResult??t)?.Contents;if(n){let i=Array.isArray(n)?n:[n];for(let o of i){if(e.prefix&&!o.Key?.startsWith(e.prefix))continue;if(s.push({Key:o.Key||"",LastModified:o.LastModified||"",Size:Number.parseInt(o.Size||"0"),ETag:o.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[n,i]of Object.entries(e.metadata))t[`x-amz-meta-${n}`]=i;let s=e.key.split("/").map((n)=>encodeURIComponent(n)).join("/"),r=e.body instanceof Uint8Array&&!Buffer.isBuffer(e.body)?Buffer.from(e.body):e.body;if(Buffer.isBuffer(r)||r instanceof Uint8Array){let n=Buffer.isBuffer(r)?r:Buffer.from(r),{accessKeyId:i,secretAccessKey:o,sessionToken:a}=this.getCredentials(),g=this.s3VirtualHost(e.bucket),l=this.objectPath(e.bucket,s),h=this.objectUrl(e.bucket,s),d=new Date,p=d.toISOString().replace(/[:-]|\.\d{3}/g,""),y=d.toISOString().slice(0,10).replace(/-/g,""),b=c.createHash("sha256").update(n).digest("hex"),S={host:g,"x-amz-date":p,"x-amz-content-sha256":b,...t};if(a)S["x-amz-security-token"]=a;let m=Object.keys(S).sort().map((P)=>`${P.toLowerCase()}:${S[P].trim()}
6
+ `).join(""),k=Object.keys(S).sort().map((P)=>P.toLowerCase()).join(";"),T=["PUT",l,"",m,k,b].join(`
7
+ `),w="AWS4-HMAC-SHA256",C=`${y}/${this.region}/s3/aws4_request`,q=[w,p,C,c.createHash("sha256").update(T).digest("hex")].join(`
8
+ `),j=c.createHmac("sha256",`AWS4${o}`).update(y).digest(),I=c.createHmac("sha256",j).update(this.region).digest(),H=c.createHmac("sha256",I).update("s3").digest(),E=c.createHmac("sha256",H).update("aws4_request").digest(),v=c.createHmac("sha256",E).update(q).digest("hex"),A=`${w} Credential=${i}/${C}, SignedHeaders=${k}, Signature=${v}`,x=await fetch(h,{method:"PUT",headers:{...S,Authorization:A},body:B(n)});if(!x.ok){let P=await x.text();throw Error(`S3 PUT failed: ${x.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((n)=>encodeURIComponent(n)).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:n}=this.getCredentials(),i=this.s3VirtualHost(e),o=t.split("/").map((P)=>encodeURIComponent(P)).join("/"),a=this.objectPath(e,o),g=this.objectUrl(e,o),l=new Date,h=l.toISOString().replace(/[:-]|\.\d{3}/g,""),d=l.toISOString().slice(0,10).replace(/-/g,""),p=c.createHash("sha256").update("").digest("hex"),y={host:i,"x-amz-date":h,"x-amz-content-sha256":p};if(n)y["x-amz-security-token"]=n;let b=Object.keys(y).sort().map((P)=>`${P.toLowerCase()}:${y[P].trim()}
9
+ `).join(""),S=Object.keys(y).sort().map((P)=>P.toLowerCase()).join(";"),m=["GET",a,"",b,S,p].join(`
10
+ `),k="AWS4-HMAC-SHA256",T=`${d}/${this.region}/s3/aws4_request`,w=[k,h,T,c.createHash("sha256").update(m).digest("hex")].join(`
11
+ `),C=c.createHmac("sha256",`AWS4${r}`).update(d).digest(),q=c.createHmac("sha256",C).update(this.region).digest(),j=c.createHmac("sha256",q).update("s3").digest(),I=c.createHmac("sha256",j).update("aws4_request").digest(),H=c.createHmac("sha256",I).update(w).digest("hex"),E=`${k} Credential=${s}/${T}, SignedHeaders=${S}, Signature=${H}`,v=await fetch(g,{method:"GET",headers:{...y,Authorization:E}});if(!v.ok){let P=await v.text();throw Error(`S3 GET failed: ${v.status} ${P}`)}let A=await v.arrayBuffer(),x=v.headers.get("content-length");return{body:new Uint8Array(A),contentType:v.headers.get("content-type")??void 0,contentLength:x?Number.parseInt(x,10):void 0}}async copyObject(e){let t={"x-amz-copy-source":`/${e.sourceBucket}/${e.sourceKey}`};if(e.metadataDirective)t["x-amz-metadata-directive"]=e.metadataDirective;if(e.contentType)t["Content-Type"]=e.contentType;if(e.metadata)for(let[s,r]of Object.entries(e.metadata))t[`x-amz-meta-${s}`]=r;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e.destinationBucket}/${e.destinationKey}`,headers:t})}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((n)=>`<Object><Key>${n}</Key></Object>`).join(`
14
14
  `)}
15
- </Delete>`,r=c.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=D(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((i)=>s.includes(i)))continue;if(e.include&&!e.include.some((i)=>s.includes(i)))continue;let r=s.substring(e.source.length+1),n=e.prefix?`${e.prefix}/${r}`:r;if(!e.dryRun){let i=D(s);await this.putObject({bucket:e.bucket,key:n,body:i,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((n)=>n.Key);if(r.length>0)await this.deleteObjects(e,r)}async getBucketSize(e,t){return(await this.list({bucket:e,prefix:t})).reduce((r,n)=>r+n.Size,0)}async listFilesRecursive(e){let t=[],s=await z(e,{withFileTypes:!0});for(let r of s){let n=M(e,r.name);if(r.isDirectory()){let i=await this.listFilesRecursive(n);t.push(...i)}else t.push(n)}return t}async putBucketPolicy(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:n}=this.getCredentials(),i=this.s3BaseHost(),o=typeof t==="string"?t:JSON.stringify(t),a=new Date,g=a.toISOString().replace(/[:-]|\.\d{3}/g,""),l=a.toISOString().slice(0,10).replace(/-/g,""),u=c.createHash("sha256").update(o).digest("hex"),d="/"+e,y="policy=",h={host:i,"x-amz-date":g,"x-amz-content-sha256":u,"content-type":"application/json"};if(n)h["x-amz-security-token"]=n;let S=Object.keys(h).sort().map((A)=>`${A.toLowerCase()}:${h[A].trim()}
16
- `).join(""),m=Object.keys(h).sort().map((A)=>A.toLowerCase()).join(";"),p=["PUT",d,"policy=",S,m,u].join(`
17
- `),C="AWS4-HMAC-SHA256",P=`${l}/${this.region}/s3/aws4_request`,k=[C,g,P,c.createHash("sha256").update(p).digest("hex")].join(`
18
- `),b=c.createHmac("sha256","AWS4"+r).update(l).digest(),v=c.createHmac("sha256",b).update(this.region).digest(),q=c.createHmac("sha256",v).update("s3").digest(),H=c.createHmac("sha256",q).update("aws4_request").digest(),E=c.createHmac("sha256",H).update(k).digest("hex"),w=`${C} Credential=${s}/${P}, SignedHeaders=${m}, Signature=${E}`,x=`${this.endpointProtocol}://${i}${d}?policy=`,T=await fetch(x,{method:"PUT",headers:{...h,Authorization:w},body:o});if(!T.ok){let A=await T.text();throw Error(`Failed to put bucket policy: ${T.status} ${A}`)}}async getBucketPolicy(e){let{accessKeyId:t,secretAccessKey:s,sessionToken:r}=this.getCredentials(),n=this.s3BaseHost(),i=new Date,o=i.toISOString().replace(/[:-]|\.\d{3}/g,""),a=i.toISOString().slice(0,10).replace(/-/g,""),g=c.createHash("sha256").update("").digest("hex"),l="/"+e,u="policy=",d={host:n,"x-amz-date":o,"x-amz-content-sha256":g};if(r)d["x-amz-security-token"]=r;let y=Object.keys(d).sort().map((T)=>`${T.toLowerCase()}:${d[T].trim()}
19
- `).join(""),h=Object.keys(d).sort().map((T)=>T.toLowerCase()).join(";"),S=["GET",l,"policy=",y,h,g].join(`
20
- `),m="AWS4-HMAC-SHA256",p=`${a}/${this.region}/s3/aws4_request`,C=[m,o,p,c.createHash("sha256").update(S).digest("hex")].join(`
21
- `),P=c.createHmac("sha256","AWS4"+s).update(a).digest(),k=c.createHmac("sha256",P).update(this.region).digest(),b=c.createHmac("sha256",k).update("s3").digest(),v=c.createHmac("sha256",b).update("aws4_request").digest(),q=c.createHmac("sha256",v).update(C).digest("hex"),H=`${m} Credential=${t}/${p}, SignedHeaders=${h}, Signature=${q}`,E=`${this.endpointProtocol}://${n}${l}?policy=`,w=await fetch(E,{method:"GET",headers:{...d,Authorization:H}});if(w.status===404)return null;if(!w.ok){let T=await w.text();throw Error(`Failed to get bucket policy: ${w.status} ${T}`)}let x=await w.text();return JSON.parse(x)}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){return{Status:(await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{versioning:""}}))?.VersioningConfiguration?.Status}}async putBucketVersioning(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
15
+ </Delete>`,r=c.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=D(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((i)=>s.includes(i)))continue;if(e.include&&!e.include.some((i)=>s.includes(i)))continue;let r=s.substring(e.source.length+1),n=e.prefix?`${e.prefix}/${r}`:r;if(!e.dryRun){let i=D(s);await this.putObject({bucket:e.bucket,key:n,body:i,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((n)=>n.Key);if(r.length>0)await this.deleteObjects(e,r)}async getBucketSize(e,t){return(await this.list({bucket:e,prefix:t})).reduce((r,n)=>r+n.Size,0)}async listFilesRecursive(e){let t=[],s=await U(e,{withFileTypes:!0});for(let r of s){let n=L(e,r.name);if(r.isDirectory()){let i=await this.listFilesRecursive(n);t.push(...i)}else t.push(n)}return t}async putBucketPolicy(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:n}=this.getCredentials(),i=this.s3BaseHost(),o=typeof t==="string"?t:JSON.stringify(t),a=new Date,g=a.toISOString().replace(/[:-]|\.\d{3}/g,""),l=a.toISOString().slice(0,10).replace(/-/g,""),h=c.createHash("sha256").update(o).digest("hex"),d="/"+e,p="policy=",y={host:i,"x-amz-date":g,"x-amz-content-sha256":h,"content-type":"application/json"};if(n)y["x-amz-security-token"]=n;let b=Object.keys(y).sort().map((x)=>`${x.toLowerCase()}:${y[x].trim()}
16
+ `).join(""),S=Object.keys(y).sort().map((x)=>x.toLowerCase()).join(";"),m=["PUT",d,"policy=",b,S,h].join(`
17
+ `),k="AWS4-HMAC-SHA256",T=`${l}/${this.region}/s3/aws4_request`,w=[k,g,T,c.createHash("sha256").update(m).digest("hex")].join(`
18
+ `),C=c.createHmac("sha256","AWS4"+r).update(l).digest(),q=c.createHmac("sha256",C).update(this.region).digest(),j=c.createHmac("sha256",q).update("s3").digest(),I=c.createHmac("sha256",j).update("aws4_request").digest(),H=c.createHmac("sha256",I).update(w).digest("hex"),E=`${k} Credential=${s}/${T}, SignedHeaders=${S}, Signature=${H}`,v=`${this.endpointProtocol}://${i}${d}?policy=`,A=await fetch(v,{method:"PUT",headers:{...y,Authorization:E},body:o});if(!A.ok){let x=await A.text();throw Error(`Failed to put bucket policy: ${A.status} ${x}`)}}async getBucketPolicy(e){let{accessKeyId:t,secretAccessKey:s,sessionToken:r}=this.getCredentials(),n=this.s3BaseHost(),i=new Date,o=i.toISOString().replace(/[:-]|\.\d{3}/g,""),a=i.toISOString().slice(0,10).replace(/-/g,""),g=c.createHash("sha256").update("").digest("hex"),l="/"+e,h="policy=",d={host:n,"x-amz-date":o,"x-amz-content-sha256":g};if(r)d["x-amz-security-token"]=r;let p=Object.keys(d).sort().map((A)=>`${A.toLowerCase()}:${d[A].trim()}
19
+ `).join(""),y=Object.keys(d).sort().map((A)=>A.toLowerCase()).join(";"),b=["GET",l,"policy=",p,y,g].join(`
20
+ `),S="AWS4-HMAC-SHA256",m=`${a}/${this.region}/s3/aws4_request`,k=[S,o,m,c.createHash("sha256").update(b).digest("hex")].join(`
21
+ `),T=c.createHmac("sha256","AWS4"+s).update(a).digest(),w=c.createHmac("sha256",T).update(this.region).digest(),C=c.createHmac("sha256",w).update("s3").digest(),q=c.createHmac("sha256",C).update("aws4_request").digest(),j=c.createHmac("sha256",q).update(k).digest("hex"),I=`${S} Credential=${t}/${m}, SignedHeaders=${y}, Signature=${j}`,H=`${this.endpointProtocol}://${n}${l}?policy=`,E=await fetch(H,{method:"GET",headers:{...d,Authorization:I}});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){return{Status:(await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{versioning:""}}))?.VersioningConfiguration?.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{return(await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{lifecycle:""}}))?.LifecycleConfiguration}catch(t){if(t.statusCode===404)return null;throw t}}async putBucketLifecycleConfiguration(e,t){let r=`<?xml version="1.0" encoding="UTF-8"?>
@@ -57,17 +57,17 @@ import{oh as U,ph as L}from"./chunk-bzth6d1s.js";import{Bp as K}from"./chunk-m07
57
57
  <IgnorePublicAcls>${t.IgnorePublicAcls??!0}</IgnorePublicAcls>
58
58
  <BlockPublicPolicy>${t.BlockPublicPolicy??!0}</BlockPublicPolicy>
59
59
  <RestrictPublicBuckets>${t.RestrictPublicBuckets??!0}</RestrictPublicBuckets>
60
- </PublicAccessBlockConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{publicAccessBlock:""},headers:{"Content-Type":"application/xml"},body:s})}async deletePublicAccessBlock(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{publicAccessBlock:""}})}generatePresignedGetUrl(e,t,s=3600){let{accessKeyId:r,secretAccessKey:n}=this.getCredentials(),i=this.s3VirtualHost(e),o=new Date,a=o.toISOString().replace(/[:-]|\.\d{3}/g,""),g=o.toISOString().slice(0,10).replace(/-/g,""),l=`${g}/${this.region}/s3/aws4_request`,u=`${r}/${l}`,d=t.split("/").map((b)=>encodeURIComponent(b)).join("/"),y=new URLSearchParams({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":u,"X-Amz-Date":a,"X-Amz-Expires":s.toString(),"X-Amz-SignedHeaders":"host"}),h=["GET",this.objectPath(e,d),y.toString(),`host:${i}
60
+ </PublicAccessBlockConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{publicAccessBlock:""},headers:{"Content-Type":"application/xml"},body:s})}async deletePublicAccessBlock(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{publicAccessBlock:""}})}generatePresignedGetUrl(e,t,s=3600){let{accessKeyId:r,secretAccessKey:n}=this.getCredentials(),i=this.s3VirtualHost(e),o=new Date,a=o.toISOString().replace(/[:-]|\.\d{3}/g,""),g=o.toISOString().slice(0,10).replace(/-/g,""),l=`${g}/${this.region}/s3/aws4_request`,h=`${r}/${l}`,d=t.split("/").map((C)=>encodeURIComponent(C)).join("/"),p=new URLSearchParams({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":h,"X-Amz-Date":a,"X-Amz-Expires":s.toString(),"X-Amz-SignedHeaders":"host"}),y=["GET",this.objectPath(e,d),p.toString(),`host:${i}
61
61
  `,"host","UNSIGNED-PAYLOAD"].join(`
62
- `),S=["AWS4-HMAC-SHA256",a,l,c.createHash("sha256").update(h).digest("hex")].join(`
63
- `),m=c.createHmac("sha256",`AWS4${n}`).update(g).digest(),p=c.createHmac("sha256",m).update(this.region).digest(),C=c.createHmac("sha256",p).update("s3").digest(),P=c.createHmac("sha256",C).update("aws4_request").digest(),k=c.createHmac("sha256",P).update(S).digest("hex");return y.append("X-Amz-Signature",k),`${this.endpointProtocol}://${i}${this.objectPath(e,d)}?${y.toString()}`}generatePresignedPutUrl(e,t,s,r=3600){let{accessKeyId:n,secretAccessKey:i}=this.getCredentials(),o=this.s3VirtualHost(e),a=new Date,g=a.toISOString().replace(/[:-]|\.\d{3}/g,""),l=a.toISOString().slice(0,10).replace(/-/g,""),u=`${l}/${this.region}/s3/aws4_request`,d=`${n}/${u}`,y=t.split("/").map((v)=>encodeURIComponent(v)).join("/"),h=new URLSearchParams({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":d,"X-Amz-Date":g,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"content-type;host"}),S=["PUT",this.objectPath(e,y),h.toString(),`content-type:${s}
62
+ `),b=["AWS4-HMAC-SHA256",a,l,c.createHash("sha256").update(y).digest("hex")].join(`
63
+ `),S=c.createHmac("sha256",`AWS4${n}`).update(g).digest(),m=c.createHmac("sha256",S).update(this.region).digest(),k=c.createHmac("sha256",m).update("s3").digest(),T=c.createHmac("sha256",k).update("aws4_request").digest(),w=c.createHmac("sha256",T).update(b).digest("hex");return p.append("X-Amz-Signature",w),`${this.endpointProtocol}://${i}${this.objectPath(e,d)}?${p.toString()}`}generatePresignedPutUrl(e,t,s,r=3600){let{accessKeyId:n,secretAccessKey:i}=this.getCredentials(),o=this.s3VirtualHost(e),a=new Date,g=a.toISOString().replace(/[:-]|\.\d{3}/g,""),l=a.toISOString().slice(0,10).replace(/-/g,""),h=`${l}/${this.region}/s3/aws4_request`,d=`${n}/${h}`,p=t.split("/").map((q)=>encodeURIComponent(q)).join("/"),y=new URLSearchParams({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":d,"X-Amz-Date":g,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"content-type;host"}),b=["PUT",this.objectPath(e,p),y.toString(),`content-type:${s}
64
64
  host:${o}
65
65
  `,"content-type;host","UNSIGNED-PAYLOAD"].join(`
66
- `),m=["AWS4-HMAC-SHA256",g,u,c.createHash("sha256").update(S).digest("hex")].join(`
67
- `),p=c.createHmac("sha256",`AWS4${i}`).update(l).digest(),C=c.createHmac("sha256",p).update(this.region).digest(),P=c.createHmac("sha256",C).update("s3").digest(),k=c.createHmac("sha256",P).update("aws4_request").digest(),b=c.createHmac("sha256",k).update(m).digest("hex");return h.append("X-Amz-Signature",b),`${this.endpointProtocol}://${o}${this.objectPath(e,y)}?${h.toString()}`}async createMultipartUpload(e,t,s){let r={};if(s?.contentType)r["Content-Type"]=s.contentType;if(s?.metadata)for(let[a,g]of Object.entries(s.metadata))r[`x-amz-meta-${a}`]=g;let n=t.split("/").map((a)=>encodeURIComponent(a)).join("/"),i=await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${n}`,bucket:e,queryParams:{uploads:""},headers:r});return{UploadId:(i?.InitiateMultipartUploadResult??i)?.UploadId}}async uploadPart(e,t,s,r,n){let{accessKeyId:i,secretAccessKey:o,sessionToken:a}=this.getCredentials(),g=this.s3VirtualHost(e),l=t.split("/").map((j)=>encodeURIComponent(j)).join("/"),u=this.objectPath(e,l),d=`${this.objectUrl(e,l)}?partNumber=${r}&uploadId=${encodeURIComponent(s)}`,y=new Date,h=y.toISOString().replace(/[:-]|\.\d{3}/g,""),S=y.toISOString().slice(0,10).replace(/-/g,""),m=c.createHash("sha256").update(n).digest("hex"),p={host:g,"x-amz-date":h,"x-amz-content-sha256":m};if(a)p["x-amz-security-token"]=a;let C=Object.keys(p).sort().map((j)=>`${j.toLowerCase()}:${p[j].trim()}
68
- `).join(""),P=Object.keys(p).sort().map((j)=>j.toLowerCase()).join(";"),k=["PUT",u,`partNumber=${r}&uploadId=${encodeURIComponent(s)}`,C,P,m].join(`
69
- `),b="AWS4-HMAC-SHA256",v=`${S}/${this.region}/s3/aws4_request`,q=[b,h,v,c.createHash("sha256").update(k).digest("hex")].join(`
70
- `),H=c.createHmac("sha256",`AWS4${o}`).update(S).digest(),E=c.createHmac("sha256",H).update(this.region).digest(),w=c.createHmac("sha256",E).update("s3").digest(),x=c.createHmac("sha256",w).update("aws4_request").digest(),T=c.createHmac("sha256",x).update(q).digest("hex"),A=`${b} Credential=${i}/${v}, SignedHeaders=${P}, Signature=${T}`,f=await fetch(d,{method:"PUT",headers:{...p,Authorization:A},body:B(n)});if(!f.ok){let j=await f.text();throw Error(`Upload part failed: ${f.status} ${j}`)}return{ETag:f.headers.get("etag")||""}}async completeMultipartUpload(e,t,s,r){let n=t.split("/").map((a)=>encodeURIComponent(a)).join("/"),o=`<?xml version="1.0" encoding="UTF-8"?>
66
+ `),S=["AWS4-HMAC-SHA256",g,h,c.createHash("sha256").update(b).digest("hex")].join(`
67
+ `),m=c.createHmac("sha256",`AWS4${i}`).update(l).digest(),k=c.createHmac("sha256",m).update(this.region).digest(),T=c.createHmac("sha256",k).update("s3").digest(),w=c.createHmac("sha256",T).update("aws4_request").digest(),C=c.createHmac("sha256",w).update(S).digest("hex");return y.append("X-Amz-Signature",C),`${this.endpointProtocol}://${o}${this.objectPath(e,p)}?${y.toString()}`}async createMultipartUpload(e,t,s){let r={};if(s?.contentType)r["Content-Type"]=s.contentType;if(s?.metadata)for(let[a,g]of Object.entries(s.metadata))r[`x-amz-meta-${a}`]=g;let n=t.split("/").map((a)=>encodeURIComponent(a)).join("/"),i=await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${n}`,bucket:e,queryParams:{uploads:""},headers:r});return{UploadId:(i?.InitiateMultipartUploadResult??i)?.UploadId}}async uploadPart(e,t,s,r,n){let{accessKeyId:i,secretAccessKey:o,sessionToken:a}=this.getCredentials(),g=this.s3VirtualHost(e),l=t.split("/").map((K)=>encodeURIComponent(K)).join("/"),h=this.objectPath(e,l),d=`${this.objectUrl(e,l)}?partNumber=${r}&uploadId=${encodeURIComponent(s)}`,p=new Date,y=p.toISOString().replace(/[:-]|\.\d{3}/g,""),b=p.toISOString().slice(0,10).replace(/-/g,""),S=c.createHash("sha256").update(n).digest("hex"),m={host:g,"x-amz-date":y,"x-amz-content-sha256":S};if(a)m["x-amz-security-token"]=a;let k=Object.keys(m).sort().map((K)=>`${K.toLowerCase()}:${m[K].trim()}
68
+ `).join(""),T=Object.keys(m).sort().map((K)=>K.toLowerCase()).join(";"),w=["PUT",h,`partNumber=${r}&uploadId=${encodeURIComponent(s)}`,k,T,S].join(`
69
+ `),C="AWS4-HMAC-SHA256",q=`${b}/${this.region}/s3/aws4_request`,j=[C,y,q,c.createHash("sha256").update(w).digest("hex")].join(`
70
+ `),I=c.createHmac("sha256",`AWS4${o}`).update(b).digest(),H=c.createHmac("sha256",I).update(this.region).digest(),E=c.createHmac("sha256",H).update("s3").digest(),v=c.createHmac("sha256",E).update("aws4_request").digest(),A=c.createHmac("sha256",v).update(j).digest("hex"),x=`${C} Credential=${i}/${q}, SignedHeaders=${T}, Signature=${A}`,P=await fetch(d,{method:"PUT",headers:{...m,Authorization:x},body:B(n)});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 n=t.split("/").map((a)=>encodeURIComponent(a)).join("/"),o=`<?xml version="1.0" encoding="UTF-8"?>
71
71
  <CompleteMultipartUpload>${r.sort((a,g)=>a.PartNumber-g.PartNumber).map((a)=>`<Part><PartNumber>${a.PartNumber}</PartNumber><ETag>${a.ETag}</ETag></Part>`).join("")}</CompleteMultipartUpload>`;await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${n}`,bucket:e,queryParams:{uploadId:s},headers:{"Content-Type":"application/xml"},body:o})}async abortMultipartUpload(e,t,s){let r=t.split("/").map((n)=>encodeURIComponent(n)).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((n)=>({Key:n.Key,UploadId:n.UploadId,Initiated:n.Initiated}))}async restoreObject(e,t,s,r="Standard"){let n=`<?xml version="1.0" encoding="UTF-8"?>
72
72
  <RestoreRequest>
73
73
  <Days>${s}</Days>
@@ -80,13 +80,13 @@ host:${o}
80
80
  <ExpressionType>SQL</ExpressionType>
81
81
  <InputSerialization>${i}</InputSerialization>
82
82
  <OutputSerialization>${o}</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:a,rawResponse:!0})}async getSignedUrl(e){let{bucket:t,key:s,expiresIn:r=3600,operation:n="getObject"}=e,{accessKeyId:i,secretAccessKey:o,sessionToken:a}=this.getCredentials(),g=new Date,l=g.toISOString().replace(/[:-]|\.\d{3}/g,""),u=g.toISOString().slice(0,10).replace(/-/g,""),d=this.s3VirtualHost(t),y=n==="putObject"?"PUT":"GET",h="AWS4-HMAC-SHA256",S=`${u}/${this.region}/s3/aws4_request`,p={"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":`${i}/${S}`,"X-Amz-Date":l,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"host"};if(a)p["X-Amz-Security-Token"]=a;let P=Object.keys(p).sort().map((I)=>`${encodeURIComponent(I)}=${encodeURIComponent(p[I])}`).join("&"),k=s.split("/").map((I)=>encodeURIComponent(I)).join("/"),b=this.objectPath(t,k),v=`host:${d}
84
- `,E=[y,b,P,v,"host","UNSIGNED-PAYLOAD"].join(`
85
- `),w=["AWS4-HMAC-SHA256",l,S,c.createHash("sha256").update(E).digest("hex")].join(`
86
- `),x=c.createHmac("sha256",`AWS4${o}`).update(u).digest(),T=c.createHmac("sha256",x).update(this.region).digest(),A=c.createHmac("sha256",T).update("s3").digest(),f=c.createHmac("sha256",A).update("aws4_request").digest(),j=c.createHmac("sha256",f).update(w).digest("hex");return`${this.endpointProtocol}://${d}${b}?${P}&X-Amz-Signature=${j}`}async listObjects(e){let{bucket:t,prefix:s,maxKeys:r=1000,continuationToken:n}=e,i={"list-type":"2","max-keys":r.toString()};if(s)i.prefix=s;if(n)i["continuation-token"]=n;let o=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:i}),a=[],g=o?.ListBucketResult??o;if(g?.Contents){let l=Array.isArray(g.Contents)?g.Contents:[g.Contents];for(let u of l)a.push({Key:u.Key||"",LastModified:u.LastModified||"",Size:Number.parseInt(u.Size||"0"),ETag:u.ETag})}return{objects:a,nextContinuationToken:g?.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 i=s.slice(r,r+1000).map((o)=>o.Key);await this.deleteObjects(e,i),t+=i.length}try{let r,n;do{let i=await this.listObjectVersions({bucket:e,keyMarker:r,versionIdMarker:n,maxKeys:1000}),o=[];if(i.versions)for(let a of i.versions)o.push({Key:a.Key,VersionId:a.VersionId});if(i.deleteMarkers)for(let a of i.deleteMarkers)o.push({Key:a.Key,VersionId:a.VersionId});if(o.length>0)await this.deleteObjectVersions(e,o),t+=o.length;r=i.nextKeyMarker,n=i.nextVersionIdMarker}while(r)}catch{}return{deletedCount:t}}async listObjectVersions(e){let{bucket:t,prefix:s,keyMarker:r,versionIdMarker:n,maxKeys:i=1000}=e,o={versions:"","max-keys":i.toString()};if(s)o.prefix=s;if(r)o["key-marker"]=r;if(n)o["version-id-marker"]=n;let a=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:o}),g=[],l=[];if(a.Version){let u=Array.isArray(a.Version)?a.Version:[a.Version];for(let d of u)g.push({Key:d.Key,VersionId:d.VersionId,IsLatest:d.IsLatest==="true"})}if(a.DeleteMarker){let u=Array.isArray(a.DeleteMarker)?a.DeleteMarker:[a.DeleteMarker];for(let d of u)l.push({Key:d.Key,VersionId:d.VersionId,IsLatest:d.IsLatest==="true"})}return{versions:g,deleteMarkers:l,nextKeyMarker:a.NextKeyMarker,nextVersionIdMarker:a.NextVersionIdMarker}}async deleteObjectVersions(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
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:a,rawResponse:!0})}async getSignedUrl(e){let{bucket:t,key:s,expiresIn:r=3600,operation:n="getObject"}=e,{accessKeyId:i,secretAccessKey:o,sessionToken:a}=this.getCredentials(),g=new Date,l=g.toISOString().replace(/[:-]|\.\d{3}/g,""),h=g.toISOString().slice(0,10).replace(/-/g,""),d=this.s3VirtualHost(t),p=n==="putObject"?"PUT":"GET",y="AWS4-HMAC-SHA256",b=`${h}/${this.region}/s3/aws4_request`,m={"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":`${i}/${b}`,"X-Amz-Date":l,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"host"};if(a)m["X-Amz-Security-Token"]=a;let T=Object.keys(m).sort().map((O)=>`${encodeURIComponent(O)}=${encodeURIComponent(m[O])}`).join("&"),w=s.split("/").map((O)=>encodeURIComponent(O)).join("/"),C=this.objectPath(t,w),q=`host:${d}
84
+ `,H=[p,C,T,q,"host","UNSIGNED-PAYLOAD"].join(`
85
+ `),E=["AWS4-HMAC-SHA256",l,b,c.createHash("sha256").update(H).digest("hex")].join(`
86
+ `),v=c.createHmac("sha256",`AWS4${o}`).update(h).digest(),A=c.createHmac("sha256",v).update(this.region).digest(),x=c.createHmac("sha256",A).update("s3").digest(),P=c.createHmac("sha256",x).update("aws4_request").digest(),K=c.createHmac("sha256",P).update(E).digest("hex");return`${this.endpointProtocol}://${d}${C}?${T}&X-Amz-Signature=${K}`}async listObjects(e){let{bucket:t,prefix:s,maxKeys:r=1000,continuationToken:n}=e,i={"list-type":"2","max-keys":r.toString()};if(s)i.prefix=s;if(n)i["continuation-token"]=n;let o=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:i}),a=[],g=o?.ListBucketResult??o;if(g?.Contents){let l=Array.isArray(g.Contents)?g.Contents:[g.Contents];for(let h of l)a.push({Key:h.Key||"",LastModified:h.LastModified||"",Size:Number.parseInt(h.Size||"0"),ETag:h.ETag})}return{objects:a,nextContinuationToken:g?.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 i=s.slice(r,r+1000).map((o)=>o.Key);await this.deleteObjects(e,i),t+=i.length}try{let r,n;do{let i=await this.listObjectVersions({bucket:e,keyMarker:r,versionIdMarker:n,maxKeys:1000}),o=[];if(i.versions)for(let a of i.versions)o.push({Key:a.Key,VersionId:a.VersionId});if(i.deleteMarkers)for(let a of i.deleteMarkers)o.push({Key:a.Key,VersionId:a.VersionId});if(o.length>0)await this.deleteObjectVersions(e,o),t+=o.length;r=i.nextKeyMarker,n=i.nextVersionIdMarker}while(r)}catch{}return{deletedCount:t}}async listObjectVersions(e){let{bucket:t,prefix:s,keyMarker:r,versionIdMarker:n,maxKeys:i=1000}=e,o={versions:"","max-keys":i.toString()};if(s)o.prefix=s;if(r)o["key-marker"]=r;if(n)o["version-id-marker"]=n;let a=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:o}),g=[],l=[];if(a.Version){let h=Array.isArray(a.Version)?a.Version:[a.Version];for(let d of h)g.push({Key:d.Key,VersionId:d.VersionId,IsLatest:d.IsLatest==="true"})}if(a.DeleteMarker){let h=Array.isArray(a.DeleteMarker)?a.DeleteMarker:[a.DeleteMarker];for(let d of h)l.push({Key:d.Key,VersionId:d.VersionId,IsLatest:d.IsLatest==="true"})}return{versions:g,deleteMarkers:l,nextKeyMarker:a.NextKeyMarker,nextVersionIdMarker:a.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((n)=>`<Object><Key>${n.Key}</Key>${n.VersionId?`<VersionId>${n.VersionId}</VersionId>`:""}</Object>`).join(`
90
90
  `)}
91
91
  </Delete>`,r=c.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{R as Bg,V as Cg};
92
+ export{yt,f};
@@ -0,0 +1 @@
1
+ import{Jl,La,Xl,no,io,oo,ms}from"./chunk-16rs9egs.js";import"./chunk-bj5nq0kn.js";export{Jl as MANAGEMENT_DASHBOARD_SITE,ms as buildManagementDashboardArtifact,La as dashboardCredentialsFile,io as ensureManagementDashboard,oo as managementDashboardSiteNames,Xl as resolveDashboardAuth,no as resolveUiSource};
@@ -0,0 +1,2 @@
1
+ function _o(n){let t=new RegExp("[\\u007F-\\uFFFF]","g");return JSON.stringify(n).replace(t,(o)=>`\\u${o.charCodeAt(0).toString(16).padStart(4,"0")}`)}
2
+ export{_o};