@stacksjs/ts-cloud 0.16.17 → 0.16.19
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-r2vrq2gr.js → chunk-0f1qpmd6.js} +5 -5
- package/dist/bin/chunk-0h6cggyt.js +1 -0
- package/dist/bin/{chunk-8af2sky9.js → chunk-0trtkv9g.js} +4 -4
- package/dist/bin/{chunk-30jk87p4.js → chunk-148x1zq8.js} +2 -2
- package/dist/bin/{chunk-e7kqxsqh.js → chunk-1j8b1d58.js} +1 -1
- package/dist/bin/chunk-28ztnqjk.js +1 -0
- package/dist/bin/chunk-2g2zrtjs.js +2 -0
- package/dist/bin/{chunk-xenj3py3.js → chunk-2mv692y4.js} +5 -5
- package/dist/bin/chunk-3ay4kfaw.js +1 -0
- package/dist/bin/{chunk-grs2cwm7.js → chunk-3n733cgx.js} +2 -2
- package/dist/bin/{chunk-z4rx32w4.js → chunk-48x0wc2g.js} +3 -3
- package/dist/bin/chunk-4cs098d1.js +1 -0
- package/dist/bin/{chunk-s5br13d9.js → chunk-4sa22raw.js} +60 -60
- package/dist/bin/chunk-52fhq35h.js +1 -0
- package/dist/bin/{chunk-fren71ry.js → chunk-5a7sxtwn.js} +1 -1
- package/dist/bin/{chunk-g8yaztb1.js → chunk-6d8chxyr.js} +3 -3
- package/dist/bin/{chunk-rt51mrj9.js → chunk-6kx50dyc.js} +2 -2
- package/dist/bin/chunk-6se7ygxa.js +1 -0
- package/dist/bin/chunk-72g1hr4z.js +1 -0
- package/dist/bin/chunk-7thhxyzy.js +1 -0
- package/dist/bin/{chunk-dp2fsnpe.js → chunk-8jbkphmg.js} +7 -7
- package/dist/bin/{chunk-g954ew3x.js → chunk-90102shh.js} +1 -1
- package/dist/bin/{chunk-dg918k6w.js → chunk-9vmtm7nq.js} +1 -1
- package/dist/bin/chunk-apnhhfkj.js +2 -0
- package/dist/bin/chunk-c7vxdwth.js +1 -0
- package/dist/bin/{chunk-kymrvq47.js → chunk-djjj62c0.js} +2 -2
- package/dist/bin/{chunk-znfh0mx7.js → chunk-dmdg23a5.js} +1 -1
- package/dist/bin/{chunk-etvcw9we.js → chunk-dyh0vndw.js} +1 -1
- package/dist/bin/chunk-e0c3agf2.js +1 -0
- package/dist/bin/{chunk-bxfnhnqd.js → chunk-e24bscb0.js} +15 -15
- package/dist/bin/chunk-e55fdn0r.js +92 -0
- package/dist/bin/{chunk-frbwzrx4.js → chunk-egn33pr9.js} +1 -1
- package/dist/bin/{chunk-q6cayjpr.js → chunk-ehb9mpt8.js} +112 -112
- package/dist/bin/chunk-gf7yavs5.js +1 -0
- package/dist/bin/chunk-gp5w7e4c.js +1 -0
- package/dist/bin/{chunk-850n63e0.js → chunk-h1rb8qvt.js} +2 -2
- package/dist/bin/chunk-hagakkgm.js +1 -0
- package/dist/bin/chunk-hr3vbg6y.js +1 -0
- package/dist/bin/chunk-hyb5v8wr.js +1 -0
- package/dist/bin/{chunk-va9y882b.js → chunk-k7wh1wr5.js} +1 -1
- package/dist/bin/{chunk-afzrsjmc.js → chunk-mx9ppkmn.js} +4 -4
- package/dist/bin/{chunk-98m9rbpk.js → chunk-mxvekmdx.js} +126 -126
- package/dist/bin/chunk-ndddd2ft.js +3 -0
- package/dist/bin/{chunk-0znhykt9.js → chunk-ngyqqy6d.js} +5 -5
- package/dist/bin/chunk-nqb1faqj.js +1 -0
- package/dist/bin/chunk-p831sptd.js +1 -0
- package/dist/bin/chunk-qxx1a51w.js +1 -0
- package/dist/bin/{chunk-6wc8a9cs.js → chunk-rbtt23vx.js} +3 -3
- package/dist/bin/chunk-sh248v2y.js +1 -0
- package/dist/bin/chunk-swfmx4f8.js +1 -0
- package/dist/bin/{chunk-evtcxme1.js → chunk-t10e32an.js} +7 -7
- package/dist/bin/{chunk-jq36fh46.js → chunk-vjkyj3xy.js} +1 -1
- package/dist/bin/chunk-w8k1gyzr.js +1 -0
- package/dist/bin/chunk-wagzxm7z.js +1 -0
- package/dist/bin/{chunk-36aywmsq.js → chunk-x63yz8xg.js} +1 -1
- package/dist/bin/chunk-xdxk6baf.js +1 -0
- package/dist/bin/chunk-y286zhty.js +1 -0
- package/dist/bin/{chunk-gn745j0p.js → chunk-ys5n5c84.js} +4 -4
- package/dist/bin/{chunk-94pvxv17.js → chunk-z1dtdw3j.js} +5 -5
- package/dist/bin/cli.js +275 -275
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/chunk-07rjctzz.js +1 -0
- package/dist/{chunk-1ayadqry.js → chunk-2m262b2n.js} +14 -14
- package/dist/{chunk-nz3ygqjb.js → chunk-31tvc877.js} +1 -1
- package/dist/{chunk-hasa64d4.js → chunk-3m9ghthh.js} +2 -2
- package/dist/chunk-4j8ef0pe.js +1 -0
- package/dist/{chunk-4bcf62qk.js → chunk-5255nr93.js} +90 -90
- package/dist/{chunk-mytcpvg5.js → chunk-5far81q7.js} +2 -2
- package/dist/chunk-6kcmbymp.js +1 -0
- package/dist/{chunk-6jzg0gtw.js → chunk-7xnwa0s8.js} +4 -4
- package/dist/chunk-9asn5fpt.js +92 -0
- package/dist/{chunk-2vr8rqg8.js → chunk-9wmer0zx.js} +1 -1
- package/dist/{chunk-ynjfj2rt.js → chunk-bcy9z4ks.js} +162 -162
- package/dist/{chunk-enhddb1a.js → chunk-bxrzsth8.js} +2 -2
- package/dist/chunk-dak9hfrd.js +1 -0
- package/dist/{chunk-2ht2ve4t.js → chunk-e52me1c6.js} +1 -1
- package/dist/{chunk-z13hksc9.js → chunk-e8e1h2h9.js} +2 -2
- package/dist/{chunk-84w9n41b.js → chunk-g6g33pt9.js} +7 -7
- package/dist/{chunk-m1x32x81.js → chunk-hyeeqga9.js} +5 -5
- package/dist/{chunk-3rh4m6ag.js → chunk-k53agv2m.js} +1 -1
- package/dist/{chunk-nca98yaf.js → chunk-kczzc599.js} +25 -25
- package/dist/{chunk-f3hhmec2.js → chunk-ptq9v346.js} +1 -1
- package/dist/{chunk-ygrxsjcz.js → chunk-qcaqc5b8.js} +2 -2
- package/dist/{chunk-81yetzg2.js → chunk-r1wpwfff.js} +7 -7
- package/dist/{chunk-pn8bczhy.js → chunk-srrscggm.js} +5 -5
- package/dist/{chunk-6m18fz5f.js → chunk-v2p7c7s4.js} +325 -325
- package/dist/{chunk-a9pqpqrh.js → chunk-vs0qrm09.js} +1 -1
- package/dist/{chunk-x3xs6qvx.js → chunk-w9jhyy09.js} +4 -4
- package/dist/{chunk-r2v44ba2.js → chunk-z3wynefj.js} +19 -19
- package/dist/chunk-z4xzd43p.js +1 -0
- package/dist/{chunk-590gwv9d.js → chunk-zx8ecz8b.js} +4 -4
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.js +1 -1
- package/dist/deploy/storage-failover.d.ts +54 -0
- package/dist/dns/index.js +1 -1
- package/dist/drivers/index.js +1 -1
- package/dist/drivers/shared/cloudfront-origin.d.ts +9 -2
- package/dist/generators/infrastructure.d.ts +9 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -48
- package/dist/operations/index.js +1 -1
- package/dist/protection/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 +6 -6
- package/dist/ui/data/volumes.html +6 -6
- package/dist/ui/index.html +6 -6
- package/dist/ui/infrastructure/topology.html +6 -6
- package/dist/ui/integrations.html +2 -2
- 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 +6 -6
- 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 +2 -2
- package/dist/ui/server/sites.html +5 -5
- package/dist/ui/server/ssh-keys.html +6 -6
- package/dist/ui/server/team.html +6 -6
- package/dist/ui/server/terminal.html +2 -2
- package/dist/ui/serverless/alarms.html +6 -6
- 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 +1 -1
- package/dist/ui/serverless/functions.html +6 -6
- 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 +6 -6
- package/dist/ui/serverless.html +5 -5
- package/package.json +3 -3
- package/dist/bin/chunk-1aqrfqbz.js +0 -1
- package/dist/bin/chunk-1k1dyh5k.js +0 -92
- package/dist/bin/chunk-71rdf1sw.js +0 -1
- package/dist/bin/chunk-75kmf1ke.js +0 -1
- package/dist/bin/chunk-7q37vt87.js +0 -1
- package/dist/bin/chunk-8r0gvent.js +0 -1
- package/dist/bin/chunk-925xkkf9.js +0 -1
- package/dist/bin/chunk-am4recks.js +0 -1
- package/dist/bin/chunk-az3emrhh.js +0 -1
- package/dist/bin/chunk-btfh77e4.js +0 -1
- package/dist/bin/chunk-bxy657va.js +0 -1
- package/dist/bin/chunk-d5sd5xtt.js +0 -1
- package/dist/bin/chunk-fbhf8kh5.js +0 -1
- package/dist/bin/chunk-g0z3a0wx.js +0 -1
- package/dist/bin/chunk-hn961k5f.js +0 -3
- package/dist/bin/chunk-m2kr333s.js +0 -2
- package/dist/bin/chunk-mtbav1sg.js +0 -1
- package/dist/bin/chunk-pk2xwzke.js +0 -1
- package/dist/bin/chunk-sbhbne4d.js +0 -1
- package/dist/bin/chunk-sd0twb8d.js +0 -1
- package/dist/bin/chunk-va8pr0ch.js +0 -1
- package/dist/bin/chunk-vwa96q94.js +0 -1
- package/dist/bin/chunk-y6vnwk4e.js +0 -1
- package/dist/bin/chunk-y7w98fc1.js +0 -1
- package/dist/bin/chunk-yw65b70x.js +0 -1
- package/dist/bin/chunk-z65rp2mn.js +0 -1
- package/dist/chunk-3jrvr0pv.js +0 -1
- package/dist/chunk-ajwt2hzh.js +0 -1
- package/dist/chunk-fw9hk0xt.js +0 -92
- package/dist/chunk-mcxmdch0.js +0 -1
- package/dist/chunk-wqhhvh3k.js +0 -1
- package/dist/chunk-xhn2v84m.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{n}from"./chunk-zx8ecz8b.js";class _e{client;region;constructor(e="us-east-1",r){this.region=e,this.client=new n(void 0,{profile:r})}async createRepository(e){let r={repositoryName:e.repositoryName};if(e.imageTagMutability)r.imageTagMutability=e.imageTagMutability;if(e.imageScanningConfiguration)r.imageScanningConfiguration=e.imageScanningConfiguration;if(e.encryptionConfiguration)r.encryptionConfiguration=e.encryptionConfiguration;if(e.tags&&e.tags.length>0)r.tags=e.tags;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.CreateRepository","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{repository:t.repository?this.parseRepository(t.repository):void 0}}async describeRepositories(e){let r={};if(e?.repositoryNames&&e.repositoryNames.length>0)r.repositoryNames=e.repositoryNames;if(e?.registryId)r.registryId=e.registryId;if(e?.maxResults)r.maxResults=e.maxResults;if(e?.nextToken)r.nextToken=e.nextToken;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.DescribeRepositories","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{repositories:t.repositories?.map((i)=>this.parseRepository(i)),nextToken:t.nextToken}}async getAuthorizationToken(e){let r={};if(e&&e.length>0)r.registryIds=e;return{authorizationData:(await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)})).authorizationData?.map((i)=>({authorizationToken:i.authorizationToken,expiresAt:i.expiresAt,proxyEndpoint:i.proxyEndpoint}))}}async deleteRepository(e){let r={repositoryName:e.repositoryName};if(e.registryId)r.registryId=e.registryId;if(e.force!==void 0)r.force=e.force;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.DeleteRepository","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{repository:t.repository?this.parseRepository(t.repository):void 0}}async describeImages(e){let r={repositoryName:e.repositoryName};if(e.registryId)r.registryId=e.registryId;if(e.imageIds&&e.imageIds.length>0)r.imageIds=e.imageIds;if(e.filter)r.filter=e.filter;if(e.maxResults)r.maxResults=e.maxResults;if(e.nextToken)r.nextToken=e.nextToken;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.DescribeImages","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{imageDetails:t.imageDetails?.map((i)=>this.parseImageDetail(i)),nextToken:t.nextToken}}async batchDeleteImage(e){let r={repositoryName:e.repositoryName,imageIds:e.imageIds};if(e.registryId)r.registryId=e.registryId;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.BatchDeleteImage","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{imageIds:t.imageIds,failures:t.failures}}async putLifecyclePolicy(e){let r={repositoryName:e.repositoryName,lifecyclePolicyText:e.lifecyclePolicyText};if(e.registryId)r.registryId=e.registryId;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{registryId:t.registryId,repositoryName:t.repositoryName,lifecyclePolicyText:t.lifecyclePolicyText}}async getLifecyclePolicy(e){let r={repositoryName:e.repositoryName};if(e.registryId)r.registryId=e.registryId;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.GetLifecyclePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{registryId:t.registryId,repositoryName:t.repositoryName,lifecyclePolicyText:t.lifecyclePolicyText,lastEvaluatedAt:t.lastEvaluatedAt}}async setRepositoryPolicy(e){let r={repositoryName:e.repositoryName,policyText:e.policyText};if(e.registryId)r.registryId=e.registryId;if(e.force!==void 0)r.force=e.force;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.SetRepositoryPolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{registryId:t.registryId,repositoryName:t.repositoryName,policyText:t.policyText}}async getRepositoryPolicy(e){let r={repositoryName:e.repositoryName};if(e.registryId)r.registryId=e.registryId;let t=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.GetRepositoryPolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)});return{registryId:t.registryId,repositoryName:t.repositoryName,policyText:t.policyText}}async tagResource(e){let r={resourceArn:e.resourceArn,tags:e.tags};await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.TagResource","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)})}async listTagsForResource(e){let r={resourceArn:e};return{tags:(await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.ListTagsForResource","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(r)})).tags}}createLifecyclePolicyText(e){return JSON.stringify({rules:e.map((r)=>({rulePriority:r.rulePriority,description:r.description,selection:r.selection,action:r.action}))})}async getDockerLoginCommand(){let e=await this.getAuthorizationToken();if(!e.authorizationData?.[0])throw Error("Failed to get authorization token");let r=e.authorizationData[0],t=r.authorizationToken||"",i=r.proxyEndpoint||"";return`echo "${Buffer.from(t,"base64").toString("utf8").split(":")[1]}" | docker login --username AWS --password-stdin ${i}`}getRegistryUri(e){return`${e}.dkr.ecr.${this.region}.amazonaws.com`}parseRepository(e){return{repositoryArn:e.repositoryArn,registryId:e.registryId,repositoryName:e.repositoryName,repositoryUri:e.repositoryUri,createdAt:e.createdAt,imageTagMutability:e.imageTagMutability,imageScanningConfiguration:e.imageScanningConfiguration,encryptionConfiguration:e.encryptionConfiguration}}parseImageDetail(e){return{registryId:e.registryId,repositoryName:e.repositoryName,imageDigest:e.imageDigest,imageTags:e.imageTags,imageSizeInBytes:e.imageSizeInBytes,imagePushedAt:e.imagePushedAt,imageScanStatus:e.imageScanStatus,imageScanFindingsSummary:e.imageScanFindingsSummary}}}
|
|
2
|
+
export{_e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{br,n,l,Wh}from"./chunk-zx8ecz8b.js";export{n as AWSClient,l as buildQueryParams,Wh as detectCredentialSource,br as resolveS3Endpoint};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mo,qr,$d,Pi,So,Co}from"./chunk-v2p7c7s4.js";import{_e}from"./chunk-5far81q7.js";import{execFileSync as C}from"node:child_process";import{mkdirSync as S,mkdtempSync as U,rmSync as L,writeFileSync as d}from"node:fs";import{tmpdir as O}from"node:os";import{dirname as j,join as s}from"node:path";var r={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m"};function I(t,e){return`${r[e]}${t}${r.reset}`}function pn(t){console.log(`${r.green}✓${r.reset} ${t}`)}function hu(t){console.error(`${r.red}✗${r.reset} ${t}`)}function ns(t){console.warn(`${r.yellow}⚠${r.reset} ${t}`)}function P(t){console.log(`${r.blue}ℹ${r.reset} ${t}`)}function v(t){console.log(`${r.cyan}→${r.reset} ${t}`)}function is(t){console.log(`
|
|
2
2
|
${r.bright}${r.cyan}${t}${r.reset}
|
|
3
|
-
`)}var F=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);function
|
|
4
|
-
`),i=Math.max(...n.map((l)=>l.length)),a="─".repeat(i+2);console.log(I(`┌${a}┐`,e)),n.forEach((l)=>{console.log(I(`│ ${l.padEnd(i)} │`,e))}),console.log(I(`└${a}┘`,e))}function A(t,e){for(let n of e){let i=s(t,n.name);S(j(i),{recursive:!0}),d(i,n.data,n.mode?{mode:n.mode}:void 0)}}async function
|
|
5
|
-
export{
|
|
3
|
+
`)}var F=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);function fu(t,e="cyan"){let n=t.split(`
|
|
4
|
+
`),i=Math.max(...n.map((l)=>l.length)),a="─".repeat(i+2);console.log(I(`┌${a}┐`,e)),n.forEach((l)=>{console.log(I(`│ ${l.padEnd(i)} │`,e))}),console.log(I(`└${a}┘`,e))}function A(t,e){for(let n of e){let i=s(t,n.name);S(j(i),{recursive:!0}),d(i,n.data,n.mode?{mode:n.mode}:void 0)}}async function xa(t){let{app:e,projectRoot:n,region:i,repository:a}=t,l=e.architecture??"x86_64",R=l==="arm64"?"linux/arm64":"linux/amd64",E=e.kind==="php",c=t.onStep??(()=>{}),p=U(s(O(),"tscloud-img-"));try{let f=s(p,"app");S(f,{recursive:!0});let y,w;if(E){So({projectRoot:n,app:e,skipBuild:t.skipBuild,onStep:c}),c("staging application tree");let o=Co(n);A(f,o),A(s(p,"runtime"),Pi().map((g)=>({name:g.path,data:g.contents,mode:g.mode})));let b=e.handlers?.http??"public/index.php";y={http:b,queue:e.handlers?.queue??b,cli:e.handlers?.cli??b},w=mo(o.map((g)=>`${g.name}:${g.data.length}`).join("|"))}else{c("bundling application");let o=await qr({projectRoot:n,app:e,skipBuild:t.skipBuild,onStep:c});d(s(f,"index.mjs"),o.bundle),y=o.handlers,w=o.sha256}let k=w.slice(0,16);d(s(p,"Dockerfile"),$d({kind:e.kind??"node",phpVersion:e.phpVersion,architecture:l}));let x=new _e(i),u;try{u=(await x.describeRepositories({repositoryNames:[a]})).repositories?.[0]?.repositoryUri??""}catch{u=""}if(!u)c(`creating ECR repository ${a}`),u=(await x.createRepository({repositoryName:a,imageScanningConfiguration:{scanOnPush:!0}})).repository?.repositoryUri??"";if(!u)throw Error(`could not resolve ECR repository URI for ${a}`);let m=`${u}:${k}`;c("docker build"),C("docker",["build","--platform",R,"--provenance=false","--sbom=false","-t",m,p],{stdio:"inherit"}),c("ecr auth + push");let h=(await x.getAuthorizationToken()).authorizationData?.[0];if(!h?.authorizationToken||!h.proxyEndpoint)throw Error("failed to get an ECR authorization token");let T=h.proxyEndpoint.replace(/^https?:\/\//,""),B=s(p,".docker");return S(B,{recursive:!0}),d(s(B,"config.json"),JSON.stringify({auths:{[T]:{auth:h.authorizationToken}}})),C("docker",["push",m],{stdio:"inherit",env:{...process.env,DOCKER_CONFIG:B}}),P(`Image: ${m}`),{imageUri:m,tag:k,handlers:y}}finally{L(p,{recursive:!0,force:!0})}}
|
|
5
|
+
export{pn,hu,ns,P,v,is,fu,xa};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import{br,n}from"./chunk-zx8ecz8b.js";import{Fe}from"./chunk-bxrzsth8.js";import*as l from"node:crypto";import{readFileSync as B}from"node:fs";import{readdir as L}from"node:fs/promises";import{join as z}from"node:path";function Bt(e){if(e){let r=D(e);if(!r)throw Error(`AWS profile '${e}' not found in ~/.aws/credentials`);return r}let t=process.env.AWS_ACCESS_KEY_ID,s=process.env.AWS_SECRET_ACCESS_KEY;if(t&&s)return{accessKeyId:t,secretAccessKey:s,sessionToken:process.env.AWS_SESSION_TOKEN};return D(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function D(e){let{existsSync:t,readFileSync:s}=Fe("node:fs"),{homedir:r}=Fe("node:os"),{join:i}=Fe("node:path"),a=process.env.AWS_SHARED_CREDENTIALS_FILE||i(r(),".aws","credentials");if(!t(a))return null;let c=s(a,"utf-8"),g=null,d,u,y;for(let h of c.split(`
|
|
2
|
+
`)){let m=h.trim();if(!m||m.startsWith("#")||m.startsWith(";"))continue;let p=m.match(/^\[([^\]]+)\]$/);if(p){if(g===e&&d&&u)return{accessKeyId:d,secretAccessKey:u,sessionToken:y};g=p[1],d=void 0,u=void 0,y=void 0;continue}if(g===e){let[b,...S]=m.split("="),f=S.join("=").trim();switch(b.trim().toLowerCase()){case"aws_access_key_id":d=f;break;case"aws_secret_access_key":u=f;break;case"aws_session_token":y=f;break}}}if(g===e&&d&&u)return{accessKeyId:d,secretAccessKey:u,sessionToken:y};return null}function U(e){let{buffer:t,byteOffset:s,byteLength:r}=e;if(t instanceof ArrayBuffer)return t.slice(s,s+r);let i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),i}function j(e,t){let s=e?.[t]??e;if(s===null||typeof s!=="object"||Array.isArray(s))return s;let r={...s};return delete r["@_xmlns"],r}class o{client;region;explicitProfile;endpoint;endpointProtocol="https";forcePathStyle;explicitCredentials;constructor(e="us-east-1",t,s){let r=typeof e==="string"?s:e,i=typeof e==="string"?e:e.region??"us-east-1",a=typeof e==="string"?t:e.profile,c=r?.endpoint?br({region:i,path:"/",endpoint:r.endpoint}):void 0;this.region=i,this.explicitProfile=a,this.endpoint=c?.host,this.endpointProtocol=c?.protocol??"https",this.forcePathStyle=r?.forcePathStyle,this.explicitCredentials=r?.credentials,this.client=new n(r?.credentials,{profile:a,endpoint:r?.endpoint,forcePathStyle:r?.forcePathStyle})}getCredentials(){if(this.explicitCredentials?.accessKeyId&&this.explicitCredentials.secretAccessKey)return this.explicitCredentials;let e=Bt(this.explicitProfile);if(e.accessKeyId&&e.secretAccessKey)return e;throw Error("S3 credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (or pass explicit credentials/profile), or configure ~/.aws/credentials.")}s3BaseHost(){return this.endpoint||`s3.${this.region}.amazonaws.com`}s3VirtualHost(e){return this.forcePathStyle?this.s3BaseHost():`${e}.${this.s3BaseHost()}`}objectPath(e,t){return this.forcePathStyle?`/${e}/${t}`:`/${t}`}objectUrl(e,t){return`${this.endpointProtocol}://${this.s3VirtualHost(e)}${this.objectPath(e,t)}`}async listBuckets(){let e=await this.client.request({service:"s3",region:this.region,method:"GET",path:"/"}),t=[],r=(e?.ListAllMyBucketsResult??e)?.Buckets?.Bucket;if(r){let i=Array.isArray(r)?r:[r];for(let a of i)t.push({Name:a.Name,CreationDate:a.CreationDate})}return{Buckets:t}}async createBucket(e,t){let s={};if(t?.acl)s["x-amz-acl"]=t.acl;let r;if(this.region!=="us-east-1"&&!this.endpoint)r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
+
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
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((i)=>i.Key);for(let i=0;i<r.length;i+=1000){let a=r.slice(i,i+1000);await this.deleteObjects(e,a)}}await this.deleteBucket(e)}async listAllObjects(e){let t=[],s;do{let r={"list-type":"2","max-keys":"1000"};if(e.prefix)r.prefix=e.prefix;if(s)r["continuation-token"]=s;let i=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e.bucket}`,queryParams:r}),a=i?.ListBucketResult??i,c=a?.Contents;if(c){let d=Array.isArray(c)?c:[c];for(let u of d)t.push({Key:u.Key,LastModified:u.LastModified||"",Size:Number.parseInt(u.Size||"0"),ETag:u.ETag})}let g=a?.IsTruncated;s=g==="true"||g===!0?a?.NextContinuationToken:void 0}while(s);return t}async list(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e.bucket}`}),s=[],i=(t?.ListBucketResult??t)?.Contents;if(i){let a=Array.isArray(i)?i:[i];for(let c of a){if(e.prefix&&!c.Key?.startsWith(e.prefix))continue;if(s.push({Key:c.Key||"",LastModified:c.LastModified||"",Size:Number.parseInt(c.Size||"0"),ETag:c.ETag}),e.maxKeys&&s.length>=e.maxKeys)break}}return s}async putObject(e){let t={};if(e.acl)t["x-amz-acl"]=e.acl;if(e.cacheControl)t["Cache-Control"]=e.cacheControl;if(e.contentType)t["Content-Type"]=e.contentType;if(e.metadata)for(let[i,a]of Object.entries(e.metadata))t[`x-amz-meta-${i}`]=a;let s=e.key.split("/").map((i)=>encodeURIComponent(i)).join("/"),r=e.body instanceof Uint8Array&&!Buffer.isBuffer(e.body)?Buffer.from(e.body):e.body;if(Buffer.isBuffer(r)||r instanceof Uint8Array){let i=Buffer.isBuffer(r)?r:Buffer.from(r),{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),d=this.s3VirtualHost(e.bucket),u=this.objectPath(e.bucket,s),y=this.objectUrl(e.bucket,s),h=new Date,m=h.toISOString().replace(/[:-]|\.\d{3}/g,""),p=h.toISOString().slice(0,10).replace(/-/g,""),b=l.createHash("sha256").update(i).digest("hex"),S={host:d,"x-amz-date":m,"x-amz-content-sha256":b,...t};if(g)S["x-amz-security-token"]=g;let f=Object.keys(S).sort().map((P)=>`${P.toLowerCase()}:${S[P].trim()}
|
|
6
|
+
`).join(""),k=Object.keys(S).sort().map((P)=>P.toLowerCase()).join(";"),T=["PUT",u,"",f,k,b].join(`
|
|
7
|
+
`),w="AWS4-HMAC-SHA256",C=`${p}/${this.region}/s3/aws4_request`,q=[w,m,C,l.createHash("sha256").update(T).digest("hex")].join(`
|
|
8
|
+
`),I=l.createHmac("sha256",`AWS4${c}`).update(p).digest(),K=l.createHmac("sha256",I).update(this.region).digest(),H=l.createHmac("sha256",K).update("s3").digest(),E=l.createHmac("sha256",H).update("aws4_request").digest(),v=l.createHmac("sha256",E).update(q).digest("hex"),A=`${w} Credential=${a}/${C}, SignedHeaders=${k}, Signature=${v}`,x=await fetch(y,{method:"PUT",headers:{...S,Authorization:A},body:U(i)});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((i)=>encodeURIComponent(i)).join("/");return await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${s}`,bucket:e,rawResponse:!0})}async getObjectBytes(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:i}=this.getCredentials(),a=this.s3VirtualHost(e),c=t.split("/").map((P)=>encodeURIComponent(P)).join("/"),g=this.objectPath(e,c),d=this.objectUrl(e,c),u=new Date,y=u.toISOString().replace(/[:-]|\.\d{3}/g,""),h=u.toISOString().slice(0,10).replace(/-/g,""),m=l.createHash("sha256").update("").digest("hex"),p={host:a,"x-amz-date":y,"x-amz-content-sha256":m};if(i)p["x-amz-security-token"]=i;let b=Object.keys(p).sort().map((P)=>`${P.toLowerCase()}:${p[P].trim()}
|
|
9
|
+
`).join(""),S=Object.keys(p).sort().map((P)=>P.toLowerCase()).join(";"),f=["GET",g,"",b,S,m].join(`
|
|
10
|
+
`),k="AWS4-HMAC-SHA256",T=`${h}/${this.region}/s3/aws4_request`,w=[k,y,T,l.createHash("sha256").update(f).digest("hex")].join(`
|
|
11
|
+
`),C=l.createHmac("sha256",`AWS4${r}`).update(h).digest(),q=l.createHmac("sha256",C).update(this.region).digest(),I=l.createHmac("sha256",q).update("s3").digest(),K=l.createHmac("sha256",I).update("aws4_request").digest(),H=l.createHmac("sha256",K).update(w).digest("hex"),E=`${k} Credential=${s}/${T}, SignedHeaders=${S}, Signature=${H}`,v=await fetch(d,{method:"GET",headers:{...p,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=(r)=>r.split("/").map((i)=>encodeURIComponent(i)).join("/"),s={"x-amz-copy-source":`/${e.sourceBucket}/${t(e.sourceKey)}`};if(e.metadataDirective)s["x-amz-metadata-directive"]=e.metadataDirective;if(e.contentType)s["Content-Type"]=e.contentType;if(e.metadata)for(let[r,i]of Object.entries(e.metadata))s[`x-amz-meta-${r}`]=i;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e.destinationBucket}/${t(e.destinationKey)}`,headers:s})}async deleteObject(e,t){let s=t.split("/").map((r)=>encodeURIComponent(r)).join("/");await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${s}`,bucket:e})}async deleteObjects(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
12
|
+
<Delete>
|
|
13
|
+
${t.map((i)=>`<Object><Key>${i}</Key></Object>`).join(`
|
|
14
|
+
`)}
|
|
15
|
+
</Delete>`,r=l.createHash("md5").update(s).digest("base64");await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}`,queryParams:{delete:""},body:s,headers:{"Content-Type":"application/xml","Content-MD5":r}})}async bucketExists(e){try{return await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}`}),!0}catch{return!1}}async copy(e){let t=B(e.source);await this.putObject({bucket:e.bucket,key:e.key,body:t,acl:e.acl,cacheControl:e.cacheControl,contentType:e.contentType,metadata:e.metadata})}async sync(e){let t=await this.listFilesRecursive(e.source);for(let s of t){if(e.exclude&&e.exclude.some((a)=>s.includes(a)))continue;if(e.include&&!e.include.some((a)=>s.includes(a)))continue;let r=s.substring(e.source.length+1),i=e.prefix?`${e.prefix}/${r}`:r;if(!e.dryRun){let a=B(s);await this.putObject({bucket:e.bucket,key:i,body:a,acl:e.acl,cacheControl:e.cacheControl,contentType:e.contentType,metadata:e.metadata})}}}async delete(e,t){await this.deleteObject(e,t)}async deletePrefix(e,t){let r=(await this.list({bucket:e,prefix:t})).map((i)=>i.Key);if(r.length>0)await this.deleteObjects(e,r)}async getBucketSize(e,t){return(await this.list({bucket:e,prefix:t})).reduce((r,i)=>r+i.Size,0)}async listFilesRecursive(e){let t=[],s=await L(e,{withFileTypes:!0});for(let r of s){let i=z(e,r.name);if(r.isDirectory()){let a=await this.listFilesRecursive(i);t.push(...a)}else t.push(i)}return t}async putBucketPolicy(e,t){let{accessKeyId:s,secretAccessKey:r,sessionToken:i}=this.getCredentials(),a=this.s3BaseHost(),c=typeof t==="string"?t:JSON.stringify(t),g=new Date,d=g.toISOString().replace(/[:-]|\.\d{3}/g,""),u=g.toISOString().slice(0,10).replace(/-/g,""),y=l.createHash("sha256").update(c).digest("hex"),h="/"+e,m="policy=",p={host:a,"x-amz-date":d,"x-amz-content-sha256":y,"content-type":"application/json"};if(i)p["x-amz-security-token"]=i;let b=Object.keys(p).sort().map((x)=>`${x.toLowerCase()}:${p[x].trim()}
|
|
16
|
+
`).join(""),S=Object.keys(p).sort().map((x)=>x.toLowerCase()).join(";"),f=["PUT",h,"policy=",b,S,y].join(`
|
|
17
|
+
`),k="AWS4-HMAC-SHA256",T=`${u}/${this.region}/s3/aws4_request`,w=[k,d,T,l.createHash("sha256").update(f).digest("hex")].join(`
|
|
18
|
+
`),C=l.createHmac("sha256","AWS4"+r).update(u).digest(),q=l.createHmac("sha256",C).update(this.region).digest(),I=l.createHmac("sha256",q).update("s3").digest(),K=l.createHmac("sha256",I).update("aws4_request").digest(),H=l.createHmac("sha256",K).update(w).digest("hex"),E=`${k} Credential=${s}/${T}, SignedHeaders=${S}, Signature=${H}`,v=`${this.endpointProtocol}://${a}${h}?policy=`,A=await fetch(v,{method:"PUT",headers:{...p,Authorization:E},body:c});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(),i=this.s3BaseHost(),a=new Date,c=a.toISOString().replace(/[:-]|\.\d{3}/g,""),g=a.toISOString().slice(0,10).replace(/-/g,""),d=l.createHash("sha256").update("").digest("hex"),u="/"+e,y="policy=",h={host:i,"x-amz-date":c,"x-amz-content-sha256":d};if(r)h["x-amz-security-token"]=r;let m=Object.keys(h).sort().map((A)=>`${A.toLowerCase()}:${h[A].trim()}
|
|
19
|
+
`).join(""),p=Object.keys(h).sort().map((A)=>A.toLowerCase()).join(";"),b=["GET",u,"policy=",m,p,d].join(`
|
|
20
|
+
`),S="AWS4-HMAC-SHA256",f=`${g}/${this.region}/s3/aws4_request`,k=[S,c,f,l.createHash("sha256").update(b).digest("hex")].join(`
|
|
21
|
+
`),T=l.createHmac("sha256","AWS4"+s).update(g).digest(),w=l.createHmac("sha256",T).update(this.region).digest(),C=l.createHmac("sha256",w).update("s3").digest(),q=l.createHmac("sha256",C).update("aws4_request").digest(),I=l.createHmac("sha256",q).update(k).digest("hex"),K=`${S} Credential=${t}/${f}, SignedHeaders=${p}, Signature=${I}`,H=`${this.endpointProtocol}://${i}${u}?policy=`,E=await fetch(H,{method:"GET",headers:{...h,Authorization:K}});if(E.status===404)return null;if(!E.ok){let A=await E.text();throw Error(`Failed to get bucket policy: ${E.status} ${A}`)}let v=await E.text();return JSON.parse(v)}async deleteBucketPolicy(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{policy:""}})}async headBucket(e){try{return{exists:!0,region:(await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}`,returnHeaders:!0}))?.headers?.["x-amz-bucket-region"]}}catch(t){if(t.statusCode===404)return{exists:!1};throw t}}async headObject(e,t){try{let s=await this.client.request({service:"s3",region:this.region,method:"HEAD",path:`/${e}/${t}`,returnHeaders:!0});return{ContentLength:s?.headers?.["content-length"]?parseInt(s.headers["content-length"]):void 0,ContentType:s?.headers?.["content-type"],ETag:s?.headers?.etag,LastModified:s?.headers?.["last-modified"]}}catch(s){if(s.statusCode===404)return null;throw s}}async getObjectBuffer(e,t){let s=await this.getObject(e,t);return Buffer.from(s)}async getObjectJson(e,t){let s=await this.getObject(e,t);return JSON.parse(s)}async putObjectJson(e,t,s,r){await this.putObject({bucket:e,key:t,body:JSON.stringify(s),contentType:"application/json",...r})}async getBucketVersioning(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{versioning:""}});return{Status:(t?.VersioningConfiguration??t)?.Status}}async putBucketVersioning(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
22
|
+
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
23
|
+
<Status>${t}</Status>
|
|
24
|
+
</VersioningConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{versioning:""},headers:{"Content-Type":"application/xml"},body:s})}async getBucketLifecycleConfiguration(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{lifecycle:""}});return j(t,"LifecycleConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async putBucketLifecycleConfiguration(e,t){let r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
25
|
+
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
26
|
+
${t.map((i)=>{let a=`<Rule><ID>${i.ID}</ID><Status>${i.Status}</Status>`;if(i.Filter)a+=`<Filter><Prefix>${i.Filter.Prefix||""}</Prefix></Filter>`;else a+="<Filter><Prefix></Prefix></Filter>";if(i.Expiration){if(i.Expiration.Days)a+=`<Expiration><Days>${i.Expiration.Days}</Days></Expiration>`;else if(i.Expiration.Date)a+=`<Expiration><Date>${i.Expiration.Date}</Date></Expiration>`}if(i.Transitions)for(let c of i.Transitions)a+=`<Transition><Days>${c.Days}</Days><StorageClass>${c.StorageClass}</StorageClass></Transition>`;if(i.NoncurrentVersionExpiration)a+=`<NoncurrentVersionExpiration><NoncurrentDays>${i.NoncurrentVersionExpiration.NoncurrentDays}</NoncurrentDays></NoncurrentVersionExpiration>`;return a+="</Rule>",a}).join("")}
|
|
27
|
+
</LifecycleConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{lifecycle:""},headers:{"Content-Type":"application/xml"},body:r})}async deleteBucketLifecycleConfiguration(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{lifecycle:""}})}async getBucketCors(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{cors:""}});return j(t,"CORSConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async putBucketCors(e,t){let r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
28
|
+
<CORSConfiguration>
|
|
29
|
+
${t.map((i)=>{let a="<CORSRule>";for(let c of i.AllowedOrigins)a+=`<AllowedOrigin>${c}</AllowedOrigin>`;for(let c of i.AllowedMethods)a+=`<AllowedMethod>${c}</AllowedMethod>`;if(i.AllowedHeaders)for(let c of i.AllowedHeaders)a+=`<AllowedHeader>${c}</AllowedHeader>`;if(i.ExposeHeaders)for(let c of i.ExposeHeaders)a+=`<ExposeHeader>${c}</ExposeHeader>`;if(i.MaxAgeSeconds)a+=`<MaxAgeSeconds>${i.MaxAgeSeconds}</MaxAgeSeconds>`;return a+="</CORSRule>",a}).join("")}
|
|
30
|
+
</CORSConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{cors:""},headers:{"Content-Type":"application/xml"},body:r})}async deleteBucketCors(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{cors:""}})}async getBucketEncryption(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{encryption:""}});return j(t,"ServerSideEncryptionConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async putBucketEncryption(e,t,s){let r=`<ApplyServerSideEncryptionByDefault><SSEAlgorithm>${t}</SSEAlgorithm>`;if(s)r+=`<KMSMasterKeyID>${s}</KMSMasterKeyID>`;r+="</ApplyServerSideEncryptionByDefault>";let i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
31
|
+
<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
32
|
+
<Rule>${r}</Rule>
|
|
33
|
+
</ServerSideEncryptionConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{encryption:""},headers:{"Content-Type":"application/xml"},body:i})}async deleteBucketEncryption(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{encryption:""}})}async getBucketTagging(e){try{let s=(await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{tagging:""}}))?.Tagging?.TagSet?.Tag;if(!s)return[];return Array.isArray(s)?s:[s]}catch(t){if(t.statusCode===404)return[];throw t}}async putBucketTagging(e,t){let r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
34
|
+
<Tagging>
|
|
35
|
+
<TagSet>${t.map((i)=>`<Tag><Key>${i.Key}</Key><Value>${i.Value}</Value></Tag>`).join("")}</TagSet>
|
|
36
|
+
</Tagging>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{tagging:""},headers:{"Content-Type":"application/xml"},body:r})}async deleteBucketTagging(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{tagging:""}})}async getObjectTagging(e,t){try{let r=(await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}/${t}`,queryParams:{tagging:""}}))?.Tagging?.TagSet?.Tag;if(!r)return[];return Array.isArray(r)?r:[r]}catch(s){if(s.statusCode===404)return[];throw s}}async putObjectTagging(e,t,s){let i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
37
|
+
<Tagging>
|
|
38
|
+
<TagSet>${s.map((a)=>`<Tag><Key>${a.Key}</Key><Value>${a.Value}</Value></Tag>`).join("")}</TagSet>
|
|
39
|
+
</Tagging>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}/${t}`,queryParams:{tagging:""},headers:{"Content-Type":"application/xml"},body:i})}async deleteObjectTagging(e,t){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}/${t}`,queryParams:{tagging:""}})}async getBucketAcl(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{acl:""}});return j(t,"AccessControlPolicy")}async putBucketAcl(e,t){await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{acl:""},headers:{"x-amz-acl":t}})}async getObjectAcl(e,t){let s=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}/${t}`,queryParams:{acl:""}});return j(s,"AccessControlPolicy")}async putObjectAcl(e,t,s){await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}/${t}`,queryParams:{acl:""},headers:{"x-amz-acl":s}})}async getBucketLocation(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{location:""}}),s=j(t,"LocationConstraint");return(typeof s==="string"?s:s?.["#text"])||"us-east-1"}async getBucketLogging(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{logging:""}});return j(t,"BucketLoggingStatus")}async putBucketLogging(e,t,s){let r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
40
|
+
<BucketLoggingStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
41
|
+
<LoggingEnabled>
|
|
42
|
+
<TargetBucket>${t}</TargetBucket>
|
|
43
|
+
<TargetPrefix>${s}</TargetPrefix>
|
|
44
|
+
</LoggingEnabled>
|
|
45
|
+
</BucketLoggingStatus>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{logging:""},headers:{"Content-Type":"application/xml"},body:r})}async getBucketNotificationConfiguration(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{notification:""}});return j(t,"NotificationConfiguration")}async putBucketNotificationConfiguration(e,t){let s="";if(t.LambdaFunctionConfigurations)for(let i of t.LambdaFunctionConfigurations){if(s+="<CloudFunctionConfiguration>",i.Id)s+=`<Id>${i.Id}</Id>`;s+=`<CloudFunction>${i.LambdaFunctionArn}</CloudFunction>`;for(let a of i.Events)s+=`<Event>${a}</Event>`;if(i.Filter?.Key?.FilterRules){s+="<Filter><S3Key>";for(let a of i.Filter.Key.FilterRules)s+=`<FilterRule><Name>${a.Name}</Name><Value>${a.Value}</Value></FilterRule>`;s+="</S3Key></Filter>"}s+="</CloudFunctionConfiguration>"}if(t.TopicConfigurations)for(let i of t.TopicConfigurations){if(s+="<TopicConfiguration>",i.Id)s+=`<Id>${i.Id}</Id>`;s+=`<Topic>${i.TopicArn}</Topic>`;for(let a of i.Events)s+=`<Event>${a}</Event>`;s+="</TopicConfiguration>"}if(t.QueueConfigurations)for(let i of t.QueueConfigurations){if(s+="<QueueConfiguration>",i.Id)s+=`<Id>${i.Id}</Id>`;s+=`<Queue>${i.QueueArn}</Queue>`;for(let a of i.Events)s+=`<Event>${a}</Event>`;s+="</QueueConfiguration>"}let r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
46
|
+
<NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
47
|
+
${s}
|
|
48
|
+
</NotificationConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{notification:""},headers:{"Content-Type":"application/xml"},body:r})}async getBucketWebsite(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{website:""}});return j(t,"WebsiteConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async putBucketWebsite(e,t){let s="";if(t.RedirectAllRequestsTo)s=`<RedirectAllRequestsTo>
|
|
49
|
+
<HostName>${t.RedirectAllRequestsTo.HostName}</HostName>
|
|
50
|
+
${t.RedirectAllRequestsTo.Protocol?`<Protocol>${t.RedirectAllRequestsTo.Protocol}</Protocol>`:""}
|
|
51
|
+
</RedirectAllRequestsTo>`;else if(s=`<IndexDocument><Suffix>${t.IndexDocument}</Suffix></IndexDocument>`,t.ErrorDocument)s+=`<ErrorDocument><Key>${t.ErrorDocument}</Key></ErrorDocument>`;let r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
52
|
+
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
53
|
+
${s}
|
|
54
|
+
</WebsiteConfiguration>`;await this.client.request({service:"s3",region:this.region,method:"PUT",path:`/${e}`,queryParams:{website:""},headers:{"Content-Type":"application/xml"},body:r})}async deleteBucketWebsite(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{website:""}})}async getBucketReplication(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{replication:""}});return j(t,"ReplicationConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async deleteBucketReplication(e){await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${e}`,queryParams:{replication:""}})}async getPublicAccessBlock(e){try{let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${e}`,queryParams:{publicAccessBlock:""}});return j(t,"PublicAccessBlockConfiguration")}catch(t){if(t.statusCode===404)return null;throw t}}async putPublicAccessBlock(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
55
|
+
<PublicAccessBlockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
56
|
+
<BlockPublicAcls>${t.BlockPublicAcls??!0}</BlockPublicAcls>
|
|
57
|
+
<IgnorePublicAcls>${t.IgnorePublicAcls??!0}</IgnorePublicAcls>
|
|
58
|
+
<BlockPublicPolicy>${t.BlockPublicPolicy??!0}</BlockPublicPolicy>
|
|
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:i}=this.getCredentials(),a=this.s3VirtualHost(e),c=new Date,g=c.toISOString().replace(/[:-]|\.\d{3}/g,""),d=c.toISOString().slice(0,10).replace(/-/g,""),u=`${d}/${this.region}/s3/aws4_request`,y=`${r}/${u}`,h=t.split("/").map((C)=>encodeURIComponent(C)).join("/"),m=new URLSearchParams({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":y,"X-Amz-Date":g,"X-Amz-Expires":s.toString(),"X-Amz-SignedHeaders":"host"}),p=["GET",this.objectPath(e,h),m.toString(),`host:${a}
|
|
61
|
+
`,"host","UNSIGNED-PAYLOAD"].join(`
|
|
62
|
+
`),b=["AWS4-HMAC-SHA256",g,u,l.createHash("sha256").update(p).digest("hex")].join(`
|
|
63
|
+
`),S=l.createHmac("sha256",`AWS4${i}`).update(d).digest(),f=l.createHmac("sha256",S).update(this.region).digest(),k=l.createHmac("sha256",f).update("s3").digest(),T=l.createHmac("sha256",k).update("aws4_request").digest(),w=l.createHmac("sha256",T).update(b).digest("hex");return m.append("X-Amz-Signature",w),`${this.endpointProtocol}://${a}${this.objectPath(e,h)}?${m.toString()}`}generatePresignedPutUrl(e,t,s,r=3600){let{accessKeyId:i,secretAccessKey:a}=this.getCredentials(),c=this.s3VirtualHost(e),g=new Date,d=g.toISOString().replace(/[:-]|\.\d{3}/g,""),u=g.toISOString().slice(0,10).replace(/-/g,""),y=`${u}/${this.region}/s3/aws4_request`,h=`${i}/${y}`,m=t.split("/").map((q)=>encodeURIComponent(q)).join("/"),p=new URLSearchParams({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":h,"X-Amz-Date":d,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"content-type;host"}),b=["PUT",this.objectPath(e,m),p.toString(),`content-type:${s}
|
|
64
|
+
host:${c}
|
|
65
|
+
`,"content-type;host","UNSIGNED-PAYLOAD"].join(`
|
|
66
|
+
`),S=["AWS4-HMAC-SHA256",d,y,l.createHash("sha256").update(b).digest("hex")].join(`
|
|
67
|
+
`),f=l.createHmac("sha256",`AWS4${a}`).update(u).digest(),k=l.createHmac("sha256",f).update(this.region).digest(),T=l.createHmac("sha256",k).update("s3").digest(),w=l.createHmac("sha256",T).update("aws4_request").digest(),C=l.createHmac("sha256",w).update(S).digest("hex");return p.append("X-Amz-Signature",C),`${this.endpointProtocol}://${c}${this.objectPath(e,m)}?${p.toString()}`}async createMultipartUpload(e,t,s){let r={};if(s?.contentType)r["Content-Type"]=s.contentType;if(s?.metadata)for(let[g,d]of Object.entries(s.metadata))r[`x-amz-meta-${g}`]=d;let i=t.split("/").map((g)=>encodeURIComponent(g)).join("/"),a=await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${i}`,bucket:e,queryParams:{uploads:""},headers:r});return{UploadId:(a?.InitiateMultipartUploadResult??a)?.UploadId}}async uploadPart(e,t,s,r,i){let{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),d=this.s3VirtualHost(e),u=t.split("/").map((O)=>encodeURIComponent(O)).join("/"),y=this.objectPath(e,u),h=`${this.objectUrl(e,u)}?partNumber=${r}&uploadId=${encodeURIComponent(s)}`,m=new Date,p=m.toISOString().replace(/[:-]|\.\d{3}/g,""),b=m.toISOString().slice(0,10).replace(/-/g,""),S=l.createHash("sha256").update(i).digest("hex"),f={host:d,"x-amz-date":p,"x-amz-content-sha256":S};if(g)f["x-amz-security-token"]=g;let k=Object.keys(f).sort().map((O)=>`${O.toLowerCase()}:${f[O].trim()}
|
|
68
|
+
`).join(""),T=Object.keys(f).sort().map((O)=>O.toLowerCase()).join(";"),w=["PUT",y,`partNumber=${r}&uploadId=${encodeURIComponent(s)}`,k,T,S].join(`
|
|
69
|
+
`),C="AWS4-HMAC-SHA256",q=`${b}/${this.region}/s3/aws4_request`,I=[C,p,q,l.createHash("sha256").update(w).digest("hex")].join(`
|
|
70
|
+
`),K=l.createHmac("sha256",`AWS4${c}`).update(b).digest(),H=l.createHmac("sha256",K).update(this.region).digest(),E=l.createHmac("sha256",H).update("s3").digest(),v=l.createHmac("sha256",E).update("aws4_request").digest(),A=l.createHmac("sha256",v).update(I).digest("hex"),x=`${C} Credential=${a}/${q}, SignedHeaders=${T}, Signature=${A}`,P=await fetch(h,{method:"PUT",headers:{...f,Authorization:x},body:U(i)});if(!P.ok){let O=await P.text();throw Error(`Upload part failed: ${P.status} ${O}`)}return{ETag:P.headers.get("etag")||""}}async completeMultipartUpload(e,t,s,r){let i=t.split("/").map((g)=>encodeURIComponent(g)).join("/"),c=`<?xml version="1.0" encoding="UTF-8"?>
|
|
71
|
+
<CompleteMultipartUpload>${r.sort((g,d)=>g.PartNumber-d.PartNumber).map((g)=>`<Part><PartNumber>${g.PartNumber}</PartNumber><ETag>${g.ETag}</ETag></Part>`).join("")}</CompleteMultipartUpload>`;await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${i}`,bucket:e,queryParams:{uploadId:s},headers:{"Content-Type":"application/xml"},body:c})}async abortMultipartUpload(e,t,s){let r=t.split("/").map((i)=>encodeURIComponent(i)).join("/");await this.client.request({service:"s3",region:this.region,method:"DELETE",path:`/${r}`,bucket:e,queryParams:{uploadId:s}})}async listMultipartUploads(e){let t=await this.client.request({service:"s3",region:this.region,method:"GET",path:"/",bucket:e,queryParams:{uploads:""}}),s=(t?.ListMultipartUploadsResult??t)?.Upload;if(!s)return[];return(Array.isArray(s)?s:[s]).map((i)=>({Key:i.Key,UploadId:i.UploadId,Initiated:i.Initiated}))}async restoreObject(e,t,s,r="Standard"){let i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
72
|
+
<RestoreRequest>
|
|
73
|
+
<Days>${s}</Days>
|
|
74
|
+
<GlacierJobParameters>
|
|
75
|
+
<Tier>${r}</Tier>
|
|
76
|
+
</GlacierJobParameters>
|
|
77
|
+
</RestoreRequest>`;await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}/${t}`,queryParams:{restore:""},headers:{"Content-Type":"application/xml"},body:i})}async selectObjectContent(e,t,s,r,i="JSON"){let a="";if(r==="CSV")a="<CSV><FileHeaderInfo>USE</FileHeaderInfo></CSV>";else if(r==="JSON")a="<JSON><Type>DOCUMENT</Type></JSON>";else a="<Parquet/>";let c="";if(i==="CSV")c="<CSV/>";else c="<JSON/>";let g=`<?xml version="1.0" encoding="UTF-8"?>
|
|
78
|
+
<SelectObjectContentRequest>
|
|
79
|
+
<Expression>${s}</Expression>
|
|
80
|
+
<ExpressionType>SQL</ExpressionType>
|
|
81
|
+
<InputSerialization>${a}</InputSerialization>
|
|
82
|
+
<OutputSerialization>${c}</OutputSerialization>
|
|
83
|
+
</SelectObjectContentRequest>`;return await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}/${t}`,queryParams:{select:"","select-type":"2"},headers:{"Content-Type":"application/xml"},body:g,rawResponse:!0})}async getSignedUrl(e){let{bucket:t,key:s,expiresIn:r=3600,operation:i="getObject"}=e,{accessKeyId:a,secretAccessKey:c,sessionToken:g}=this.getCredentials(),d=new Date,u=d.toISOString().replace(/[:-]|\.\d{3}/g,""),y=d.toISOString().slice(0,10).replace(/-/g,""),h=this.s3VirtualHost(t),m=i==="putObject"?"PUT":"GET",p="AWS4-HMAC-SHA256",b=`${y}/${this.region}/s3/aws4_request`,f={"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":`${a}/${b}`,"X-Amz-Date":u,"X-Amz-Expires":r.toString(),"X-Amz-SignedHeaders":"host"};if(g)f["X-Amz-Security-Token"]=g;let T=Object.keys(f).sort().map((R)=>`${encodeURIComponent(R)}=${encodeURIComponent(f[R])}`).join("&"),w=s.split("/").map((R)=>encodeURIComponent(R)).join("/"),C=this.objectPath(t,w),q=`host:${h}
|
|
84
|
+
`,H=[m,C,T,q,"host","UNSIGNED-PAYLOAD"].join(`
|
|
85
|
+
`),E=["AWS4-HMAC-SHA256",u,b,l.createHash("sha256").update(H).digest("hex")].join(`
|
|
86
|
+
`),v=l.createHmac("sha256",`AWS4${c}`).update(y).digest(),A=l.createHmac("sha256",v).update(this.region).digest(),x=l.createHmac("sha256",A).update("s3").digest(),P=l.createHmac("sha256",x).update("aws4_request").digest(),O=l.createHmac("sha256",P).update(E).digest("hex");return`${this.endpointProtocol}://${h}${C}?${T}&X-Amz-Signature=${O}`}async listObjects(e){let{bucket:t,prefix:s,maxKeys:r=1000,continuationToken:i}=e,a={"list-type":"2","max-keys":r.toString()};if(s)a.prefix=s;if(i)a["continuation-token"]=i;let c=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:a}),g=[],d=c?.ListBucketResult??c;if(d?.Contents){let u=Array.isArray(d.Contents)?d.Contents:[d.Contents];for(let y of u)g.push({Key:y.Key||"",LastModified:y.LastModified||"",Size:Number.parseInt(y.Size||"0"),ETag:y.ETag})}return{objects:g,nextContinuationToken:d?.NextContinuationToken}}async emptyBucket(e){let t=0,s=await this.listAllObjects({bucket:e});if(s.length>0)for(let r=0;r<s.length;r+=1000){let a=s.slice(r,r+1000).map((c)=>c.Key);await this.deleteObjects(e,a),t+=a.length}try{let r,i;do{let a=await this.listObjectVersions({bucket:e,keyMarker:r,versionIdMarker:i,maxKeys:1000}),c=[];if(a.versions)for(let g of a.versions)c.push({Key:g.Key,VersionId:g.VersionId});if(a.deleteMarkers)for(let g of a.deleteMarkers)c.push({Key:g.Key,VersionId:g.VersionId});if(c.length>0)await this.deleteObjectVersions(e,c),t+=c.length;r=a.nextKeyMarker,i=a.nextVersionIdMarker}while(r)}catch{}return{deletedCount:t}}async listObjectVersions(e){let{bucket:t,prefix:s,keyMarker:r,versionIdMarker:i,maxKeys:a=1000}=e,c={versions:"","max-keys":a.toString()};if(s)c.prefix=s;if(r)c["key-marker"]=r;if(i)c["version-id-marker"]=i;let g=await this.client.request({service:"s3",region:this.region,method:"GET",path:`/${t}`,queryParams:c}),d=[],u=[];if(g.Version){let y=Array.isArray(g.Version)?g.Version:[g.Version];for(let h of y)d.push({Key:h.Key,VersionId:h.VersionId,IsLatest:h.IsLatest==="true"})}if(g.DeleteMarker){let y=Array.isArray(g.DeleteMarker)?g.DeleteMarker:[g.DeleteMarker];for(let h of y)u.push({Key:h.Key,VersionId:h.VersionId,IsLatest:h.IsLatest==="true"})}return{versions:d,deleteMarkers:u,nextKeyMarker:g.NextKeyMarker,nextVersionIdMarker:g.NextVersionIdMarker}}async deleteObjectVersions(e,t){let s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
87
|
+
<Delete>
|
|
88
|
+
<Quiet>true</Quiet>
|
|
89
|
+
${t.map((i)=>`<Object><Key>${i.Key}</Key>${i.VersionId?`<VersionId>${i.VersionId}</VersionId>`:""}</Object>`).join(`
|
|
90
|
+
`)}
|
|
91
|
+
</Delete>`,r=l.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{Bt,o};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n}from"./chunk-
|
|
1
|
+
import{n}from"./chunk-zx8ecz8b.js";class y{client;region;constructor(e="us-east-1"){this.region=e,this.client=new n}async createHostedZone(e){let t=e.CallerReference||`${Date.now()}-${Math.random().toString(36).slice(2)}`,o=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
|
3
3
|
<Name>${e.Name}</Name>
|
|
4
4
|
<CallerReference>${t}</CallerReference>`;if(e.HostedZoneConfig){if(o+=`
|