@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.
- package/dist/aws/index.js +1 -1
- package/dist/bin/chunk-16rs9egs.js +6 -0
- package/dist/bin/chunk-1j2sja1j.js +1 -0
- package/dist/bin/chunk-1rcsm0px.js +1 -0
- package/dist/bin/chunk-1s4dny8d.js +1 -0
- package/dist/bin/chunk-1wvrtg42.js +8 -0
- package/dist/bin/chunk-1x7mm26k.js +1 -0
- package/dist/bin/chunk-2paqksap.js +6 -0
- package/dist/bin/chunk-3gwmejhk.js +1 -0
- package/dist/bin/chunk-4201mvaj.js +2 -0
- package/dist/bin/chunk-49sthm4q.js +2 -0
- package/dist/bin/chunk-4yntpqbe.js +1 -0
- package/dist/bin/chunk-4zbnwt9b.js +2 -0
- package/dist/{chunk-2ybcnrte.js → bin/chunk-57w9nsjk.js} +3 -3
- package/dist/bin/chunk-61ysn56t.js +1 -0
- package/dist/bin/chunk-6vay4ggv.js +9 -0
- package/dist/bin/{chunk-wcem4cqb.js → chunk-7a7n6p2m.js} +2 -2
- package/dist/bin/chunk-7x0hrna6.js +1 -0
- package/dist/bin/{chunk-e2dnxp8d.js → chunk-80zkjpfz.js} +29 -29
- package/dist/bin/chunk-92nng29y.js +1 -0
- package/dist/bin/chunk-94cfdvrn.js +2 -0
- package/dist/bin/chunk-9q8zjavc.js +725 -0
- package/dist/bin/chunk-a929za72.js +2 -0
- package/dist/{chunk-ac87ds1k.js → bin/chunk-bckm6fre.js} +6 -6
- package/dist/bin/chunk-bj5nq0kn.js +7364 -0
- package/dist/bin/chunk-c51xp8f7.js +1 -0
- package/dist/bin/chunk-d7r6mhyv.js +34 -0
- package/dist/bin/chunk-dbmk60r7.js +60 -0
- package/dist/bin/chunk-dhxwmkhz.js +2 -0
- package/dist/bin/chunk-f1ke4ygp.js +1 -0
- package/dist/bin/chunk-f35pte64.js +44 -0
- package/dist/bin/{chunk-t5ngva49.js → chunk-f8mbjwme.js} +8 -8
- package/dist/bin/chunk-fnr6k11h.js +1 -0
- package/dist/bin/chunk-mzfct5en.js +1 -0
- package/dist/bin/chunk-n6qqa2fr.js +511 -0
- package/dist/bin/chunk-ngav845g.js +2 -0
- package/dist/bin/chunk-nrnq9adz.js +1 -0
- package/dist/bin/chunk-p36ns96s.js +1 -0
- package/dist/bin/chunk-pega3x2x.js +1 -0
- package/dist/bin/chunk-pt2bz3kr.js +1 -0
- package/dist/bin/chunk-q5aj280b.js +1 -0
- package/dist/bin/chunk-r6cvc2pr.js +1 -0
- package/dist/bin/chunk-rh2sqtew.js +1 -0
- package/dist/bin/chunk-rpg5k3wt.js +3 -0
- package/dist/bin/chunk-tkzpbb7n.js +1 -0
- package/dist/bin/chunk-vwyq2s2k.js +1 -0
- package/dist/bin/chunk-vx649y7t.js +1 -0
- package/dist/bin/chunk-vymg9ywg.js +2 -0
- package/dist/bin/chunk-w637s5q0.js +3 -0
- package/dist/bin/chunk-wge61ccr.js +2 -0
- package/dist/bin/{chunk-jxd3j00s.js → chunk-wr6a423y.js} +13 -13
- package/dist/bin/chunk-y7ece16e.js +111 -0
- package/dist/bin/chunk-ydpnsp4x.js +3 -0
- package/dist/bin/{chunk-t7rcfwqc.js → chunk-yhxpmk29.js} +32 -32
- package/dist/bin/chunk-yn34zgr2.js +1 -0
- package/dist/bin/chunk-ynr22ma8.js +2 -0
- package/dist/bin/chunk-yt8rgkqt.js +2 -0
- package/dist/bin/chunk-z2ez8wn9.js +37 -0
- package/dist/bin/cli.js +428 -428
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/chunk-30h9rgfn.js +6 -0
- package/dist/chunk-3kapcdpn.js +92 -0
- package/dist/chunk-5g1hsrab.js +4 -0
- package/dist/chunk-5qqb671d.js +1 -0
- package/dist/chunk-5ww7kc5z.js +114 -0
- package/dist/chunk-6g81m01r.js +141 -0
- package/dist/{chunk-q9a1z53k.js → chunk-6j8f4ahv.js} +51 -51
- package/dist/{chunk-6cxb8d6y.js → chunk-6nvn041c.js} +3 -3
- package/dist/chunk-7hy9p6xr.js +5 -0
- package/dist/chunk-7kwha0fw.js +585 -0
- package/dist/chunk-9mhcjht7.js +37 -0
- package/dist/chunk-9w32efae.js +1 -0
- package/dist/chunk-bqaqkmtr.js +2 -0
- package/dist/chunk-djd9xgkz.js +709 -0
- package/dist/chunk-e0919h5g.js +2 -0
- package/dist/{chunk-dndxwssj.js → chunk-e7ds04wb.js} +2 -2
- package/dist/chunk-fdexq9e1.js +1 -0
- package/dist/chunk-hw3p6pth.js +1 -0
- package/dist/chunk-jb8em9ba.js +2 -0
- package/dist/chunk-pkan6evc.js +2 -0
- package/dist/chunk-qzwack6w.js +44 -0
- package/dist/chunk-r5emv4x8.js +2 -0
- package/dist/chunk-thpce63q.js +34 -0
- package/dist/chunk-ttq6dvft.js +22 -0
- package/dist/chunk-vpy3zjqv.js +1 -0
- package/dist/chunk-vva43vnp.js +60 -0
- package/dist/{bin/chunk-m9r5jype.js → chunk-wjgnfg6q.js} +6 -6
- package/dist/chunk-wrnhbb13.js +1 -0
- package/dist/chunk-xxbvjq8g.js +7355 -0
- package/dist/chunk-zftpjxkr.js +2 -0
- package/dist/deploy/index.js +1 -1
- package/dist/dns/index.js +1 -1
- package/dist/drivers/index.d.ts +1 -0
- package/dist/drivers/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +91 -91
- package/dist/operations/index.js +1 -1
- package/dist/protection/index.js +1 -1
- package/dist/push/index.js +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/accept-invitation.html +1 -1
- package/dist/ui/access-denied.html +1 -1
- package/dist/ui/account/automation.html +6 -6
- package/dist/ui/account/security.html +2 -2
- package/dist/ui/applications/compose.html +6 -6
- package/dist/ui/applications/new.html +1 -1
- package/dist/ui/data/backups.html +6 -6
- package/dist/ui/data/services.html +7 -7
- package/dist/ui/data/volumes.html +6 -6
- package/dist/ui/index.html +6 -6
- package/dist/ui/infrastructure/topology.html +9 -9
- package/dist/ui/integrations.html +1 -1
- package/dist/ui/operations/alerts.html +6 -6
- package/dist/ui/operations/configuration.html +6 -6
- package/dist/ui/operations/jobs.html +6 -6
- package/dist/ui/operations/maintenance.html +6 -6
- package/dist/ui/operations/observability.html +6 -6
- package/dist/ui/operations/previews.html +6 -6
- package/dist/ui/operations/queue.html +6 -6
- package/dist/ui/operations/regions.html +6 -6
- package/dist/ui/operations/releases.html +6 -6
- package/dist/ui/operations/spend.html +6 -6
- package/dist/ui/operations/workloads.html +9 -9
- package/dist/ui/security.html +2 -2
- package/dist/ui/server/actions.html +6 -6
- package/dist/ui/server/activity.html +1 -1
- package/dist/ui/server/capacity.html +6 -6
- package/dist/ui/server/database.html +6 -6
- package/dist/ui/server/deployments.html +6 -6
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +6 -6
- package/dist/ui/server/fleet.html +6 -6
- package/dist/ui/server/logs.html +6 -6
- package/dist/ui/server/metrics.html +6 -6
- package/dist/ui/server/security.html +2 -2
- package/dist/ui/server/services.html +1 -1
- package/dist/ui/server/sites.html +17 -17
- package/dist/ui/server/ssh-keys.html +6 -6
- package/dist/ui/server/team.html +5 -5
- package/dist/ui/server/terminal.html +2 -2
- package/dist/ui/serverless/alarms.html +5 -5
- package/dist/ui/serverless/assets.html +2 -2
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +6 -6
- package/dist/ui/serverless/deployments.html +2 -2
- package/dist/ui/serverless/firewall.html +2 -2
- package/dist/ui/serverless/functions.html +5 -5
- package/dist/ui/serverless/logs.html +6 -6
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +6 -6
- package/dist/ui/serverless/secrets.html +6 -6
- package/dist/ui/serverless/traces.html +5 -5
- package/dist/ui/serverless.html +6 -6
- package/dist/ui-src/src/charts.ts +1141 -1294
- package/dist/ui-src/src/topology.ts +3 -3
- package/package.json +3 -3
- package/dist/bin/chunk-0b49jjgr.js +0 -2
- package/dist/bin/chunk-0xnnkeb1.js +0 -1
- package/dist/bin/chunk-227jmf2b.js +0 -2
- package/dist/bin/chunk-2nyyg44g.js +0 -1
- package/dist/bin/chunk-2ztr119n.js +0 -3
- package/dist/bin/chunk-43xj5cny.js +0 -1
- package/dist/bin/chunk-5w6y9pmz.js +0 -1
- package/dist/bin/chunk-5x4rdx8k.js +0 -37
- package/dist/bin/chunk-6zc6a6t3.js +0 -725
- package/dist/bin/chunk-7aagqqr9.js +0 -1
- package/dist/bin/chunk-85qrgshq.js +0 -44
- package/dist/bin/chunk-8zk8msx0.js +0 -2
- package/dist/bin/chunk-9j83q0r4.js +0 -1
- package/dist/bin/chunk-9nhqbes6.js +0 -60
- package/dist/bin/chunk-a4js49mx.js +0 -1
- package/dist/bin/chunk-a9e0hvwe.js +0 -6
- package/dist/bin/chunk-a9tgxf2h.js +0 -1
- package/dist/bin/chunk-aahrv359.js +0 -1
- package/dist/bin/chunk-bfx23be3.js +0 -1
- package/dist/bin/chunk-bpps61am.js +0 -111
- package/dist/bin/chunk-bzth6d1s.js +0 -6
- package/dist/bin/chunk-ca3taw2m.js +0 -1
- package/dist/bin/chunk-cgzp0328.js +0 -1
- package/dist/bin/chunk-d2aaef9v.js +0 -1
- package/dist/bin/chunk-e0z2t4mf.js +0 -6
- package/dist/bin/chunk-empfsmdk.js +0 -2
- package/dist/bin/chunk-er3mww4m.js +0 -1
- package/dist/bin/chunk-fmp5bv0j.js +0 -3
- package/dist/bin/chunk-g3kp5ddx.js +0 -1
- package/dist/bin/chunk-grepda40.js +0 -1
- package/dist/bin/chunk-h6xqtypj.js +0 -2
- package/dist/bin/chunk-hwk9ahms.js +0 -2
- package/dist/bin/chunk-k1xw3zbm.js +0 -34
- package/dist/bin/chunk-m07s5esk.js +0 -2
- package/dist/bin/chunk-n20kbxwb.js +0 -7364
- package/dist/bin/chunk-n2fnav53.js +0 -3
- package/dist/bin/chunk-nv211m42.js +0 -8
- package/dist/bin/chunk-psgjy3z4.js +0 -1
- package/dist/bin/chunk-qmnr82da.js +0 -1
- package/dist/bin/chunk-qqpb82ty.js +0 -2
- package/dist/bin/chunk-rqc8btkj.js +0 -2
- package/dist/bin/chunk-rs85xvt7.js +0 -1
- package/dist/bin/chunk-sj5csg49.js +0 -2
- package/dist/bin/chunk-tjgy10zm.js +0 -9
- package/dist/bin/chunk-v0beqdna.js +0 -1
- package/dist/bin/chunk-vf2s3tba.js +0 -1
- package/dist/bin/chunk-vzkfjrx2.js +0 -511
- package/dist/bin/chunk-wsh5ervz.js +0 -1
- package/dist/bin/chunk-xenhbdmr.js +0 -1
- package/dist/bin/chunk-xrdpxwbf.js +0 -1
- package/dist/bin/chunk-y68m9bx7.js +0 -2
- package/dist/chunk-4884der5.js +0 -1
- package/dist/chunk-4wdxsnn2.js +0 -44
- package/dist/chunk-5hhyyhjt.js +0 -1
- package/dist/chunk-5zkacdw1.js +0 -1
- package/dist/chunk-6f68caq0.js +0 -1
- package/dist/chunk-7z50g5xz.js +0 -4
- package/dist/chunk-8fh4m5ge.js +0 -1
- package/dist/chunk-97pb7wb1.js +0 -1
- package/dist/chunk-ea7tn8nn.js +0 -709
- package/dist/chunk-ess6vxfj.js +0 -2
- package/dist/chunk-j06r5rwv.js +0 -2
- package/dist/chunk-j1g67djb.js +0 -92
- package/dist/chunk-k8x8mrkr.js +0 -2
- package/dist/chunk-mnmz8t7q.js +0 -34
- package/dist/chunk-n1fyryha.js +0 -141
- package/dist/chunk-n1hg0jxs.js +0 -2
- package/dist/chunk-n5xmh0ma.js +0 -37
- package/dist/chunk-q22qfwsc.js +0 -22
- package/dist/chunk-r8t25tbm.js +0 -7355
- package/dist/chunk-t8hzekmk.js +0 -585
- package/dist/chunk-whyttetx.js +0 -5
- package/dist/chunk-yf8stygs.js +0 -114
- package/dist/chunk-ze5x2bpm.js +0 -2
- package/dist/chunk-zh0apedk.js +0 -60
- package/dist/chunk-zjyz926j.js +0 -2
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)){let
|
|
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),
|
|
6
|
-
`).join(""),
|
|
7
|
-
`),
|
|
8
|
-
`),
|
|
9
|
-
`).join(""),
|
|
10
|
-
`),
|
|
11
|
-
`),
|
|
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
|
|
16
|
-
`).join(""),
|
|
17
|
-
`),
|
|
18
|
-
`),
|
|
19
|
-
`).join(""),
|
|
20
|
-
`),
|
|
21
|
-
`),
|
|
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`,
|
|
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
|
-
`),
|
|
63
|
-
`),
|
|
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
|
-
`),
|
|
67
|
-
`),
|
|
68
|
-
`).join(""),
|
|
69
|
-
`),
|
|
70
|
-
`),
|
|
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,""),
|
|
84
|
-
`,
|
|
85
|
-
`),
|
|
86
|
-
`),
|
|
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{
|
|
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};
|