@stacksjs/ts-cloud 0.9.2 → 0.9.4
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 -269
- package/dist/bin/chunk-00kg80qg.js +1 -0
- package/dist/bin/chunk-09nwf2gy.js +34 -0
- package/dist/bin/chunk-1k5kszjp.js +111 -0
- package/dist/bin/chunk-21e0mavm.js +1 -0
- package/dist/bin/chunk-271gk1n2.js +6 -0
- package/dist/bin/chunk-2empps47.js +2 -0
- package/dist/bin/chunk-38pq971s.js +2 -0
- package/dist/bin/chunk-3gykfyq4.js +37 -0
- package/dist/bin/chunk-3vqfexc4.js +70 -0
- package/dist/bin/chunk-4vrqm9h0.js +2 -0
- package/dist/bin/chunk-598yf4bs.js +1 -0
- package/dist/bin/chunk-5ectjq0b.js +1 -0
- package/dist/bin/chunk-5erkxpt7.js +512 -0
- package/dist/bin/chunk-5mrtzemj.js +1 -0
- package/dist/bin/chunk-5n9fmabb.js +1 -0
- package/dist/bin/chunk-9knpg30y.js +1 -0
- package/dist/bin/chunk-9pvsff8g.js +1 -0
- package/dist/bin/chunk-ax9mr6wm.js +44 -0
- package/dist/bin/chunk-axhnkn5g.js +2 -0
- package/dist/bin/chunk-c1vcdgvr.js +1 -0
- package/dist/bin/chunk-ctd2vg9w.js +2 -0
- package/dist/bin/chunk-dbgffky8.js +1 -0
- package/dist/bin/chunk-ddk4rt4j.js +6 -0
- package/dist/bin/chunk-dwr30vbv.js +1 -0
- package/dist/bin/chunk-e0rkrq70.js +1 -0
- package/dist/bin/chunk-e3xrwh9z.js +1 -0
- package/dist/bin/chunk-etrb03mt.js +1507 -0
- package/dist/bin/chunk-fhc6ntvd.js +2 -0
- package/dist/bin/chunk-fpm59y25.js +6 -0
- package/dist/bin/chunk-fvbxvq6b.js +1 -0
- package/dist/bin/chunk-fy8j3y8p.js +92 -0
- package/dist/bin/chunk-fz21b57w.js +1 -0
- package/dist/bin/chunk-gavvf0pg.js +141 -0
- package/dist/bin/chunk-ggn7ax8p.js +4 -0
- package/dist/bin/chunk-gpe2prkm.js +1 -0
- package/dist/bin/chunk-h5pa5men.js +2 -0
- package/dist/bin/chunk-hm08xdxf.js +2 -0
- package/dist/bin/chunk-hzgz13nf.js +1 -0
- package/dist/bin/chunk-j703btc5.js +50 -0
- package/dist/bin/chunk-k9t9wvms.js +1 -0
- package/dist/bin/chunk-m669wtgr.js +1 -0
- package/dist/bin/chunk-m7dgskt1.js +1 -0
- package/dist/bin/chunk-mh0kdzqp.js +2 -0
- package/dist/bin/chunk-mr0atd2s.js +2 -0
- package/dist/bin/chunk-mz0wbbsj.js +3 -0
- package/dist/bin/chunk-ngcyftm2.js +1 -0
- package/dist/bin/chunk-p66ptpmr.js +2 -0
- package/dist/bin/chunk-qk9qgepa.js +1 -0
- package/dist/bin/chunk-rxcvf10f.js +7364 -0
- package/dist/bin/chunk-rytk89az.js +60 -0
- package/dist/bin/chunk-tga3hhwk.js +6 -0
- package/dist/bin/chunk-tx0tqq2k.js +8 -0
- package/dist/bin/chunk-vek8a0w6.js +1 -0
- package/dist/bin/chunk-vm3q5gf2.js +3 -0
- package/dist/bin/chunk-y7s5r8y6.js +3 -0
- package/dist/bin/chunk-yv9sth30.js +1 -0
- package/dist/bin/chunk-zmegvjp8.js +581 -0
- package/dist/bin/cli.js +417 -10597
- package/dist/bin/dashboard-server.js +1 -6998
- package/dist/chunk-0ccta6z6.js +6 -0
- package/dist/chunk-0k1cs6pp.js +1 -0
- package/dist/chunk-1egjn203.js +704 -0
- package/dist/chunk-2wx29qga.js +5 -0
- package/dist/chunk-5m5rqmv7.js +1 -0
- package/dist/chunk-8ea5022g.js +114 -0
- package/dist/chunk-8xqn3c0w.js +2 -0
- package/dist/chunk-b4esxhmw.js +2 -0
- package/dist/chunk-b8e5wzwn.js +44 -0
- package/dist/chunk-bggt4n6e.js +2 -0
- package/dist/chunk-cwkg37rs.js +37 -0
- package/dist/chunk-dskvqt67.js +7355 -0
- package/dist/chunk-gahsdmxf.js +1617 -0
- package/dist/chunk-gnv3r2jg.js +1 -0
- package/dist/chunk-hg3c48cp.js +34 -0
- package/dist/chunk-m5azeva3.js +2 -0
- package/dist/chunk-r3qf56b3.js +92 -0
- package/dist/chunk-sdqa9ghv.js +141 -0
- package/dist/chunk-svrvvcm7.js +1 -0
- package/dist/chunk-v0p3hpc3.js +60 -0
- package/dist/chunk-wdzjbecg.js +50 -0
- package/dist/chunk-ww8k3g7j.js +1 -0
- package/dist/chunk-xmqfc62w.js +1 -0
- package/dist/chunk-xrebj679.js +435 -0
- package/dist/chunk-xt3s24vr.js +2 -0
- package/dist/chunk-y21zk0pn.js +4 -0
- package/dist/deploy/attach-credentials.d.ts +57 -0
- package/dist/deploy/index.js +1 -168
- package/dist/deploy/site-ports.d.ts +151 -0
- package/dist/deploy/site-target.d.ts +24 -1
- package/dist/dns/index.js +1 -41
- package/dist/drivers/index.js +1 -154
- package/dist/index.js +100 -6129
- package/dist/protection/index.js +1 -89
- package/dist/push/index.js +1 -509
- package/dist/spend/index.js +1 -173
- package/dist/ui/404.html +16 -548
- package/dist/ui/_stx/chunk.5ddb5087.js +90 -0
- package/dist/ui/_stx/chunk.9fd39d5b.js +86 -0
- package/dist/ui/_stx/chunk.d5301f79.js +119 -0
- package/dist/ui/_stx/crosswind.222ed683.css +1 -0
- package/dist/ui/_stx/crosswind.616c25f3.css +1 -0
- package/dist/ui/_stx/crosswind.80baa894.css +320 -0
- package/dist/ui/_stx/crosswind.906ee17c.css +1 -0
- package/dist/ui/_stx/crosswind.996ed49e.css +1 -0
- package/dist/ui/_stx/crosswind.b7a99a5c.css +1 -0
- package/dist/ui/_stx/router.fa5bc4dc.js +4 -0
- package/dist/ui/_stx/runtime.c696d17a.js +1 -0
- package/dist/ui/_stx/style.448ab192.css +1 -0
- package/dist/ui/accept-invitation.html +2 -1133
- package/dist/ui/access-denied.html +7 -1130
- package/dist/ui/account/automation.html +12 -1134
- package/dist/ui/account/security.html +13 -1136
- package/dist/ui/applications/compose.html +12 -1134
- package/dist/ui/applications/new.html +13 -1137
- package/dist/ui/data/backups.html +91 -1136
- package/dist/ui/data/services.html +89 -1136
- package/dist/ui/data/volumes.html +61 -1136
- package/dist/ui/index.html +60 -1136
- package/dist/ui/infrastructure/topology.html +128 -1135
- package/dist/ui/integrations.html +13 -1138
- package/dist/ui/operations/alerts.html +59 -1136
- package/dist/ui/operations/configuration.html +13 -1135
- package/dist/ui/operations/jobs.html +87 -1136
- package/dist/ui/operations/maintenance.html +12 -1134
- package/dist/ui/operations/observability.html +93 -1136
- package/dist/ui/operations/previews.html +12 -1134
- package/dist/ui/operations/queue.html +12 -1134
- package/dist/ui/operations/regions.html +12 -1134
- package/dist/ui/operations/releases.html +12 -1134
- package/dist/ui/operations/spend.html +65 -1136
- package/dist/ui/operations/workloads.html +115 -1136
- package/dist/ui/robots.txt +2 -0
- package/dist/ui/security.html +24 -1136
- package/dist/ui/server/actions.html +67 -1138
- package/dist/ui/server/activity.html +7 -1130
- package/dist/ui/server/capacity.html +12 -1134
- package/dist/ui/server/database.html +166 -1135
- package/dist/ui/server/deployments.html +60 -1136
- package/dist/ui/server/diagnostics.html +7 -1130
- package/dist/ui/server/firewall.html +286 -1212
- package/dist/ui/server/fleet.html +45 -1136
- package/dist/ui/server/logs.html +34 -1135
- package/dist/ui/server/metrics.html +124 -1140
- package/dist/ui/server/security.html +7 -1130
- package/dist/ui/server/services.html +46 -1133
- package/dist/ui/server/sites.html +287 -1137
- package/dist/ui/server/ssh-keys.html +62 -1135
- package/dist/ui/server/team.html +155 -1136
- package/dist/ui/server/terminal.html +97 -1183
- package/dist/ui/serverless/alarms.html +62 -1135
- package/dist/ui/serverless/assets.html +47 -1132
- package/dist/ui/serverless/cost.html +7 -1130
- package/dist/ui/serverless/data.html +46 -1135
- package/dist/ui/serverless/deployments.html +47 -1132
- package/dist/ui/serverless/firewall.html +7 -1130
- package/dist/ui/serverless/functions.html +50 -1136
- package/dist/ui/serverless/logs.html +34 -1135
- package/dist/ui/serverless/metrics.html +7 -1130
- package/dist/ui/serverless/queues.html +58 -1135
- package/dist/ui/serverless/secrets.html +62 -1136
- package/dist/ui/serverless/traces.html +12 -1134
- package/dist/ui/serverless.html +64 -1137
- package/dist/ui-src/pages/server/firewall.stx +14 -14
- package/package.json +3 -3
- package/dist/chunk-01d86gt1.js +0 -1324
- package/dist/chunk-050r7ycy.js +0 -46516
- package/dist/chunk-29rse4p1.js +0 -12203
- package/dist/chunk-32e7ya18.js +0 -642
- package/dist/chunk-4cjrg98a.js +0 -597
- package/dist/chunk-50jpda9q.js +0 -371
- package/dist/chunk-6a1t7fnq.js +0 -12121
- package/dist/chunk-728jvrr0.js +0 -1701
- package/dist/chunk-7m60qnc8.js +0 -1762
- package/dist/chunk-aa2dkn7b.js +0 -205
- package/dist/chunk-d48vtdj4.js +0 -433
- package/dist/chunk-f55nkpvb.js +0 -8
- package/dist/chunk-fgk8cqew.js +0 -152
- package/dist/chunk-he9a874b.js +0 -769
- package/dist/chunk-hg7rhrgd.js +0 -7274
- package/dist/chunk-k2yyatfw.js +0 -10
- package/dist/chunk-k4px0bnv.js +0 -23
- package/dist/chunk-nsgqsmrh.js +0 -1779
- package/dist/chunk-qr803fye.js +0 -2122
- package/dist/chunk-rds0sy87.js +0 -1771
- package/dist/chunk-rxgchb08.js +0 -42033
- package/dist/chunk-ttz2ra5j.js +0 -12
- package/dist/chunk-v0bahtg2.js +0 -4
- package/dist/chunk-va2yd85b.js +0 -200
- package/dist/chunk-x9s0cqfx.js +0 -13
- package/dist/chunk-zqtpg06c.js +0 -1752
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Og as _}from"./chunk-fpm59y25.js";class ${client;region;constructor(j="us-east-1",q){this.region=j,this.client=new _(void 0,{profile:q})}async createStack(j){let q={Action:"CreateStack",StackName:j.stackName,Version:"2010-05-15"};if(j.templateBody)q.TemplateBody=j.templateBody;else if(j.templateUrl)q.TemplateURL=j.templateUrl;else throw Error("Either templateBody or templateUrl must be provided");if(j.parameters)j.parameters.forEach((z,H)=>{q[`Parameters.member.${H+1}.ParameterKey`]=z.ParameterKey,q[`Parameters.member.${H+1}.ParameterValue`]=z.ParameterValue});if(j.capabilities)j.capabilities.forEach((z,H)=>{q[`Capabilities.member.${H+1}`]=z});if(j.roleArn)q.RoleARN=j.roleArn;if(j.tags)j.tags.forEach((z,H)=>{q[`Tags.member.${H+1}.Key`]=z.Key,q[`Tags.member.${H+1}.Value`]=z.Value});if(j.timeoutInMinutes)q.TimeoutInMinutes=j.timeoutInMinutes;if(j.onFailure)q.OnFailure=j.onFailure;let G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()});return{StackId:G.StackId||G.CreateStackResult?.StackId}}async updateStack(j){let q={Action:"UpdateStack",StackName:j.stackName,Version:"2010-05-15"};if(j.templateBody)q.TemplateBody=j.templateBody;else if(j.templateUrl)q.TemplateURL=j.templateUrl;if(j.parameters)j.parameters.forEach((z,H)=>{if(q[`Parameters.member.${H+1}.ParameterKey`]=z.ParameterKey,z.UsePreviousValue)q[`Parameters.member.${H+1}.UsePreviousValue`]="true";else q[`Parameters.member.${H+1}.ParameterValue`]=z.ParameterValue});if(j.capabilities)j.capabilities.forEach((z,H)=>{q[`Capabilities.member.${H+1}`]=z});if(j.roleArn)q.RoleARN=j.roleArn;if(j.tags)j.tags.forEach((z,H)=>{q[`Tags.member.${H+1}.Key`]=z.Key,q[`Tags.member.${H+1}.Value`]=z.Value});let G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()});return{StackId:G.StackId||G.UpdateStackResult?.StackId}}async deleteStack(j,q,G){let z={Action:"DeleteStack",StackName:j,Version:"2010-05-15"};if(q)z.RoleARN=q;if(G&&G.length>0)G.forEach((H,Q)=>{z[`RetainResources.member.${Q+1}`]=H});await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(z).toString()})}async describeStacks(j={}){let q={Action:"DescribeStacks",Version:"2010-05-15"};if(j.stackName)q.StackName=j.stackName;let G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()});return{Stacks:this.parseStacksResponse(G)}}async describeStackEvents(j){let q={Action:"DescribeStackEvents",StackName:j,Version:"2010-05-15"},G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()});return{StackEvents:this.parseStackEvents(G)}}async listStackResources(j){let q={Action:"ListStackResources",StackName:j,Version:"2010-05-15"},z=(await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()}))?.ListStackResourcesResult?.StackResourceSummaries?.member,H=[];if(z)H=Array.isArray(z)?z:[z];return{StackResourceSummaries:H}}async waitForStack(j,q){let G={"stack-create-complete":["CREATE_COMPLETE"],"stack-update-complete":["UPDATE_COMPLETE"],"stack-delete-complete":["DELETE_COMPLETE"]},z=["CREATE_FAILED","ROLLBACK_FAILED","ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE"],H=G[q],Q=360,J=0;while(J<360)try{let I=await this.describeStacks({stackName:j});if(I.Stacks.length===0){if(q==="stack-delete-complete")return;if(J%10===0)console.log(`[waitForStack] Attempt ${J}: Stack not visible yet`);await new Promise((O)=>setTimeout(O,2000)),J++;continue}let L=I.Stacks[0];if(J%10===0)console.log(`[waitForStack] Attempt ${J}: Status = ${L.StackStatus}${L.StackStatusReason?` (${L.StackStatusReason})`:""}`);if(H.includes(L.StackStatus))return;if((q==="stack-create-complete"||q==="stack-update-complete")&&(L.StackStatus==="DELETE_IN_PROGRESS"||L.StackStatus==="DELETE_COMPLETE")){console.log("[waitForStack] Stack is being deleted (creation/update failed)");let O="";try{let U=await this.describeStackEvents(j);console.log("[waitForStack] Stack events (most recent first):");for(let X of U.StackEvents.slice(0,15))if(X.ResourceStatus.includes("FAILED")||X.ResourceStatusReason){if(console.log(` ${X.LogicalResourceId}: ${X.ResourceStatus} - ${X.ResourceStatusReason||"No reason provided"}`),X.ResourceStatus.includes("FAILED")&&X.ResourceStatusReason&&!O)O=X.ResourceStatusReason}}catch{}let V=O||L.StackStatusReason||"Check CloudFormation console for details.";throw Error(`Stack creation/update failed - stack is being deleted. Reason: ${V}`)}if(L.StackStatus==="DELETE_FAILED"&&q==="stack-delete-complete"){let O=Error("Stack deletion failed - may have resources that need to be retained");throw O.code="DELETE_FAILED",O.stackStatus=L.StackStatus,O.statusReason=L.StackStatusReason,O}if(z.includes(L.StackStatus))throw Error(`Stack reached failure status: ${L.StackStatus}`);await new Promise((O)=>setTimeout(O,5000)),J++}catch(I){if(q==="stack-delete-complete"&&I.message?.includes("does not exist"))return;if(q==="stack-create-complete"&&I.message?.includes("does not exist")){if(J%10===0)console.log(`[waitForStack] Attempt ${J}: Stack does not exist (error), retrying...`);await new Promise((L)=>setTimeout(L,2000)),J++;continue}throw console.log(`[waitForStack] Unexpected error: ${I.message}`),I}throw console.log(`[waitForStack] Timeout after ${J} attempts`),Error(`Timeout waiting for stack to reach ${q}`)}async validateTemplate(j){let q={Action:"ValidateTemplate",TemplateBody:j,Version:"2010-05-15"};return await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()})}async listStacks(j){let q={Action:"ListStacks",Version:"2010-05-15"};if(j)j.forEach((I,L)=>{q[`StackStatusFilter.member.${L+1}`]=I});let G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()}),z=G.ListStacksResponse||G,H=z.ListStacksResult||z,Q=H.StackSummaries?.member||H.StackSummaries||[];return{StackSummaries:(Array.isArray(Q)?Q:Q?[Q]:[]).map((I)=>({StackId:I.StackId||"",StackName:I.StackName||"",TemplateDescription:I.TemplateDescription,CreationTime:I.CreationTime||"",LastUpdatedTime:I.LastUpdatedTime,DeletionTime:I.DeletionTime,StackStatus:I.StackStatus||""}))}}async createChangeSet(j){let q={Action:"CreateChangeSet",StackName:j.stackName,ChangeSetName:j.changeSetName,Version:"2010-05-15"};if(j.templateBody)q.TemplateBody=j.templateBody;else if(j.templateUrl)q.TemplateURL=j.templateUrl;if(j.parameters)j.parameters.forEach((z,H)=>{q[`Parameters.member.${H+1}.ParameterKey`]=z.ParameterKey,q[`Parameters.member.${H+1}.ParameterValue`]=z.ParameterValue});if(j.capabilities)j.capabilities.forEach((z,H)=>{q[`Capabilities.member.${H+1}`]=z});if(j.changeSetType)q.ChangeSetType=j.changeSetType;let G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()});return{Id:G.Id,StackId:G.StackId}}async describeChangeSet(j,q){let G={Action:"DescribeChangeSet",StackName:j,ChangeSetName:q,Version:"2010-05-15"};return await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(G).toString()})}async executeChangeSet(j,q){let G={Action:"ExecuteChangeSet",StackName:j,ChangeSetName:q,Version:"2010-05-15"};await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(G).toString()})}async deleteChangeSet(j,q){let G={Action:"DeleteChangeSet",StackName:j,ChangeSetName:q,Version:"2010-05-15"};await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(G).toString()})}async getStackOutputs(j){let q=await this.describeStacks({stackName:j});if(!q.Stacks||q.Stacks.length===0)throw Error(`Stack ${j} not found`);let G=q.Stacks[0],z={};if(G.Outputs)for(let H of G.Outputs)z[H.OutputKey]=H.OutputValue;return z}async getTemplate(j){let q={Action:"GetTemplate",StackName:j,Version:"2010-05-15"},G=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(q).toString()});return{TemplateBody:G?.GetTemplateResult?.TemplateBody||G?.TemplateBody||""}}parseStacksResponse(j){let q=[],G=j?.DescribeStacksResult?.Stacks?.member||j?.Stacks?.member||j?.Stacks||j;if(G&&!Array.isArray(G))G=[G];if(Array.isArray(G)){for(let z of G)if(z.StackId||z.StackName){let H;if(z.Outputs?.member)H=(Array.isArray(z.Outputs.member)?z.Outputs.member:[z.Outputs.member]).map((J)=>({OutputKey:J.OutputKey,OutputValue:J.OutputValue,Description:J.Description,ExportName:J.ExportName}));q.push({StackId:z.StackId,StackName:z.StackName,StackStatus:z.StackStatus,CreationTime:z.CreationTime,LastUpdatedTime:z.LastUpdatedTime,StackStatusReason:z.StackStatusReason,Outputs:H})}}else if(j.StackId)q.push({StackId:j.StackId,StackName:j.StackName,StackStatus:j.StackStatus,CreationTime:j.CreationTime,LastUpdatedTime:j.LastUpdatedTime});return q}parseStackEvents(j){let q=[],G=j?.DescribeStackEventsResult?.StackEvents?.member||j?.StackEvents?.member||j?.StackEvents||[];if(G&&!Array.isArray(G))G=[G];for(let z of G)if(z.LogicalResourceId)q.push({Timestamp:z.Timestamp,ResourceType:z.ResourceType,LogicalResourceId:z.LogicalResourceId,ResourceStatus:z.ResourceStatus,ResourceStatusReason:z.ResourceStatusReason});return q}async waitForStackWithProgress(j,q,G){let z={"stack-create-complete":["CREATE_COMPLETE"],"stack-update-complete":["UPDATE_COMPLETE"],"stack-delete-complete":["DELETE_COMPLETE"]},H=["CREATE_FAILED","ROLLBACK_FAILED","ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE"],Q=z[q],J=360,I=0,L=new Set;while(I<360)try{if(G)try{let X=[...(await this.describeStackEvents(j)).StackEvents||[]].reverse();for(let Y of X){let Z=`${Y.LogicalResourceId}-${Y.ResourceStatus}-${Y.Timestamp}`;if(!L.has(Z))L.add(Z),G({resourceId:Y.LogicalResourceId,resourceType:Y.ResourceType,status:Y.ResourceStatus,reason:Y.ResourceStatusReason,timestamp:Y.Timestamp})}}catch{}let O=await this.describeStacks({stackName:j});if(O.Stacks.length===0){if(q==="stack-delete-complete")return;await new Promise((U)=>setTimeout(U,2000)),I++;continue}let V=O.Stacks[0];if(Q.includes(V.StackStatus))return;if(V.StackStatus==="DELETE_FAILED"&&q==="stack-delete-complete"){let U=Error("Stack deletion failed - may have resources that need to be retained");throw U.code="DELETE_FAILED",U.stackStatus=V.StackStatus,U.statusReason=V.StackStatusReason,U}if(H.includes(V.StackStatus))throw Error(`Stack reached failure status: ${V.StackStatus}`);await new Promise((U)=>setTimeout(U,3000)),I++}catch(O){if(q==="stack-delete-complete"&&O.message?.includes("does not exist"))return;if(q==="stack-create-complete"&&O.message?.includes("does not exist")){await new Promise((V)=>setTimeout(V,2000)),I++;continue}throw O}throw Error(`Timeout waiting for stack to reach ${q}`)}async waitForStackComplete(j,q=120,G=5000){let z=["CREATE_COMPLETE","UPDATE_COMPLETE","DELETE_COMPLETE"],H=["CREATE_FAILED","UPDATE_FAILED","DELETE_FAILED","ROLLBACK_COMPLETE","ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED"];for(let Q=0;Q<q;Q++)try{let J=await this.describeStacks({stackName:j});if(J.Stacks.length===0)return{success:!0,status:"DELETE_COMPLETE"};let I=J.Stacks[0],L=I.StackStatus;if(z.includes(L))return{success:!0,status:L};if(H.includes(L))return{success:!1,status:L,reason:I.StackStatusReason};await new Promise((O)=>setTimeout(O,G))}catch(J){if(J.message?.includes("does not exist"))return{success:!0,status:"DELETE_COMPLETE"};throw J}return{success:!1,status:"TIMEOUT",reason:"Timeout waiting for stack operation"}}}
|
|
2
|
+
export{$ as Uf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Og as v}from"./chunk-fpm59y25.js";class B{client;region;constructor(k="us-east-1",q){this.region=k,this.client=new v(void 0,{profile:q})}async getCallerIdentity(){let k=await this.client.request({service:"sts",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetCallerIdentity&Version=2011-06-15"});if(typeof k==="string"){let w=k.match(/<Account>(\d+)<\/Account>/),x=k.match(/<UserId>([^<]+)<\/UserId>/),z=k.match(/<Arn>([^<]+)<\/Arn>/);return{Account:w?.[1],UserId:x?.[1],Arn:z?.[1]}}let q=k?.GetCallerIdentityResponse?.GetCallerIdentityResult||k?.GetCallerIdentityResult;if(q)return{Account:String(q.Account),UserId:q.UserId,Arn:q.Arn};if(k?.Account)return{Account:String(k.Account),UserId:k.UserId,Arn:k.Arn};return{Account:void 0,UserId:void 0,Arn:void 0}}}
|
|
2
|
+
export{B as cd};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qe as L}from"./chunk-ax9mr6wm.js";var _="\x00";function X(R,E){if(R==="*"||R==="**")return!0;let D=R.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*");return new RegExp(`^${D}$`).test(E)}function A(R,E){if(R.startsWith("*.")){let D=R.slice(1);return E.endsWith(D)&&E.length>D.length}return R===E}function W(R,E){if(R.enabled===!1)return!1;if(R.methods?.length&&!R.methods.some((D)=>D.toUpperCase()===E.method.toUpperCase()))return!1;if(R.path&&!X(R.path,E.path))return!1;if(R.host&&!A(R.host,E.host??""))return!1;return!0}function Z(R,E){let D=R.key??{source:"ip"},F=D.fallbackToIp!==!1,H;if(D.source==="ip")H=E.ip;else if(D.source==="global")H="global";else if(D.source==="host")H=E.host??"";else if(D.source==="path")H=E.path;else if(D.source==="header")H=D.name?E.headers?.[D.name.toLowerCase()]:void 0;else if(D.source==="cookie")H=D.name?E.cookies?.[D.name]:void 0;if(!H&&D.source!=="global")H=F?E.ip:"__missing__";return`${R.id}\x00${H}`}class C{clock;maxTrackedKeys;buckets=new Map;windows=new Map;rules;constructor(R,E=()=>Date.now(),D=1e5){this.clock=E;this.maxTrackedKeys=D;this.rules=[...R].sort((F,H)=>(F.priority??0)-(H.priority??0))}check(R){let E=this.clock(),D=this.rules.filter((j)=>W(j,R)),F;for(let j of D){let z=this.test(j,R,E);if(z.allowed)continue;if(!F||$(z.action)>$(F.action))F=z}if(F)return F;let H={action:"allow",allowed:!0};for(let j of D){let z=this.consume(j,R,E);if(z.remaining!=null&&(H.remaining??1/0)>z.remaining)H=z}return H}test(R,E,D){let F=Z(R,E);if((R.algorithm??"token_bucket")==="token_bucket"){let j=R.burst??R.limit,z=this.buckets.get(F),B=z?Math.min(j,z.tokens+this.refill(R,D-z.updatedAt)):j;if(B>=1)return{action:"allow",allowed:!0};return this.blocked(R,F,0,this.msPerToken(R)*(1-B),D)}let H=(this.windows.get(F)?.hits??[]).filter((j)=>j>D-R.windowMs);if(H.length<R.limit)return{action:"allow",allowed:!0};return this.blocked(R,F,0,H[0]+R.windowMs-D,D)}peek(R){let E=this.clock();for(let D of this.rules){if(!W(D,R))continue;let F=this.test(D,R,E);if(!F.allowed)return F}return{action:"allow",allowed:!0}}msPerToken(R){return R.windowMs/Math.max(1,R.limit)}refill(R,E){return Math.max(0,E)/this.msPerToken(R)}blocked(R,E,D,F,H){let j=R.action??"deny";return{action:j,allowed:j==="allow"||j==="log",ruleId:R.id,limit:R.limit,remaining:D,retryAfterMs:Math.max(0,Math.ceil(F)),resetAt:H+Math.max(0,F),key:E}}consume(R,E,D){let F=Z(R,E);if((R.algorithm??"token_bucket")==="token_bucket"){let J=R.burst??R.limit,V=this.buckets.get(F)??{tokens:J,updatedAt:D},Q=Math.min(J,V.tokens+this.refill(R,D-V.updatedAt));if(Q<1)return this.buckets.set(F,{tokens:Q,updatedAt:D}),this.blocked(R,F,0,this.msPerToken(R)*(1-Q),D);return this.evictIfNeeded(this.buckets),this.buckets.set(F,{tokens:Q-1,updatedAt:D}),{action:"allow",allowed:!0,ruleId:R.id,limit:J,remaining:Math.floor(Q-1),resetAt:D+this.msPerToken(R)*(J-(Q-1)),key:F}}let j=this.windows.get(F)??{hits:[]},z=D-R.windowMs,B=j.hits.filter((J)=>J>z);if(B.length>=R.limit)return this.windows.set(F,{hits:B}),this.blocked(R,F,0,B[0]+R.windowMs-D,D);return B.push(D),this.evictIfNeeded(this.windows),this.windows.set(F,{hits:B}),{action:"allow",allowed:!0,ruleId:R.id,limit:R.limit,remaining:R.limit-B.length,resetAt:B[0]+R.windowMs,key:F}}evictIfNeeded(R){if(R.size<this.maxTrackedKeys)return;let E=R.size-this.maxTrackedKeys+1,D=0;for(let F of R.keys())if(R.delete(F),++D>=E)break}sweep(){let R=this.clock(),E=0;for(let[D,F]of this.windows){let H=D.split("\x00")[0],j=this.rules.find((z)=>z.id===H);if(!j){this.windows.delete(D),E++;continue}if(F.hits.every((z)=>z<=R-j.windowMs))this.windows.delete(D),E++}for(let[D,F]of this.buckets){let H=D.split("\x00")[0],j=this.rules.find((z)=>z.id===H);if(!j||R-F.updatedAt>j.windowMs*2)this.buckets.delete(D),E++}return E}get trackedKeys(){return this.buckets.size+this.windows.size}}function $(R){return{allow:0,log:1,throttle:2,challenge:3,deny:4}[R]}function O(R){let E={};if(R.limit!=null)E["ratelimit-limit"]=String(R.limit);if(R.remaining!=null)E["ratelimit-remaining"]=String(R.remaining);if(R.resetAt!=null)E["ratelimit-reset"]=String(Math.max(0,Math.ceil((R.resetAt-Date.now())/1000)));if(!R.allowed&&R.retryAfterMs!=null)E["retry-after"]=String(Math.max(1,Math.ceil(R.retryAfterMs/1000)));return E}function T(){return[{id:"global-ip",limit:600,windowMs:60000,burst:100,key:{source:"ip"},action:"deny",priority:100},{id:"api-ip",limit:120,windowMs:60000,burst:30,path:"/api/**",key:{source:"ip"},action:"deny",priority:50},{id:"auth-ip",limit:10,windowMs:60000,algorithm:"sliding_window",path:"/auth/**",methods:["POST"],key:{source:"ip"},action:"challenge",priority:10}]}var G="protection.controls",U=24,N=4,P={ipRules:{allow:[],block:[]}};function Y(R,E){if(!R?.enabled)return;return new Date(R.expiresAt).getTime()>E.getTime()?R:void 0}function I(R,E){let D=Number.isFinite(R)?Number(R):E;return Math.min(U,Math.max(0.25,D))}var K=500;class S{controlPlane;options;constructor(R,E={}){this.controlPlane=R;this.options=E}now(){return this.options.now?.()??new Date}read(){let R=this.controlPlane.getSetting(G);if(!R||typeof R!=="object"||Array.isArray(R))return{...P,ipRules:{allow:[],block:[]}};let E=R;return{attackMode:E.attackMode,mitigationPause:E.mitigationPause,ipRules:{allow:Array.isArray(E.ipRules?.allow)?E.ipRules.allow:[],block:Array.isArray(E.ipRules?.block)?E.ipRules.block:[]},updatedAt:E.updatedAt}}write(R){let E={...R,updatedAt:this.now().toISOString()};return this.controlPlane.setSetting(G,E),E}raw(){return this.read()}current(){let R=this.now(),E=this.read();return{attackMode:Y(E.attackMode,R),mitigationPause:Y(E.mitigationPause,R),ipRules:E.ipRules}}enableAttackMode(R){let E=this.now(),D={enabled:!0,startedAt:E.toISOString(),expiresAt:new Date(E.getTime()+I(R.hours,N)*3600000).toISOString(),reason:R.reason.trim()||"Attack mode enabled by an operator.",actorId:R.actorId};return this.write({...this.read(),attackMode:D}),D}disableAttackMode(){let R=this.read();if(!R.attackMode?.enabled)return!1;return this.write({...R,attackMode:{...R.attackMode,enabled:!1}}),!0}pauseMitigations(R){let E=R.reason.trim();if(!E)throw Error("Pausing mitigations requires a reason: you are liable for the traffic it admits.");let D=this.now(),F={enabled:!0,startedAt:D.toISOString(),expiresAt:new Date(D.getTime()+I(R.hours,U)*3600000).toISOString(),reason:E,actorId:R.actorId};return this.write({...this.read(),mitigationPause:F}),F}resumeMitigations(){let R=this.read();if(!R.mitigationPause?.enabled)return!1;return this.write({...R,mitigationPause:{...R.mitigationPause,enabled:!1}}),!0}addIpRule(R,E){let D=E.trim();if(!L(D))throw Error(`Not a valid IP or CIDR: ${E}`);let F=this.read(),H={...F.ipRules,[R]:[...new Set([...F.ipRules[R],D])]};if(H[R].length>K)throw Error(`At most ${K} ${R} rules are supported.`);let j=R==="allow"?"block":"allow";return H[j]=H[j].filter((z)=>z!==D),this.write({...F,ipRules:H}),H}removeIpRule(R,E){let D=this.read(),F={...D.ipRules,[R]:D.ipRules[R].filter((H)=>H!==E.trim())};return this.write({...D,ipRules:F}),F}}function b(R){if(R.mitigationPause)return{attackMode:!!R.attackMode,mitigationPaused:!0,summary:`Automatic mitigation is paused until ${R.mitigationPause.expiresAt}. All traffic is being served and billed.`,expiresAt:R.mitigationPause.expiresAt};if(R.attackMode)return{attackMode:!0,mitigationPaused:!1,summary:`Attack mode is on until ${R.attackMode.expiresAt}. Every visitor is being challenged.`,expiresAt:R.attackMode.expiresAt};return{attackMode:!1,mitigationPaused:!1,summary:"Protection is in its normal posture."}}function m(R,E){if(E.mitigationPause)return R.map((D)=>({...D,enabled:!1}));if(!E.attackMode)return[...R];return R.map((D)=>({...D,action:D.action==="deny"?"deny":"challenge",burst:Math.max(1,Math.min(D.burst??D.limit,5))}))}function x(R,E){let D=[...new Set([...R.allowlist??[],...E.ipRules.allow])],F=[...new Set([...R.blocklist??[],...E.ipRules.block])];if(E.mitigationPause)return{...R,allowlist:D,blocklist:F,monitorOnly:!0};if(!E.attackMode)return{...R,allowlist:D,blocklist:F};let H=R.thresholds??{};return{...R,allowlist:D,blocklist:F,thresholds:{...H,newConnectionsPerSecond:Math.max(1,Math.floor((H.newConnectionsPerSecond??50)/5)),concurrentPerSource:Math.max(1,Math.floor((H.concurrentPerSource??100)/5))}}}function f(R,E){let D=R?.infrastructure?.compute;if(!D||D.ddos===!1)return R;let F=typeof D.ddos==="object"&&D.ddos!==null?D.ddos:{};return{...R,infrastructure:{...R.infrastructure,compute:{...D,ddos:x(F,E)}}}}export{_ as a,X as b,W as c,Z as d,C as e,O as f,T as g,G as h,U as i,N as j,S as k,b as l,m,x as n,f as o};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import{Og as L}from"./chunk-fpm59y25.js";class Q{client;region;constructor(j="us-east-1"){this.region=j,this.client=new L}async createHostedZone(j){let k=j.CallerReference||`${Date.now()}-${Math.random().toString(36).slice(2)}`,F=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
|
3
|
+
<Name>${j.Name}</Name>
|
|
4
|
+
<CallerReference>${k}</CallerReference>`;if(j.HostedZoneConfig){if(F+=`
|
|
5
|
+
<HostedZoneConfig>`,j.HostedZoneConfig.Comment)F+=`
|
|
6
|
+
<Comment>${j.HostedZoneConfig.Comment}</Comment>`;if(j.HostedZoneConfig.PrivateZone!==void 0)F+=`
|
|
7
|
+
<PrivateZone>${j.HostedZoneConfig.PrivateZone}</PrivateZone>`;F+=`
|
|
8
|
+
</HostedZoneConfig>`}if(j.VPC)F+=`
|
|
9
|
+
<VPC>
|
|
10
|
+
<VPCRegion>${j.VPC.VPCRegion}</VPCRegion>
|
|
11
|
+
<VPCId>${j.VPC.VPCId}</VPCId>
|
|
12
|
+
</VPC>`;if(j.DelegationSetId)F+=`
|
|
13
|
+
<DelegationSetId>${j.DelegationSetId}</DelegationSetId>`;F+=`
|
|
14
|
+
</CreateHostedZoneRequest>`;let J=await this.client.request({service:"route53",region:this.region,method:"POST",path:"/2013-04-01/hostedzone",headers:{"content-type":"application/xml"},body:F});return this.parseCreateHostedZoneResponse(J)}async listHostedZones(j){let k={};if(j?.Marker)k.marker=j.Marker;if(j?.MaxItems)k.maxitems=j.MaxItems;let F=await this.client.request({service:"route53",region:this.region,method:"GET",path:"/2013-04-01/hostedzone",queryParams:Object.keys(k).length>0?k:void 0});return this.parseListHostedZonesResponse(F)}async listHostedZonesByName(j){let k={};if(j?.DNSName)k.dnsname=j.DNSName;if(j?.HostedZoneId)k.hostedzoneid=j.HostedZoneId;if(j?.MaxItems)k.maxitems=j.MaxItems;let F=await this.client.request({service:"route53",region:this.region,method:"GET",path:"/2013-04-01/hostedzonesbyname",queryParams:Object.keys(k).length>0?k:void 0});return this.parseListHostedZonesResponse(F)}async getHostedZone(j){let k=j.Id.replace("/hostedzone/",""),F=await this.client.request({service:"route53",region:this.region,method:"GET",path:`/2013-04-01/hostedzone/${k}`});return this.parseGetHostedZoneResponse(F)}async deleteHostedZone(j){let k=j.Id.replace("/hostedzone/","");await this.client.request({service:"route53",region:this.region,method:"DELETE",path:`/2013-04-01/hostedzone/${k}`})}async listResourceRecordSets(j){let k=j.HostedZoneId.replace("/hostedzone/",""),F={};if(j.StartRecordName)F.name=j.StartRecordName;if(j.StartRecordType)F.type=j.StartRecordType;if(j.StartRecordIdentifier)F.identifier=j.StartRecordIdentifier;if(j.MaxItems)F.maxitems=j.MaxItems;let J=await this.client.request({service:"route53",region:this.region,method:"GET",path:`/2013-04-01/hostedzone/${k}/rrset`,queryParams:Object.keys(F).length>0?F:void 0});return this.parseListResourceRecordSetsResponse(J)}async changeResourceRecordSets(j){let k=j.HostedZoneId.replace("/hostedzone/",""),F=`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
|
+
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
|
16
|
+
<ChangeBatch>`;if(j.ChangeBatch.Comment)F+=`
|
|
17
|
+
<Comment>${this.escapeXml(j.ChangeBatch.Comment)}</Comment>`;F+=`
|
|
18
|
+
<Changes>`;for(let H of j.ChangeBatch.Changes){if(F+=`
|
|
19
|
+
<Change>
|
|
20
|
+
<Action>${H.Action}</Action>
|
|
21
|
+
<ResourceRecordSet>
|
|
22
|
+
<Name>${H.ResourceRecordSet.Name}</Name>
|
|
23
|
+
<Type>${H.ResourceRecordSet.Type}</Type>`,H.ResourceRecordSet.TTL!==void 0)F+=`
|
|
24
|
+
<TTL>${H.ResourceRecordSet.TTL}</TTL>`;if(H.ResourceRecordSet.SetIdentifier)F+=`
|
|
25
|
+
<SetIdentifier>${H.ResourceRecordSet.SetIdentifier}</SetIdentifier>`;if(H.ResourceRecordSet.Weight!==void 0)F+=`
|
|
26
|
+
<Weight>${H.ResourceRecordSet.Weight}</Weight>`;if(H.ResourceRecordSet.Region)F+=`
|
|
27
|
+
<Region>${H.ResourceRecordSet.Region}</Region>`;if(H.ResourceRecordSet.Failover)F+=`
|
|
28
|
+
<Failover>${H.ResourceRecordSet.Failover}</Failover>`;if(H.ResourceRecordSet.HealthCheckId)F+=`
|
|
29
|
+
<HealthCheckId>${H.ResourceRecordSet.HealthCheckId}</HealthCheckId>`;if(H.ResourceRecordSet.ResourceRecords&&H.ResourceRecordSet.ResourceRecords.length>0){F+=`
|
|
30
|
+
<ResourceRecords>`;for(let K of H.ResourceRecordSet.ResourceRecords)F+=`
|
|
31
|
+
<ResourceRecord>
|
|
32
|
+
<Value>${this.escapeXml(K.Value)}</Value>
|
|
33
|
+
</ResourceRecord>`;F+=`
|
|
34
|
+
</ResourceRecords>`}if(H.ResourceRecordSet.AliasTarget)F+=`
|
|
35
|
+
<AliasTarget>
|
|
36
|
+
<HostedZoneId>${H.ResourceRecordSet.AliasTarget.HostedZoneId}</HostedZoneId>
|
|
37
|
+
<DNSName>${H.ResourceRecordSet.AliasTarget.DNSName}</DNSName>
|
|
38
|
+
<EvaluateTargetHealth>${H.ResourceRecordSet.AliasTarget.EvaluateTargetHealth}</EvaluateTargetHealth>
|
|
39
|
+
</AliasTarget>`;if(H.ResourceRecordSet.GeoLocation){if(F+=`
|
|
40
|
+
<GeoLocation>`,H.ResourceRecordSet.GeoLocation.ContinentCode)F+=`
|
|
41
|
+
<ContinentCode>${H.ResourceRecordSet.GeoLocation.ContinentCode}</ContinentCode>`;if(H.ResourceRecordSet.GeoLocation.CountryCode)F+=`
|
|
42
|
+
<CountryCode>${H.ResourceRecordSet.GeoLocation.CountryCode}</CountryCode>`;if(H.ResourceRecordSet.GeoLocation.SubdivisionCode)F+=`
|
|
43
|
+
<SubdivisionCode>${H.ResourceRecordSet.GeoLocation.SubdivisionCode}</SubdivisionCode>`;F+=`
|
|
44
|
+
</GeoLocation>`}F+=`
|
|
45
|
+
</ResourceRecordSet>
|
|
46
|
+
</Change>`}F+=`
|
|
47
|
+
</Changes>
|
|
48
|
+
</ChangeBatch>
|
|
49
|
+
</ChangeResourceRecordSetsRequest>`;let J=await this.client.request({service:"route53",region:this.region,method:"POST",path:`/2013-04-01/hostedzone/${k}/rrset`,headers:{"content-type":"application/xml"},body:F});return this.parseChangeResourceRecordSetsResponse(J)}escapeXml(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}parseCreateHostedZoneResponse(j){let k=j.CreateHostedZoneResponse||j;return{HostedZone:this.parseHostedZone(k.HostedZone),ChangeInfo:{Id:k.ChangeInfo?.Id||"",Status:k.ChangeInfo?.Status||"",SubmittedAt:k.ChangeInfo?.SubmittedAt||""},DelegationSet:this.parseDelegationSet(k.DelegationSet),Location:k.Location||""}}parseListHostedZonesResponse(j){let k=j.ListHostedZonesResponse||j.ListHostedZonesByNameResponse||j,F=k.HostedZones?.HostedZone||k.HostedZones||[];if(!Array.isArray(F))F=F?[F]:[];return{HostedZones:F.map((J)=>this.parseHostedZone(J)),IsTruncated:k.IsTruncated==="true"||k.IsTruncated===!0,MaxItems:k.MaxItems||"100",Marker:k.Marker,NextMarker:k.NextMarker}}parseGetHostedZoneResponse(j){let k=j.GetHostedZoneResponse||j;return{HostedZone:this.parseHostedZone(k.HostedZone),DelegationSet:this.parseDelegationSet(k.DelegationSet),VPCs:k.VPCs?.VPC?Array.isArray(k.VPCs.VPC)?k.VPCs.VPC:[k.VPCs.VPC]:void 0}}parseListResourceRecordSetsResponse(j){let k=j.ListResourceRecordSetsResponse||j,F=k.ResourceRecordSets?.ResourceRecordSet||k.ResourceRecordSets||[];if(!Array.isArray(F))F=F?[F]:[];return{ResourceRecordSets:F.map((J)=>this.parseResourceRecordSet(J)),IsTruncated:k.IsTruncated==="true"||k.IsTruncated===!0,MaxItems:k.MaxItems||"100",NextRecordName:k.NextRecordName,NextRecordType:k.NextRecordType,NextRecordIdentifier:k.NextRecordIdentifier}}parseChangeResourceRecordSetsResponse(j){let k=j.ChangeResourceRecordSetsResponse||j;return{ChangeInfo:{Id:k.ChangeInfo?.Id||"",Status:k.ChangeInfo?.Status||"",SubmittedAt:k.ChangeInfo?.SubmittedAt||"",Comment:k.ChangeInfo?.Comment}}}parseHostedZone(j){if(!j)return{Id:"",Name:""};return{Id:j.Id||"",Name:j.Name||"",CallerReference:j.CallerReference,Config:j.Config?{Comment:j.Config.Comment,PrivateZone:j.Config.PrivateZone==="true"||j.Config.PrivateZone===!0}:void 0,ResourceRecordSetCount:j.ResourceRecordSetCount?Number(j.ResourceRecordSetCount):void 0}}parseDelegationSet(j){if(!j)return{NameServers:[]};let k=j.NameServers?.NameServer||j.NameServers||[];if(!Array.isArray(k))k=k?[k]:[];return{Id:j.Id,CallerReference:j.CallerReference,NameServers:k}}parseResourceRecordSet(j){if(!j)return{Name:"",Type:""};let k=j.ResourceRecords?.ResourceRecord||j.ResourceRecords||[];if(!Array.isArray(k))k=k?[k]:[];return{Name:j.Name||"",Type:j.Type||"",TTL:j.TTL?Number(j.TTL):void 0,ResourceRecords:k.map((F)=>({Value:F.Value||F})),AliasTarget:j.AliasTarget?{HostedZoneId:j.AliasTarget.HostedZoneId,DNSName:j.AliasTarget.DNSName,EvaluateTargetHealth:j.AliasTarget.EvaluateTargetHealth==="true"||j.AliasTarget.EvaluateTargetHealth===!0}:void 0,SetIdentifier:j.SetIdentifier,Weight:j.Weight?Number(j.Weight):void 0,Region:j.Region,GeoLocation:j.GeoLocation,Failover:j.Failover,HealthCheckId:j.HealthCheckId}}async findHostedZoneByName(j){let k=j.endsWith(".")?j:`${j}.`;return(await this.listHostedZonesByName({DNSName:k})).HostedZones.find((H)=>H.Name===k)||null}async createARecord(j){let k=Array.isArray(j.Value)?j.Value:[j.Value];return this.changeResourceRecordSets({HostedZoneId:j.HostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:j.Name,Type:"A",TTL:j.TTL||300,ResourceRecords:k.map((F)=>({Value:F}))}}]}})}async createCnameRecord(j){return this.changeResourceRecordSets({HostedZoneId:j.HostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:j.Name,Type:"CNAME",TTL:j.TTL||300,ResourceRecords:[{Value:j.Value}]}}]}})}async createAliasRecord(j){return this.changeResourceRecordSets({HostedZoneId:j.HostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:j.Name,Type:j.Type||"A",AliasTarget:{HostedZoneId:j.TargetHostedZoneId,DNSName:j.TargetDNSName,EvaluateTargetHealth:j.EvaluateTargetHealth??!1}}}]}})}async createTxtRecord(j){let F=(Array.isArray(j.Value)?j.Value:[j.Value]).map((J)=>{if(!J.startsWith('"'))return`"${J}"`;return J});return this.changeResourceRecordSets({HostedZoneId:j.HostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:j.Name,Type:"TXT",TTL:j.TTL||300,ResourceRecords:F.map((J)=>({Value:J}))}}]}})}async createMxRecord(j){return this.changeResourceRecordSets({HostedZoneId:j.HostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:j.Name,Type:"MX",TTL:j.TTL||300,ResourceRecords:j.Values.map((k)=>({Value:`${k.priority} ${k.mailServer}`}))}}]}})}async deleteRecord(j){return this.changeResourceRecordSets({HostedZoneId:j.HostedZoneId,ChangeBatch:{Changes:[{Action:"DELETE",ResourceRecordSet:j.RecordSet}]}})}async waitForChange(j,k=60,F=5000){let J=j.replace("/change/","");for(let H=0;H<k;H++){let K=await this.client.request({service:"route53",region:this.region,method:"GET",path:`/2013-04-01/change/${J}`});if((K.GetChangeResponse?.ChangeInfo?.Status||K.ChangeInfo?.Status)==="INSYNC")return!0;await new Promise((O)=>setTimeout(O,F))}return!1}async findOrCreateHostedZone(j){let k=j.domainName.endsWith(".")?j.domainName:`${j.domainName}.`,F=await this.findHostedZoneByName(k);if(F){let H=await this.getHostedZone({Id:F.Id});return{hostedZone:F,nameServers:H.DelegationSet.NameServers,isNew:!1}}let J=await this.createHostedZone({Name:k,HostedZoneConfig:{Comment:j.comment||`Hosted zone for ${j.domainName}`,PrivateZone:j.privateZone},VPC:j.vpc});return{hostedZone:J.HostedZone,nameServers:J.DelegationSet.NameServers,isNew:!0}}static getRootDomain(j){let k=j.replace(/\.$/,"").split(".");if(k.length<=2)return j;return k.slice(-2).join(".")}async findHostedZoneForDomain(j){let F=j.replace(/\.$/,"").split(".");for(let J=0;J<F.length-1;J++){let H=F.slice(J).join("."),K=await this.findHostedZoneByName(H);if(K)return K}return null}async ensureHostedZone(j){let k=await this.findOrCreateHostedZone({domainName:j.domainName,comment:j.comment});return{hostedZoneId:k.hostedZone.Id.replace("/hostedzone/",""),nameServers:k.nameServers,isNew:k.isNew,action:k.isNew?"created":"found"}}async setupDomainDns(j){let{domain:k,createIfNotExists:F=!0}=j,J=await this.findHostedZoneByName(k);if(J){let K=await this.getHostedZone({Id:J.Id});return{success:!0,hostedZoneId:J.Id.replace("/hostedzone/",""),nameServers:K.DelegationSet.NameServers,isNew:!1,message:`Found existing hosted zone for ${k}`}}if(!F)return{success:!1,hostedZoneId:null,nameServers:[],isNew:!1,message:`No hosted zone found for ${k} and createIfNotExists is false`};let H=await this.createHostedZone({Name:k,HostedZoneConfig:{Comment:`Created automatically by ts-cloud for ${k}`}});return{success:!0,hostedZoneId:H.HostedZone.Id.replace("/hostedzone/",""),nameServers:H.DelegationSet.NameServers,isNew:!0,message:`Created new hosted zone for ${k}. Please update your domain registrar with these name servers: ${H.DelegationSet.NameServers.join(", ")}`}}static CloudFrontHostedZoneId="Z2FDTNDATAQYW2";static S3WebsiteHostedZoneIds={"us-east-1":"Z3AQBSTGFYJSTF","us-east-2":"Z2O1EMRO9K5GLX","us-west-1":"Z2F56UZL2M1ACD","us-west-2":"Z3BJ6K6RIION7M","ap-east-1":"ZNB98KWMFR0R6","ap-south-1":"Z11RGJOFQNVJUP","ap-northeast-1":"Z2M4EHUR26P7ZW","ap-northeast-2":"Z3W03O7B5YMIYP","ap-northeast-3":"Z2YQB5RD63NC85","ap-southeast-1":"Z3O0J2DXBE1FTB","ap-southeast-2":"Z1WCIGYICN2BYD","ca-central-1":"Z1QDHH18159H29","eu-central-1":"Z21DNDUVLTQW6Q","eu-west-1":"Z1BKCTXD74EZPE","eu-west-2":"Z3GKZC51ZF0DB4","eu-west-3":"Z3R1K369G5AVDG","eu-north-1":"Z3BAZG2TWCNX0D","sa-east-1":"Z7KQH4QJS55SO"};static ALBHostedZoneIds={"us-east-1":"Z35SXDOTRQ7X7K","us-east-2":"Z3AADJGX6KTTL2","us-west-1":"Z368ELLRRE2KJ0","us-west-2":"Z1H1FL5HABSF5","ap-east-1":"Z3DQVH9N71FHZ0","ap-south-1":"ZP97RAFLXTNZK","ap-northeast-1":"Z14GRHDCWA56QT","ap-northeast-2":"ZWKZPGTI48KDX","ap-northeast-3":"Z5LXEBD8Y73MNV","ap-southeast-1":"Z1LMS91P8CMLE5","ap-southeast-2":"Z1GM3OXH4ZPM65","ca-central-1":"ZQSVJUPU6J1EY","eu-central-1":"Z215JYRZR1TBD5","eu-west-1":"Z32O12XQLNTSW2","eu-west-2":"ZHURV8PSTC4K8","eu-west-3":"Z3Q77PNBQS71R4","eu-north-1":"Z23TAZ6LKFMNIO","sa-east-1":"Z2P70J7HTTTPLU"};static APIGatewayHostedZoneIds={"us-east-1":"Z1UJRXOUMOOFQ8","us-east-2":"ZOJJZC49E0EPZ","us-west-1":"Z2MUQ32089INYE","us-west-2":"Z2OJLYMUO9EFXC","ap-east-1":"Z3FD1VL90ND7K5","ap-south-1":"Z3VO1THU9YC4UR","ap-northeast-1":"Z1YSHQZHG15GKL","ap-northeast-2":"Z20JF4UZKIW1U8","ap-northeast-3":"Z2YQB5RD63NC85","ap-southeast-1":"ZL327KTPIQFUL","ap-southeast-2":"Z2RPCDW04V8134","ca-central-1":"Z19DQILCV0OWEC","eu-central-1":"Z1U9ULNL0V5AJ3","eu-west-1":"ZLY8HYME6SFDD","eu-west-2":"ZJ5UAJN8Y3Z2Q","eu-west-3":"Z3KY65QIEKYHQQ","eu-north-1":"Z3UWIKFBOOGXPP","sa-east-1":"ZCMLWB8V5SYIT"}}
|
|
50
|
+
export{Q as Zf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ae as b,Be as c,Ce as d,De as e,Ee as f,Fe as g,Ge as h,He as i,Ie as j,ze as a}from"./chunk-zmegvjp8.js";import"./chunk-3gykfyq4.js";import"./chunk-ax9mr6wm.js";import"./chunk-ggn7ax8p.js";import"./chunk-ddk4rt4j.js";import"./chunk-tga3hhwk.js";import"./chunk-axhnkn5g.js";import"./chunk-h5pa5men.js";import"./chunk-fy8j3y8p.js";import"./chunk-fpm59y25.js";import"./chunk-rxcvf10f.js";import"./chunk-mh0kdzqp.js";export{a as sharedBoxProbeScript,e as serverLogSources,j as resolveServerDashboardData,i as resolveConfigOnlyServerDashboardData,g as parseServerSecurity,f as parseServerLogs,h as parseDeployHistory,c as parseBlock,b as metricsScript,d as mergeDiscoveredSites};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Uf as a}from"./chunk-h5pa5men.js";import"./chunk-fpm59y25.js";import"./chunk-mh0kdzqp.js";export{a as CloudFormationClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{od as a,pd as b,qd as c,rd as d}from"./chunk-y7s5r8y6.js";import"./chunk-tga3hhwk.js";import"./chunk-rxcvf10f.js";import"./chunk-mh0kdzqp.js";export{c as runComputeRecipe,a as rollbackComputeSite,d as restoreDatabaseBackup,b as getComputeDeployHistory};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Og as w}from"./chunk-fpm59y25.js";class x{client;region;constructor(b="us-east-1",j){this.region=b,this.client=new w(void 0,{profile:j})}async createRepository(b){let j={repositoryName:b.repositoryName};if(b.imageTagMutability)j.imageTagMutability=b.imageTagMutability;if(b.imageScanningConfiguration)j.imageScanningConfiguration=b.imageScanningConfiguration;if(b.encryptionConfiguration)j.encryptionConfiguration=b.encryptionConfiguration;if(b.tags&&b.tags.length>0)j.tags=b.tags;let q=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(j)});return{repository:q.repository?this.parseRepository(q.repository):void 0}}async describeRepositories(b){let j={};if(b?.repositoryNames&&b.repositoryNames.length>0)j.repositoryNames=b.repositoryNames;if(b?.registryId)j.registryId=b.registryId;if(b?.maxResults)j.maxResults=b.maxResults;if(b?.nextToken)j.nextToken=b.nextToken;let q=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(j)});return{repositories:q.repositories?.map((v)=>this.parseRepository(v)),nextToken:q.nextToken}}async getAuthorizationToken(b){let j={};if(b&&b.length>0)j.registryIds=b;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(j)})).authorizationData?.map((v)=>({authorizationToken:v.authorizationToken,expiresAt:v.expiresAt,proxyEndpoint:v.proxyEndpoint}))}}async deleteRepository(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;if(b.force!==void 0)j.force=b.force;let q=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(j)});return{repository:q.repository?this.parseRepository(q.repository):void 0}}async describeImages(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;if(b.imageIds&&b.imageIds.length>0)j.imageIds=b.imageIds;if(b.filter)j.filter=b.filter;if(b.maxResults)j.maxResults=b.maxResults;if(b.nextToken)j.nextToken=b.nextToken;let q=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(j)});return{imageDetails:q.imageDetails?.map((v)=>this.parseImageDetail(v)),nextToken:q.nextToken}}async batchDeleteImage(b){let j={repositoryName:b.repositoryName,imageIds:b.imageIds};if(b.registryId)j.registryId=b.registryId;let q=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(j)});return{imageIds:q.imageIds,failures:q.failures}}async putLifecyclePolicy(b){let j={repositoryName:b.repositoryName,lifecyclePolicyText:b.lifecyclePolicyText};if(b.registryId)j.registryId=b.registryId;let q=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(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,lifecyclePolicyText:q.lifecyclePolicyText}}async getLifecyclePolicy(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;let q=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(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,lifecyclePolicyText:q.lifecyclePolicyText,lastEvaluatedAt:q.lastEvaluatedAt}}async setRepositoryPolicy(b){let j={repositoryName:b.repositoryName,policyText:b.policyText};if(b.registryId)j.registryId=b.registryId;if(b.force!==void 0)j.force=b.force;let q=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(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,policyText:q.policyText}}async getRepositoryPolicy(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;let q=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(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,policyText:q.policyText}}async tagResource(b){let j={resourceArn:b.resourceArn,tags:b.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(j)})}async listTagsForResource(b){let j={resourceArn:b};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(j)})).tags}}createLifecyclePolicyText(b){return JSON.stringify({rules:b.map((j)=>({rulePriority:j.rulePriority,description:j.description,selection:j.selection,action:j.action}))})}async getDockerLoginCommand(){let b=await this.getAuthorizationToken();if(!b.authorizationData?.[0])throw Error("Failed to get authorization token");let j=b.authorizationData[0],q=j.authorizationToken||"",v=j.proxyEndpoint||"";return`echo "${Buffer.from(q,"base64").toString("utf8").split(":")[1]}" | docker login --username AWS --password-stdin ${v}`}getRegistryUri(b){return`${b}.dkr.ecr.${this.region}.amazonaws.com`}parseRepository(b){return{repositoryArn:b.repositoryArn,registryId:b.registryId,repositoryName:b.repositoryName,repositoryUri:b.repositoryUri,createdAt:b.createdAt,imageTagMutability:b.imageTagMutability,imageScanningConfiguration:b.imageScanningConfiguration,encryptionConfiguration:b.encryptionConfiguration}}parseImageDetail(b){return{registryId:b.registryId,repositoryName:b.repositoryName,imageDigest:b.imageDigest,imageTags:b.imageTags,imageSizeInBytes:b.imageSizeInBytes,imagePushedAt:b.imagePushedAt,imageScanStatus:b.imageScanStatus,imageScanFindingsSummary:b.imageScanFindingsSummary}}}
|
|
2
|
+
export{x as rg};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{Rd as E}from"./chunk-p66ptpmr.js";import{Uf as n}from"./chunk-h5pa5men.js";import{$f as C}from"./chunk-fy8j3y8p.js";import{Ag as m,Hg as Zz,ug as k,vg as Xz,wg as l,yg as F,zg as Y}from"./chunk-271gk1n2.js";import{Og as Jz}from"./chunk-fpm59y25.js";import{Do as Yz,Gh as $z,Hh as Wz,Ih as Mz,Jo as Hz,Qn as Oz,Rn as _z,Tn as Kz,Vn as Qz,Wn as jz}from"./chunk-rxcvf10f.js";import{Vo as t}from"./chunk-mh0kdzqp.js";import{existsSync as Lz,readdirSync as Uz,readFileSync as Bz,statSync as Ez}from"node:fs";import{join as Pz,relative as Rz}from"node:path";class d{client;region;constructor(z="us-east-1",G){this.region=z,this.client=new Jz}async createSecret(z){let G={Name:z.Name};if(z.Description)G.Description=z.Description;if(z.KmsKeyId)G.KmsKeyId=z.KmsKeyId;if(z.SecretBinary)G.SecretBinary=z.SecretBinary;if(z.SecretString)G.SecretString=z.SecretString;if(z.Tags&&z.Tags.length>0)G.Tags=z.Tags;if(z.AddReplicaRegions&&z.AddReplicaRegions.length>0)G.AddReplicaRegions=z.AddReplicaRegions;if(z.ForceOverwriteReplicaSecret!==void 0)G.ForceOverwriteReplicaSecret=z.ForceOverwriteReplicaSecret;G.ClientRequestToken=z.ClientRequestToken||crypto.randomUUID();let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.CreateSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,VersionId:J.VersionId,ReplicationStatus:J.ReplicationStatus}}async updateSecret(z){let G={SecretId:z.SecretId};if(z.Description)G.Description=z.Description;if(z.KmsKeyId)G.KmsKeyId=z.KmsKeyId;if(z.SecretBinary)G.SecretBinary=z.SecretBinary;if(z.SecretString)G.SecretString=z.SecretString;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.UpdateSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,VersionId:J.VersionId}}async putSecretValue(z){let G={SecretId:z.SecretId};if(z.SecretBinary)G.SecretBinary=z.SecretBinary;if(z.SecretString)G.SecretString=z.SecretString;if(z.VersionStages&&z.VersionStages.length>0)G.VersionStages=z.VersionStages;if(z.ClientRequestToken)G.ClientRequestToken=z.ClientRequestToken;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.PutSecretValue","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,VersionId:J.VersionId,VersionStages:J.VersionStages}}async getSecretValue(z){let G={SecretId:z.SecretId};if(z.VersionId)G.VersionId=z.VersionId;if(z.VersionStage)G.VersionStage=z.VersionStage;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.GetSecretValue","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,VersionId:J.VersionId,SecretBinary:J.SecretBinary,SecretString:J.SecretString,VersionStages:J.VersionStages,CreatedDate:J.CreatedDate}}async describeSecret(z){let G={SecretId:z},J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.DescribeSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return this.parseSecret(J)}async listSecrets(z){let G={};if(z?.MaxResults)G.MaxResults=z.MaxResults;if(z?.NextToken)G.NextToken=z.NextToken;if(z?.Filters&&z.Filters.length>0)G.Filters=z.Filters;if(z?.SortOrder)G.SortOrder=z.SortOrder;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.ListSecrets","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{SecretList:J.SecretList?.map((X)=>this.parseSecret(X)),NextToken:J.NextToken}}async deleteSecret(z){let G={SecretId:z.SecretId};if(z.RecoveryWindowInDays!==void 0)G.RecoveryWindowInDays=z.RecoveryWindowInDays;if(z.ForceDeleteWithoutRecovery!==void 0)G.ForceDeleteWithoutRecovery=z.ForceDeleteWithoutRecovery;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.DeleteSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,DeletionDate:J.DeletionDate}}async restoreSecret(z){let G={SecretId:z},J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.RestoreSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name}}async rotateSecret(z){let G={SecretId:z.SecretId};if(z.ClientRequestToken)G.ClientRequestToken=z.ClientRequestToken;if(z.RotationLambdaARN)G.RotationLambdaARN=z.RotationLambdaARN;if(z.RotationRules)G.RotationRules=z.RotationRules;if(z.RotateImmediately!==void 0)G.RotateImmediately=z.RotateImmediately;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.RotateSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,VersionId:J.VersionId}}async cancelRotateSecret(z){let G={SecretId:z},J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.CancelRotateSecret","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name}}async getResourcePolicy(z){let G={SecretId:z},J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.GetResourcePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name,ResourcePolicy:J.ResourcePolicy}}async putResourcePolicy(z){let G={SecretId:z.SecretId,ResourcePolicy:z.ResourcePolicy};if(z.BlockPublicPolicy!==void 0)G.BlockPublicPolicy=z.BlockPublicPolicy;let J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.PutResourcePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name}}async deleteResourcePolicy(z){let G={SecretId:z},J=await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.DeleteResourcePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)});return{ARN:J.ARN,Name:J.Name}}async tagResource(z){let G={SecretId:z.SecretId,Tags:z.Tags};await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.TagResource","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)})}async untagResource(z){let G={SecretId:z.SecretId,TagKeys:z.TagKeys};await this.client.request({service:"secretsmanager",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"secretsmanager.UntagResource","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(G)})}async setString(z,G,J){try{let X=await this.putSecretValue({SecretId:z,SecretString:G});return{ARN:X.ARN,VersionId:X.VersionId}}catch(X){if(X.code==="ResourceNotFoundException"){let Z=await this.createSecret({Name:z,SecretString:G,Description:J?.description,KmsKeyId:J?.kmsKeyId,Tags:J?.tags});return{ARN:Z.ARN,VersionId:Z.VersionId}}throw X}}async setJson(z,G,J){return this.setString(z,JSON.stringify(G),J)}async getString(z){return(await this.getSecretValue({SecretId:z})).SecretString}async getJson(z){let G=await this.getString(z);if(G)return JSON.parse(G);return}async listAll(){let z=[],G;do{let J=await this.listSecrets({NextToken:G});if(J.SecretList)z.push(...J.SecretList);G=J.NextToken}while(G);return z}parseSecret(z){return{ARN:z.ARN,Name:z.Name,Description:z.Description,KmsKeyId:z.KmsKeyId,RotationEnabled:z.RotationEnabled,RotationLambdaARN:z.RotationLambdaARN,RotationRules:z.RotationRules,LastRotatedDate:z.LastRotatedDate,LastChangedDate:z.LastChangedDate,LastAccessedDate:z.LastAccessedDate,DeletedDate:z.DeletedDate,NextRotationDate:z.NextRotationDate,Tags:z.Tags,SecretVersionsToStages:z.SecretVersionsToStages,CreatedDate:z.CreatedDate,PrimaryRegion:z.PrimaryRegion}}}function q(z,G){let J=z.environments?.[G]?.app;if(!J)throw Error(`No serverless app configured for environment '${G}'. Add environments.${G}.app to your config.`);let X=z.project.slug,Z=z.environments?.[G]?.region||z.project.region||"us-east-1";return{app:J,slug:X,region:Z,stackName:$z(z,G),artifactBucket:Wz(X,G),assetsBucket:Mz(X,G)}}function iz(z,G){let J=q(z,G),X=`${J.slug}-${G}`;return{region:J.region,slug:J.slug,stackName:J.stackName,functions:{http:`${X}-http`,queue:`${X}-queue`,cli:`${X}-cli`}}}async function N(z,G=8){let J;for(let X=0;X<G;X++)try{return await z()}catch(Z){let $=Z?.code||Z?.name||"",W=String(Z?.message||"");if($==="ResourceConflictException"||/update is in progress|currently in the following state/i.test(W)){J=Z,await new Promise((M)=>setTimeout(M,3000));continue}throw Z}throw J}var Tz=(z,G)=>`releases/${z}/${G}/current.json`;async function p(z,G,J,X){try{return await z.getObjectJson(G,Tz(J,X))}catch{return null}}async function Vz(z,G,J,X,Z){await z.putObjectJson(G,Tz(J,X),Z)}async function hz(z,G){if(!z.secrets)return{};let J=new d(G),X={},Z=Array.isArray(z.secrets)?z.secrets.map(($)=>({envName:$.split("/").pop().toUpperCase().replace(/[^A-Z0-9_]/g,"_"),secretId:$})):Object.entries(z.secrets).map(([$,W])=>({envName:$,secretId:W}));if(Array.isArray(z.secrets)){let $=new Map;for(let{envName:M,secretId:O}of Z)$.set(M,[...$.get(M)??[],O]);let W=[...$.entries()].filter(([,M])=>M.length>1);if(W.length){let M=W.map(([O,K])=>`${O} ← ${K.join(", ")}`).join("; ");throw Error(`serverless secrets: multiple secrets map to the same env var (${M}). Use the map form { ENV_NAME: 'secret/id' } to disambiguate.`)}}for(let{envName:$,secretId:W}of Z){let O=(await J.getSecretValue({SecretId:W})).SecretString??"";try{let K=JSON.parse(O);if(K&&typeof K==="object"&&!Array.isArray(K)){for(let[H,j]of Object.entries(K))X[H]=String(j);continue}}catch{}X[$]=O}return X}function Iz(z,G){let J={},X=G.DbProxyEndpoint||G.DbEndpoint;if(X)J.DB_CONNECTION="mysql",J.DB_HOST=X,J.DB_PORT="3306",J.DB_DATABASE=J.DB_DATABASE||"app";if(G.CacheEndpoint){if(J.REDIS_HOST=G.CacheEndpoint,J.REDIS_PORT="6379",z.cache?.driver==="elasticache")J.CACHE_STORE="redis",J.CACHE_DRIVER="redis",J.SESSION_DRIVER="redis"}return J}function o(z,G,J,X,Z,$,W,M={}){let O=z.kind==="php"?Yz({cacheDriver:z.cache?.driver==="elasticache"?"redis":"dynamodb"}):{};return{TSCLOUD_LAMBDA_MODE:X,TSCLOUD_ENV:J,MAINTENANCE_MODE:"0",...z.octane?{TSCLOUD_OCTANE:"1"}:{},...z.serveAssets?{TSCLOUD_SERVE_ASSETS:"1"}:{},...z.redirectRobotsTxt===!1?{TSCLOUD_REDIRECT_ROBOTS_TXT:"0"}:{},...O,...M,...G.app.cache?.driver!=="elasticache"?{TSCLOUD_CACHE_TABLE:`${G.slug}-${J}-cache`}:{},...W?{TSCLOUD_QUEUE:W,SQS_QUEUE:W}:{},...$?{ASSET_URL:$}:{},...z.env??{},...Z}}function Nz(z){let G=z.slice(z.lastIndexOf(".")).toLowerCase();return{".html":"text/html",".css":"text/css",".js":"text/javascript",".mjs":"text/javascript",".json":"application/json",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".txt":"text/plain",".map":"application/json"}[G]??"application/octet-stream"}function*Fz(z){for(let G of Uz(z)){let J=Pz(z,G);if(Ez(J).isDirectory())yield*Fz(J);else yield J}}async function Cz(z,G,J,X,Z=!1){let $=0;for(let W of Fz(J)){let M=Rz(J,W).replace(/\\/g,"/");if(!Z&&M.split("/").some((O)=>O.startsWith(".")))continue;await z.putObject({bucket:G,key:`${X}/${M}`,body:Bz(W),contentType:Nz(W),cacheControl:"public, max-age=31536000, immutable"}),$++}return $}function Sz(z,G){let J=Object.entries(G).reduce((X,[Z,$])=>X+Buffer.byteLength(`${Z}=${$}`,"utf8"),0);if(J>4096){let X=Object.entries(G).map(([Z,$])=>[Z,Buffer.byteLength(`${Z}=${$}`,"utf8")]).sort((Z,$)=>$[1]-Z[1]).slice(0,5).map(([Z,$])=>`${Z} (${$}B)`).join(", ");throw Error(`${z}: environment variables total ${J}B, over AWS's 4096B limit (${J-4096}B too large). Largest: ${X}. Move large/secret values out of env — store them in Secrets Manager and fetch at cold start.`)}}async function b(z,G,J,X){Sz(G,J),await N(()=>z.updateFunctionConfiguration({FunctionName:G,Environment:{Variables:J}})),await z.waitForFunctionActive(G,120);let Z=X.kind==="image"?{FunctionName:G,ImageUri:X.imageUri}:{FunctionName:G,S3Bucket:X.bucket,S3Key:X.key};await N(()=>z.updateFunctionCode(Z)),await z.waitForFunctionActive(G,120)}async function c(z,G){let X=(await N(()=>z.publishVersion({FunctionName:G}))).Version;if(!X)throw Error(`publishVersion returned no version for ${G}`);return await N(()=>z.updateAlias({FunctionName:G,Name:"live",FunctionVersion:X})),X}async function rz(z,G,J={}){let X=q(z,G),{app:Z,slug:$,region:W,stackName:M,artifactBucket:O}=X,K=J.projectRoot??process.cwd();m(`Deploying serverless app: ${$} (${G})`),F(`Stack: ${M}`),F(`Region: ${W}`);let H=new C(W),j=new n(W),V=new E(W),L=Z.kind==="php",U=Z.packaging==="image",Q=Kz(Z),R,A,w,i,g=[];if(U&&Q.usesLayer&&Q.layerKind!=="php")throw Error(`packaging: 'image' currently supports PHP and managed Node runtimes. ${Q.kind}${Q.kind==="node"?` ${Q.version}`:""} uses a custom runtime — `+"use the default zip packaging (the runtime layer is built + attached automatically).");if(U){Y("Building + pushing container image");let{buildAndPushServerlessImage:_}=await import("./chunk-00kg80qg.js"),P=await _({app:Z,projectRoot:K,region:W,repository:`${$}-${G}`,skipBuild:J.skipBuild,onStep:(D)=>F(` ${D}`)});R=P.handlers,A={kind:"image",imageUri:P.imageUri},w=P.tag,g.push({ParameterKey:"ImageUri",ParameterValue:P.imageUri})}else{Y("Packaging application");let _=L?Hz({projectRoot:K,app:Z,skipBuild:J.skipBuild,onStep:(B)=>F(` ${B}`)}):await _z({projectRoot:K,app:Z,skipBuild:J.skipBuild,onStep:(B)=>F(` ${B}`)}),P=Oz($,G,_.sha256);if(F(`Artifact: ${_.sha256.slice(0,12)} (${(_.zip.length/1024).toFixed(0)} KB)`),R=_.handlers,w=_.sha256,Q.usesLayer){let B=Q.layerEnvVar?process.env[Q.layerEnvVar]:void 0;if(i=Z.layers??(B?[B]:void 0),!i?.length){let Dz=Q.layerKind==="php"?"serverless:build-php-layer":Q.layerKind==="bun"?"serverless:build-bun-layer":"serverless:build-node-layer";throw Error(`${Q.kind} apps on provided.al2023 need a runtime layer. Set environments.<env>.app.layers or the ${Q.layerEnvVar} env var (build one with \`cloud ${Dz}\`)${Q.kind==="node"?", or use a managed Node version (18/20/22)":""}.`)}}if(!await H.bucketExists(O))Y(`Creating artifact bucket ${O}`),await H.createBucket(O);if(await H.headObject(O,P).then((B)=>B!==null).catch(()=>!1))F("Artifact already uploaded — reusing");else Y("Uploading artifact"),await H.putObject({bucket:O,key:P,body:_.zip,contentType:"application/zip"});A={kind:"zip",bucket:O,key:P},g.push({ParameterKey:"ArtifactBucket",ParameterValue:O},{ParameterKey:"ArtifactKey",ParameterValue:P})}let T=jz({config:z,environment:G,app:Z,handlers:R,runtimeLayers:i}),e=JSON.stringify(T.template),zz=["CAPABILITY_NAMED_IAM"],S=await j.describeStacks({stackName:M}).then((_)=>_.Stacks[0]?.StackStatus).catch(()=>{return}),f=S!==void 0;if(S&&/DELETE_IN_PROGRESS/.test(S))Y("Waiting for an in-progress stack delete to finish"),await j.waitForStack(M,"stack-delete-complete").catch(()=>{}),f=!1;else if(S&&/(?:ROLLBACK_COMPLETE|REVIEW_IN_PROGRESS|CREATE_FAILED)/.test(S))Y(`Deleting unusable stack (status ${S}) before recreate`),await j.deleteStack(M),await j.waitForStack(M,"stack-delete-complete").catch(()=>{}),f=!1;Y(f?"Updating infrastructure stack":"Creating infrastructure stack");try{if(f)await j.updateStack({stackName:M,templateBody:e,parameters:g,capabilities:zz}),await j.waitForStack(M,"stack-update-complete");else await j.createStack({stackName:M,templateBody:e,parameters:g,capabilities:zz,onFailure:"DELETE"}),await j.waitForStack(M,"stack-create-complete")}catch(_){if(/No updates are to be performed/i.test(String(_?.message)))F("No infrastructure changes");else throw _}let r=await j.getStackOutputs(M).catch(()=>({})),h;if(Z.assets){let _=Pz(K,Z.assets);if(Lz(_)){let P=Z.assetDomain||r.AssetsCdnDomain;h=P?`https://${P}/${w}`:void 0,Y(`Syncing assets from ${Z.assets}`);let D=await Cz(H,X.assetsBucket,_,w,Z.dotFilesAsAssets);F(`Uploaded ${D} asset(s)${h?` → ${h}`:""}`)}else l(`Assets directory not found: ${_}`)}Y("Resolving secrets");let x=await hz(Z,W);if(Z.database?.connection==="aurora-serverless")try{let P=await new d(W).getSecretValue({SecretId:`${$}/${G}/db`}),D=JSON.parse(P.SecretString??"{}");if(D.username)x.DB_USERNAME=D.username;if(D.password)x.DB_PASSWORD=D.password}catch(_){l(`Could not resolve Aurora DB credentials: ${_.message}`)}if(!await H.bucketExists(O))await H.createBucket(O);let v=await p(H,O,$,G),I={},a=T.queueNames[0],s=Iz(Z,r);if(Y("Activating functions"),I.http=o(Z,X,G,"http",x,h,a,s),await b(V,T.functionNames.http,I.http,A),I.cli=o(Z,X,G,"cli",x,h,a,s),await b(V,T.functionNames.cli,I.cli,A),T.queueNames.length)I.queue=o(Z,X,G,"queue",x,h,a,s),await b(V,T.functionNames.queue,I.queue,A);let Gz=(Z.provisionedConcurrency??0)>0,u={};if(Gz){if(Y("Publishing versions + flipping live alias"),u.http=await c(V,T.functionNames.http),u.cli=await c(V,T.functionNames.cli),T.queueNames.length)u.queue=await c(V,T.functionNames.queue)}if(await Vz(H,O,$,G,{sha:w,code:A,previousSha:v?.sha,previousCode:v?.code,previousFunctionEnv:v?.functionEnv,...Gz?{functionVersions:u,previousFunctionVersions:v?.functionVersions}:{},functionEnv:I,functionNames:{http:T.functionNames.http,cli:T.functionNames.cli,...T.queueNames.length?{queue:T.functionNames.queue}:{}},assetUrl:h,timestamp:new Date().toISOString()}),!J.skipDeployHooks&&Z.deploy?.length){Y("Running deploy hooks");for(let _ of Z.deploy){F(` deploy: ${_}`);let P=await V.invoke({FunctionName:T.functionNames.cli,InvocationType:"RequestResponse",Payload:{command:_},LogType:"Tail"});if(P.FunctionError)throw Xz("Deploy hook failed — the new build is ALREADY LIVE."),F(` Roll back with: cloud serverless:rollback --env ${G}`),Error(`Deploy hook failed (${_}): ${P.Payload}`)}}let y=r.HttpApiEndpoint;if(!J.skipHealthCheck&&y){Y("Health check");try{let _=await fetch(y,{method:"GET"});F(`GET ${y} → ${_.status}`)}catch(_){l(`Health check could not reach ${y}: ${_.message}`)}}Zz(["Serverless deploy complete","",y?`URL: ${y}`:"",`Stack: ${M}`,`Build: ${w.slice(0,12)}`].filter(Boolean).join(`
|
|
2
|
+
`),"green")}async function az(z,G){let J=q(z,G),X=new C(J.region),Z=new E(J.region),$=await p(X,J.artifactBucket,J.slug,G);if(!$)throw Error("No previous release to redeploy. Run a full deploy first.");m(`Redeploying ${J.slug} (${G}) — build ${$.sha.slice(0,12)}`);for(let[W,M]of Object.entries($.functionNames)){if(!M)continue;Y(`Re-activating ${W} (${M})`),await b(Z,M,$.functionEnv[W]??{},$.code);let O=$.functionVersions?.[W];if(O)await N(()=>Z.updateAlias({FunctionName:M,Name:"live",FunctionVersion:O}))}k("Redeploy complete")}async function sz(z,G){let J=q(z,G),X=new C(J.region),Z=new E(J.region),$=await p(X,J.artifactBucket,J.slug,G);if(!$?.previousCode)throw Error("No previous release to roll back to.");m(`Rolling back ${J.slug} (${G}) → ${$.previousSha?.slice(0,12)}`);for(let[W,M]of Object.entries($.functionNames)){if(!M)continue;Y(`Restoring ${W} (${M})`);let O=$.previousFunctionEnv?.[W]??$.functionEnv[W]??{};await b(Z,M,O,$.previousCode);let K=$.previousFunctionVersions?.[W];if(K)await N(()=>Z.updateAlias({FunctionName:M,Name:"live",FunctionVersion:K}))}await Vz(X,J.artifactBucket,J.slug,G,{...$,sha:$.previousSha??$.sha,code:$.previousCode,functionEnv:$.previousFunctionEnv??$.functionEnv,functionVersions:$.previousFunctionVersions??$.functionVersions,previousSha:void 0,previousCode:void 0,previousFunctionEnv:void 0,previousFunctionVersions:void 0,timestamp:new Date().toISOString()}),k("Rollback complete")}async function oz(z,G,J,X){let Z=q(z,G),$=new E(Z.region),W=`${Z.slug}-${G}-http`,O={...(await $.getFunction(W)).Configuration?.Environment?.Variables??{}};if(O.MAINTENANCE_MODE=J?"1":"0",J&&X)O.MAINTENANCE_BYPASS_SECRET=X;if(!J)delete O.MAINTENANCE_BYPASS_SECRET;if(await N(()=>$.updateFunctionConfiguration({FunctionName:W,Environment:{Variables:O}})),(Z.app.provisionedConcurrency??0)>0)await $.waitForFunctionActive(W,120),await c($,W);k(J?"Application is now in maintenance mode (503)":"Application is live")}async function yz(z,G,J){let X=q(z,G),Z=new E(X.region),$=`${X.slug}-${G}-cli`,W=await Z.invoke({FunctionName:$,InvocationType:"RequestResponse",Payload:{command:J},LogType:"Tail"});if(W.FunctionError)throw Error(`Command failed: ${W.Payload}`);return W.Payload??""}var wz=(z,G)=>`commands/${z}/${G}/history.json`,kz=50;async function qz(z,G,J,X){try{return(await z.getObjectJson(G,wz(J,X)))?.records??[]}catch{return[]}}async function tz(z,G,J){let X=q(z,G),Z=new E(X.region),$=`${X.slug}-${G}-cli`,W=await Z.invoke({FunctionName:$,InvocationType:"RequestResponse",Payload:{command:J},LogType:"Tail"}),M=W.Payload??"",O=W.FunctionError?"error":"ok",K=-1;try{let H=new C(X.region);if(await H.bucketExists(X.artifactBucket)){let j=await qz(H,X.artifactBucket,X.slug,G);K=j.reduce((V,L)=>Math.max(V,L.id),0)+1,j.push({id:K,command:J,timestamp:new Date().toISOString(),status:O,output:M.slice(0,4000)}),await H.putObjectJson(X.artifactBucket,wz(X.slug,G),{records:j.slice(-kz)})}}catch{}if(W.FunctionError)throw Error(`Command failed${K>0?` (#${K})`:""}: ${M}`);return{id:K,status:O,output:M}}async function xz(z,G){let J=q(z,G),X=new C(J.region);return qz(X,J.artifactBucket,J.slug,G)}async function nz(z,G,J){let X=await xz(z,G);if(!X.length)return;return J==null?X[X.length-1]:X.find((Z)=>Z.id===J)}async function ez(z,G,J){let X=Buffer.from(J,"utf-8").toString("base64");return yz(z,G,`tscloud:db-query --sql-base64=${X}`)}async function zG(z,G){let J=q(z,G),X=new n(J.region),Z=new E(J.region),$=new C(J.region),W="not deployed",M={};try{let{Stacks:U}=await X.describeStacks({stackName:J.stackName});W=U?.[0]?.StackStatus??W;for(let Q of U?.[0]?.Outputs??[])if(Q.OutputKey)M[Q.OutputKey]=Q.OutputValue??""}catch{}let O=Qz(J.app,J.slug,G),K=J.app.provisionedConcurrency??0,H=["http","cli",...O.length?["queue"]:[]],j=`${J.slug}-${G}`,V=[];for(let U of H){let Q=`${j}-${U}`,R={mode:U,name:Q,version:"$LATEST"};if(K>0){let A=await Z.getAlias(Q,"live").catch(()=>null);if(A?.FunctionVersion){R.version=A.FunctionVersion;let w=await Z.getProvisionedConcurrencyConfig(Q,"live").catch(()=>null);if(w)R.provisioned={status:w.Status??"-",allocated:w.AllocatedProvisionedConcurrentExecutions??0,requested:w.RequestedProvisionedConcurrentExecutions??0}}}V.push(R)}let L=await p($,J.artifactBucket,J.slug,G).catch(()=>null);return{slug:J.slug,environment:G,region:J.region,stackStatus:W,endpoint:M.HttpApiEndpoint,assetUrl:L?.assetUrl,scheduler:J.app.scheduler??"on",queues:O,provisionedConcurrency:K,functions:V,lastRelease:L?{sha:L.sha,timestamp:L.timestamp}:void 0}}function Az(z,G){return`${z}-${G}-db`}async function GG(z,G,J,X){let Z=q(z,G);if(Z.app.database?.connection!=="aurora-serverless")throw Error("No Aurora Serverless v2 database is configured for this environment.");let{RDSClient:$}=await import("./chunk-yv9sth30.js"),W=new $(Z.region),M=Az(Z.slug,G);Y(`Scaling ${M} → ${J}–${X} ACUs`),await W.modifyDBCluster({DBClusterIdentifier:M,ServerlessV2ScalingConfiguration:{MinCapacity:J,MaxCapacity:X},ApplyImmediately:!0}),k(`Scaling applied to ${M} (takes effect shortly).`)}async function JG(z,G,J){let X=q(z,G);if(X.app.database?.connection!=="aurora-serverless")throw Error("No Aurora Serverless v2 database is configured for this environment.");if(!J.toTime&&!J.latest)throw Error("Specify a restore point: --to <ISO timestamp> or --latest.");let{RDSClient:Z}=await import("./chunk-yv9sth30.js"),$=new Z(X.region),W=Az(X.slug,G),M=J.latest?"latest":J.toTime.toISOString().replace(/[^0-9]/g,"").slice(0,14),O=J.target??`${W}-restore-${M}`;Y(`Restoring ${W} → new cluster ${O} (${J.latest?"latest restorable time":J.toTime.toISOString()})`),await $.restoreDBClusterToPointInTime({DBClusterIdentifier:O,SourceDBClusterIdentifier:W,RestoreToTime:J.toTime,UseLatestRestorableTime:J.latest}),Y("Waiting for the restored cluster to be ready");for(let K=0;K<120;K++){let{DBClusters:H}=await $.describeDBClusters({DBClusterIdentifier:O}),j=H?.[0]?.Status;if(j&&j!=="creating")break;await new Promise((V)=>setTimeout(V,15000))}return Y("Adding a writer instance"),await $.createDBInstance({DBInstanceIdentifier:`${O}-1`,DBClusterIdentifier:O,Engine:"aurora-mysql",DBInstanceClass:"db.serverless"}),k(`Restore complete → cluster ${O} with writer ${O}-1. Point an env's database at it once available.`),O}
|
|
3
|
+
export{d as zd,iz as Ad,hz as Bd,Iz as Cd,o as Dd,Sz as Ed,rz as Fd,az as Gd,sz as Hd,oz as Id,yz as Jd,tz as Kd,xz as Ld,nz as Md,ez as Nd,zG as Od,GG as Pd,JG as Qd};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-rytk89az.js";import"./chunk-ctd2vg9w.js";import"./chunk-gavvf0pg.js";import"./chunk-h5pa5men.js";import"./chunk-j703btc5.js";import"./chunk-fy8j3y8p.js";import"./chunk-fpm59y25.js";import"./chunk-mh0kdzqp.js";export{c as uploadStaticFiles,d as invalidateCache,a as generateStaticSiteTemplate,f as deployStaticSiteFull,b as deployStaticSite,e as deleteStaticSite};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Og as V}from"./chunk-fpm59y25.js";import{deflateRawSync as Z}from"zlib";function Q(G,k){let J=typeof k==="string"?Buffer.from(k,"utf-8"):k,K=Z(J),U=E(J),Y=new Date,M=(Y.getHours()<<11|Y.getMinutes()<<5|Y.getSeconds()>>1)&65535,$=(Y.getFullYear()-1980<<9|Y.getMonth()+1<<5|Y.getDate())&65535,O=Buffer.from(G,"utf-8"),_=Buffer.alloc(30+O.length);_.writeUInt32LE(67324752,0),_.writeUInt16LE(20,4),_.writeUInt16LE(0,6),_.writeUInt16LE(8,8),_.writeUInt16LE(M,10),_.writeUInt16LE($,12),_.writeUInt32LE(U,14),_.writeUInt32LE(K.length,18),_.writeUInt32LE(J.length,22),_.writeUInt16LE(O.length,26),_.writeUInt16LE(0,28),O.copy(_,30);let X=Buffer.alloc(46+O.length);X.writeUInt32LE(33639248,0),X.writeUInt16LE(20,4),X.writeUInt16LE(20,6),X.writeUInt16LE(0,8),X.writeUInt16LE(8,10),X.writeUInt16LE(M,12),X.writeUInt16LE($,14),X.writeUInt32LE(U,16),X.writeUInt32LE(K.length,20),X.writeUInt32LE(J.length,24),X.writeUInt16LE(O.length,28),X.writeUInt16LE(0,30),X.writeUInt16LE(0,32),X.writeUInt16LE(0,34),X.writeUInt16LE(0,36),X.writeUInt32LE(0,38),X.writeUInt32LE(0,42),O.copy(X,46);let h=_.length+K.length,j=X.length,A=Buffer.alloc(22);return A.writeUInt32LE(101010256,0),A.writeUInt16LE(0,4),A.writeUInt16LE(0,6),A.writeUInt16LE(1,8),A.writeUInt16LE(1,10),A.writeUInt32LE(j,12),A.writeUInt32LE(h,16),A.writeUInt16LE(0,20),Buffer.concat([_,K,X,A])}function E(G){let k=[];for(let K=0;K<256;K++){let U=K;for(let Y=0;Y<8;Y++)U=U&1?3988292384^U>>>1:U>>>1;k[K]=U}let J=4294967295;for(let K=0;K<G.length;K++)J=k[(J^G[K])&255]^J>>>8;return(J^4294967295)>>>0}class I{client;region;constructor(G="us-east-1",k){this.region=G,this.client=new V(void 0,{profile:k})}async createFunction(G){return await this.client.request({service:"lambda",region:this.region,method:"POST",path:"/2015-03-31/functions",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)})}async getFunction(G){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(G)}`,headers:{"Content-Type":"application/json"}})}async updateFunctionCode(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(k)}/code`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async updateFunctionCodeInline(G,k,J="index.js"){let K=Q(J,k);return this.updateFunctionCode({FunctionName:G,ZipFile:K.toString("base64")})}async updateFunctionConfiguration(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(k)}/configuration`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async deleteFunction(G){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(G)}`,headers:{"Content-Type":"application/json"}})}async invoke(G){let{FunctionName:k,InvocationType:J="RequestResponse",Payload:K,LogType:U}=G,Y={"Content-Type":"application/json","X-Amz-Invocation-Type":J};if(U)Y["X-Amz-Log-Type"]=U;let M=K?typeof K==="string"?K:JSON.stringify(K):void 0,$=await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/invocations`,headers:Y,body:M,returnHeaders:!0});return{StatusCode:$.statusCode||200,FunctionError:$.headers?.["x-amz-function-error"],LogResult:$.headers?.["x-amz-log-result"],Payload:typeof $.body==="string"?$.body:JSON.stringify($.body),ExecutedVersion:$.headers?.["x-amz-executed-version"]}}async listFunctions(G){let k={};if(G?.MaxItems)k.MaxItems=String(G.MaxItems);if(G?.Marker)k.Marker=G.Marker;if(G?.FunctionVersion)k.FunctionVersion=G.FunctionVersion;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:"/2015-03-31/functions",queryParams:Object.keys(k).length>0?k:void 0,headers:{"Content-Type":"application/json"}})}async addPermission(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async removePermission(G,k){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(G)}/policy/${encodeURIComponent(k)}`,headers:{"Content-Type":"application/json"}})}async publishVersion(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async createAlias(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/aliases`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async updateAlias(G){let{FunctionName:k,Name:J,...K}=G;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(k)}/aliases/${encodeURIComponent(J)}`,headers:{"Content-Type":"application/json"},body:JSON.stringify(K)})}async getAlias(G,k){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(G)}/aliases/${encodeURIComponent(k)}`})}catch(J){if(/ResourceNotFound/i.test(String(J?.message)))return null;throw J}}async getProvisionedConcurrencyConfig(G,k){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-09-30/functions/${encodeURIComponent(G)}/provisioned-concurrency`,queryParams:{Qualifier:k}})}catch(J){if(/ProvisionedConcurrencyConfigNotFound|ResourceNotFound/i.test(String(J?.message)))return null;throw J}}async putProvisionedConcurrencyConfig(G){let{FunctionName:k,Qualifier:J,ProvisionedConcurrentExecutions:K}=G;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-09-30/functions/${encodeURIComponent(k)}/provisioned-concurrency`,queryParams:{Qualifier:J},headers:{"Content-Type":"application/json"},body:JSON.stringify({ProvisionedConcurrentExecutions:K})})}async getFunctionConcurrency(G){try{return(await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-10-31/functions/${encodeURIComponent(G)}/concurrency`}))?.ReservedConcurrentExecutions??null}catch(k){if(/ResourceNotFound|ProvisionedConcurrencyConfigNotFound/i.test(String(k?.message)))return null;throw k}}async putFunctionConcurrency(G,k){await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-10-31/functions/${encodeURIComponent(G)}/concurrency`,headers:{"Content-Type":"application/json"},body:JSON.stringify({ReservedConcurrentExecutions:k})})}async deleteFunctionConcurrency(G){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-10-31/functions/${encodeURIComponent(G)}/concurrency`})}async deleteProvisionedConcurrencyConfig(G,k){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-09-30/functions/${encodeURIComponent(G)}/provisioned-concurrency`,queryParams:{Qualifier:k}})}async waitForFunctionActive(G,k=60){let J=Date.now(),K=k*1000;while(Date.now()-J<K)try{let U=await this.getFunction(G),Y=U.Configuration?.State;if(Y==="Active")return U.Configuration;if(Y==="Failed")throw Error(`Function ${G} failed: ${U.Configuration?.StateReason}`);await new Promise((M)=>setTimeout(M,2000))}catch(U){if(U.code==="ResourceNotFoundException"){await new Promise((Y)=>setTimeout(Y,2000));continue}throw U}throw Error(`Timeout waiting for function ${G} to become active`)}async functionExists(G){try{return await this.getFunction(G),!0}catch(k){if(k.code==="ResourceNotFoundException"||k.statusCode===404)return!1;throw k}}async createFunctionUrl(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2021-10-31/functions/${encodeURIComponent(k)}/url`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async getFunctionUrl(G){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2021-10-31/functions/${encodeURIComponent(G)}/url`,headers:{"Content-Type":"application/json"}})}catch(k){if(k.statusCode===404)return null;throw k}}async deleteFunctionUrl(G){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2021-10-31/functions/${encodeURIComponent(G)}/url`,headers:{"Content-Type":"application/json"}})}async createFunctionWithCode(G){let{Code:k,Filename:J="index.js",...K}=G,U=Q(J,k);return this.createFunction({...K,Code:{ZipFile:U.toString("base64")}})}async addFunctionUrlPermission(G){return this.addPermission({FunctionName:G,StatementId:"FunctionURLAllowPublicAccess",Action:"lambda:InvokeFunctionUrl",Principal:"*",FunctionUrlAuthType:"NONE"})}async publishLayerVersion(G){let{LayerName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(k)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async listLayerVersions(G,k){let J={};if(k?.CompatibleRuntime)J.CompatibleRuntime=k.CompatibleRuntime;if(k?.CompatibleArchitecture)J.CompatibleArchitecture=k.CompatibleArchitecture;if(k?.MaxItems)J.MaxItems=String(k.MaxItems);if(k?.Marker)J.Marker=k.Marker;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(G)}/versions`,queryParams:Object.keys(J).length>0?J:void 0,headers:{"Content-Type":"application/json"}})}async getLayerVersion(G,k){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(G)}/versions/${k}`,headers:{"Content-Type":"application/json"}})}async addLayerVersionPermission(G){let{LayerName:k,VersionNumber:J,...K}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(k)}/versions/${J}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(K)})}async deleteLayerVersion(G,k){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2018-10-31/layers/${encodeURIComponent(G)}/versions/${k}`,headers:{"Content-Type":"application/json"}})}}
|
|
2
|
+
export{I as Rd};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$b as C,Ab as b,Ac as ba,Bb as c,Bc as ca,Cb as d,Cc as da,Db as e,Dc as ea,Eb as f,Ec as fa,Fb as g,Fc as ga,Gb as h,Gc as ha,Hb as i,Hc as ia,Ib as j,Ic as ja,Jb as k,Jc as ka,Kb as l,Kc as la,Lb as m,Lc as ma,Mb as n,Mc as na,Nb as o,Nc as oa,Ob as p,Oc as pa,Pb as q,Pc as qa,Qb as r,Qc as ra,Rb as s,Rc as sa,Sb as t,Sc as ta,Tb as u,Tc as ua,Ub as v,Uc as va,Vb as w,Vc as wa,Wb as x,Wc as xa,Xb as y,Xc as ya,Yb as z,Yc as za,Zb as A,Zc as Aa,_b as B,ac as D,ad as Ba,bc as E,bd as Ca,cc as F,dc as G,ec as H,fc as I,gc as J,hc as K,ic as L,jc as M,kc as N,lc as O,mc as P,nc as Q,oc as R,pc as S,qc as T,rc as U,sc as V,tc as W,uc as X,vc as Y,wc as Z,xc as _,yc as $,zb as a,zc as aa}from"./chunk-1k5kszjp.js";import"./chunk-ax9mr6wm.js";import"./chunk-etrb03mt.js";import"./chunk-rxcvf10f.js";import"./chunk-mh0kdzqp.js";export{n as zonedParts,o as zoneOffsetMs,ia as zeroFill,p as utcInstantOfLocal,w as usageDeltaKey,ea as toFocusRecords,fa as toFocusJsonl,f as tieredMicroCents,O as strongestActiveAction,ga as streamFocusJsonl,xa as startSpendLoop,Ca as spendOpenApiPaths,ra as spendNotificationText,$ as signalDefinition,A as scopeKey,N as runEnforcement,Y as routeMatches,j as roundCents,S as robustZScore,D as projectSpend,i as priceUsageLines,h as priceUsage,r as previousBudgetWindow,M as planEnforcement,E as percentOfLimit,ba as optionsForSignal,y as meterTelemetry,k as mergePriceBooks,J as mergeDecisions,R as medianAbsoluteDeviation,Q as median,ca as lookbackHoursForSignal,m as isValidTimeZone,P as isOperationAllowed,t as hourBucketsBetween,s as hourBucket,Ba as handleSpendRequest,H as governingLimitCents,F as formatTimeToExhaustion,qa as formatCents,g as findPriceEntry,v as findMapping,T as ewma,I as evaluateBudget,V as detectLatestAnomaly,U as detectAnomalies,na as createEnforcementHandlers,Aa as compositeSpendTransport,q as budgetWindow,ma as assertSpendAllows,W as anomalyOptionsForSignal,z as aggregateDeltas,L as USER_VISIBLE_ACTIONS,pa as URGENT_SPEND_EVENTS,C as SpendStore,ha as SpendService,va as SpendRunner,sa as SpendNotificationRouter,ua as SpendLoopLease,ka as SpendGate,la as SpendCapError,aa as SignalSource,ta as SPEND_LEASE_SETTING,ja as SPEND_GATE_SETTING,wa as SPEND_CYCLE_SECONDS,X as SENSITIVITY_THRESHOLDS,oa as RecordingSpendTransport,G as MIN_PROJECTION_CONFIDENCE,e as MICRO_CENTS,a as METER_KEYS,b as METERS,da as FOCUS_VERSION,d as ENFORCEMENT_SEVERITY,K as ENFORCEMENT_DESCRIPTIONS,c as ENFORCEMENT_ACTIONS,_ as DETECTABLE_SIGNALS,B as DEFAULT_THRESHOLDS,l as DEFAULT_PRICE_BOOK,u as DEFAULT_METER_MAPPINGS,x as CounterTracker,za as ComputeSpendTransport,ya as AwsSpendTransport,Z as AnomalyConfigStore};
|