@stacksjs/ts-cloud 0.7.23 → 0.7.25
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/bin/cli.js +7 -7
- package/dist/{chunk-c3yy2xyq.js → chunk-11q3tpyf.js} +2 -2
- package/dist/{chunk-0tfwdnmf.js → chunk-3rpt9j1f.js} +1 -0
- package/dist/{chunk-5cfcv2s2.js → chunk-rwqzjjm4.js} +1 -1
- package/dist/{chunk-5mejsd43.js → chunk-wc51as8q.js} +1 -1
- package/dist/{chunk-khfnaap2.js → chunk-x6y786pg.js} +4 -4
- package/dist/deploy/index.js +4 -4
- package/dist/drivers/index.js +2 -2
- package/dist/index.js +4 -4
- package/dist/ui/index.html +3 -3
- package/dist/ui/server/actions.html +3 -3
- package/dist/ui/server/backups.html +3 -3
- package/dist/ui/server/database.html +3 -3
- package/dist/ui/server/deployments.html +3 -3
- package/dist/ui/server/firewall.html +3 -3
- package/dist/ui/server/logs.html +3 -3
- package/dist/ui/server/services.html +3 -3
- package/dist/ui/server/sites.html +3 -3
- package/dist/ui/server/ssh-keys.html +3 -3
- package/dist/ui/server/team.html +3 -3
- package/dist/ui/server/terminal.html +3 -3
- package/dist/ui/server/workers.html +3 -3
- package/dist/ui/serverless/alarms.html +3 -3
- package/dist/ui/serverless/assets.html +3 -3
- package/dist/ui/serverless/data.html +3 -3
- package/dist/ui/serverless/deployments.html +3 -3
- package/dist/ui/serverless/functions.html +3 -3
- package/dist/ui/serverless/logs.html +3 -3
- package/dist/ui/serverless/queues.html +3 -3
- package/dist/ui/serverless/scheduler.html +3 -3
- package/dist/ui/serverless/secrets.html +3 -3
- package/dist/ui/serverless/traces.html +3 -3
- package/dist/ui/serverless.html +3 -3
- package/package.json +3 -3
package/dist/bin/cli.js
CHANGED
|
@@ -254,7 +254,7 @@ rpm -U ./amazon-cloudwatch-agent.rpm || true
|
|
|
254
254
|
# Install Node.js or PHP/Python based on app needs
|
|
255
255
|
# Configure application server (PM2, Nginx, Apache)
|
|
256
256
|
# Mount EFS for shared file storage
|
|
257
|
-
`}},storage:{uploads:{type:"efs",performanceMode:"generalPurpose",throughputMode:"bursting",encrypted:!0,lifecyclePolicy:{transitionToIA:30}},backups:{public:!1,versioning:!0,encryption:!0,lifecycleRules:[{id:"ArchiveOldBackups",enabled:!0,transitions:[{days:90,storageClass:"GLACIER"}]}]},static:{public:!0,versioning:!1,encryption:!1,cors:[{allowedOrigins:[Z||"*"],allowedMethods:["GET","HEAD"]}]}},cdn:{enabled:!0,origins:[{originId:"static-assets",domainName:`${Y}-static.s3.amazonaws.com`,pathPattern:"/static/*"}],customDomain:Z?{domain:Z,certificateArn:"TO_BE_GENERATED"}:void 0,cachePolicy:{minTTL:0,defaultTTL:86400,maxTTL:31536000},compress:!0,http3:!0},databases:z==="mysql"?{mysql:{engine:"mysql",version:"8.0",instanceClass:"db.t3.medium",allocatedStorage:100,maxAllocatedStorage:500,multiAZ:!0,backupRetentionDays:14,preferredBackupWindow:"03:00-04:00",preferredMaintenanceWindow:"sun:04:00-sun:05:00",enablePerformanceInsights:!0,performanceInsightsRetention:7,deletionProtection:!0,parameters:{max_connections:"500",innodb_buffer_pool_size:"{DBInstanceClassMemory*3/4}",slow_query_log:"1",long_query_time:"2"}}}:{postgres:{engine:"postgres",version:"15",instanceClass:"db.t3.medium",allocatedStorage:100,maxAllocatedStorage:500,multiAZ:!0,backupRetentionDays:14,preferredBackupWindow:"03:00-04:00",preferredMaintenanceWindow:"sun:04:00-sun:05:00",enablePerformanceInsights:!0,performanceInsightsRetention:7,deletionProtection:!0,parameters:{max_connections:"500",shared_buffers:"{DBInstanceClassMemory/4}",log_min_duration_statement:"2000"}}},cache:U==="redis"?{redis:{nodeType:"cache.t3.medium",numCacheNodes:2,engine:"redis",engineVersion:"7.0",port:6379,parameterGroup:{maxmemoryPolicy:"allkeys-lru",timeout:"300"},snapshotRetentionLimit:5,snapshotWindow:"03:00-05:00",automaticFailoverEnabled:!0}}:void 0,queues:{jobs:{fifo:!1,visibilityTimeout:900,messageRetentionPeriod:345600,receiveMessageWaitTime:20,deadLetterQueue:!0,maxReceiveCount:3},emails:{fifo:!1,visibilityTimeout:300,messageRetentionPeriod:86400,deadLetterQueue:!0}},functions:{"job-worker":{runtime:"nodejs20.x",handler:"dist/workers/jobs.handler",memory:2048,timeout:900,events:[{type:"sqs",queueName:`${Y}-jobs`,batchSize:10}]},"email-sender":{runtime:"nodejs20.x",handler:"dist/workers/email.handler",memory:512,timeout:60,events:[{type:"sqs",queueName:`${Y}-emails`,batchSize:10}]},cleanup:{runtime:"nodejs20.x",handler:"dist/tasks/cleanup.handler",memory:512,timeout:300,events:[{type:"schedule",expression:"cron(0 2 * * ? *)"}]}},monitoring:{dashboard:{name:`${Y}-web-app`,widgets:[{type:"metric",metrics:["EC2CPUUtilization","ALBRequestCount","ALBTargetResponseTime","RDSCPUUtilization","RDSDatabaseConnections","RDSReadLatency","RDSWriteLatency"]}]},alarms:[{metric:"EC2CPUUtilization",threshold:80,evaluationPeriods:2},{metric:"RDSCPUUtilization",threshold:80,evaluationPeriods:2},{metric:"RDSDatabaseConnections",threshold:400,evaluationPeriods:1},{metric:"ALBTargetResponseTime",threshold:2000,evaluationPeriods:2},{metric:"ALBUnhealthyHostCount",threshold:1,evaluationPeriods:1}],logs:{retention:14,groups:[`${Y}-app`,`${Y}-nginx`,`${Y}-workers`]}},security:{certificate:Z?{domain:Z,validationMethod:"DNS"}:void 0,waf:{enabled:!0,rules:["rateLimit","sqlInjection","xss","knownBadInputs"]},securityGroups:{alb:{ingress:[{port:80,protocol:"tcp",cidr:"0.0.0.0/0"},{port:443,protocol:"tcp",cidr:"0.0.0.0/0"}]},app:{ingress:[{port:3000,protocol:"tcp",source:"alb-sg"}]},database:{ingress:[{port:z==="mysql"?3306:5432,protocol:"tcp",source:"app-sg"}]},...U==="redis"&&{cache:{ingress:[{port:6379,protocol:"tcp",source:"app-sg"}]}}}}}}}function EL($){let{name:J,slug:Y,domain:Z,repository:Q,phpVersion:G="8.3",size:W="small",database:z=Y.replace(/-/g,"_"),databasePassword:U,sslEmail:H,deployStrategy:X="push",provider:K="hetzner"}=$;return{project:{name:J,slug:Y,region:"us-east-1"},mode:"server",cloud:{provider:K},environments:{production:{type:"production",domain:Z}},infrastructure:{compute:{mode:"server",size:W,runtime:"php",webServer:"nginx",php:{versions:[G],default:G},managedServices:{mysql:!0,redis:!0},firewall:{enabled:!0},autoUpdates:!0,monitoring:!0,backups:{enabled:!0,schedule:"0 2 * * *",retentionCount:7}},appDatabase:{engine:"mysql",name:z,username:z,password:U}},sites:{main:{root:".",type:"laravel",domain:Z,phpVersion:G,repository:{...Q,strategy:X},scheduler:!0,queues:[{connection:"redis",queue:"default",processes:1}],ssl:{provider:"letsencrypt",email:H}}}}}function qL($){let{name:J,slug:Y,domain:Z,layers:Q,phpVersion:G="8.3",architecture:W="x86_64",memory:z=1024,build:U,deploy:H=["migrate --force"],cache:X="dynamodb",scheduler:K="on",region:B="us-east-1"}=$;return{project:{name:J,slug:Y,region:B},mode:"serverless",environments:{production:{type:"production",domain:Z,app:{kind:"php",runtime:"provided.al2023",phpVersion:G,architecture:W,layers:Q,memory:z,build:U,deploy:H,assets:"public",queues:!0,scheduler:K,cache:{driver:X},domain:Z}}}}}function TL($){return{root:$.root??"packages/ui/dist",deploy:"server",type:"static",domain:$.domain,build:$.build??"cd packages/ui && bun install && bun run build",ssl:{provider:"letsencrypt"},auth:{username:$.username??"admin",password:$.password}}}function yU($){let J=$.split(".").filter(Boolean);return J.length<=2?$:J.slice(-2).join(".")}function vU($,J){let Y=[],Z=$.infrastructure?.dns?.domain;if(Z)Y.push(Z);if(J&&$.environments?.[J]?.domain)Y.push($.environments[J].domain);for(let Q of Object.values($.sites??{})){let G=Q;if(!G||G.redirect)continue;let W=G.domain;if(typeof W==="string")Y.push(W);else if(Array.isArray(W))Y.push(...W.filter((z)=>typeof z==="string"))}return Y.filter((Q)=>Q&&!Q.startsWith("dashboard."))}function fU($,J,Y){if(Y)return Y;let Z=vU($,J)[0];if(!Z)return null;return`dashboard.${yU(Z)}`}function gU($,J,Y){if(Y)return[Y];let Z=[];for(let Q of vU($,J)){let G=yU(Q);if(!Z.includes(G))Z.push(G)}return Z.map((Q)=>`dashboard.${Q}`)}function T$($){return Object.entries($.sites??{}).some(([J,Y])=>{if(!Y)return!1;let Z=Y.root??"";return T7(J)||Z==="ui/dist"||Z.endsWith("/ui/dist")||Z.endsWith("/dist/ui")})}function BY($){return NY+$.replace(/^dashboard\./,"").replace(/\./g,"-")}function T7($){return $==="dashboard"||$.startsWith(NY)}function j9($,J,Y){if(T$($))return[];let Z=Y.password?{auth:{username:Y.username||"admin",password:Y.password,realm:Y.realm}}:{},Q=Y.build===!1||Y.build===void 0?{}:{build:Y.build};if(Y.live!==!1){let W=fU($,J,Y.domain);if(!W)return[];let z=Y.port??7676,U={root:Y.uiRoot,deploy:"server",domain:W,preStart:["bun install --production --no-save"],start:`bun ${bU} dashboard:serve --box --host 127.0.0.1 --port ${z}`,port:z,sharedPaths:[hU],healthCheck:{path:"/login"},ssl:{provider:"letsencrypt"}};return[{name:BY(W),site:U}]}return gU($,J,Y.domain).map((W)=>({name:BY(W),site:{root:Y.uiRoot,deploy:"server",type:"static",domain:W,ssl:{provider:"letsencrypt"},...Q,...Z}}))}function RL($,J,Y){return j9($,J,Y)[0]??null}function PY($,J){let Y={...$};for(let Z in J){let Q=J[Z],G=Y[Z];if(Q===void 0)continue;if(Array.isArray(Q)&&Array.isArray(G))Y[Z]=[...G,...Q];else if(typeof Q==="object"&&Q!==null&&!Array.isArray(Q)&&typeof G==="object"&&G!==null&&!Array.isArray(G))Y[Z]=PY(G,Q);else Y[Z]=Q}return Y}function VY($,J){return PY($,J)}function DL(...$){return $.reduce((J,Y)=>PY(J,Y),{})}function wL($,J){return(Y)=>{let Z=$(Y);if(typeof J==="function")return VY(Z,J(Z,Y));return VY(Z,J)}}function R$($){return{infrastructure:$}}function NL($){return R$({monitoring:$})}function PL($){return R$({security:$})}function SL($){return R$({databases:$})}function CL($){return R$({cache:$})}function xL($){return R$({cdn:$})}function IL($){return R$({queues:$})}function mU(){let $=process.env.AWS_ACCESS_KEY_ID,J=process.env.AWS_SECRET_ACCESS_KEY;if(!$||!J)return null;return{accessKeyId:$,secretAccessKey:J,sessionToken:process.env.AWS_SESSION_TOKEN}}function lU($){let J=$?.profile||process.env.AWS_PROFILE||"default",Y=$?.credentialsFile||cU(dU(),".aws","credentials");if(!uU(Y))return null;try{let Z=SY(Y,"utf-8");return kL(Z,J)}catch{return null}}function kL($,J){let Y=$.split(`
|
|
257
|
+
`}},storage:{uploads:{type:"efs",performanceMode:"generalPurpose",throughputMode:"bursting",encrypted:!0,lifecyclePolicy:{transitionToIA:30}},backups:{public:!1,versioning:!0,encryption:!0,lifecycleRules:[{id:"ArchiveOldBackups",enabled:!0,transitions:[{days:90,storageClass:"GLACIER"}]}]},static:{public:!0,versioning:!1,encryption:!1,cors:[{allowedOrigins:[Z||"*"],allowedMethods:["GET","HEAD"]}]}},cdn:{enabled:!0,origins:[{originId:"static-assets",domainName:`${Y}-static.s3.amazonaws.com`,pathPattern:"/static/*"}],customDomain:Z?{domain:Z,certificateArn:"TO_BE_GENERATED"}:void 0,cachePolicy:{minTTL:0,defaultTTL:86400,maxTTL:31536000},compress:!0,http3:!0},databases:z==="mysql"?{mysql:{engine:"mysql",version:"8.0",instanceClass:"db.t3.medium",allocatedStorage:100,maxAllocatedStorage:500,multiAZ:!0,backupRetentionDays:14,preferredBackupWindow:"03:00-04:00",preferredMaintenanceWindow:"sun:04:00-sun:05:00",enablePerformanceInsights:!0,performanceInsightsRetention:7,deletionProtection:!0,parameters:{max_connections:"500",innodb_buffer_pool_size:"{DBInstanceClassMemory*3/4}",slow_query_log:"1",long_query_time:"2"}}}:{postgres:{engine:"postgres",version:"15",instanceClass:"db.t3.medium",allocatedStorage:100,maxAllocatedStorage:500,multiAZ:!0,backupRetentionDays:14,preferredBackupWindow:"03:00-04:00",preferredMaintenanceWindow:"sun:04:00-sun:05:00",enablePerformanceInsights:!0,performanceInsightsRetention:7,deletionProtection:!0,parameters:{max_connections:"500",shared_buffers:"{DBInstanceClassMemory/4}",log_min_duration_statement:"2000"}}},cache:U==="redis"?{redis:{nodeType:"cache.t3.medium",numCacheNodes:2,engine:"redis",engineVersion:"7.0",port:6379,parameterGroup:{maxmemoryPolicy:"allkeys-lru",timeout:"300"},snapshotRetentionLimit:5,snapshotWindow:"03:00-05:00",automaticFailoverEnabled:!0}}:void 0,queues:{jobs:{fifo:!1,visibilityTimeout:900,messageRetentionPeriod:345600,receiveMessageWaitTime:20,deadLetterQueue:!0,maxReceiveCount:3},emails:{fifo:!1,visibilityTimeout:300,messageRetentionPeriod:86400,deadLetterQueue:!0}},functions:{"job-worker":{runtime:"nodejs20.x",handler:"dist/workers/jobs.handler",memory:2048,timeout:900,events:[{type:"sqs",queueName:`${Y}-jobs`,batchSize:10}]},"email-sender":{runtime:"nodejs20.x",handler:"dist/workers/email.handler",memory:512,timeout:60,events:[{type:"sqs",queueName:`${Y}-emails`,batchSize:10}]},cleanup:{runtime:"nodejs20.x",handler:"dist/tasks/cleanup.handler",memory:512,timeout:300,events:[{type:"schedule",expression:"cron(0 2 * * ? *)"}]}},monitoring:{dashboard:{name:`${Y}-web-app`,widgets:[{type:"metric",metrics:["EC2CPUUtilization","ALBRequestCount","ALBTargetResponseTime","RDSCPUUtilization","RDSDatabaseConnections","RDSReadLatency","RDSWriteLatency"]}]},alarms:[{metric:"EC2CPUUtilization",threshold:80,evaluationPeriods:2},{metric:"RDSCPUUtilization",threshold:80,evaluationPeriods:2},{metric:"RDSDatabaseConnections",threshold:400,evaluationPeriods:1},{metric:"ALBTargetResponseTime",threshold:2000,evaluationPeriods:2},{metric:"ALBUnhealthyHostCount",threshold:1,evaluationPeriods:1}],logs:{retention:14,groups:[`${Y}-app`,`${Y}-nginx`,`${Y}-workers`]}},security:{certificate:Z?{domain:Z,validationMethod:"DNS"}:void 0,waf:{enabled:!0,rules:["rateLimit","sqlInjection","xss","knownBadInputs"]},securityGroups:{alb:{ingress:[{port:80,protocol:"tcp",cidr:"0.0.0.0/0"},{port:443,protocol:"tcp",cidr:"0.0.0.0/0"}]},app:{ingress:[{port:3000,protocol:"tcp",source:"alb-sg"}]},database:{ingress:[{port:z==="mysql"?3306:5432,protocol:"tcp",source:"app-sg"}]},...U==="redis"&&{cache:{ingress:[{port:6379,protocol:"tcp",source:"app-sg"}]}}}}}}}function EL($){let{name:J,slug:Y,domain:Z,repository:Q,phpVersion:G="8.3",size:W="small",database:z=Y.replace(/-/g,"_"),databasePassword:U,sslEmail:H,deployStrategy:X="push",provider:K="hetzner"}=$;return{project:{name:J,slug:Y,region:"us-east-1"},mode:"server",cloud:{provider:K},environments:{production:{type:"production",domain:Z}},infrastructure:{compute:{mode:"server",size:W,runtime:"php",webServer:"nginx",php:{versions:[G],default:G},managedServices:{mysql:!0,redis:!0},firewall:{enabled:!0},autoUpdates:!0,monitoring:!0,backups:{enabled:!0,schedule:"0 2 * * *",retentionCount:7}},appDatabase:{engine:"mysql",name:z,username:z,password:U}},sites:{main:{root:".",type:"laravel",domain:Z,phpVersion:G,repository:{...Q,strategy:X},scheduler:!0,queues:[{connection:"redis",queue:"default",processes:1}],ssl:{provider:"letsencrypt",email:H}}}}}function qL($){let{name:J,slug:Y,domain:Z,layers:Q,phpVersion:G="8.3",architecture:W="x86_64",memory:z=1024,build:U,deploy:H=["migrate --force"],cache:X="dynamodb",scheduler:K="on",region:B="us-east-1"}=$;return{project:{name:J,slug:Y,region:B},mode:"serverless",environments:{production:{type:"production",domain:Z,app:{kind:"php",runtime:"provided.al2023",phpVersion:G,architecture:W,layers:Q,memory:z,build:U,deploy:H,assets:"public",queues:!0,scheduler:K,cache:{driver:X},domain:Z}}}}}function TL($){return{root:$.root??"packages/ui/dist",deploy:"server",type:"static",domain:$.domain,build:$.build??"cd packages/ui && bun install && bun run build",ssl:{provider:"letsencrypt"},auth:{username:$.username??"admin",password:$.password}}}function yU($){let J=$.split(".").filter(Boolean);return J.length<=2?$:J.slice(-2).join(".")}function vU($,J){let Y=[],Z=$.infrastructure?.dns?.domain;if(Z)Y.push(Z);if(J&&$.environments?.[J]?.domain)Y.push($.environments[J].domain);for(let Q of Object.values($.sites??{})){let G=Q;if(!G||G.redirect)continue;let W=G.domain;if(typeof W==="string")Y.push(W);else if(Array.isArray(W))Y.push(...W.filter((z)=>typeof z==="string"))}return Y.filter((Q)=>Q&&!Q.startsWith("dashboard."))}function fU($,J,Y){if(Y)return Y;let Z=vU($,J)[0];if(!Z)return null;return`dashboard.${yU(Z)}`}function gU($,J,Y){if(Y)return[Y];let Z=[];for(let Q of vU($,J)){let G=yU(Q);if(!Z.includes(G))Z.push(G)}return Z.map((Q)=>`dashboard.${Q}`)}function T$($){return Object.entries($.sites??{}).some(([J,Y])=>{if(!Y)return!1;let Z=Y.root??"";return T7(J)||Z==="ui/dist"||Z.endsWith("/ui/dist")||Z.endsWith("/dist/ui")})}function BY($){return NY+$.replace(/^dashboard\./,"").replace(/\./g,"-")}function T7($){return $==="dashboard"||$.startsWith(NY)}function j9($,J,Y){if(T$($))return[];let Z=Y.password?{auth:{username:Y.username||"admin",password:Y.password,realm:Y.realm}}:{},Q=Y.build===!1||Y.build===void 0?{}:{build:Y.build};if(Y.live!==!1){let W=fU($,J,Y.domain);if(!W)return[];let z=Y.port??7676,U={root:Y.uiRoot,deploy:"server",domain:W,preStart:["bun install --production --no-save"],start:`bun ${bU} dashboard:serve --box --host 127.0.0.1 --port ${z}`,port:z,zeroDowntime:!1,sharedPaths:[hU],healthCheck:{path:"/login"},ssl:{provider:"letsencrypt"}};return[{name:BY(W),site:U}]}return gU($,J,Y.domain).map((W)=>({name:BY(W),site:{root:Y.uiRoot,deploy:"server",type:"static",domain:W,ssl:{provider:"letsencrypt"},...Q,...Z}}))}function RL($,J,Y){return j9($,J,Y)[0]??null}function PY($,J){let Y={...$};for(let Z in J){let Q=J[Z],G=Y[Z];if(Q===void 0)continue;if(Array.isArray(Q)&&Array.isArray(G))Y[Z]=[...G,...Q];else if(typeof Q==="object"&&Q!==null&&!Array.isArray(Q)&&typeof G==="object"&&G!==null&&!Array.isArray(G))Y[Z]=PY(G,Q);else Y[Z]=Q}return Y}function VY($,J){return PY($,J)}function DL(...$){return $.reduce((J,Y)=>PY(J,Y),{})}function wL($,J){return(Y)=>{let Z=$(Y);if(typeof J==="function")return VY(Z,J(Z,Y));return VY(Z,J)}}function R$($){return{infrastructure:$}}function NL($){return R$({monitoring:$})}function PL($){return R$({security:$})}function SL($){return R$({databases:$})}function CL($){return R$({cache:$})}function xL($){return R$({cdn:$})}function IL($){return R$({queues:$})}function mU(){let $=process.env.AWS_ACCESS_KEY_ID,J=process.env.AWS_SECRET_ACCESS_KEY;if(!$||!J)return null;return{accessKeyId:$,secretAccessKey:J,sessionToken:process.env.AWS_SESSION_TOKEN}}function lU($){let J=$?.profile||process.env.AWS_PROFILE||"default",Y=$?.credentialsFile||cU(dU(),".aws","credentials");if(!uU(Y))return null;try{let Z=SY(Y,"utf-8");return kL(Z,J)}catch{return null}}function kL($,J){let Y=$.split(`
|
|
258
258
|
`),Z=null,Q,G,W;for(let z of Y){let U=z.trim();if(!U||U.startsWith("#")||U.startsWith(";"))continue;let H=U.match(/^\[([^\]]+)\]$/);if(H){if(Z===J&&Q&&G)return{accessKeyId:Q,secretAccessKey:G,sessionToken:W};Z=H[1],Q=void 0,G=void 0,W=void 0;continue}if(Z===J){let[X,...K]=U.split("="),B=K.join("=").trim();switch(X.trim().toLowerCase()){case"aws_access_key_id":Q=B;break;case"aws_secret_access_key":G=B;break;case"aws_session_token":W=B;break}}}if(Z===J&&Q&&G)return{accessKeyId:Q,secretAccessKey:G,sessionToken:W};return null}async function pU($){let J=$?.timeout??1000,Y="http://169.254.169.254";try{let Z=await z9("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"21600"}},J);if(!Z.ok)return null;let Q=await Z.text(),G=await z9("http://169.254.169.254/latest/meta-data/iam/security-credentials/",{headers:{"X-aws-ec2-metadata-token":Q}},J);if(!G.ok)return null;let W=(await G.text()).trim(),z=await z9(`http://169.254.169.254/latest/meta-data/iam/security-credentials/${W}`,{headers:{"X-aws-ec2-metadata-token":Q}},J);if(!z.ok)return null;let U=await z.json();return{accessKeyId:U.AccessKeyId,secretAccessKey:U.SecretAccessKey,sessionToken:U.Token,expiration:new Date(U.Expiration)}}catch{return null}}async function rU($){let J=$?.timeout??1000,Y=process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,Z=process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI,Q=null;if(Y)Q=`http://169.254.170.2${Y}`;else if(Z)Q=Z;if(!Q)return null;try{let G={},W=process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN;if(W)G.Authorization=W;let z=await z9(Q,{headers:G},J);if(!z.ok)return null;let U=await z.json();return{accessKeyId:U.AccessKeyId,secretAccessKey:U.SecretAccessKey,sessionToken:U.Token,expiration:new Date(U.Expiration)}}catch{return null}}async function nU($){let J=$?.timeout??5000,Y=process.env.AWS_WEB_IDENTITY_TOKEN_FILE,Z=process.env.AWS_ROLE_ARN,Q=process.env.AWS_ROLE_SESSION_NAME||"ts-cloud-session";if(!Y||!Z)return null;try{let G=SY(Y,"utf-8").trim(),W=process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||"us-east-1",z=W.startsWith("us-gov")?`https://sts.${W}.amazonaws.com`:W==="us-east-1"?"https://sts.amazonaws.com":`https://sts.${W}.amazonaws.com`,U=new URLSearchParams({Action:"AssumeRoleWithWebIdentity",Version:"2011-06-15",RoleArn:Z,RoleSessionName:Q,WebIdentityToken:G}),H=await z9(`${z}/?${U.toString()}`,{method:"POST"},J);if(!H.ok)return null;let X=await H.text(),K=Z9(X,"AccessKeyId"),B=Z9(X,"SecretAccessKey"),V=Z9(X,"SessionToken"),O=Z9(X,"Expiration");if(!K||!B)return null;return{accessKeyId:K,secretAccessKey:B,sessionToken:V??void 0,expiration:O?new Date(O):void 0}}catch{return null}}async function L9($){let J=mU();if(J)return J;let Y=lU($);if(Y)return Y;let Z=await nU($);if(Z)return Z;let Q=await rU($);if(Q)return Q;let G=await pU($);if(G)return G;throw Error("Could not find AWS credentials. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or configure ~/.aws/credentials, or run on an EC2 instance with an IAM role.")}function hL($){let J=null,Y=null;return async()=>{if(J){if(!J.expiration)return J;let Z=300000;if(J.expiration.getTime()-Date.now()>Z)return J}if(Y)return Y;return Y=L9($).then((Z)=>{return J=Z,Y=null,Z}).catch((Z)=>{throw Y=null,Z}),Y}}async function z9($,J,Y){let Z=new AbortController,Q=setTimeout(()=>Z.abort(),Y);try{let G=await fetch($,{...J,signal:Z.signal});return clearTimeout(Q),G}catch(G){throw clearTimeout(Q),G}}function Z9($,J){let Y=new RegExp(`<${J}>([^<]+)</${J}>`),Z=$.match(Y);return Z?Z[1]:null}async function R7($){return L9({profile:$})}function iU($){let J=process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION;if(J)return J;let Y=cU(dU(),".aws","config");if(uU(Y))try{let Z=SY(Y,"utf-8"),Q=$||process.env.AWS_PROFILE||"default",G=Q==="default"?"[default]":`[profile ${Q}]`,W=Z.split(`
|
|
259
259
|
`),z=!1;for(let U of W){let H=U.trim();if(H.startsWith("[")){z=H===G;continue}if(z&&H.startsWith("region")){let[,X]=H.split("=");if(X)return X.trim()}}}catch{}return"us-east-1"}async function aU($){let J=$||await L9(),Y=iU(),{signRequest:Z}=await V9().then(()=>XU),Q=Y.startsWith("us-gov")?`https://sts.${Y}.amazonaws.com`:Y==="us-east-1"?"https://sts.amazonaws.com":`https://sts.${Y}.amazonaws.com`,G="Action=GetCallerIdentity&Version=2011-06-15",W=Z({method:"POST",url:Q,body:"Action=GetCallerIdentity&Version=2011-06-15",headers:{"Content-Type":"application/x-www-form-urlencoded"},...J,service:"sts",region:Y}),z=await fetch(W.url,{method:W.method,headers:W.headers,body:W.body});if(!z.ok)throw Error(`Failed to get account ID: ${await z.text()}`);let U=await z.text(),H=Z9(U,"Account");if(!H)throw Error("Failed to parse account ID from response");return H}class tU{profile;credentials=null;region;constructor($="us-east-1",J="default"){this.profile=J,this.region=$}async init(){if(this.credentials=await R7(this.profile),this.credentials.region)this.region=this.credentials.region}async ensureCredentials(){if(!this.credentials)await this.init();return this.credentials}async request($,J){let Y=await this.ensureCredentials(),Z={Action:$,Version:"2010-05-15",...OY(J)},Q=new URLSearchParams(Z).toString(),W=await(await M$({method:"POST",url:`https://cloudformation.${this.region}.amazonaws.com/`,service:"cloudformation",region:this.region,headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q,accessKeyId:Y.accessKeyId,secretAccessKey:Y.secretAccessKey,sessionToken:Y.sessionToken})).text();return bL(W)}async createStack($){let J={StackName:$.stackName};if($.templateBody)J.TemplateBody=$.templateBody;else if($.templateURL)J.TemplateURL=$.templateURL;else throw Error("Either templateBody or templateURL must be provided");if($.parameters)for(let[Q,[G,W]]of Object.entries($.parameters).entries())J[`Parameters.member.${Q+1}.ParameterKey`]=G,J[`Parameters.member.${Q+1}.ParameterValue`]=W;if($.capabilities)for(let[Q,G]of $.capabilities.entries())J[`Capabilities.member.${Q+1}`]=G;if($.tags)for(let[Q,[G,W]]of Object.entries($.tags).entries())J[`Tags.member.${Q+1}.Key`]=G,J[`Tags.member.${Q+1}.Value`]=W;if($.timeoutInMinutes)J.TimeoutInMinutes=$.timeoutInMinutes;if($.onFailure)J.OnFailure=$.onFailure;let Y=await this.request("CreateStack",J);return(Y?.CreateStackResult||Y?.CreateStackResponse?.CreateStackResult||Y)?.StackId}async updateStack($){let J={StackName:$.stackName};if($.templateBody)J.TemplateBody=$.templateBody;else if($.templateURL)J.TemplateURL=$.templateURL;if($.parameters)for(let[Q,[G,W]]of Object.entries($.parameters).entries())J[`Parameters.member.${Q+1}.ParameterKey`]=G,J[`Parameters.member.${Q+1}.ParameterValue`]=W;if($.capabilities)for(let[Q,G]of $.capabilities.entries())J[`Capabilities.member.${Q+1}`]=G;if($.tags)for(let[Q,[G,W]]of Object.entries($.tags).entries())J[`Tags.member.${Q+1}.Key`]=G,J[`Tags.member.${Q+1}.Value`]=W;let Y=await this.request("UpdateStack",J);return(Y?.UpdateStackResult||Y?.UpdateStackResponse?.UpdateStackResult||Y)?.StackId}async deleteStack($){await this.request("DeleteStack",{StackName:$})}async describeStack($){let J=await this.request("DescribeStacks",{StackName:$}),Z=(J?.DescribeStacksResult||J?.DescribeStacksResponse?.DescribeStacksResult||J)?.Stacks?.member,Q=Array.isArray(Z)?Z[0]:Z;if(!Q)throw Error(`Stack ${$} not found`);return yL(Q)}async listStacks($){let J={};if($)for(let[Z,Q]of $.entries())J[`StackStatusFilter.member.${Z+1}`]=Q;let Y=await this.request("ListStacks",J);return vL(Y)}async describeStackEvents($){let J=await this.request("DescribeStackEvents",{StackName:$});return fL(J)}async waitForStack($,J,Y){let G=0,W=null;while(G<360){G++;let z=await this.describeStack($);if(Y)try{let U=await this.describeStackEvents($),H=[];if(W){for(let X of U){if(X.EventId===W)break;H.push(X)}H.reverse()}else if(U.length>0)H=[U[0]];for(let X of H)Y(X);if(U.length>0)W=U[0].EventId}catch{}if(z.StackStatus&&J.includes(z.StackStatus))return z;if(z.StackStatus?.includes("FAILED")||z.StackStatus?.includes("ROLLBACK"))throw Error(`Stack reached failed state: ${z.StackStatus}
|
|
260
260
|
Reason: ${z.StackStatusReason||"Unknown"}`);await new Promise((U)=>setTimeout(U,5000))}throw Error(`Timeout waiting for stack ${$} to complete`)}async waitForStackWithProgress($,J,Y){let Q={"stack-create-complete":["CREATE_COMPLETE"],"stack-update-complete":["UPDATE_COMPLETE"],"stack-delete-complete":["DELETE_COMPLETE"]}[J];if(!Q)throw Error(`Unknown waiter: ${J}`);return this.waitForStack($,Q,Y)}async createChangeSet($){let J={StackName:$.stackName,ChangeSetName:$.changeSetName,ChangeSetType:"UPDATE"};if($.templateBody)J.TemplateBody=$.templateBody;else if($.templateURL)J.TemplateURL=$.templateURL;if($.parameters)for(let[Z,[Q,G]]of Object.entries($.parameters).entries())J[`Parameters.member.${Z+1}.ParameterKey`]=Q,J[`Parameters.member.${Z+1}.ParameterValue`]=G;if($.capabilities)for(let[Z,Q]of $.capabilities.entries())J[`Capabilities.member.${Z+1}`]=Q;return(await this.request("CreateChangeSet",J)).ChangeSetId}async executeChangeSet($,J){await this.request("ExecuteChangeSet",{ChangeSetName:$,StackName:J})}async describeStacks($){let J=typeof $==="string"?$:$.stackName;try{return{Stacks:[await this.describeStack(J)]}}catch{return{Stacks:[]}}}async getStackOutputs($){let J=await this.request("DescribeStacks",{StackName:$}),Z=(J?.DescribeStacksResult||J?.DescribeStacksResponse?.DescribeStacksResult||J)?.Stacks?.member,Q=Array.isArray(Z)?Z[0]:Z;if(!Q)return{};let G={},W=Q.Outputs?.member;if(W){let z=Array.isArray(W)?W:[W];for(let U of z)if(U.OutputKey&&U.OutputValue)G[U.OutputKey]=U.OutputValue}return G}}function OY($,J=""){let Y={};for(let[Z,Q]of Object.entries($)){let G=J?`${J}.${Z}`:Z;if(Array.isArray(Q))Q.forEach((W,z)=>{if(typeof W==="object")Object.assign(Y,OY(W,`${G}.${z+1}`));else Y[`${G}.${z+1}`]=String(W)});else if(typeof Q==="object"&&Q!==null)Object.assign(Y,OY(Q,G));else if(Q!==void 0&&Q!==null)Y[G]=String(Q)}return Y}function bL($){$=$.replace(/<\?xml[^?]*\?>\s*/,"").trim();function J(Q,G,W){let z=1,U=W,H=`<${G}`,X=`</${G}>`;while(U<Q.length&&z>0){let K=Q.indexOf(H,U),B=Q.indexOf(X,U);if(B===-1)return-1;if(K!==-1&&K<B){let V=Q[K+H.length];if(V===">"||V===" "||V==="/"){let O=Q.indexOf(">",K);if(O!==-1&&Q[O-1]==="/")U=O+1;else z++,U=O+1}else U=K+H.length}else{if(z--,z===0)return B;U=B+X.length}}return-1}function Y(Q,G){while(G<Q.length&&/\s/.test(Q[G]))G++;if(G>=Q.length||Q[G]!=="<"){let A=Q.indexOf("<",G);if(A===-1)return{value:Q.slice(G).trim(),end:Q.length};return{value:Q.slice(G,A).trim(),end:A}}if(Q[G+1]==="/")return{value:void 0,end:G};let W=Q.slice(G).match(/^<(\w+)([^>]*?)\/?>/);if(!W)return{value:void 0,end:G+1};let z=W[1];if(W[0].endsWith("/>"))return{value:"",end:G+W[0].length};let H=G+W[0].length,X=`</${z}>`,K=J(Q,z,H);if(K===-1)return{value:void 0,end:G+W[0].length};let B=Q.slice(H,K).trim();if(!B.includes("<"))return{value:B,end:K+X.length};let V={},O=H;while(O<K){while(O<K&&/\s/.test(Q[O]))O++;if(O>=K)break;if(Q[O]!=="<"||Q[O+1]==="/")break;let A=Q.slice(O).match(/^<(\w+)/);if(!A)break;let _=A[1],M=Y(Q,O);if(M.value===void 0){O++;continue}if(_==="member"||V[_]!==void 0){if(!Array.isArray(V[_]))V[_]=V[_]!==void 0?[V[_]]:[];V[_].push(M.value)}else V[_]=M.value;O=M.end}return{value:V,end:K+X.length}}return Y($,0).value||{}}function yL($){return{StackName:$.StackName||"",StackId:$.StackId,StackStatus:$.StackStatus,CreationTime:$.CreationTime,LastUpdatedTime:$.LastUpdatedTime,StackStatusReason:$.StackStatusReason,Description:$.Description}}function vL($){let Y=($?.ListStacksResult||$?.ListStacksResponse?.ListStacksResult||$)?.StackSummaries?.member;if(!Y)return[];return(Array.isArray(Y)?Y:[Y]).map((Q)=>({StackName:Q.StackName||"",StackId:Q.StackId,StackStatus:Q.StackStatus,CreationTime:Q.CreationTime,LastUpdatedTime:Q.LastUpdatedTime,StackStatusReason:Q.StackStatusReason,Description:Q.Description}))}function fL($){let Y=($?.DescribeStackEventsResult||$?.DescribeStackEventsResponse?.DescribeStackEventsResult||$)?.StackEvents?.member;if(!Y)return[];return(Array.isArray(Y)?Y:[Y]).map((Q)=>({StackId:Q.StackId||"",EventId:Q.EventId||"",StackName:Q.StackName||"",LogicalResourceId:Q.LogicalResourceId||"",PhysicalResourceId:Q.PhysicalResourceId,ResourceType:Q.ResourceType||"",Timestamp:Q.Timestamp||"",ResourceStatus:Q.ResourceStatus||"",ResourceStatusReason:Q.ResourceStatusReason}))}class CY{region;endpoint;forcePathStyle;credentials;credentialOptions;retryOptions;constructor($={}){this.region=$.region||process.env.AWS_REGION||"us-east-1",this.endpoint=$.endpoint||`https://s3.${this.region}.amazonaws.com`,this.forcePathStyle=$.forcePathStyle||!1,this.credentials=$.credentials,this.credentialOptions=$.credentialOptions,this.retryOptions=$.retryOptions||{}}async getCredentials(){if(this.credentials)return this.credentials;return L9(this.credentialOptions)}buildUrl($,J){let Y=J?encodeURIComponent(J).replace(/%2F/g,"/"):"";if(this.forcePathStyle)return J?`${this.endpoint}/${$}/${Y}`:`${this.endpoint}/${$}`;let Z=new URL(this.endpoint);return Z.hostname=`${$}.${Z.hostname}`,J?`${Z.origin}/${Y}`:Z.origin}async get($,J,Y={}){let Z=await this.getCredentials(),Q=this.buildUrl($,J),G={};if(Y.range)G.Range=Y.range;if(Y.ifModifiedSince)G["If-Modified-Since"]=Y.ifModifiedSince.toUTCString();if(Y.ifMatch)G["If-Match"]=Y.ifMatch;if(Y.ifNoneMatch)G["If-None-Match"]=Y.ifNoneMatch;let W=new URL(Q);if(Y.responseContentType)W.searchParams.set("response-content-type",Y.responseContentType);if(Y.responseContentDisposition)W.searchParams.set("response-content-disposition",Y.responseContentDisposition);let z=K1({method:"GET",url:W.toString(),headers:G,...Z,service:"s3",region:this.region}),U=await fetch(z.url,{method:z.method,headers:z.headers});if(!U.ok&&U.status!==304){let H=await U.text();throw new N1(`Failed to get object: ${H}`,U.status,$,J)}return U}async getText($,J,Y={}){return(await this.get($,J,Y)).text()}async getJSON($,J,Y={}){return(await this.get($,J,Y)).json()}async getBuffer($,J,Y={}){return(await this.get($,J,Y)).arrayBuffer()}async put($,J,Y,Z={}){let Q,G;if(typeof Y==="string")Q=new TextEncoder().encode(Y).length,G=Y;else if(Y instanceof ArrayBuffer)Q=Y.byteLength,G=Y;else if(Y instanceof Uint8Array)Q=Y.byteLength,G=Y;else if(Y instanceof Blob)Q=Y.size,G=Y;else return this.uploadMultipart($,J,Y,{...Z,partSize:UY});if(Q>uL){let W=mL(G).stream();return this.uploadMultipart($,J,W,{...Z,partSize:UY})}return this.putSimple($,J,G,Q,Z)}async putSimple($,J,Y,Z,Q){let G=await this.getCredentials(),W=this.buildUrl($,J),z={"Content-Length":String(Z),"Content-Type":Q.contentType||GU(J)};if(Q.contentEncoding)z["Content-Encoding"]=Q.contentEncoding;if(Q.cacheControl)z["Cache-Control"]=Q.cacheControl;if(Q.contentDisposition)z["Content-Disposition"]=Q.contentDisposition;if(Q.storageClass)z["x-amz-storage-class"]=Q.storageClass;if(Q.serverSideEncryption)z["x-amz-server-side-encryption"]=Q.serverSideEncryption;if(Q.acl)z["x-amz-acl"]=Q.acl;if(Q.tagging)z["x-amz-tagging"]=Q.tagging;if(Q.metadata)for(let[B,V]of Object.entries(Q.metadata))z[`x-amz-meta-${B.toLowerCase()}`]=V;let U;if(typeof Y==="string")U=Y;else if(Y instanceof Blob)U=await Y.text();else U=new TextDecoder().decode(Y instanceof ArrayBuffer?new Uint8Array(Y):Y);let H=K1({method:"PUT",url:W,headers:z,body:U,...G,service:"s3",region:this.region}),X=await fetch(H.url,{method:H.method,headers:H.headers,body:Y});if(!X.ok){let B=await X.text();throw new N1(`Failed to put object: ${B}`,X.status,$,J)}return{etag:(X.headers.get("ETag")||"").replace(/"/g,"")}}async delete($,J){let Y=await this.getCredentials(),Z=this.buildUrl($,J),Q=K1({method:"DELETE",url:Z,...Y,service:"s3",region:this.region}),G=await fetch(Q.url,{method:Q.method,headers:Q.headers});if(!G.ok&&G.status!==204){let W=await G.text();throw new N1(`Failed to delete object: ${W}`,G.status,$,J)}}async deleteMany($,J){let Y=await this.getCredentials(),Z=`${this.buildUrl($)}?delete`,G=`<?xml version="1.0" encoding="UTF-8"?><Delete><Quiet>false</Quiet>${J.map((O)=>`<Object><Key>${cL(O)}</Key></Object>`).join("")}</Delete>`,W=K1({method:"POST",url:Z,headers:{"Content-Type":"application/xml"},body:G,...Y,service:"s3",region:this.region}),z=await fetch(W.url,{method:W.method,headers:W.headers,body:G});if(!z.ok){let O=await z.text();throw new N1(`Failed to delete objects: ${O}`,z.status,$)}let U=await z.text(),H=[],X=[],K=/<Deleted><Key>([^<]+)<\/Key>/g,B;while((B=K.exec(U))!==null)H.push(B[1]);let V=/<Error><Key>([^<]+)<\/Key><Code>([^<]+)<\/Code><Message>([^<]+)<\/Message>/g;while((B=V.exec(U))!==null)X.push({key:B[1],error:`${B[2]}: ${B[3]}`});return{deleted:H,errors:X}}async list($,J={}){let Y=await this.getCredentials(),Z=new URL(this.buildUrl($));if(Z.searchParams.set("list-type","2"),J.prefix)Z.searchParams.set("prefix",J.prefix);if(J.delimiter)Z.searchParams.set("delimiter",J.delimiter);if(J.maxKeys)Z.searchParams.set("max-keys",String(J.maxKeys));if(J.continuationToken)Z.searchParams.set("continuation-token",J.continuationToken);if(J.startAfter)Z.searchParams.set("start-after",J.startAfter);let Q=K1({method:"GET",url:Z.toString(),...Y,service:"s3",region:this.region}),G=await fetch(Q.url,{method:Q.method,headers:Q.headers});if(!G.ok){let z=await G.text();throw new N1(`Failed to list objects: ${z}`,G.status,$)}let W=await G.text();return dL(W)}async*listAll($,J={}){let Y;do{let Z=await this.list($,{...J,continuationToken:Y});for(let Q of Z.contents)yield Q;Y=Z.nextContinuationToken}while(Y)}async head($,J){let Y=await this.getCredentials(),Z=this.buildUrl($,J),Q=K1({method:"HEAD",url:Z,...Y,service:"s3",region:this.region}),G=await fetch(Q.url,{method:Q.method,headers:Q.headers});if(G.status===404)return null;if(!G.ok){let z=await G.text();throw new N1(`Failed to head object: ${z}`,G.status,$,J)}let W={};return G.headers.forEach((z,U)=>{if(U.toLowerCase().startsWith("x-amz-meta-"))W[U.slice(11)]=z}),{contentLength:Number(G.headers.get("Content-Length")||0),contentType:G.headers.get("Content-Type")||"application/octet-stream",etag:(G.headers.get("ETag")||"").replace(/"/g,""),lastModified:new Date(G.headers.get("Last-Modified")||0),metadata:W,storageClass:G.headers.get("x-amz-storage-class")||void 0,serverSideEncryption:G.headers.get("x-amz-server-side-encryption")||void 0}}async exists($,J){return await this.head($,J)!==null}async copy($,J,Y,Z,Q={}){let G=await this.getCredentials(),W=this.buildUrl(Y,Z),z={"x-amz-copy-source":`/${$}/${encodeURIComponent(J)}`};if(Q.metadataDirective)z["x-amz-metadata-directive"]=Q.metadataDirective;if(Q.contentType)z["Content-Type"]=Q.contentType;if(Q.storageClass)z["x-amz-storage-class"]=Q.storageClass;if(Q.acl)z["x-amz-acl"]=Q.acl;if(Q.metadata)for(let[V,O]of Object.entries(Q.metadata))z[`x-amz-meta-${V.toLowerCase()}`]=O;let U=K1({method:"PUT",url:W,headers:z,...G,service:"s3",region:this.region}),H=await fetch(U.url,{method:U.method,headers:U.headers});if(!H.ok){let V=await H.text();throw new N1(`Failed to copy object: ${V}`,H.status,Y,Z)}let K=(await H.text()).match(/<ETag>"?([^"<]+)"?<\/ETag>/);return{etag:K?K[1]:""}}async getPresignedUrl($,J,Y={}){let Z=await this.getCredentials(),Q=this.buildUrl($,J);return _Y({url:Q,method:Y.method||"GET",expiresIn:Y.expiresIn||3600,...Z,service:"s3",region:this.region})}async uploadMultipart($,J,Y,Z={}){let Q=await this.getCredentials(),G=Math.max(Z.partSize||UY,gL),W,z;if(Y instanceof ReadableStream)W=Y;else if(Y instanceof Blob)W=Y.stream(),z=Y.size;else{let X=new Blob([Y]);W=X.stream(),z=X.size}let{uploadId:U,baseUrl:H}=await this.initiateMultipartUpload($,J,Z);try{let X=await this.uploadParts($,J,H,U,W,G,Q,z,Z.concurrency||4,Z.onProgress);return await this.completeMultipartUpload($,J,H,U,X)}catch(X){throw await this.abortMultipartUpload($,J,U,H).catch(()=>{}),X}}async initiateMultipartUpload($,J,Y){let Z=await this.getCredentials(),Q=this.buildUrl($,J),G=`${Q}?uploads`,W={"Content-Type":Y.contentType||GU(J)};if(Y.storageClass)W["x-amz-storage-class"]=Y.storageClass;if(Y.serverSideEncryption)W["x-amz-server-side-encryption"]=Y.serverSideEncryption;if(Y.acl)W["x-amz-acl"]=Y.acl;if(Y.metadata)for(let[B,V]of Object.entries(Y.metadata))W[`x-amz-meta-${B.toLowerCase()}`]=V;let z=K1({method:"POST",url:G,headers:W,...Z,service:"s3",region:this.region}),U=await fetch(z.url,{method:z.method,headers:z.headers});if(!U.ok){let B=await U.text();throw new N1(`Failed to initiate multipart upload: ${B}`,U.status,$,J)}let X=(await U.text()).match(/<UploadId>([^<]+)<\/UploadId>/);if(!X)throw new N1("Failed to parse upload ID from response",0,$,J);let K=Q;if(U.url)try{let B=new URL(U.url);B.search="",K=B.toString()}catch{}return{uploadId:X[1],baseUrl:K}}async uploadParts($,J,Y,Z,Q,G,W,z,U,H){let X=[],K=Q.getReader(),B=1,V=new Uint8Array(0),O=0,A=z?Math.ceil(z/G):void 0,_=new Map,M=async(q,E)=>{let T=`${Y}?partNumber=${E}&uploadId=${encodeURIComponent(Z)}`,w={"Content-Length":String(q.byteLength),"x-amz-content-sha256":"UNSIGNED-PAYLOAD"},N=K1({method:"PUT",url:T,headers:w,...W,service:"s3",region:this.region}),I=await fetch(N.url,{method:N.method,headers:N.headers,body:q,redirect:"error"});if(!I.ok){let h=await I.text();throw new N1(`Failed to upload part ${E}: ${h}`,I.status,$,J)}let x=(I.headers.get("ETag")||"").replace(/"/g,"");if(!x)throw new N1(`Missing ETag for part ${E}`,I.status,$,J);return{partNumber:E,etag:x}},j=async()=>{let q=await Promise.race(_.values());_.delete(q.partNumber),X.push(q)};while(!0){let{done:q,value:E}=await K.read();if(E){let T=new Uint8Array(V.length+E.length);T.set(V),T.set(E,V.length),V=T}while(V.length>=G||q&&V.length>0){let T=V.slice(0,G);V=V.slice(G);let w=B++;if(_.size>=U)await j();if(_.set(w,M(T,w)),O+=T.byteLength,H)H({loaded:O,total:z||O,part:w,totalParts:A||w})}if(q)break}while(_.size>0)await j();return X.sort((q,E)=>q.partNumber-E.partNumber),X}async completeMultipartUpload($,J,Y,Z,Q){let G=await this.getCredentials(),W=`${Y}?uploadId=${encodeURIComponent(Z)}`,U=`<?xml version="1.0" encoding="UTF-8"?><CompleteMultipartUpload>${Q.map((O)=>`<Part><PartNumber>${O.partNumber}</PartNumber><ETag>"${O.etag}"</ETag></Part>`).join("")}</CompleteMultipartUpload>`,H=K1({method:"POST",url:W,headers:{"Content-Type":"application/xml"},body:U,...G,service:"s3",region:this.region}),X=await fetch(H.url,{method:H.method,headers:H.headers,body:U});if(!X.ok){let O=await X.text();throw new N1(`Failed to complete multipart upload: ${O}`,X.status,$,J)}let B=(await X.text()).match(/<ETag>"?([^"<]+)"?<\/ETag>/);return{etag:B?B[1]:""}}async abortMultipartUpload($,J,Y,Z){let Q=await this.getCredentials(),G=`${Z??this.buildUrl($,J)}?uploadId=${encodeURIComponent(Y)}`,W=K1({method:"DELETE",url:G,...Q,service:"s3",region:this.region});await fetch(W.url,{method:W.method,headers:W.headers})}async emptyAndDeleteBucket($){let Y=[];for await(let W of this.listAll($,{}))if(Y.push(W.key),Y.length>=1000)await this.deleteMany($,Y),Y=[];if(Y.length>0)await this.deleteMany($,Y);let Z=await this.getCredentials(),Q=this.buildUrl($),G=K1({method:"DELETE",url:Q,...Z,service:"s3",region:this.region});await fetch(G.url,{method:G.method,headers:G.headers})}}function dL($){let J=[],Y=[],Z=/<Contents>([\s\S]*?)<\/Contents>/g,Q;while((Q=Z.exec($))!==null){let W=Q[1];J.push({key:i1(W,"Key")||"",lastModified:new Date(i1(W,"LastModified")||0),etag:(i1(W,"ETag")||"").replace(/"/g,""),size:Number(i1(W,"Size")||0),storageClass:i1(W,"StorageClass")||"STANDARD"})}let G=/<CommonPrefixes><Prefix>([^<]+)<\/Prefix><\/CommonPrefixes>/g;while((Q=G.exec($))!==null)Y.push(Q[1]);return{contents:J,commonPrefixes:Y,isTruncated:i1($,"IsTruncated")==="true",continuationToken:i1($,"ContinuationToken")||void 0,nextContinuationToken:i1($,"NextContinuationToken")||void 0,keyCount:Number(i1($,"KeyCount")||0),maxKeys:Number(i1($,"MaxKeys")||1000),prefix:i1($,"Prefix")||void 0,delimiter:i1($,"Delimiter")||void 0}}function i1($,J){let Y=new RegExp(`<${J}>([^<]*)</${J}>`),Z=$.match(Y);return Z?Z[1]:null}function cL($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function GU($){let J=$.split(".").pop()?.toLowerCase();return{html:"text/html",htm:"text/html",css:"text/css",js:"application/javascript",mjs:"application/javascript",json:"application/json",xml:"application/xml",txt:"text/plain",md:"text/markdown",csv:"text/csv",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",avif:"image/avif",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",avi:"video/x-msvideo",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",zip:"application/zip",gz:"application/gzip",tar:"application/x-tar",rar:"application/vnd.rar","7z":"application/x-7z-compressed",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",wasm:"application/wasm"}[J||""]||"application/octet-stream"}function mL($){if($ instanceof Blob)return $;if(typeof $==="string")return new Blob([$],{type:"text/plain"});return new Blob([$])}function lL($){return new CY($)}class sU{profile;credentials=null;constructor($="default"){this.profile=$}async init(){this.credentials=await R7(this.profile)}async ensureCredentials(){if(!this.credentials)await this.init();return this.credentials}async createInvalidation($){let J=await this.ensureCredentials(),Y=$.callerReference||`invalidation-${Date.now()}`,Z=`<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -7576,7 +7576,7 @@ Run \`${this.name??"cli"} --help\` for usage.`;d2.stderr.write(`${G}${Q}${W}
|
|
|
7576
7576
|
`).length-1;this.output.write(M2.move(-999,$*-1))}render(){let $=J4(this._render(this)??"",$4.stdout.columns,{hard:!0,trim:!1});if($===this._prevFrame)return;if(this.state==="initial")this.output.write(M2.hide);else{let J=bV(this._prevFrame,$);if(this.restoreCursor(),J&&J?.length===1){let Y=J[0];this.output.write(M2.move(0,Y)),this.output.write(a5.lines(1));let Z=$.split(`
|
|
7577
7577
|
`);this.output.write(Z[Y]),this._prevFrame=$,this.output.write(M2.move(0,Z.length-Y-1));return}if(J&&J?.length>1){let Y=J[0];this.output.write(M2.move(0,Y)),this.output.write(a5.down());let Q=$.split(`
|
|
7578
7578
|
`).slice(Y);this.output.write(Q.join(`
|
|
7579
|
-
`)),this._prevFrame=$;return}this.output.write(a5.down())}if(this.output.write($),this.state==="initial")this.state="active";this._prevFrame=$}}function dV($,J){if($===void 0)return 0;if(J.length===0)return 0;let Z=J.findIndex((Q)=>Q.value===$);return Z!==-1?Z:0}function cV($,J){return(J.label??String(J.value)).toLowerCase().includes($.toLowerCase())}function mV($,J){if(!J)return;if($)return J;return J[0]}class lV extends JJ{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#$=0;#Y="";#Z;#J;get cursor(){return this.#$}get userInputWithCursor(){if(!this.userInput)return V6.inverse(V6.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let $=this.userInput.slice(0,this._cursor),[J,...Y]=this.userInput.slice(this._cursor);return`${$}${V6.inverse(J)}${Y.join("")}`}get options(){if(typeof this.#J==="function")return this.#J();return this.#J}constructor($){super($);this.#J=$.options;let J=this.options;this.filteredOptions=[...J],this.multiple=$.multiple===!0,this.#Z=$.filter??cV;let Y;if($.initialValue&&Array.isArray($.initialValue))if(this.multiple)Y=$.initialValue;else Y=$.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Y=[this.options[0].value];if(Y)for(let Z of Y){let Q=J.findIndex((G)=>G.value===Z);if(Q!==-1)this.toggleSelected(Z),this.#$=Q}this.focusedValue=this.options[this.#$]?.value,this.on("key",(Z,Q)=>this.#Q(Z,Q)),this.on("userInput",(Z)=>this.#G(Z))}_isActionKey($,J){return $==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&$!==void 0&&$!==""}#Q($,J){let Y=J.name==="up",Z=J.name==="down",Q=J.name==="return";if(Y||Z){if(this.#$=Math.max(0,Math.min(this.#$+(Y?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#$]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(Q)this.value=mV(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected($){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes($))this.selectedValues=this.selectedValues.filter((J)=>J!==$);else this.selectedValues=[...this.selectedValues,$];else this.selectedValues=[$]}#G($){if($!==this.#Y){this.#Y=$;let J=this.options;if($)this.filteredOptions=J.filter((Y)=>this.#Z($,Y));else this.filteredOptions=[...J];if(this.#$=dV(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#$]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class pV extends JJ{options;cursor=0;#$;getGroupItems($){return this.options.filter((J)=>J.group===$)}isGroupSelected($){let J=this.getGroupItems($),Y=this.value;if(Y===void 0)return!1;return J.every((Z)=>Y.includes(Z.value))}toggleValue(){let $=this.options[this.cursor];if(this.value===void 0)this.value=[];if($.group===!0){let J=String($.value),Y=this.getGroupItems(J);if(this.isGroupSelected(J))this.value=this.value.filter((Z)=>Y.findIndex((Q)=>Q.value===Z)===-1);else this.value=[...this.value,...Y.map((Z)=>Z.value)];this.value=Array.from(new Set(this.value))}else{let J=this.value.includes($.value);this.value=J?this.value.filter((Y)=>Y!==$.value):[...this.value,$.value]}}constructor($){super($,!1);let{options:J}=$;this.#$=$.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([Y,Z])=>[{value:Y,group:!0,label:Y},...Z.map((Q)=>({...Q,group:Y}))]),this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Y})=>Y===$.cursorAt),this.#$?0:1),this.on("cursor",(Y)=>{switch(Y){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Z=this.options[this.cursor]?.group===!0;if(!this.#$&&Z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Z=this.options[this.cursor]?.group===!0;if(!this.#$&&Z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var rV=$V();var P0=($,J)=>rV?$:J,XP=P0("◆","*"),FP=P0("■","x"),KP=P0("▲","x"),BP=P0("◇","o"),VP=P0("┌","T"),nV=P0("│","|"),OP=P0("└","—"),AP=P0("●",">"),_P=P0("○"," "),jP=P0("◻","[•]"),LP=P0("◼","[+]"),MP=P0("◻","[ ]"),EP=P0("▪","•"),qP=P0("─","-"),TP=P0("╮","+"),RP=P0("├","+"),DP=P0("╯","+"),wP=P0("●","•"),NP=P0("◆","*"),PP=P0("▲","!"),SP=P0("■","x");var CP={light:P0("─","-"),heavy:P0("━","="),block:P0("█","#")};function iV(){return`${V6.gray(nV)} `}var xP=iV();var YJ="0.7.
|
|
7579
|
+
`)),this._prevFrame=$;return}this.output.write(a5.down())}if(this.output.write($),this.state==="initial")this.state="active";this._prevFrame=$}}function dV($,J){if($===void 0)return 0;if(J.length===0)return 0;let Z=J.findIndex((Q)=>Q.value===$);return Z!==-1?Z:0}function cV($,J){return(J.label??String(J.value)).toLowerCase().includes($.toLowerCase())}function mV($,J){if(!J)return;if($)return J;return J[0]}class lV extends JJ{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#$=0;#Y="";#Z;#J;get cursor(){return this.#$}get userInputWithCursor(){if(!this.userInput)return V6.inverse(V6.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let $=this.userInput.slice(0,this._cursor),[J,...Y]=this.userInput.slice(this._cursor);return`${$}${V6.inverse(J)}${Y.join("")}`}get options(){if(typeof this.#J==="function")return this.#J();return this.#J}constructor($){super($);this.#J=$.options;let J=this.options;this.filteredOptions=[...J],this.multiple=$.multiple===!0,this.#Z=$.filter??cV;let Y;if($.initialValue&&Array.isArray($.initialValue))if(this.multiple)Y=$.initialValue;else Y=$.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Y=[this.options[0].value];if(Y)for(let Z of Y){let Q=J.findIndex((G)=>G.value===Z);if(Q!==-1)this.toggleSelected(Z),this.#$=Q}this.focusedValue=this.options[this.#$]?.value,this.on("key",(Z,Q)=>this.#Q(Z,Q)),this.on("userInput",(Z)=>this.#G(Z))}_isActionKey($,J){return $==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&$!==void 0&&$!==""}#Q($,J){let Y=J.name==="up",Z=J.name==="down",Q=J.name==="return";if(Y||Z){if(this.#$=Math.max(0,Math.min(this.#$+(Y?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#$]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(Q)this.value=mV(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected($){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes($))this.selectedValues=this.selectedValues.filter((J)=>J!==$);else this.selectedValues=[...this.selectedValues,$];else this.selectedValues=[$]}#G($){if($!==this.#Y){this.#Y=$;let J=this.options;if($)this.filteredOptions=J.filter((Y)=>this.#Z($,Y));else this.filteredOptions=[...J];if(this.#$=dV(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#$]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class pV extends JJ{options;cursor=0;#$;getGroupItems($){return this.options.filter((J)=>J.group===$)}isGroupSelected($){let J=this.getGroupItems($),Y=this.value;if(Y===void 0)return!1;return J.every((Z)=>Y.includes(Z.value))}toggleValue(){let $=this.options[this.cursor];if(this.value===void 0)this.value=[];if($.group===!0){let J=String($.value),Y=this.getGroupItems(J);if(this.isGroupSelected(J))this.value=this.value.filter((Z)=>Y.findIndex((Q)=>Q.value===Z)===-1);else this.value=[...this.value,...Y.map((Z)=>Z.value)];this.value=Array.from(new Set(this.value))}else{let J=this.value.includes($.value);this.value=J?this.value.filter((Y)=>Y!==$.value):[...this.value,$.value]}}constructor($){super($,!1);let{options:J}=$;this.#$=$.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([Y,Z])=>[{value:Y,group:!0,label:Y},...Z.map((Q)=>({...Q,group:Y}))]),this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Y})=>Y===$.cursorAt),this.#$?0:1),this.on("cursor",(Y)=>{switch(Y){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Z=this.options[this.cursor]?.group===!0;if(!this.#$&&Z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Z=this.options[this.cursor]?.group===!0;if(!this.#$&&Z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var rV=$V();var P0=($,J)=>rV?$:J,XP=P0("◆","*"),FP=P0("■","x"),KP=P0("▲","x"),BP=P0("◇","o"),VP=P0("┌","T"),nV=P0("│","|"),OP=P0("└","—"),AP=P0("●",">"),_P=P0("○"," "),jP=P0("◻","[•]"),LP=P0("◼","[+]"),MP=P0("◻","[ ]"),EP=P0("▪","•"),qP=P0("─","-"),TP=P0("╮","+"),RP=P0("├","+"),DP=P0("╯","+"),wP=P0("●","•"),NP=P0("◆","*"),PP=P0("▲","!"),SP=P0("■","x");var CP={light:P0("─","-"),heavy:P0("━","="),block:P0("█","#")};function iV(){return`${V6.gray(nV)} `}var xP=iV();var YJ="0.7.25";F0();import{existsSync as KJ}from"node:fs";import{mkdir as GO,writeFile as L4}from"node:fs/promises";function BJ($){$.command("init","Initialize a new ts-cloud project").option("--mode <mode>","Deployment mode: server or serverless").option("--name <name>","Project name").option("--region <region>","AWS Region").action(async(J)=>{if(D("Initializing ts-cloud Project"),KJ("cloud.config.ts")){if(!await p("cloud.config.ts already exists. Overwrite?",!1)){F("Initialization cancelled");return}}let Y=J?.name||await D0("Project name","my-app"),Z=J?.mode||await _6("Select deployment mode",["serverless","server"]),Q=J?.region||await _6("Select AWS region",["us-east-1","us-west-2","eu-west-1","eu-central-1","ap-southeast-1"]),G=new P("Creating configuration file...");G.start();let W=`import { defineConfig } from '@ts-cloud/core'
|
|
7580
7580
|
|
|
7581
7581
|
export default defineConfig({
|
|
7582
7582
|
project: {
|
|
@@ -8056,18 +8056,18 @@ This will revoke all access for this team member`),!await p("Remove this team me
|
|
|
8056
8056
|
Team member removed!`),F("All access credentials have been revoked")})}F0();import{existsSync as u1,writeFileSync as aD,copyFileSync as G6,readFileSync as eG,mkdirSync as tD}from"node:fs";import{dirname as sD}from"node:path";_1();k0();z2();b7();G0();class p7{client;region;constructor($="us-east-1",J){this.region=$,this.client=new $0}async describeServices($){let J={cluster:$.cluster,services:$.services};return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.DescribeServices","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async listServices($){let J={cluster:$};return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.ListServices","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async listTasks($,J){let Y={cluster:$};if(J)Y.serviceName=J;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.ListTasks","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(Y)})}async describeTasks($,J){let Y={cluster:$,tasks:J};return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.DescribeTasks","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(Y)})}async updateService($){let J={cluster:$.cluster,service:$.service};if($.forceNewDeployment!==void 0)J.forceNewDeployment=$.forceNewDeployment;if($.desiredCount!==void 0)J.desiredCount=$.desiredCount;if($.taskDefinition)J.taskDefinition=$.taskDefinition;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.UpdateService","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async createService($){let J={cluster:$.cluster,serviceName:$.serviceName,taskDefinition:$.taskDefinition,desiredCount:$.desiredCount};if($.launchType)J.launchType=$.launchType;if($.networkConfiguration)J.networkConfiguration=$.networkConfiguration;if($.loadBalancers)J.loadBalancers=$.loadBalancers;if($.healthCheckGracePeriodSeconds!==void 0)J.healthCheckGracePeriodSeconds=$.healthCheckGracePeriodSeconds;if($.deploymentConfiguration)J.deploymentConfiguration=$.deploymentConfiguration;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.CreateService","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async deleteService($){let J={cluster:$.cluster,service:$.service};if($.force!==void 0)J.force=$.force;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.DeleteService","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async listClusters(){return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.ListClusters","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({})})}async describeClusters($){let J={clusters:$,include:["ATTACHMENTS","CONFIGURATIONS","SETTINGS","STATISTICS","TAGS"]};return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.DescribeClusters","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async stopTask($){let J={cluster:$.cluster,task:$.task};if($.reason)J.reason=$.reason;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.StopTask","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async runTask($){let J={cluster:$.cluster,taskDefinition:$.taskDefinition};if($.count!==void 0)J.count=$.count;if($.launchType)J.launchType=$.launchType;if($.networkConfiguration)J.networkConfiguration=$.networkConfiguration;if($.overrides)J.overrides=$.overrides;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.RunTask","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async registerTaskDefinition($){return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.RegisterTaskDefinition","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify($)})}async deregisterTaskDefinition($){return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.DeregisterTaskDefinition","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({taskDefinition:$})})}async describeTaskDefinition($){return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.DescribeTaskDefinition","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({taskDefinition:$,include:["TAGS"]})})}async listTaskDefinitionFamilies($){let J={};if($?.familyPrefix)J.familyPrefix=$.familyPrefix;if($?.status)J.status=$.status;return await this.client.request({service:"ecs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerServiceV20141113.ListTaskDefinitionFamilies","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(J)})}async waitForServiceStable($,J,Y=40,Z=15000){for(let Q=0;Q<Y;Q++){let W=(await this.describeServices({cluster:$,services:[J]})).services?.[0];if(W){let z=W.deployments?.find((U)=>U.status==="PRIMARY");if(z&&z.runningCount===z.desiredCount&&W.deployments?.length===1)return!0}await new Promise((z)=>setTimeout(z,Z))}return!1}async forceNewDeployment($,J){return this.updateService({cluster:$,service:J,forceNewDeployment:!0})}async scaleService($,J,Y){return this.updateService({cluster:$,service:J,desiredCount:Y})}}r7();G0();import{execSync as $W}from"node:child_process";import{tmpdir as oD}from"node:os";import{join as eD}from"node:path";b9();B2();import{existsSync as ST,readdirSync as CT,readFileSync as xT,statSync as IT}from"node:fs";import{join as kT,relative as hT,extname as bT}from"node:path";var yT=[{name:"AWS Access Key ID",pattern:/(?:^|[^A-Z0-9])((AKIA|ABIA|ACCA|ASIA)[A-Z0-9]{16})(?:[^A-Z0-9]|$)/g,severity:"critical",description:"AWS Access Key ID detected"},{name:"AWS Secret Access Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key|secretAccessKey)\s*[=:]\s*['"]?([A-Za-z0-9/+=]{40})['"]?/gi,severity:"critical",description:"AWS Secret Access Key detected"},{name:"AWS Secret Key (Generic)",pattern:/(?:^|['"`:=\s])([A-Za-z0-9/+=]{40})(?:['"`\s]|$)/g,severity:"high",description:"Potential AWS Secret Key (40-char base64)"},{name:"Generic API Key",pattern:/(?:api[_-]?key|apikey|api[_-]?secret)\s*[=:]\s*['"]?([A-Za-z0-9_\-]{20,})['"]?/gi,severity:"high",description:"Generic API key detected"},{name:"RSA Private Key",pattern:/-----BEGIN RSA PRIVATE KEY-----/g,severity:"critical",description:"RSA private key detected"},{name:"OpenSSH Private Key",pattern:/-----BEGIN OPENSSH PRIVATE KEY-----/g,severity:"critical",description:"OpenSSH private key detected"},{name:"EC Private Key",pattern:/-----BEGIN EC PRIVATE KEY-----/g,severity:"critical",description:"EC private key detected"},{name:"PGP Private Key",pattern:/-----BEGIN PGP PRIVATE KEY BLOCK-----/g,severity:"critical",description:"PGP private key detected"},{name:"GitHub Token",pattern:/(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}/g,severity:"critical",description:"GitHub personal access token detected"},{name:"GitHub OAuth",pattern:/github[_-]?oauth[_-]?token\s*[=:]\s*['"]?([A-Za-z0-9_]{40})['"]?/gi,severity:"critical",description:"GitHub OAuth token detected"},{name:"Slack Token",pattern:/xox[baprs]-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*/g,severity:"critical",description:"Slack token detected"},{name:"Slack Webhook",pattern:/https:\/\/hooks\.slack\.com\/services\/T[A-Z0-9]+\/B[A-Z0-9]+\/[A-Za-z0-9]+/g,severity:"high",description:"Slack webhook URL detected"},{name:"Discord Webhook",pattern:/https:\/\/discord(?:app)?\.com\/api\/webhooks\/[0-9]+\/[A-Za-z0-9_-]+/g,severity:"high",description:"Discord webhook URL detected"},{name:"JWT Token",pattern:/eyJ[A-Za-z0-9_-]*\.eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*/g,severity:"high",description:"JWT token detected"},{name:"Google API Key",pattern:/AIza[0-9A-Za-z_-]{35}/g,severity:"critical",description:"Google API key detected"},{name:"Google OAuth ID",pattern:/[0-9]+-[A-Za-z0-9_]{32}\.apps\.googleusercontent\.com/g,severity:"high",description:"Google OAuth client ID detected"},{name:"Firebase API Key",pattern:/(?:firebase[_-]?api[_-]?key)\s*[=:]\s*['"]?([A-Za-z0-9_-]{39})['"]?/gi,severity:"critical",description:"Firebase API key detected"},{name:"Cloudflare API Token",pattern:/(?:cloudflare[_-]?api[_-]?token|cf[_-]?api[_-]?token)\s*[=:]\s*['"]?([A-Za-z0-9_-]{40})['"]?/gi,severity:"critical",description:"Cloudflare API token detected"},{name:"Azure Client Secret",pattern:/(?:azure[_-]?client[_-]?secret|client[_-]?secret)\s*[=:]\s*['"]?([A-Za-z0-9~._-]{34,})['"]?/gi,severity:"critical",description:"Azure client secret detected"},{name:"Heroku API Key",pattern:/(?:heroku[_-]?api[_-]?key)\s*[=:]\s*['"]?([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})['"]?/gi,severity:"critical",description:"Heroku API key detected"},{name:"Database Connection String",pattern:/(?:mysql|postgres|postgresql|mongodb|redis|mongodb\+srv):\/\/[^:]+:[^@]+@[^/\s]+/gi,severity:"critical",description:"Database connection string with credentials detected"},{name:"Database Password",pattern:/(?:db[_-]?password|database[_-]?password|mysql[_-]?password|postgres[_-]?password)\s*[=:]\s*['"]?([^'"\s]{8,})['"]?/gi,severity:"critical",description:"Database password detected"},{name:"Stripe API Key",pattern:/(?:sk|pk)_(?:test|live)_[0-9a-zA-Z]{24,}/g,severity:"critical",description:"Stripe API key detected"},{name:"PayPal Client ID",pattern:/(?:paypal[_-]?client[_-]?id)\s*[=:]\s*['"]?([A-Za-z0-9_-]{80})['"]?/gi,severity:"high",description:"PayPal client ID detected"},{name:"Square Access Token",pattern:/sq0[a-z]{3}-[0-9A-Za-z_-]{22,}/g,severity:"critical",description:"Square access token detected"},{name:"Twilio API Key",pattern:/SK[a-f0-9]{32}/g,severity:"critical",description:"Twilio API key detected"},{name:"SendGrid API Key",pattern:/SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}/g,severity:"critical",description:"SendGrid API key detected"},{name:"Mailgun API Key",pattern:/key-[0-9a-zA-Z]{32}/g,severity:"critical",description:"Mailgun API key detected"},{name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"]([^'"]{8,})['"](?!\s*[,\]])/gi,severity:"high",description:"Hardcoded password detected"},{name:"Secret/Token Assignment",pattern:/(?:secret|token|auth[_-]?token|access[_-]?token)\s*[=:]\s*['"]([A-Za-z0-9_\-/+=]{16,})['"](?!\s*[,\]])/gi,severity:"high",description:"Hardcoded secret or token detected"},{name:"NPM Token",pattern:/(?:npm[_-]?token)\s*[=:]\s*['"]?([A-Za-z0-9_-]{36})['"]?/gi,severity:"critical",description:"NPM token detected"},{name:"SSH Private Key Path Exposed",pattern:/~\/\.ssh\/id_[a-z]+|\/home\/[^/]+\/\.ssh\/id_[a-z]+/g,severity:"medium",description:"SSH private key path exposed"},{name:"Env Variable with Secret",pattern:/(?:process\.env\.)((?=[A-Z_]*(?:SECRET|KEY|TOKEN|PASSWORD|CREDENTIAL|AUTH))[A-Z_]+)\s*(?:===?\s*['"]([^'"]+)['"])?/g,severity:"medium",description:"Environment variable containing secret may be exposed"}],vT=[".js",".jsx",".ts",".tsx",".mjs",".cjs",".vue",".svelte",".html",".htm",".css",".scss",".less",".json",".yaml",".yml",".toml",".xml",".env",".config",".conf"],fT=["node_modules",".git",".svn",".hg","dist","build","coverage",".nyc_output","__pycache__",".pytest_cache","vendor",".idea",".vscode",".turbo",".next",".nuxt","pantry",".pantry","tests","test","__tests__","spec","__mocks__",".github",".gitlab",".circleci"],gT=["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lockb","bun.lock","*.min.js","*.min.css","*.map","*.d.ts","*.test.ts","*.test.js","*.spec.ts","*.spec.js",".env",".env.*"];class mQ{patterns;excludeDirs;excludeFiles;maxFileSize;constructor($){this.patterns=[...yT,...$?.customPatterns||[]],this.excludeDirs=[...fT,...$?.excludeDirs||[]],this.excludeFiles=[...gT,...$?.excludeFiles||[]],this.maxFileSize=$?.maxFileSize||1048576}async scan($){let J=Date.now(),Y=[],Z=0,{directory:Q,exclude:G=[],include:W,skipPatterns:z=[]}=$,U=$.failOnSeverity||"critical";if(!ST(Q))throw Error(`Directory not found: ${Q}`);let H=this.getFilesToScan(Q,[...this.excludeDirs,...G],W);for(let O of H){let A=hT(Q,O);if(this.shouldExcludeFile(A))continue;try{if(IT(O).size>this.maxFileSize)continue;let M=xT(O,"utf-8"),j=this.scanContent(M,A,z);Y.push(...j),Z++}catch{continue}}let X={critical:Y.filter((O)=>O.pattern.severity==="critical").length,high:Y.filter((O)=>O.pattern.severity==="high").length,medium:Y.filter((O)=>O.pattern.severity==="medium").length,low:Y.filter((O)=>O.pattern.severity==="low").length},K=["low","medium","high","critical"],B=K.indexOf(U),V=!0;for(let O=B;O<K.length;O++)if(X[K[O]]>0){V=!1;break}return{passed:V,findings:Y,scannedFiles:Z,duration:Date.now()-J,summary:X}}scanContent($,J,Y){let Z=[],Q=$.split(`
|
|
8057
8057
|
`);for(let G of this.patterns){if(Y.includes(G.name))continue;G.pattern.lastIndex=0;let W;while((W=G.pattern.exec($))!==null){let z=$.substring(0,W.index),U=z.split(`
|
|
8058
8058
|
`).length,H=z.lastIndexOf(`
|
|
8059
|
-
`),X=W.index-H,K=Q[U-1]||"";if(this.isLikelyPlaceholder(W[0],K))continue;if(this.isLowEntropy(W[1]||W[0]))continue;Z.push({file:J,line:U,column:X,match:this.maskSecret(W[0]),pattern:G,context:this.maskSecret(K.trim())})}}return Z}isLikelyPlaceholder($,J){let Y=["example","placeholder","your_","YOUR_","xxx","XXX","***","test","TEST","dummy","DUMMY","fake","FAKE","sample","SAMPLE","<your","${","{{","process.env","import.meta.env","CHANGEME","TODO","FIXME"],Z=$.toLowerCase(),Q=J.toLowerCase();for(let W of Y)if(Z.includes(W.toLowerCase())||Q.includes(W.toLowerCase()))return!0;let G=J.trim();if(G.startsWith("//")||G.startsWith("#")||G.startsWith("*")||G.startsWith("/*")){if(Q.includes("example")||Q.includes("format:")||Q.includes("e.g."))return!0}return!1}isLowEntropy($){if($.length<8)return!1;if(new Set($).size<8)return!0;if(/(.)\1{3,}/.test($))return!0;return!1}maskSecret($){if($.length<=8)return"*".repeat($.length);let J=Math.min(4,Math.floor($.length*0.2));return $.substring(0,J)+"*".repeat($.length-J*2)+$.substring($.length-J)}getFilesToScan($,J,Y){let Z=[],Q=Y||vT,G=(W)=>{let z=CT(W,{withFileTypes:!0});for(let U of z){let H=kT(W,U.name);if(U.isDirectory()){if(!J.includes(U.name))G(H)}else if(U.isFile()){let X=bT(U.name).toLowerCase();if(Q.includes(X)||U.name.startsWith(".env")||U.name.endsWith(".config"))Z.push(H)}}};return G($),Z}shouldExcludeFile($){let J=$.split("/").pop()||"";for(let Y of this.excludeFiles)if(Y.startsWith("*")){let Z=Y.substring(1);if(J.endsWith(Z))return!0}else if(Y.endsWith("*")){let Z=Y.substring(0,Y.length-1);if(J.startsWith(Z))return!0}else if(J===Y)return!0;return!1}addPattern($){this.patterns.push($)}getPatterns(){return[...this.patterns]}}z2();F0();function uT($){if(!$)return[];if(Array.isArray($))return $.map(String);let J=$,Y=J.Items??J.Item;if(!Y)return[];if(Array.isArray(Y))return Y.map(String);if(typeof Y==="object"&&Y!==null){let Z=Y;if("Item"in Z){let Q=Z.Item;if(!Q)return[];return Array.isArray(Q)?Q.map(String):[String(Q)]}if("CNAME"in Z){let Q=Z.CNAME;if(!Q)return[];return Array.isArray(Q)?Q.map(String):[String(Q)]}return Object.values(Z).flatMap((Q)=>{if(Array.isArray(Q))return Q.map(String);return typeof Q==="string"?[Q]:[]})}return[String(Y)]}async function t7($){if($.length===0)return;let J=new E0,Y=await J.listDistributions(),Z=[...new Set($.map((Q)=>Q.toLowerCase()))];for(let Q of Z){let G=Y.find((z)=>{return uT(z.Aliases).some((H)=>H.toLowerCase()===Q)});if(!G?.Id){d(`No CloudFront distribution found for ${Q} — skipping dynamic HTTP method sync`);continue}if(await J.ensureDynamicHttpMethods(G.Id))f(`CloudFront ${G.Id} (${Q}): enabled POST/PUT/PATCH/DELETE on dynamic paths`);else F(`CloudFront ${G.Id} (${Q}): already allows dynamic HTTP methods`)}}await u2([f0(),I$(),fG()]);import{execSync as AD}from"node:child_process";async function _D($,J,Y,Z={},Q=process.cwd()){if(!$)return;if(Z.step?.(`Running ${Y} hook`),typeof $==="string"){AD($,{stdio:"inherit",cwd:Q});return}await $(J)}async function $6($,J,Y={},Z){try{return await _D($.hooks?.[J],$,J,Y,Z),!0}catch(Q){return Y.error?.(`${J} hook failed: ${Q?.message||Q}`),!1}}await G$();async function $w($){let J=WJ();if(J.emptyEnvKey||J.emptyEnvSecret)d("Empty AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY env var detected — likely a misconfigured .env file. Remove the empty lines or fill them in.");F(`AWS credentials: ${J.description}`);try{let Z=await new k9($).getCallerIdentity();if(Z.Arn)F(`AWS identity: ${Z.Arn}`)}catch(Y){d(`Could not verify AWS identity: ${Y.message}`)}}function Jw(){try{return $W("git rev-parse --short HEAD",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return Date.now().toString(36)}}async function oG($,J,Y){let{ensureManagementDashboard:
|
|
8059
|
+
`),X=W.index-H,K=Q[U-1]||"";if(this.isLikelyPlaceholder(W[0],K))continue;if(this.isLowEntropy(W[1]||W[0]))continue;Z.push({file:J,line:U,column:X,match:this.maskSecret(W[0]),pattern:G,context:this.maskSecret(K.trim())})}}return Z}isLikelyPlaceholder($,J){let Y=["example","placeholder","your_","YOUR_","xxx","XXX","***","test","TEST","dummy","DUMMY","fake","FAKE","sample","SAMPLE","<your","${","{{","process.env","import.meta.env","CHANGEME","TODO","FIXME"],Z=$.toLowerCase(),Q=J.toLowerCase();for(let W of Y)if(Z.includes(W.toLowerCase())||Q.includes(W.toLowerCase()))return!0;let G=J.trim();if(G.startsWith("//")||G.startsWith("#")||G.startsWith("*")||G.startsWith("/*")){if(Q.includes("example")||Q.includes("format:")||Q.includes("e.g."))return!0}return!1}isLowEntropy($){if($.length<8)return!1;if(new Set($).size<8)return!0;if(/(.)\1{3,}/.test($))return!0;return!1}maskSecret($){if($.length<=8)return"*".repeat($.length);let J=Math.min(4,Math.floor($.length*0.2));return $.substring(0,J)+"*".repeat($.length-J*2)+$.substring($.length-J)}getFilesToScan($,J,Y){let Z=[],Q=Y||vT,G=(W)=>{let z=CT(W,{withFileTypes:!0});for(let U of z){let H=kT(W,U.name);if(U.isDirectory()){if(!J.includes(U.name))G(H)}else if(U.isFile()){let X=bT(U.name).toLowerCase();if(Q.includes(X)||U.name.startsWith(".env")||U.name.endsWith(".config"))Z.push(H)}}};return G($),Z}shouldExcludeFile($){let J=$.split("/").pop()||"";for(let Y of this.excludeFiles)if(Y.startsWith("*")){let Z=Y.substring(1);if(J.endsWith(Z))return!0}else if(Y.endsWith("*")){let Z=Y.substring(0,Y.length-1);if(J.startsWith(Z))return!0}else if(J===Y)return!0;return!1}addPattern($){this.patterns.push($)}getPatterns(){return[...this.patterns]}}z2();F0();function uT($){if(!$)return[];if(Array.isArray($))return $.map(String);let J=$,Y=J.Items??J.Item;if(!Y)return[];if(Array.isArray(Y))return Y.map(String);if(typeof Y==="object"&&Y!==null){let Z=Y;if("Item"in Z){let Q=Z.Item;if(!Q)return[];return Array.isArray(Q)?Q.map(String):[String(Q)]}if("CNAME"in Z){let Q=Z.CNAME;if(!Q)return[];return Array.isArray(Q)?Q.map(String):[String(Q)]}return Object.values(Z).flatMap((Q)=>{if(Array.isArray(Q))return Q.map(String);return typeof Q==="string"?[Q]:[]})}return[String(Y)]}async function t7($){if($.length===0)return;let J=new E0,Y=await J.listDistributions(),Z=[...new Set($.map((Q)=>Q.toLowerCase()))];for(let Q of Z){let G=Y.find((z)=>{return uT(z.Aliases).some((H)=>H.toLowerCase()===Q)});if(!G?.Id){d(`No CloudFront distribution found for ${Q} — skipping dynamic HTTP method sync`);continue}if(await J.ensureDynamicHttpMethods(G.Id))f(`CloudFront ${G.Id} (${Q}): enabled POST/PUT/PATCH/DELETE on dynamic paths`);else F(`CloudFront ${G.Id} (${Q}): already allows dynamic HTTP methods`)}}await u2([f0(),I$(),fG()]);import{execSync as AD}from"node:child_process";async function _D($,J,Y,Z={},Q=process.cwd()){if(!$)return;if(Z.step?.(`Running ${Y} hook`),typeof $==="string"){AD($,{stdio:"inherit",cwd:Q});return}await $(J)}async function $6($,J,Y={},Z){try{return await _D($.hooks?.[J],$,J,Y,Z),!0}catch(Q){return Y.error?.(`${J} hook failed: ${Q?.message||Q}`),!1}}await G$();async function $w($){let J=WJ();if(J.emptyEnvKey||J.emptyEnvSecret)d("Empty AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY env var detected — likely a misconfigured .env file. Remove the empty lines or fill them in.");F(`AWS credentials: ${J.description}`);try{let Z=await new k9($).getCallerIdentity();if(Z.Arn)F(`AWS identity: ${Z.Arn}`)}catch(Y){d(`Could not verify AWS identity: ${Y.message}`)}}function Jw(){try{return $W("git rev-parse --short HEAD",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return Date.now().toString(36)}}async function oG($,J,Y,Z){let{ensureManagementDashboard:Q}=await e9().then(() => MF);Q($,{logger:{info:F,warn:d}});let G=$.sites||{},W=Object.entries(G);if(W.length===0)return d("infrastructure.compute is set but no sites are configured — nothing to deploy. Add sites to `cloud.config.ts`."),!0;if(Z&&!G[Z])return R(`Site '${Z}' was not found. Configured sites: ${W.map(([_])=>_).join(", ")}`),!1;let z=W.filter(([_,M])=>{if(!M)return!1;if(Z&&_!==Z)return!1;if(n0(M)==="bucket")return d(`Site '${_}' targets a bucket — skipping compute deploy (handled by the static-site path).`),!1;return!0});if(z.length===0)return!0;if(Z)F(`Deploying only '${Z}'. Other sites keep their current release; proxy routes are still regenerated in full.`);let U=$.project.slug,X=($.infrastructure?.compute||{}).runtime||"bun",K=o0({config:$}),B=Jw(),V=new Map,O={step:(_)=>e(_),error:(_)=>R(_)};if(!await $6($,"beforeDeploy",O))return!0;if(!await $6($,"beforeBuild",O))return!0;for(let[_,M]of z){let j=n0(M);if(D(`Preparing site: ${_}`),F(`Domain: ${M.domain||"(none)"}`),F(`Source: ${M.root}`),F(`Kind: ${j==="server-static"?"static (shipped to /var/www)":"app (systemd service)"}`),j==="server-app")F(`Start: ${M.start}`),F(`Port: ${M.port??"(unset)"}`);if(M.build){e(`Running build: ${M.build}`);try{$W(M.build,{stdio:"inherit",cwd:process.cwd()})}catch(E){return R(`Build failed for site '${_}': ${E.message}`),!0}}if(!u1(M.root))return R(`Build output not found at ${M.root} for site '${_}'`),!0;let q=eD(oD(),`${U}-${_}-${B}.tar.gz`);e(`Packaging ${M.root} → ${q}`);try{let E=(M.exclude||[]).map((T)=>`--exclude='${T}'`).join(" ");$W(`tar czf "${q}" -C "${M.root}" ${E} .`,{stdio:"inherit"})}catch(E){return R(`Failed to package '${_}': ${E.message}`),!0}V.set(_,q)}if(!await $6($,"afterBuild",O))return!0;let A=await N5({config:Z?{...$,sites:Object.fromEntries(z)}:$,rpxConfig:Z?$:void 0,environment:J,driver:K,sha:B,runtime:X,tarballForSite:(_)=>{let M=V.get(_);if(!M)throw Error(`Missing tarball for site '${_}'`);return M},logger:{info:(_)=>F(_),warn:(_)=>d(_),error:(_)=>R(_),step:(_)=>e(_),success:(_)=>f(_)}});if(A)await $6($,"afterDeploy",O);return A}async function k5($){let J=new mQ;e("Running pre-deployment security scan...");let Y=await J.scan({directory:$.sourceDir,failOnSeverity:$.failOnSeverity||"critical",skipPatterns:$.skipPatterns});return{passed:Y.passed,result:Y}}function h5($){let{summary:J,findings:Y,scannedFiles:Z,duration:Q}=$;if(F(`
|
|
8060
8060
|
Scanned ${Z} files in ${Q}ms`),J.critical>0)R(` Critical: ${J.critical}`);else F(` Critical: ${J.critical}`);if(J.high>0)d(` High: ${J.high}`);else F(` High: ${J.high}`);if(F(` Medium: ${J.medium}`),F(` Low: ${J.low}`),Y.length>0){F(`
|
|
8061
8061
|
Findings:`);let G=Y.filter((X)=>X.pattern.severity==="critical"),W=Y.filter((X)=>X.pattern.severity==="high"),z=Y.filter((X)=>X.pattern.severity==="medium"),U=Y.filter((X)=>X.pattern.severity==="low"),H=(X,K,B)=>{if(X.length>0){console.log(`
|
|
8062
8062
|
${p2(`[${K}]`,B)}`);for(let V of X.slice(0,10))F(` ${V.pattern.name}`),F(` File: ${V.file}:${V.line}`),F(` Match: ${V.match}`);if(X.length>10)F(` ... and ${X.length-10} more ${K.toLowerCase()} findings`)}};H(G,"CRITICAL","red"),H(W,"HIGH","yellow"),H(z,"MEDIUM","blue"),H(U,"LOW","gray")}}function JW($){$.command("deploy:security-scan","Run pre-deployment security scan").option("--source <path>","Source directory to scan",{default:"."}).option("--fail-on <severity>","Fail on severity level (critical, high, medium, low)",{default:"critical"}).option("--skip-patterns <patterns>","Comma-separated list of pattern names to skip").action(async(J)=>{D("Pre-Deployment Security Scan");try{let Y=J?.source||".",Z=J?.failOn||"critical",Q=J?.skipPatterns?.split(",").map((z)=>z.trim())||[];if(!u1(Y)){R(`Source directory not found: ${Y}`);return}F(`Source: ${Y}`),F(`Fail on: ${Z} or higher severity`);let{passed:G,result:W}=await k5({sourceDir:Y,failOnSeverity:Z,skipPatterns:Q});if(h5(W),G)f(`
|
|
8063
8063
|
✓ Security scan passed - no blocking issues found`);else R(`
|
|
8064
8064
|
✗ Security scan failed - blocking issues detected`),F(`
|
|
8065
|
-
Recommendations:`),F(" 1. Remove any hardcoded credentials from your code"),F(" 2. Use environment variables or AWS Secrets Manager"),F(" 3. Add sensitive files to .gitignore"),F(" 4. Use --skip-patterns to ignore false positives"),process.exit(1)}catch(Y){R(`Security scan failed: ${Y.message}`),process.exit(1)}}),$.command("deploy","Deploy infrastructure").option("--stack <name>","Stack name").option("--env <environment>","Environment to deploy to").option("--site <name>","Deploy specific site only").option("--skip-security-scan","Skip pre-deployment security scan").option("--skip-dns-verification","Skip DNS provider verification and record creation (use when DNS is already configured)").option("--security-fail-on <severity>","Security scan fail threshold (critical, high, medium, low)",{default:"critical"}).option("--yes","Skip confirmation prompts (non-interactive / CI)").action(async(J)=>{D("Deploying Infrastructure");let Y=J?.yes===!0||process.env.CI==="true",Z=J?.env||"staging",Q=null;Q=await Yw(Z);try{let G=await r(),{errors:W,warnings:z}=tQ(G);for(let c of z)d(c);if(W.length>0){R(`
|
|
8065
|
+
Recommendations:`),F(" 1. Remove any hardcoded credentials from your code"),F(" 2. Use environment variables or AWS Secrets Manager"),F(" 3. Add sensitive files to .gitignore"),F(" 4. Use --skip-patterns to ignore false positives"),process.exit(1)}catch(Y){R(`Security scan failed: ${Y.message}`),process.exit(1)}}),$.command("deploy","Deploy infrastructure").option("--stack <name>","Stack name").option("--env <environment>","Environment to deploy to").option("--site <name>","Deploy specific site only (routes are still regenerated in full)").option("--skip-security-scan","Skip pre-deployment security scan").option("--skip-dns-verification","Skip DNS provider verification and record creation (use when DNS is already configured)").option("--security-fail-on <severity>","Security scan fail threshold (critical, high, medium, low)",{default:"critical"}).option("--yes","Skip confirmation prompts (non-interactive / CI)").action(async(J)=>{D("Deploying Infrastructure");let Y=J?.yes===!0||process.env.CI==="true",Z=J?.env||"staging",Q=null;Q=await Yw(Z);try{let G=await r(),{errors:W,warnings:z}=tQ(G);for(let c of z)d(c);if(W.length>0){R(`
|
|
8066
8066
|
✗ Deployment configuration is invalid:`);for(let c of W)R(` • ${c}`);return}let U=G.project?.region||"us-east-1";if(await $w(U),!J?.skipSecurityScan){let c=process.cwd(),{passed:n,result:C}=await k5({sourceDir:c,failOnSeverity:J?.securityFailOn||"critical"});if(h5(C),!n){R(`
|
|
8067
8067
|
✗ Security scan failed - deployment blocked`),F(`
|
|
8068
8068
|
To proceed anyway, use --skip-security-scan flag`),F("To change sensitivity, use --security-fail-on <severity>");return}f(`✓ Security scan passed
|
|
8069
8069
|
`)}else d(`Security scan skipped (--skip-security-scan)
|
|
8070
|
-
`);if(O9(G)==="serverless"){e("Serverless project detected: deploying the Lambda application");let{deployServerlessApp:c}=await t0().then(() => f1);await c(G,Z,{}),f("Serverless deployment complete");return}let H=J?.stack||a0(G,Z),X=G.project.region||"us-east-1",K=G.infrastructure?.deployStack!==!1,B=G.sites&&Object.keys(G.sites).length>0,V=G.infrastructure?.dns?.provider;if(B&&V){if(await Qw(G,J?.site,V,X,J?.skipDnsVerification,Z,Y),!K){if(G.infrastructure?.compute){let c=Object.values(G.sites).map((n)=>n.domain).filter((n)=>!!n);if(c.length>0)e("Syncing CloudFront dynamic HTTP methods for app domains..."),await t7(c)}return}}if(!K){F("Infrastructure stack deployment disabled (infrastructure.deployStack: false)");return}let O=C2(G);if(F(`Cloud provider: ${O}`),F(`Stack: ${H}`),F(`Region: ${X}`),F(`Environment: ${Z}`),(O==="hetzner"||G.infrastructure?.compute?.mode==="server")&&G.infrastructure?.compute){e(`Provisioning ${O} compute infrastructure...`);let c=o0({config:G,provider:O});if(!c.provisionComputeInfrastructure){R(`${O} driver does not support compute provisioning`);return}let n=await c.provisionComputeInfrastructure({config:G,environment:Z});if(f(`${O} compute infrastructure ready`),n.appPublicIp)F(`App server: ${n.appPublicIp}`);if(n.appInstanceId)F(`Server ID: ${n.appInstanceId}`);if(!await oG(G,Z,X))R(`App deploy to ${O} compute reported a failure`);else f(`App deployed to ${O} compute`),await Zw(G,n.appPublicIp,V);return}e("Generating CloudFormation template...");let _=new Z8({config:G,environment:Z});_.generate();let M=_.toJSON(),j=JSON.parse(M);if(Object.keys(j.Resources||{}).length===0){F(`No infrastructure resources to deploy for environment '${Z}' — skipping stack ${H}.`);return}e("Validating template...");let E=q9(j),T=T9(M),w=R9(j),N=[...E.errors,...T.errors,...w.errors];if(N.length>0){R("Template validation failed:");for(let c of N)R(` - ${c.path}: ${c.message}`);return}let I=[...E.warnings,...T.warnings,...w.warnings];if(I.length>0)for(let c of I)d(` - ${c.path}: ${c.message}`);f("Template validated successfully");let x=Object.keys(j.Resources).length;F(`
|
|
8070
|
+
`);if(O9(G)==="serverless"){e("Serverless project detected: deploying the Lambda application");let{deployServerlessApp:c}=await t0().then(() => f1);await c(G,Z,{}),f("Serverless deployment complete");return}let H=J?.stack||a0(G,Z),X=G.project.region||"us-east-1",K=G.infrastructure?.deployStack!==!1,B=G.sites&&Object.keys(G.sites).length>0,V=G.infrastructure?.dns?.provider;if(B&&V){if(await Qw(G,J?.site,V,X,J?.skipDnsVerification,Z,Y),!K){if(G.infrastructure?.compute){let c=Object.values(G.sites).map((n)=>n.domain).filter((n)=>!!n);if(c.length>0)e("Syncing CloudFront dynamic HTTP methods for app domains..."),await t7(c)}return}}if(!K){F("Infrastructure stack deployment disabled (infrastructure.deployStack: false)");return}let O=C2(G);if(F(`Cloud provider: ${O}`),F(`Stack: ${H}`),F(`Region: ${X}`),F(`Environment: ${Z}`),(O==="hetzner"||G.infrastructure?.compute?.mode==="server")&&G.infrastructure?.compute){e(`Provisioning ${O} compute infrastructure...`);let c=o0({config:G,provider:O});if(!c.provisionComputeInfrastructure){R(`${O} driver does not support compute provisioning`);return}let n=await c.provisionComputeInfrastructure({config:G,environment:Z});if(f(`${O} compute infrastructure ready`),n.appPublicIp)F(`App server: ${n.appPublicIp}`);if(n.appInstanceId)F(`Server ID: ${n.appInstanceId}`);if(!await oG(G,Z,X,J?.site))R(`App deploy to ${O} compute reported a failure`);else f(`App deployed to ${O} compute`),await Zw(G,n.appPublicIp,V);return}e("Generating CloudFormation template...");let _=new Z8({config:G,environment:Z});_.generate();let M=_.toJSON(),j=JSON.parse(M);if(Object.keys(j.Resources||{}).length===0){F(`No infrastructure resources to deploy for environment '${Z}' — skipping stack ${H}.`);return}e("Validating template...");let E=q9(j),T=T9(M),w=R9(j),N=[...E.errors,...T.errors,...w.errors];if(N.length>0){R("Template validation failed:");for(let c of N)R(` - ${c.path}: ${c.message}`);return}let I=[...E.warnings,...T.warnings,...w.warnings];if(I.length>0)for(let c of I)d(` - ${c.path}: ${c.message}`);f("Template validated successfully");let x=Object.keys(j.Resources).length;F(`
|
|
8071
8071
|
Resources to deploy: ${x}`);let h={};for(let c of Object.values(j.Resources)){let n=c.Type;h[n]=(h[n]||0)+1}for(let[c,n]of Object.entries(h).sort((C,b)=>b[1]-C[1]).slice(0,5))F(` - ${c}: ${n}`);if(!(Y||await p(`
|
|
8072
8072
|
Deploy now?`,!0))){F("Deployment cancelled");return}let g=new A0(X);e("Checking stack status...");let k=!1;try{let c=await g.describeStacks({stackName:H});k=c.Stacks&&c.Stacks.length>0}catch(c){k=!1}if(k){F("Stack exists, updating...");let c=new P("Updating CloudFormation stack...");c.start();try{await g.updateStack({stackName:H,templateBody:M,capabilities:["CAPABILITY_IAM","CAPABILITY_NAMED_IAM"],tags:[{Key:"Project",Value:G.project.name},{Key:"Environment",Value:Z},{Key:"ManagedBy",Value:"ts-cloud"}]}),c.succeed("Update initiated"),e("Waiting for stack update to complete..."),await g.waitForStack(H,"stack-update-complete"),f("Stack updated successfully!")}catch(n){if(n.message.includes("No updates are to be performed"))c.succeed("No changes detected"),F("Stack is already up to date — continuing to app deploy");else throw n}}else{F("Creating new stack...");let c=new P("Creating CloudFormation stack...");c.start(),await g.createStack({stackName:H,templateBody:M,capabilities:["CAPABILITY_IAM","CAPABILITY_NAMED_IAM"],tags:[{Key:"Project",Value:G.project.name},{Key:"Environment",Value:Z},{Key:"ManagedBy",Value:"ts-cloud"}]}),c.succeed("Stack creation initiated"),e("Waiting for stack creation to complete..."),await g.waitForStack(H,"stack-create-complete"),f("Stack created successfully!")}let i=await g.getStackOutputs(H);if(l1(`Deployment Complete!
|
|
8073
8073
|
|
|
@@ -8078,8 +8078,8 @@ Resources: ${x}
|
|
|
8078
8078
|
|
|
8079
8079
|
View in console:
|
|
8080
8080
|
https://console.aws.amazon.com/cloudformation/home?region=${X}#/stacks/stackinfo?stackId=${encodeURIComponent(H)}`,"green"),Object.keys(i).length>0){F(`
|
|
8081
|
-
Stack Outputs:`);for(let[c,n]of Object.entries(i))F(` - ${c}: ${n}`)}if(G.infrastructure?.storage)for(let[c,n]of Object.entries(G.infrastructure.storage)){if(!n.website||!n.root)continue;let C=i[`${c}BucketName`]||i.FrontendBucketName,b=i[`${c}CloudFrontDistributionId`];if(!C){d(`Could not find bucket name for storage '${c}' — skipping file upload`);continue}if(!u1(n.root)){d(`Source directory not found: ${n.root} — skipping file upload for '${c}'`);continue}e(`Uploading files from ${n.root} to s3://${C}...`);let{uploadStaticFiles:u,invalidateCache:m}=await Promise.resolve().then(() => (h9(),n7)),s=await u({sourceDir:n.root,bucket:C,region:X,onProgress:(J0,Z0,B0)=>{if(J0%10===0||J0===Z0)F(` ${J0}/${Z0}: ${B0}`)}});if(s.errors.length>0)d(`Upload completed with errors: ${s.errors.join(", ")}`);else{let J0=s.skipped>0?`Uploaded ${s.uploaded} files (${s.skipped} unchanged)`:`Uploaded ${s.uploaded} files`;f(J0)}if(b&&s.uploaded>0){e("Invalidating CloudFront cache...");let{invalidationId:J0}=await m(b);f(`Cache invalidation created: ${J0}`)}}if(G.infrastructure?.compute)await oG(G,Z,X);if(G.infrastructure?.compute&&G.sites){let c=Object.values(G.sites).map((n)=>n.domain).filter((n)=>!!n);if(c.length>0)e("Syncing CloudFront dynamic HTTP methods for app domains..."),await t7(c)}}catch(G){if(R(`Deployment failed: ${G.message}`),G.stack)F(`
|
|
8082
|
-
Stack trace:`),console.error(G.stack)}finally{if(Q)await Q()}}),$.command("deploy:server","Deploy EC2 infrastructure").option("--env <environment>","Environment (production, staging, development)").action(async(J)=>{D("Deploying Server Infrastructure");try{let Y=await r(),Z=J?.env||"production",Q=Y.project.region||"us-east-1",G=J8(Y);if(G){R(G),process.exitCode=1;return}if(!Y.infrastructure?.compute){R("No `infrastructure.compute` configured — nothing to deploy as a server."),F("Add an EC2 compute block to cloud.config, or use `cloud deploy:serverless` for Lambda apps."),process.exitCode=1;return}if(F(`Region: ${Q}`),F(`Environment: ${Z}`),!await oG(Y,Z,Q)){process.exitCode=1;return}if(Y.sites){let z=Object.values(Y.sites).map((U)=>U.domain).filter((U)=>!!U);if(z.length>0)e("Syncing CloudFront dynamic HTTP methods for app domains..."),await t7(z)}f(`
|
|
8081
|
+
Stack Outputs:`);for(let[c,n]of Object.entries(i))F(` - ${c}: ${n}`)}if(G.infrastructure?.storage)for(let[c,n]of Object.entries(G.infrastructure.storage)){if(!n.website||!n.root)continue;let C=i[`${c}BucketName`]||i.FrontendBucketName,b=i[`${c}CloudFrontDistributionId`];if(!C){d(`Could not find bucket name for storage '${c}' — skipping file upload`);continue}if(!u1(n.root)){d(`Source directory not found: ${n.root} — skipping file upload for '${c}'`);continue}e(`Uploading files from ${n.root} to s3://${C}...`);let{uploadStaticFiles:u,invalidateCache:m}=await Promise.resolve().then(() => (h9(),n7)),s=await u({sourceDir:n.root,bucket:C,region:X,onProgress:(J0,Z0,B0)=>{if(J0%10===0||J0===Z0)F(` ${J0}/${Z0}: ${B0}`)}});if(s.errors.length>0)d(`Upload completed with errors: ${s.errors.join(", ")}`);else{let J0=s.skipped>0?`Uploaded ${s.uploaded} files (${s.skipped} unchanged)`:`Uploaded ${s.uploaded} files`;f(J0)}if(b&&s.uploaded>0){e("Invalidating CloudFront cache...");let{invalidationId:J0}=await m(b);f(`Cache invalidation created: ${J0}`)}}if(G.infrastructure?.compute)await oG(G,Z,X,J?.site);if(G.infrastructure?.compute&&G.sites){let c=Object.values(G.sites).map((n)=>n.domain).filter((n)=>!!n);if(c.length>0)e("Syncing CloudFront dynamic HTTP methods for app domains..."),await t7(c)}}catch(G){if(R(`Deployment failed: ${G.message}`),G.stack)F(`
|
|
8082
|
+
Stack trace:`),console.error(G.stack)}finally{if(Q)await Q()}}),$.command("deploy:server","Deploy EC2 infrastructure").option("--env <environment>","Environment (production, staging, development)").option("--site <name>","Deploy specific site only (routes are still regenerated in full)").action(async(J)=>{D("Deploying Server Infrastructure");try{let Y=await r(),Z=J?.env||"production",Q=Y.project.region||"us-east-1",G=J8(Y);if(G){R(G),process.exitCode=1;return}if(!Y.infrastructure?.compute){R("No `infrastructure.compute` configured — nothing to deploy as a server."),F("Add an EC2 compute block to cloud.config, or use `cloud deploy:serverless` for Lambda apps."),process.exitCode=1;return}if(F(`Region: ${Q}`),F(`Environment: ${Z}`),!await oG(Y,Z,Q,J?.site)){process.exitCode=1;return}if(Y.sites){let z=Object.values(Y.sites).map((U)=>U.domain).filter((U)=>!!U);if(z.length>0)e("Syncing CloudFront dynamic HTTP methods for app domains..."),await t7(z)}f(`
|
|
8083
8083
|
Server deployment complete!`)}catch(Y){R(`Deployment failed: ${Y.message}`),process.exitCode=1}}),$.command("deploy:serverless","Deploy a serverless application (http/queue/cli Lambda functions)").option("--env <environment>","Environment (production, staging, development)").option("--skip-build","Skip local build hooks").option("--skip-hooks","Skip remote deploy hooks (e.g. migrations)").option("--redeploy","Re-activate the last build without rebuilding").action(async(J)=>{try{let Y=await r(),Z=J?.env||"production",Q=J8(Y);if(Q){R(Q),process.exitCode=1;return}let{deployServerlessApp:G,redeployServerlessApp:W}=await t0().then(() => f1);if(J?.redeploy){await W(Y,Z);return}await G(Y,Z,{skipBuild:J?.skipBuild,skipDeployHooks:J?.skipHooks})}catch(Y){R(`Deployment failed: ${Y.message}`),process.exitCode=1}}),$.command("serverless:rollback","Roll back a serverless app to the previous build").option("--env <environment>","Environment (production, staging, development)").action(async(J)=>{try{let Y=await r(),Z=J?.env||"production",{rollbackServerlessApp:Q}=await t0().then(() => f1);await Q(Y,Z)}catch(Y){R(`Rollback failed: ${Y.message}`),process.exitCode=1}}),$.command("deploy:rollback [site]","Roll a compute site back to a previous release").option("--env <environment>","Environment (production, staging, development)").option("--to <release>","Release id to roll back to (default: the previous release)").action(async(J,Y)=>{D("Rolling Back Release");try{let Z=await r(),Q=Y?.env||"production",G=J||Object.keys(Z.sites||{})[0];if(!G){R("No site configured to roll back."),process.exitCode=1;return}let{rollbackComputeSite:W}=await S8().then(() => J6),z=await W({driver:o0({config:Z}),slug:Z.project.slug,environment:Q,logger:z0},{siteName:G,to:Y?.to});if(!z.success){R(`Rollback failed: ${z.error||"unknown error"}`),process.exitCode=1;return}for(let U of z.perInstance||[])F(` ${U.instanceId}: ${U.output?.trim()||U.status}`)}catch(Z){R(`Rollback failed: ${Z.message}`),process.exitCode=1}}),$.command("deploy:history [site]","Show a compute site's deployment history").option("--env <environment>","Environment (production, staging, development)").option("--limit <n>","Number of entries to show",{default:"20"}).action(async(J,Y)=>{D("Deployment History");try{let Z=await r(),Q=Y?.env||"production",G=J||Object.keys(Z.sites||{})[0];if(!G){R("No site configured."),process.exitCode=1;return}let{getComputeDeployHistory:W}=await S8().then(() => J6),z=await W({driver:o0({config:Z}),slug:Z.project.slug,environment:Q,logger:z0},{siteName:G,limit:Number.parseInt(Y?.limit||"20",10)||20});if(!z.success){R(`Could not read history: ${z.error||"unknown error"}`),process.exitCode=1;return}for(let U of z.perInstance||[])F(`
|
|
8084
8084
|
${U.instanceId}:`),F(U.output?.trimEnd()||"(no output)")}catch(Z){R(`History lookup failed: ${Z.message}`),process.exitCode=1}}),$.command("deploy:recipe <name> <script>","Run a reusable server recipe (a local bash file) across servers").option("--env <environment>","Environment (production, staging, development)").option("--user <user>","User to run the recipe as",{default:"root"}).action(async(J,Y,Z)=>{D(`Running Recipe: ${J}`);try{if(!u1(Y)){R(`Recipe script not found: ${Y}`),process.exitCode=1;return}let Q=await r(),G=Z?.env||"production",W=eG(Y,"utf8").split(`
|
|
8085
8085
|
`),{runComputeRecipe:z}=await S8().then(() => J6),U=await z({driver:o0({config:Q}),slug:Q.project.slug,environment:G,logger:z0},{name:J,script:W,user:Z?.user});for(let H of U.perInstance||[])F(`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildAndPushServerlessImage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-wc51as8q.js";
|
|
4
4
|
import"./chunk-hsk6fe6x.js";
|
|
5
|
-
import"./chunk-
|
|
5
|
+
import"./chunk-3rpt9j1f.js";
|
|
6
6
|
import"./chunk-arsh1g5h.js";
|
|
7
7
|
import"./chunk-v0bahtg2.js";
|
|
8
8
|
export {
|
|
@@ -21977,6 +21977,7 @@ function resolveManagementDashboardSites(config, environment, opts) {
|
|
|
21977
21977
|
preStart: ["bun install --production --no-save"],
|
|
21978
21978
|
start: `bun ${DASHBOARD_ENTRY} dashboard:serve --box --host 127.0.0.1 --port ${port}`,
|
|
21979
21979
|
port,
|
|
21980
|
+
zeroDowntime: false,
|
|
21980
21981
|
sharedPaths: [DASHBOARD_STATE_DIR],
|
|
21981
21982
|
healthCheck: { path: "/login" },
|
|
21982
21983
|
ssl: { provider: "letsencrypt" }
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
step,
|
|
7
7
|
success,
|
|
8
8
|
warn
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-wc51as8q.js";
|
|
10
10
|
import {
|
|
11
11
|
CloudWatchLogsClient,
|
|
12
12
|
CostExplorerClient,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
resolveSiteKind,
|
|
29
29
|
resolveUiSource,
|
|
30
30
|
siteInstallBase
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-rwqzjjm4.js";
|
|
32
32
|
import {
|
|
33
33
|
artifactKey,
|
|
34
34
|
composeServerlessAppTemplate,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
resolveServerlessArtifactBucketName,
|
|
43
43
|
resolveServerlessAssetBucketName,
|
|
44
44
|
resolveServerlessRuntime
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-3rpt9j1f.js";
|
|
46
46
|
import {
|
|
47
47
|
deployStaticSiteWithExternalDnsFull
|
|
48
48
|
} from "./chunk-d7p84vz5.js";
|
|
@@ -347,7 +347,7 @@ async function deployServerlessApp(config, environment, opts = {}) {
|
|
|
347
347
|
}
|
|
348
348
|
if (imageMode) {
|
|
349
349
|
step("Building + pushing container image");
|
|
350
|
-
const { buildAndPushServerlessImage } = await import("./chunk-
|
|
350
|
+
const { buildAndPushServerlessImage } = await import("./chunk-11q3tpyf.js");
|
|
351
351
|
const built = await buildAndPushServerlessImage({
|
|
352
352
|
app,
|
|
353
353
|
projectRoot,
|
package/dist/deploy/index.js
CHANGED
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
sanitizeCloudConfig,
|
|
13
13
|
setMaintenance,
|
|
14
14
|
startLocalDashboardServer
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-x6y786pg.js";
|
|
16
16
|
import {
|
|
17
17
|
buildAndPushServerlessImage
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-wc51as8q.js";
|
|
19
19
|
import"../chunk-b82pbxyp.js";
|
|
20
20
|
import"../chunk-hsk6fe6x.js";
|
|
21
21
|
import {
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
resolveUiSource,
|
|
31
31
|
siteInstallBase,
|
|
32
32
|
validateDeploymentConfig
|
|
33
|
-
} from "../chunk-
|
|
34
|
-
import"../chunk-
|
|
33
|
+
} from "../chunk-rwqzjjm4.js";
|
|
34
|
+
import"../chunk-3rpt9j1f.js";
|
|
35
35
|
import"../chunk-93hjhs78.js";
|
|
36
36
|
import {
|
|
37
37
|
deleteStaticSite,
|
package/dist/drivers/index.js
CHANGED
|
@@ -48,8 +48,8 @@ import {
|
|
|
48
48
|
waitForCloudInit,
|
|
49
49
|
waitForSsh,
|
|
50
50
|
wrapCloudInitUserData
|
|
51
|
-
} from "../chunk-
|
|
52
|
-
import"../chunk-
|
|
51
|
+
} from "../chunk-rwqzjjm4.js";
|
|
52
|
+
import"../chunk-3rpt9j1f.js";
|
|
53
53
|
import"../chunk-93hjhs78.js";
|
|
54
54
|
import"../chunk-qpj3edwz.js";
|
|
55
55
|
import"../chunk-vd87cpvn.js";
|
package/dist/index.js
CHANGED
|
@@ -55,10 +55,10 @@ import {
|
|
|
55
55
|
sanitizeCloudConfig,
|
|
56
56
|
setMaintenance,
|
|
57
57
|
startLocalDashboardServer
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-x6y786pg.js";
|
|
59
59
|
import {
|
|
60
60
|
buildAndPushServerlessImage
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-wc51as8q.js";
|
|
62
62
|
import {
|
|
63
63
|
CloudWatchLogsClient,
|
|
64
64
|
EFSClient,
|
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
waitForCloudInit,
|
|
106
106
|
waitForSsh,
|
|
107
107
|
wrapCloudInitUserData
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-rwqzjjm4.js";
|
|
109
109
|
import {
|
|
110
110
|
ABTestManager,
|
|
111
111
|
AI,
|
|
@@ -506,7 +506,7 @@ import {
|
|
|
506
506
|
withSecurity,
|
|
507
507
|
withTimeout,
|
|
508
508
|
xrayManager
|
|
509
|
-
} from "./chunk-
|
|
509
|
+
} from "./chunk-3rpt9j1f.js";
|
|
510
510
|
import {
|
|
511
511
|
EC2Client,
|
|
512
512
|
SSMClient
|