@stacksjs/ts-cloud 0.7.44 → 0.7.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aws/index.js +1 -1
- package/dist/bin/cli.js +2 -2
- package/dist/{chunk-v8d5kvf3.js → chunk-3bfv1z4v.js} +12 -2
- package/dist/{chunk-w5vzhhr3.js → chunk-73vcqg6z.js} +2 -2
- package/dist/{chunk-h4b7p6c8.js → chunk-jp2a8yad.js} +3 -3
- package/dist/{chunk-g4ev4092.js → chunk-qdsvsrbt.js} +1 -1
- package/dist/deploy/index.js +3 -3
- package/dist/dns/index.js +1 -1
- package/dist/dns/porkbun.d.ts +2 -1
- package/dist/index.js +3 -3
- 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/aws/index.js
CHANGED
package/dist/bin/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import{createRequire as HV}from"node:module";var zV=Object.defineProperty;var UV
|
|
|
8
8
|
${V0.bright}${V0.cyan}${$}${V0.reset}
|
|
9
9
|
`)}class P{frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];interval=null;currentFrame=0;message;constructor($){this.message=$}get text(){return this.message}set text($){if(this.message=$,LJ&&this.interval)console.log(` ${$}`)}start(){if(LJ){console.log(` ${this.message}`),this.interval=!0;return}this.interval=setInterval(()=>{process.stdout.write(`\r${V0.cyan}${this.frames[this.currentFrame]}${V0.reset} ${this.message}`),this.currentFrame=(this.currentFrame+1)%this.frames.length},80)}succeed($){this.stop(),f($||this.message)}fail($){this.stop(),R($||this.message)}warn($){this.stop(),J2($||this.message)}stop(){if(this.interval){if(!LJ)process.stdout.write("\r");if(typeof this.interval==="object")clearInterval(this.interval);this.interval=null}}}class b4{total;current=0;width=40;constructor($){this.total=$}update($){this.current=$,this.render()}increment(){this.current++,this.render()}render(){let $=Math.floor(this.current/this.total*100),J=Math.floor(this.current/this.total*this.width),Y=this.width-J,Z=`${"█".repeat(J)}${"░".repeat(Y)}`;if(process.stdout.write(`\r${V0.cyan}${Z}${V0.reset} ${$}% (${this.current}/${this.total})`),this.current>=this.total)process.stdout.write(`
|
|
10
10
|
`)}}async function w0($,J){let Z=(await import("node:readline")).createInterface({input:process.stdin,output:process.stdout});return new Promise((Q)=>{let G=J?`${V0.cyan}?${V0.reset} ${$} ${V0.gray}(${J})${V0.reset}: `:`${V0.cyan}?${V0.reset} ${$}: `;Z.question(G,(W)=>{Z.close(),Q(W||J||"")})})}async function l($,J=!1){let Y=await w0(`${$} (y/n)`,J?"y":"n");return Y.toLowerCase()==="y"||Y.toLowerCase()==="yes"}async function N6($,J){console.log(`${V0.cyan}?${V0.reset} ${$}`),J.forEach((Q,G)=>{console.log(` ${V0.gray}${G+1}.${V0.reset} ${Q}`)});let Y=await w0("Select","1"),Z=Number.parseInt(Y)-1;if(Z>=0&&Z<J.length)return J[Z];return J[0]}function o($,J){let Y=$.map((Q,G)=>{let W=Math.max(...J.map((z)=>(z[G]||"").length));return Math.max(Q.length,W)}),Z=$.map((Q,G)=>Q.padEnd(Y[G])).join(" ");console.log(n2(Z,"bright")),console.log(n2("─".repeat(Z.length),"gray")),J.forEach((Q)=>{let G=Q.map((W,z)=>(W||"").padEnd(Y[z])).join(" ");console.log(G)})}function P6($){if($===0)return"0 B";let J=1024,Y=["B","KB","MB","GB","TB"],Z=Math.floor(Math.log($)/Math.log(J));return`${Number.parseFloat(($/J**Z).toFixed(2))} ${Y[Z]}`}function RO($){if($<1000)return`${$}ms`;let J=Math.floor($/1000);if(J<60)return`${J}s`;let Y=Math.floor(J/60),Z=J%60;if(Y<60)return`${Y}m ${Z}s`;let Q=Math.floor(Y/60),G=Y%60;return`${Q}h ${G}m`}function r1($,J="cyan"){let Y=$.split(`
|
|
11
|
-
`),Z=Math.max(...Y.map((G)=>G.length)),Q="─".repeat(Z+2);console.log(n2(`┌${Q}┐`,J)),Y.forEach((G)=>{console.log(n2(`│ ${G.padEnd(Z)} │`,J))}),console.log(n2(`└${Q}┘`,J))}async function MJ(){return!0}async function EJ(){try{let{AWSClient:$}=await Promise.resolve().then(() => (G0(),r2));return await new $().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()}),!0}catch{return!1}}async function qJ(){try{let{AWSClient:$}=await Promise.resolve().then(() => (G0(),r2)),Y=await new $().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()});return Y.Account||Y.GetCallerIdentityResult?.Account||null}catch{return null}}async function TJ(){try{let{AWSClient:$}=await Promise.resolve().then(() => (G0(),r2)),Y=await new $().request({service:"ec2",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"DescribeRegions",Version:"2016-11-15"}).toString()}),Z=[];if(Y.regionInfo){let Q=Array.isArray(Y.regionInfo)?Y.regionInfo:[Y.regionInfo];Z.push(...Q.map((G)=>G.regionName))}return Z.length>0?Z:h4()}catch{return h4()}}function h4(){return["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-central-1","ap-southeast-1","ap-northeast-1"]}var V0,J2,LJ;var K0=Y0(()=>{V0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m"};J2=d;LJ=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI)});function UU($,J=""){return $===408||$===409||$===425||$===429||$>=500||/rate limit|temporar|timed? ?out|try again/i.test(J)}async function VY($,J){let Y=J?.headers.get("retry-after"),Z=Y===null||Y===void 0?void 0:Number(Y)*1000,Q=Number.isFinite(Z)?Math.max(0,Z):Math.min(1000*2**($-1),30000);await new Promise((G)=>setTimeout(G,Q))}class G8{name="porkbun";apiKey;secretKey;constructor($,J){this.apiKey=$,this.secretKey=J}async request($,J={}){let Y;for(let Z=1;Z<=8;Z+=1){let Q;try{Q=await fetch(`https://api.porkbun.com/api/json/v3${$}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apikey:this.apiKey,secretapikey:this.secretKey,...J})})}catch(W){if(Y=W,Z===8)throw W;await VY(Z);continue}if(!Q.ok){if(Y=Error(`Porkbun API error: ${Q.status} ${Q.statusText}`),!UU(Q.status)||Z===8)throw Y;await VY(Z,Q);continue}let G=await Q.json();if(G.status==="ERROR"){if(Y=Error(`Porkbun API error: ${G.message||"Unknown error"}`),!UU(0,G.message)||Z===8)throw Y;await VY(Z,Q);continue}return G}throw Y}getSubdomain($,J){let Y=$.replace(/\.$/,""),Z=J.replace(/\.$/,"");if(Y===Z)return"";if(Y.endsWith(`.${Z}`))return Y.slice(0,-(Z.length+1));return Y}getRootDomain($){let J=$.replace(/\.$/,"").split(".");if(J.length>=2)return J.slice(-2).join(".");return $}async createRecord($,J){try{let Y=this.getRootDomain($),Z=this.getSubdomain(J.name,Y),Q={type:J.type,content:J.content,ttl:String(J.ttl||600)};if(Z)Q.name=Z;if((J.type==="MX"||J.type==="SRV")&&J.priority!==void 0)Q.prio=String(J.priority);if(J.type==="SRV"&&J.weight!==void 0&&J.port!==void 0)Q.content=`${J.weight} ${J.port} ${J.content}`;return{success:!0,id:(await this.request(`/dns/create/${Y}`,Q)).id?.toString(),message:"Record created successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async upsertRecord($,J){try{let Y=this.getRootDomain($),Z=this.getSubdomain(J.name,Y),Q=await this.listRecords($,J.type);if(Q.success){let G=Q.records.find((W)=>{return this.getSubdomain(W.name,Y)===Z&&W.type===J.type});if(G?.id){let W={type:J.type,content:J.content,ttl:String(J.ttl||600)};if(Z)W.name=Z;if((J.type==="MX"||J.type==="SRV")&&J.priority!==void 0)W.prio=String(J.priority);if(J.type==="SRV"&&J.weight!==void 0&&J.port!==void 0)W.content=`${J.weight} ${J.port} ${J.content}`;return await this.request(`/dns/edit/${Y}/${G.id}`,W),{success:!0,id:G.id,message:"Record updated successfully"}}}return this.createRecord($,J)}catch(Y){return this.createRecord($,J)}}async deleteRecord($,J){try{let Y=this.getRootDomain($);if("id"in J&&J.id)return await this.request(`/dns/delete/${Y}/${J.id}`),{success:!0,message:"Record deleted successfully"};let Z=this.getSubdomain(J.name,Y),Q=await this.listRecords($);if(!Q.success)return{success:!1,message:"Failed to list records"};let G=Q.records.find((W)=>{return this.getSubdomain(W.name,Y)===Z&&W.type===J.type&&W.content===J.content});if(!G?.id)return{success:!1,message:"Record not found"};return await this.request(`/dns/delete/${Y}/${G.id}`),{success:!0,message:"Record deleted successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async listRecords($,J){try{let Y=this.getRootDomain($),Z=`/dns/retrieve/${Y}`;if(J)Z=`/dns/retrieveByNameType/${Y}/${J}`;return{success:!0,records:((await this.request(Z)).records||[]).map((W)=>({id:W.id,name:W.name||Y,type:W.type,content:W.content,ttl:Number.parseInt(W.ttl,10),priority:W.prio?Number.parseInt(W.prio,10):void 0}))}}catch(Y){return{success:!1,records:[],message:Y instanceof Error?Y.message:"Unknown error"}}}async canManageDomain($){try{let J=this.getRootDomain($);return await this.request(`/dns/retrieve/${J}`),!0}catch{return!1}}async listDomains(){try{return((await this.request("/domain/listAll")).domains||[]).map((J)=>J.domain)}catch{return[]}}async getNameServers($){try{let J=this.getRootDomain($);return(await this.request(`/dns/getNS/${J}`)).ns||[]}catch{return[]}}async updateNameServers($,J){try{let Y=this.getRootDomain($);return await this.request(`/dns/updateNS/${Y}`,{ns:J}),!0}catch{return!1}}}class W8{name="godaddy";apiKey;apiSecret;baseUrl;constructor($,J,Y="production"){this.apiKey=$,this.apiSecret=J,this.baseUrl=Y==="ote"?"https://api.ote-godaddy.com":"https://api.godaddy.com"}async request($,J,Y){let Z=`${this.baseUrl}${J}`,Q={Authorization:`sso-key ${this.apiKey}:${this.apiSecret}`,"Content-Type":"application/json",Accept:"application/json"},G={method:$,headers:Q};if(Y)G.body=JSON.stringify(Y);let W=await fetch(Z,G);if(W.status===204)return{};if(W.ok){let U=await W.text();if(U)return JSON.parse(U);return{}}let z=`GoDaddy API error: ${W.status} ${W.statusText}`;try{let U=await W.json();if(U.message)z=`GoDaddy API error: ${U.message}`;if(U.fields)z+=` - Fields: ${JSON.stringify(U.fields)}`}catch{}throw Error(z)}getSubdomain($,J){let Y=$.replace(/\.$/,""),Z=J.replace(/\.$/,"");if(Y===Z)return"@";if(Y.endsWith(`.${Z}`))return Y.slice(0,-(Z.length+1));return Y}getRootDomain($){let J=$.replace(/\.$/,"").split(".");if(J.length>=2)return J.slice(-2).join(".");return $}toGoDaddyRecord($,J){let Y=this.getRootDomain(J),Z=this.getSubdomain($.name,Y),Q={type:$.type,name:Z,data:$.content,ttl:$.ttl||600};if($.type==="MX"&&$.priority!==void 0)Q.priority=$.priority;return Q}fromGoDaddyRecord($,J){let Y=this.getRootDomain(J),Z=$.name;if(Z==="@")Z=Y;else if(!Z.endsWith(Y))Z=`${Z}.${Y}`;return{name:Z,type:$.type,content:$.data,ttl:$.ttl,priority:$.priority}}async createRecord($,J){try{let Y=this.getRootDomain($),Z=this.toGoDaddyRecord(J,$);return await this.request("PATCH",`/v1/domains/${Y}/records`,[Z]),{success:!0,message:"Record created successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async upsertRecord($,J){try{let Y=this.getRootDomain($),Z=this.toGoDaddyRecord(J,$);return await this.request("PUT",`/v1/domains/${Y}/records/${J.type}/${Z.name}`,[Z]),{success:!0,message:"Record upserted successfully"}}catch(Y){return this.createRecord($,J)}}async deleteRecord($,J){try{let Y=this.getRootDomain($),Z=this.getSubdomain(J.name,Y),Q=await this.request("GET",`/v1/domains/${Y}/records/${J.type}/${Z}`),G=Q.filter((W)=>W.data!==J.content);if(G.length===Q.length)return{success:!1,message:"Record not found"};if(G.length===0)try{await this.request("DELETE",`/v1/domains/${Y}/records/${J.type}/${Z}`)}catch{}else await this.request("PUT",`/v1/domains/${Y}/records/${J.type}/${Z}`,G);return{success:!0,message:"Record deleted successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async listRecords($,J){try{let Y=this.getRootDomain($),Z=`/v1/domains/${Y}/records`;if(J)Z=`/v1/domains/${Y}/records/${J}`;return{success:!0,records:(await this.request("GET",Z)).map((G)=>this.fromGoDaddyRecord(G,$))}}catch(Y){return{success:!1,records:[],message:Y instanceof Error?Y.message:"Unknown error"}}}async canManageDomain($){try{let J=this.getRootDomain($);return await this.request("GET",`/v1/domains/${J}`),!0}catch{return!1}}async listDomains(){try{return(await this.request("GET","/v1/domains")).map((J)=>J.domain)}catch{return[]}}async getDomainDetails($){try{let J=this.getRootDomain($),Y=await this.request("GET",`/v1/domains/${J}`);return{domain:Y.domain,status:Y.status,nameServers:Y.nameServers,expires:Y.expires}}catch{return null}}async updateNameServers($,J){try{let Y=this.getRootDomain($);return await this.request("PUT",`/v1/domains/${Y}/records/NS`,J.map((Z)=>({type:"NS",name:"@",data:Z,ttl:3600}))),!0}catch{return!1}}async checkDomainAvailability($){try{let J=await this.request("GET",`/v1/domains/available?domain=${encodeURIComponent($)}`);return{available:J.available,price:J.price,currency:J.currency}}catch{return{available:!1}}}}class B7{name="cloudflare";apiToken;zoneCache=new Map;constructor($){this.apiToken=$}async request($,J,Y){let Z=`https://api.cloudflare.com/client/v4${J}`,Q={Authorization:`Bearer ${this.apiToken}`,"Content-Type":"application/json"},G={method:$,headers:Q};if(Y)G.body=JSON.stringify(Y);let z=await(await fetch(Z,G)).json();if(!z.success){let U=z.errors.map((X)=>X.message).join(", ");throw Error(`Cloudflare API error: ${U}`)}return z}getRootDomain($){let J=$.replace(/\.$/,"").split(".");if(J.length>=2)return J.slice(-2).join(".");return $}async getZoneId($){let J=this.getRootDomain($),Y=this.zoneCache.get(J);if(Y)return Y;let Z=await this.request("GET",`/zones?name=${encodeURIComponent(J)}`);if(!Z.result||Z.result.length===0)throw Error(`Zone not found for domain: ${J}`);let Q=Z.result[0].id;return this.zoneCache.set(J,Q),Q}getFullRecordName($,J){let Y=this.getRootDomain(J),Z=$.replace(/\.$/,"");if(!Z||Z===Y||Z==="@")return Y;if(Z.endsWith(`.${Y}`))return Z;return`${Z}.${Y}`}toCloudflareRecord($,J){let Y={type:$.type,name:this.getFullRecordName($.name,J),content:$.content||$.value||"",ttl:$.ttl||1};if($.type==="MX"&&$.priority!==void 0)Y.priority=$.priority;if($.type==="SRV"){if($.priority!==void 0)Y.priority=$.priority}return Y}fromCloudflareRecord($){return{id:$.id,name:$.name,type:$.type,content:$.content,ttl:$.ttl,priority:$.priority}}async createRecord($,J){try{let Y=await this.getZoneId($),Z=this.toCloudflareRecord(J,$);return{success:!0,id:(await this.request("POST",`/zones/${Y}/dns_records`,Z)).result.id,message:"Record created successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async upsertRecord($,J){try{let Y=await this.getZoneId($),Z=this.getFullRecordName(J.name,$),Q=await this.request("GET",`/zones/${Y}/dns_records?type=${J.type}&name=${encodeURIComponent(Z)}`),G=this.toCloudflareRecord(J,$);if(Q.result&&Q.result.length>0){let z=Q.result[0].id;return{success:!0,id:(await this.request("PUT",`/zones/${Y}/dns_records/${z}`,G)).result.id,message:"Record updated successfully"}}return{success:!0,id:(await this.request("POST",`/zones/${Y}/dns_records`,G)).result.id,message:"Record created successfully"}}catch(Y){return this.createRecord($,J)}}async deleteRecord($,J){try{let Y=await this.getZoneId($),Z=this.getFullRecordName(J.name,$),Q=await this.request("GET",`/zones/${Y}/dns_records?type=${J.type}&name=${encodeURIComponent(Z)}`);if(!Q.result||Q.result.length===0)return{success:!1,message:"Record not found"};let G=Q.result.find((W)=>W.content===J.content);if(!G)return{success:!1,message:"Record with matching content not found"};return await this.request("DELETE",`/zones/${Y}/dns_records/${G.id}`),{success:!0,message:"Record deleted successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async listRecords($,J){try{let Z=`/zones/${await this.getZoneId($)}/dns_records?per_page=100`;if(J)Z+=`&type=${J}`;let Q=[],G=1,W=!0;while(W){let z=await this.request("GET",`${Z}&page=${G}`);if(Q.push(...z.result||[]),z.result_info)W=G<z.result_info.total_pages,G++;else W=!1}return{success:!0,records:Q.map((z)=>this.fromCloudflareRecord(z))}}catch(Y){return{success:!1,records:[],message:Y instanceof Error?Y.message:"Unknown error"}}}async canManageDomain($){try{return await this.getZoneId($),!0}catch{return!1}}async listDomains(){try{let $=[],J=1,Y=!0;while(Y){let Z=await this.request("GET",`/zones?per_page=50&page=${J}`);if($.push(...Z.result||[]),Z.result_info)Y=J<Z.result_info.total_pages,J++;else Y=!1}return $.map((Z)=>Z.name)}catch{return[]}}async getZoneDetails($){try{let J=await this.getZoneId($),Y=await this.request("GET",`/zones/${J}`);return{id:Y.result.id,name:Y.result.name,status:Y.result.status,nameServers:Y.result.name_servers,paused:Y.result.paused}}catch{return null}}async purgeCache($,J){try{let Y=await this.getZoneId($),Z={};if(J?.purgeEverything)Z.purge_everything=!0;else{if(J?.files)Z.files=J.files;if(J?.tags)Z.tags=J.tags;if(J?.hosts)Z.hosts=J.hosts}if(Object.keys(Z).length===0)Z.purge_everything=!0;return await this.request("POST",`/zones/${Y}/purge_cache`,Z),!0}catch{return!1}}async getRecordProxyStatus($,J){try{let Y=await this.getZoneId($),Z=this.getFullRecordName(J.name,$),Q=await this.request("GET",`/zones/${Y}/dns_records?type=${J.type}&name=${encodeURIComponent(Z)}`);if(Q.result&&Q.result.length>0)return Q.result.find((W)=>W.content===J.content)?.proxied??null;return null}catch{return null}}async setRecordProxyStatus($,J,Y){try{let Z=await this.getZoneId($),Q=this.getFullRecordName(J.name,$),G=await this.request("GET",`/zones/${Z}/dns_records?type=${J.type}&name=${encodeURIComponent(Q)}`);if(!G.result||G.result.length===0)return!1;let W=G.result.find((z)=>z.content===J.content);if(!W)return!1;return await this.request("PATCH",`/zones/${Z}/dns_records/${W.id}`,{proxied:Y}),!0}catch{return!1}}}var W1;var _$=Y0(()=>{G0();W1=class W1{client;region;constructor($="us-east-1"){this.region=$,this.client=new J0}async createHostedZone($){let J=$.CallerReference||`${Date.now()}-${Math.random().toString(36).slice(2)}`,Y=`<?xml version="1.0" encoding="UTF-8"?>
|
|
11
|
+
`),Z=Math.max(...Y.map((G)=>G.length)),Q="─".repeat(Z+2);console.log(n2(`┌${Q}┐`,J)),Y.forEach((G)=>{console.log(n2(`│ ${G.padEnd(Z)} │`,J))}),console.log(n2(`└${Q}┘`,J))}async function MJ(){return!0}async function EJ(){try{let{AWSClient:$}=await Promise.resolve().then(() => (G0(),r2));return await new $().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()}),!0}catch{return!1}}async function qJ(){try{let{AWSClient:$}=await Promise.resolve().then(() => (G0(),r2)),Y=await new $().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()});return Y.Account||Y.GetCallerIdentityResult?.Account||null}catch{return null}}async function TJ(){try{let{AWSClient:$}=await Promise.resolve().then(() => (G0(),r2)),Y=await new $().request({service:"ec2",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"DescribeRegions",Version:"2016-11-15"}).toString()}),Z=[];if(Y.regionInfo){let Q=Array.isArray(Y.regionInfo)?Y.regionInfo:[Y.regionInfo];Z.push(...Q.map((G)=>G.regionName))}return Z.length>0?Z:h4()}catch{return h4()}}function h4(){return["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-central-1","ap-southeast-1","ap-northeast-1"]}var V0,J2,LJ;var K0=Y0(()=>{V0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m"};J2=d;LJ=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI)});function UU($,J=""){return $===408||$===409||$===425||$===429||$>=500||/rate limit|temporar|timed? ?out|try again/i.test(J)}async function VY($,J){let Y=J?.headers.get("retry-after"),Z=Y===null||Y===void 0?void 0:Number(Y)*1000,Q=Number.isFinite(Z)?Math.max(0,Z):Math.min(1000*2**($-1),30000);await new Promise((G)=>setTimeout(G,Q))}class G8{name="porkbun";apiKey;secretKey;requestTimeoutMs;constructor($,J,Y=15000){this.apiKey=$,this.secretKey=J,this.requestTimeoutMs=Y}async request($,J={}){let Y;for(let Z=1;Z<=8;Z+=1){let Q,G=new AbortController,W=setTimeout(()=>{G.abort(Error(`Porkbun API request timed out after ${this.requestTimeoutMs}ms`))},this.requestTimeoutMs);try{Q=await fetch(`https://api.porkbun.com/api/json/v3${$}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apikey:this.apiKey,secretapikey:this.secretKey,...J}),signal:G.signal})}catch(U){if(Y=U,Z===8)throw U;await VY(Z);continue}finally{clearTimeout(W)}if(!Q.ok){if(Y=Error(`Porkbun API error: ${Q.status} ${Q.statusText}`),!UU(Q.status)||Z===8)throw Y;await VY(Z,Q);continue}let z=await Q.json();if(z.status==="ERROR"){if(Y=Error(`Porkbun API error: ${z.message||"Unknown error"}`),!UU(0,z.message)||Z===8)throw Y;await VY(Z,Q);continue}return z}throw Y}getSubdomain($,J){let Y=$.replace(/\.$/,""),Z=J.replace(/\.$/,"");if(Y===Z)return"";if(Y.endsWith(`.${Z}`))return Y.slice(0,-(Z.length+1));return Y}getRootDomain($){let J=$.replace(/\.$/,"").split(".");if(J.length>=2)return J.slice(-2).join(".");return $}async createRecord($,J){try{let Y=this.getRootDomain($),Z=this.getSubdomain(J.name,Y),Q={type:J.type,content:J.content,ttl:String(J.ttl||600)};if(Z)Q.name=Z;if((J.type==="MX"||J.type==="SRV")&&J.priority!==void 0)Q.prio=String(J.priority);if(J.type==="SRV"&&J.weight!==void 0&&J.port!==void 0)Q.content=`${J.weight} ${J.port} ${J.content}`;return{success:!0,id:(await this.request(`/dns/create/${Y}`,Q)).id?.toString(),message:"Record created successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async upsertRecord($,J){try{let Y=this.getRootDomain($),Z=this.getSubdomain(J.name,Y),Q=await this.listRecords($,J.type);if(Q.success){let G=Q.records.find((W)=>{return this.getSubdomain(W.name,Y)===Z&&W.type===J.type});if(G?.id){let W={type:J.type,content:J.content,ttl:String(J.ttl||600)};if(Z)W.name=Z;if((J.type==="MX"||J.type==="SRV")&&J.priority!==void 0)W.prio=String(J.priority);if(J.type==="SRV"&&J.weight!==void 0&&J.port!==void 0)W.content=`${J.weight} ${J.port} ${J.content}`;return await this.request(`/dns/edit/${Y}/${G.id}`,W),{success:!0,id:G.id,message:"Record updated successfully"}}}return this.createRecord($,J)}catch(Y){return this.createRecord($,J)}}async deleteRecord($,J){try{let Y=this.getRootDomain($);if("id"in J&&J.id)return await this.request(`/dns/delete/${Y}/${J.id}`),{success:!0,message:"Record deleted successfully"};let Z=this.getSubdomain(J.name,Y),Q=await this.listRecords($);if(!Q.success)return{success:!1,message:"Failed to list records"};let G=Q.records.find((W)=>{return this.getSubdomain(W.name,Y)===Z&&W.type===J.type&&W.content===J.content});if(!G?.id)return{success:!1,message:"Record not found"};return await this.request(`/dns/delete/${Y}/${G.id}`),{success:!0,message:"Record deleted successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async listRecords($,J){try{let Y=this.getRootDomain($),Z=`/dns/retrieve/${Y}`;if(J)Z=`/dns/retrieveByNameType/${Y}/${J}`;return{success:!0,records:((await this.request(Z)).records||[]).map((W)=>({id:W.id,name:W.name||Y,type:W.type,content:W.content,ttl:Number.parseInt(W.ttl,10),priority:W.prio?Number.parseInt(W.prio,10):void 0}))}}catch(Y){return{success:!1,records:[],message:Y instanceof Error?Y.message:"Unknown error"}}}async canManageDomain($){try{let J=this.getRootDomain($);return await this.request(`/dns/retrieve/${J}`),!0}catch{return!1}}async listDomains(){try{return((await this.request("/domain/listAll")).domains||[]).map((J)=>J.domain)}catch{return[]}}async getNameServers($){try{let J=this.getRootDomain($);return(await this.request(`/dns/getNS/${J}`)).ns||[]}catch{return[]}}async updateNameServers($,J){try{let Y=this.getRootDomain($);return await this.request(`/dns/updateNS/${Y}`,{ns:J}),!0}catch{return!1}}}class W8{name="godaddy";apiKey;apiSecret;baseUrl;constructor($,J,Y="production"){this.apiKey=$,this.apiSecret=J,this.baseUrl=Y==="ote"?"https://api.ote-godaddy.com":"https://api.godaddy.com"}async request($,J,Y){let Z=`${this.baseUrl}${J}`,Q={Authorization:`sso-key ${this.apiKey}:${this.apiSecret}`,"Content-Type":"application/json",Accept:"application/json"},G={method:$,headers:Q};if(Y)G.body=JSON.stringify(Y);let W=await fetch(Z,G);if(W.status===204)return{};if(W.ok){let U=await W.text();if(U)return JSON.parse(U);return{}}let z=`GoDaddy API error: ${W.status} ${W.statusText}`;try{let U=await W.json();if(U.message)z=`GoDaddy API error: ${U.message}`;if(U.fields)z+=` - Fields: ${JSON.stringify(U.fields)}`}catch{}throw Error(z)}getSubdomain($,J){let Y=$.replace(/\.$/,""),Z=J.replace(/\.$/,"");if(Y===Z)return"@";if(Y.endsWith(`.${Z}`))return Y.slice(0,-(Z.length+1));return Y}getRootDomain($){let J=$.replace(/\.$/,"").split(".");if(J.length>=2)return J.slice(-2).join(".");return $}toGoDaddyRecord($,J){let Y=this.getRootDomain(J),Z=this.getSubdomain($.name,Y),Q={type:$.type,name:Z,data:$.content,ttl:$.ttl||600};if($.type==="MX"&&$.priority!==void 0)Q.priority=$.priority;return Q}fromGoDaddyRecord($,J){let Y=this.getRootDomain(J),Z=$.name;if(Z==="@")Z=Y;else if(!Z.endsWith(Y))Z=`${Z}.${Y}`;return{name:Z,type:$.type,content:$.data,ttl:$.ttl,priority:$.priority}}async createRecord($,J){try{let Y=this.getRootDomain($),Z=this.toGoDaddyRecord(J,$);return await this.request("PATCH",`/v1/domains/${Y}/records`,[Z]),{success:!0,message:"Record created successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async upsertRecord($,J){try{let Y=this.getRootDomain($),Z=this.toGoDaddyRecord(J,$);return await this.request("PUT",`/v1/domains/${Y}/records/${J.type}/${Z.name}`,[Z]),{success:!0,message:"Record upserted successfully"}}catch(Y){return this.createRecord($,J)}}async deleteRecord($,J){try{let Y=this.getRootDomain($),Z=this.getSubdomain(J.name,Y),Q=await this.request("GET",`/v1/domains/${Y}/records/${J.type}/${Z}`),G=Q.filter((W)=>W.data!==J.content);if(G.length===Q.length)return{success:!1,message:"Record not found"};if(G.length===0)try{await this.request("DELETE",`/v1/domains/${Y}/records/${J.type}/${Z}`)}catch{}else await this.request("PUT",`/v1/domains/${Y}/records/${J.type}/${Z}`,G);return{success:!0,message:"Record deleted successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async listRecords($,J){try{let Y=this.getRootDomain($),Z=`/v1/domains/${Y}/records`;if(J)Z=`/v1/domains/${Y}/records/${J}`;return{success:!0,records:(await this.request("GET",Z)).map((G)=>this.fromGoDaddyRecord(G,$))}}catch(Y){return{success:!1,records:[],message:Y instanceof Error?Y.message:"Unknown error"}}}async canManageDomain($){try{let J=this.getRootDomain($);return await this.request("GET",`/v1/domains/${J}`),!0}catch{return!1}}async listDomains(){try{return(await this.request("GET","/v1/domains")).map((J)=>J.domain)}catch{return[]}}async getDomainDetails($){try{let J=this.getRootDomain($),Y=await this.request("GET",`/v1/domains/${J}`);return{domain:Y.domain,status:Y.status,nameServers:Y.nameServers,expires:Y.expires}}catch{return null}}async updateNameServers($,J){try{let Y=this.getRootDomain($);return await this.request("PUT",`/v1/domains/${Y}/records/NS`,J.map((Z)=>({type:"NS",name:"@",data:Z,ttl:3600}))),!0}catch{return!1}}async checkDomainAvailability($){try{let J=await this.request("GET",`/v1/domains/available?domain=${encodeURIComponent($)}`);return{available:J.available,price:J.price,currency:J.currency}}catch{return{available:!1}}}}class B7{name="cloudflare";apiToken;zoneCache=new Map;constructor($){this.apiToken=$}async request($,J,Y){let Z=`https://api.cloudflare.com/client/v4${J}`,Q={Authorization:`Bearer ${this.apiToken}`,"Content-Type":"application/json"},G={method:$,headers:Q};if(Y)G.body=JSON.stringify(Y);let z=await(await fetch(Z,G)).json();if(!z.success){let U=z.errors.map((X)=>X.message).join(", ");throw Error(`Cloudflare API error: ${U}`)}return z}getRootDomain($){let J=$.replace(/\.$/,"").split(".");if(J.length>=2)return J.slice(-2).join(".");return $}async getZoneId($){let J=this.getRootDomain($),Y=this.zoneCache.get(J);if(Y)return Y;let Z=await this.request("GET",`/zones?name=${encodeURIComponent(J)}`);if(!Z.result||Z.result.length===0)throw Error(`Zone not found for domain: ${J}`);let Q=Z.result[0].id;return this.zoneCache.set(J,Q),Q}getFullRecordName($,J){let Y=this.getRootDomain(J),Z=$.replace(/\.$/,"");if(!Z||Z===Y||Z==="@")return Y;if(Z.endsWith(`.${Y}`))return Z;return`${Z}.${Y}`}toCloudflareRecord($,J){let Y={type:$.type,name:this.getFullRecordName($.name,J),content:$.content||$.value||"",ttl:$.ttl||1};if($.type==="MX"&&$.priority!==void 0)Y.priority=$.priority;if($.type==="SRV"){if($.priority!==void 0)Y.priority=$.priority}return Y}fromCloudflareRecord($){return{id:$.id,name:$.name,type:$.type,content:$.content,ttl:$.ttl,priority:$.priority}}async createRecord($,J){try{let Y=await this.getZoneId($),Z=this.toCloudflareRecord(J,$);return{success:!0,id:(await this.request("POST",`/zones/${Y}/dns_records`,Z)).result.id,message:"Record created successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async upsertRecord($,J){try{let Y=await this.getZoneId($),Z=this.getFullRecordName(J.name,$),Q=await this.request("GET",`/zones/${Y}/dns_records?type=${J.type}&name=${encodeURIComponent(Z)}`),G=this.toCloudflareRecord(J,$);if(Q.result&&Q.result.length>0){let z=Q.result[0].id;return{success:!0,id:(await this.request("PUT",`/zones/${Y}/dns_records/${z}`,G)).result.id,message:"Record updated successfully"}}return{success:!0,id:(await this.request("POST",`/zones/${Y}/dns_records`,G)).result.id,message:"Record created successfully"}}catch(Y){return this.createRecord($,J)}}async deleteRecord($,J){try{let Y=await this.getZoneId($),Z=this.getFullRecordName(J.name,$),Q=await this.request("GET",`/zones/${Y}/dns_records?type=${J.type}&name=${encodeURIComponent(Z)}`);if(!Q.result||Q.result.length===0)return{success:!1,message:"Record not found"};let G=Q.result.find((W)=>W.content===J.content);if(!G)return{success:!1,message:"Record with matching content not found"};return await this.request("DELETE",`/zones/${Y}/dns_records/${G.id}`),{success:!0,message:"Record deleted successfully"}}catch(Y){return{success:!1,message:Y instanceof Error?Y.message:"Unknown error"}}}async listRecords($,J){try{let Z=`/zones/${await this.getZoneId($)}/dns_records?per_page=100`;if(J)Z+=`&type=${J}`;let Q=[],G=1,W=!0;while(W){let z=await this.request("GET",`${Z}&page=${G}`);if(Q.push(...z.result||[]),z.result_info)W=G<z.result_info.total_pages,G++;else W=!1}return{success:!0,records:Q.map((z)=>this.fromCloudflareRecord(z))}}catch(Y){return{success:!1,records:[],message:Y instanceof Error?Y.message:"Unknown error"}}}async canManageDomain($){try{return await this.getZoneId($),!0}catch{return!1}}async listDomains(){try{let $=[],J=1,Y=!0;while(Y){let Z=await this.request("GET",`/zones?per_page=50&page=${J}`);if($.push(...Z.result||[]),Z.result_info)Y=J<Z.result_info.total_pages,J++;else Y=!1}return $.map((Z)=>Z.name)}catch{return[]}}async getZoneDetails($){try{let J=await this.getZoneId($),Y=await this.request("GET",`/zones/${J}`);return{id:Y.result.id,name:Y.result.name,status:Y.result.status,nameServers:Y.result.name_servers,paused:Y.result.paused}}catch{return null}}async purgeCache($,J){try{let Y=await this.getZoneId($),Z={};if(J?.purgeEverything)Z.purge_everything=!0;else{if(J?.files)Z.files=J.files;if(J?.tags)Z.tags=J.tags;if(J?.hosts)Z.hosts=J.hosts}if(Object.keys(Z).length===0)Z.purge_everything=!0;return await this.request("POST",`/zones/${Y}/purge_cache`,Z),!0}catch{return!1}}async getRecordProxyStatus($,J){try{let Y=await this.getZoneId($),Z=this.getFullRecordName(J.name,$),Q=await this.request("GET",`/zones/${Y}/dns_records?type=${J.type}&name=${encodeURIComponent(Z)}`);if(Q.result&&Q.result.length>0)return Q.result.find((W)=>W.content===J.content)?.proxied??null;return null}catch{return null}}async setRecordProxyStatus($,J,Y){try{let Z=await this.getZoneId($),Q=this.getFullRecordName(J.name,$),G=await this.request("GET",`/zones/${Z}/dns_records?type=${J.type}&name=${encodeURIComponent(Q)}`);if(!G.result||G.result.length===0)return!1;let W=G.result.find((z)=>z.content===J.content);if(!W)return!1;return await this.request("PATCH",`/zones/${Z}/dns_records/${W.id}`,{proxied:Y}),!0}catch{return!1}}}var W1;var _$=Y0(()=>{G0();W1=class W1{client;region;constructor($="us-east-1"){this.region=$,this.client=new J0}async createHostedZone($){let J=$.CallerReference||`${Date.now()}-${Math.random().toString(36).slice(2)}`,Y=`<?xml version="1.0" encoding="UTF-8"?>
|
|
12
12
|
<CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
|
13
13
|
<Name>${$.Name}</Name>
|
|
14
14
|
<CallerReference>${J}</CallerReference>`;if($.HostedZoneConfig){if(Y+=`
|
|
@@ -7605,7 +7605,7 @@ Run \`${this.name??"cli"} --help\` for usage.`;m2.stderr.write(`${G}${Q}${W}
|
|
|
7605
7605
|
`).length-1;this.output.write(R2.move(-999,$*-1))}render(){let $=_4(this._render(this)??"",j4.stdout.columns,{hard:!0,trim:!1});if($===this._prevFrame)return;if(this.state==="initial")this.output.write(R2.hide);else{let J=JO(this._prevFrame,$);if(this.restoreCursor(),J&&J?.length===1){let Y=J[0];this.output.write(R2.move(0,Y)),this.output.write(zJ.lines(1));let Z=$.split(`
|
|
7606
7606
|
`);this.output.write(Z[Y]),this._prevFrame=$,this.output.write(R2.move(0,Z.length-Y-1));return}if(J&&J?.length>1){let Y=J[0];this.output.write(R2.move(0,Y)),this.output.write(zJ.down());let Q=$.split(`
|
|
7607
7607
|
`).slice(Y);this.output.write(Q.join(`
|
|
7608
|
-
`)),this._prevFrame=$;return}this.output.write(zJ.down())}if(this.output.write($),this.state==="initial")this.state="active";this._prevFrame=$}}function zO($,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 UO($,J){return(J.label??String(J.value)).toLowerCase().includes($.toLowerCase())}function XO($,J){if(!J)return;if($)return J;return J[0]}class HO extends BJ{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#$=0;#Y="";#Z;#J;get cursor(){return this.#$}get userInputWithCursor(){if(!this.userInput)return R6.inverse(R6.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`${$}${R6.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??UO;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=XO(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.#$=zO(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 FO extends BJ{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 KO=MV();var S0=($,J)=>KO?$:J,bP=S0("◆","*"),yP=S0("■","x"),vP=S0("▲","x"),fP=S0("◇","o"),gP=S0("┌","T"),BO=S0("│","|"),uP=S0("└","—"),dP=S0("●",">"),cP=S0("○"," "),mP=S0("◻","[•]"),lP=S0("◼","[+]"),pP=S0("◻","[ ]"),rP=S0("▪","•"),nP=S0("─","-"),iP=S0("╮","+"),aP=S0("├","+"),tP=S0("╯","+"),sP=S0("●","•"),oP=S0("◆","*"),eP=S0("▲","!"),$S=S0("■","x");var JS={light:S0("─","-"),heavy:S0("━","="),block:S0("█","#")};function VO(){return`${R6.gray(BO)} `}var YS=VO();var VJ="0.7.
|
|
7608
|
+
`)),this._prevFrame=$;return}this.output.write(zJ.down())}if(this.output.write($),this.state==="initial")this.state="active";this._prevFrame=$}}function zO($,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 UO($,J){return(J.label??String(J.value)).toLowerCase().includes($.toLowerCase())}function XO($,J){if(!J)return;if($)return J;return J[0]}class HO extends BJ{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#$=0;#Y="";#Z;#J;get cursor(){return this.#$}get userInputWithCursor(){if(!this.userInput)return R6.inverse(R6.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`${$}${R6.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??UO;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=XO(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.#$=zO(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 FO extends BJ{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 KO=MV();var S0=($,J)=>KO?$:J,bP=S0("◆","*"),yP=S0("■","x"),vP=S0("▲","x"),fP=S0("◇","o"),gP=S0("┌","T"),BO=S0("│","|"),uP=S0("└","—"),dP=S0("●",">"),cP=S0("○"," "),mP=S0("◻","[•]"),lP=S0("◼","[+]"),pP=S0("◻","[ ]"),rP=S0("▪","•"),nP=S0("─","-"),iP=S0("╮","+"),aP=S0("├","+"),tP=S0("╯","+"),sP=S0("●","•"),oP=S0("◆","*"),eP=S0("▲","!"),$S=S0("■","x");var JS={light:S0("─","-"),heavy:S0("━","="),block:S0("█","#")};function VO(){return`${R6.gray(BO)} `}var YS=VO();var VJ="0.7.45";K0();import{existsSync as RJ}from"node:fs";import{mkdir as DO,writeFile as y4}from"node:fs/promises";function DJ($){$.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(w("Initializing ts-cloud Project"),RJ("cloud.config.ts")){if(!await l("cloud.config.ts already exists. Overwrite?",!1)){F("Initialization cancelled");return}}let Y=J?.name||await w0("Project name","my-app"),Z=J?.mode||await N6("Select deployment mode",["serverless","server"]),Q=J?.region||await N6("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'
|
|
7609
7609
|
|
|
7610
7610
|
export default defineConfig({
|
|
7611
7611
|
project: {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
// src/dns/porkbun.ts
|
|
8
8
|
var PORKBUN_API_URL = "https://api.porkbun.com/api/json/v3";
|
|
9
9
|
var PORKBUN_MAX_ATTEMPTS = 8;
|
|
10
|
+
var PORKBUN_REQUEST_TIMEOUT_MS = 15000;
|
|
10
11
|
function isRetryablePorkbunResponse(status, message = "") {
|
|
11
12
|
return status === 408 || status === 409 || status === 425 || status === 429 || status >= 500 || /rate limit|temporar|timed? ?out|try again/i.test(message);
|
|
12
13
|
}
|
|
@@ -21,14 +22,20 @@ class PorkbunProvider {
|
|
|
21
22
|
name = "porkbun";
|
|
22
23
|
apiKey;
|
|
23
24
|
secretKey;
|
|
24
|
-
|
|
25
|
+
requestTimeoutMs;
|
|
26
|
+
constructor(apiKey, secretKey, requestTimeoutMs = PORKBUN_REQUEST_TIMEOUT_MS) {
|
|
25
27
|
this.apiKey = apiKey;
|
|
26
28
|
this.secretKey = secretKey;
|
|
29
|
+
this.requestTimeoutMs = requestTimeoutMs;
|
|
27
30
|
}
|
|
28
31
|
async request(endpoint, additionalBody = {}) {
|
|
29
32
|
let lastError;
|
|
30
33
|
for (let attempt = 1;attempt <= PORKBUN_MAX_ATTEMPTS; attempt += 1) {
|
|
31
34
|
let response;
|
|
35
|
+
const controller = new AbortController;
|
|
36
|
+
const timeout = setTimeout(() => {
|
|
37
|
+
controller.abort(new Error(`Porkbun API request timed out after ${this.requestTimeoutMs}ms`));
|
|
38
|
+
}, this.requestTimeoutMs);
|
|
32
39
|
try {
|
|
33
40
|
response = await fetch(`${PORKBUN_API_URL}${endpoint}`, {
|
|
34
41
|
method: "POST",
|
|
@@ -39,7 +46,8 @@ class PorkbunProvider {
|
|
|
39
46
|
apikey: this.apiKey,
|
|
40
47
|
secretapikey: this.secretKey,
|
|
41
48
|
...additionalBody
|
|
42
|
-
})
|
|
49
|
+
}),
|
|
50
|
+
signal: controller.signal
|
|
43
51
|
});
|
|
44
52
|
} catch (error) {
|
|
45
53
|
lastError = error;
|
|
@@ -47,6 +55,8 @@ class PorkbunProvider {
|
|
|
47
55
|
throw error;
|
|
48
56
|
await waitForPorkbunRetry(attempt);
|
|
49
57
|
continue;
|
|
58
|
+
} finally {
|
|
59
|
+
clearTimeout(timeout);
|
|
50
60
|
}
|
|
51
61
|
if (!response.ok) {
|
|
52
62
|
lastError = new Error(`Porkbun API error: ${response.status} ${response.statusText}`);
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
generateStaticSiteTemplate,
|
|
6
6
|
invalidateCache,
|
|
7
7
|
uploadStaticFiles
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-jp2a8yad.js";
|
|
9
9
|
import"./chunk-tjjgajbh.js";
|
|
10
|
-
import"./chunk-
|
|
10
|
+
import"./chunk-3bfv1z4v.js";
|
|
11
11
|
import"./chunk-tnztxpcb.js";
|
|
12
12
|
import"./chunk-qpj3edwz.js";
|
|
13
13
|
import"./chunk-vd87cpvn.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Route53Provider,
|
|
8
8
|
UnifiedDnsValidator,
|
|
9
9
|
createDnsProvider
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3bfv1z4v.js";
|
|
11
11
|
import {
|
|
12
12
|
Route53Client
|
|
13
13
|
} from "./chunk-tnztxpcb.js";
|
|
@@ -813,7 +813,7 @@ async function deployStaticSiteWithExternalDnsFull(config) {
|
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
815
|
onProgress?.("upload", "Uploading files to S3...");
|
|
816
|
-
const { uploadStaticFiles } = await import("./chunk-
|
|
816
|
+
const { uploadStaticFiles } = await import("./chunk-73vcqg6z.js");
|
|
817
817
|
const uploadResult = await uploadStaticFiles({
|
|
818
818
|
sourceDir,
|
|
819
819
|
bucket: infraResult.bucket,
|
|
@@ -833,7 +833,7 @@ async function deployStaticSiteWithExternalDnsFull(config) {
|
|
|
833
833
|
}
|
|
834
834
|
if (infraResult.distributionId && uploadResult.uploaded > 0) {
|
|
835
835
|
onProgress?.("invalidate", "Invalidating CloudFront cache...");
|
|
836
|
-
const { invalidateCache } = await import("./chunk-
|
|
836
|
+
const { invalidateCache } = await import("./chunk-73vcqg6z.js");
|
|
837
837
|
await invalidateCache(infraResult.distributionId);
|
|
838
838
|
}
|
|
839
839
|
onProgress?.("complete", "Deployment complete!");
|
package/dist/deploy/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
sanitizeCloudConfig,
|
|
15
15
|
setMaintenance,
|
|
16
16
|
startLocalDashboardServer
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-qdsvsrbt.js";
|
|
18
18
|
import {
|
|
19
19
|
buildAndPushServerlessImage
|
|
20
20
|
} from "../chunk-tskj9fay.js";
|
|
@@ -45,9 +45,9 @@ import {
|
|
|
45
45
|
generateStaticSiteTemplate,
|
|
46
46
|
invalidateCache,
|
|
47
47
|
uploadStaticFiles
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-jp2a8yad.js";
|
|
49
49
|
import"../chunk-tjjgajbh.js";
|
|
50
|
-
import"../chunk-
|
|
50
|
+
import"../chunk-3bfv1z4v.js";
|
|
51
51
|
import"../chunk-tnztxpcb.js";
|
|
52
52
|
import"../chunk-qpj3edwz.js";
|
|
53
53
|
import"../chunk-vd87cpvn.js";
|
package/dist/dns/index.js
CHANGED
package/dist/dns/porkbun.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare class PorkbunProvider implements DnsProvider {
|
|
|
7
7
|
readonly name = "porkbun";
|
|
8
8
|
private apiKey;
|
|
9
9
|
private secretKey;
|
|
10
|
-
|
|
10
|
+
private requestTimeoutMs;
|
|
11
|
+
constructor(apiKey: string, secretKey: string, requestTimeoutMs?: number);
|
|
11
12
|
/**
|
|
12
13
|
* Make an authenticated API request to Porkbun
|
|
13
14
|
*/
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
sanitizeCloudConfig,
|
|
58
58
|
setMaintenance,
|
|
59
59
|
startLocalDashboardServer
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-qdsvsrbt.js";
|
|
61
61
|
import {
|
|
62
62
|
buildAndPushServerlessImage
|
|
63
63
|
} from "./chunk-tskj9fay.js";
|
|
@@ -528,7 +528,7 @@ import {
|
|
|
528
528
|
generateStaticSiteTemplate,
|
|
529
529
|
invalidateCache,
|
|
530
530
|
uploadStaticFiles
|
|
531
|
-
} from "./chunk-
|
|
531
|
+
} from "./chunk-jp2a8yad.js";
|
|
532
532
|
import {
|
|
533
533
|
CloudFrontClient
|
|
534
534
|
} from "./chunk-tjjgajbh.js";
|
|
@@ -546,7 +546,7 @@ import {
|
|
|
546
546
|
createRoute53Validator,
|
|
547
547
|
detectDnsProvider,
|
|
548
548
|
dnsProviders
|
|
549
|
-
} from "./chunk-
|
|
549
|
+
} from "./chunk-3bfv1z4v.js";
|
|
550
550
|
import {
|
|
551
551
|
Route53Client
|
|
552
552
|
} from "./chunk-tnztxpcb.js";
|