@stacksjs/ts-cloud 0.16.44 → 0.16.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aws/index.js +1 -1
- package/dist/bin/{chunk-gn03w47w.js → chunk-01w4zbex.js} +1 -1
- package/dist/bin/{chunk-nmqjmx30.js → chunk-12x968en.js} +1 -1
- package/dist/bin/chunk-1xxmyx0r.js +1 -0
- package/dist/bin/{chunk-kdsgbvep.js → chunk-23m8kbwh.js} +1 -1
- package/dist/bin/{chunk-bj7ashn6.js → chunk-2gqhzn2r.js} +1 -1
- package/dist/bin/chunk-45qr2bd3.js +1 -0
- package/dist/bin/chunk-4nn00brw.js +1 -0
- package/dist/bin/chunk-5f1n5d80.js +1 -0
- package/dist/bin/{chunk-s64d5nw2.js → chunk-5mm6qn6m.js} +1 -1
- package/dist/bin/chunk-5xr76cms.js +1 -0
- package/dist/bin/{chunk-q40k9jvk.js → chunk-65yvjecx.js} +2 -2
- package/dist/bin/{chunk-5amvqed8.js → chunk-6y6g726g.js} +3 -3
- package/dist/bin/{chunk-f64jvh96.js → chunk-7qbxq0be.js} +2 -2
- package/dist/bin/{chunk-8z4wgqkh.js → chunk-cz2wq0tf.js} +1 -1
- package/dist/bin/chunk-d0tmmzy5.js +1 -0
- package/dist/bin/{chunk-7p2va3nj.js → chunk-de69nra4.js} +1 -1
- package/dist/bin/{chunk-tf8qxy9k.js → chunk-dj03v81n.js} +20 -20
- package/dist/bin/chunk-dn1yybdy.js +1 -0
- package/dist/bin/chunk-fqghdpvr.js +1 -0
- package/dist/bin/{chunk-35x7z78g.js → chunk-frzpqsbj.js} +1 -1
- package/dist/bin/chunk-gkdr09xx.js +1 -0
- package/dist/bin/{chunk-xxe9ga9r.js → chunk-gyvkravq.js} +3 -3
- package/dist/bin/{chunk-jaexpxs8.js → chunk-her9ny96.js} +1 -1
- package/dist/bin/{chunk-3hkppc7h.js → chunk-kqxk1pds.js} +1 -1
- package/dist/bin/{chunk-hfnpjy9y.js → chunk-n2c6y0k1.js} +1 -1
- package/dist/bin/{chunk-3v2pd05g.js → chunk-nhqz2j90.js} +1 -1
- package/dist/bin/{chunk-erf79tm2.js → chunk-nmr484r7.js} +21 -21
- package/dist/bin/chunk-pr1dg1km.js +1 -0
- package/dist/bin/{chunk-dkf2kcsc.js → chunk-psvqpztv.js} +3 -3
- package/dist/bin/{chunk-ce1qnjs2.js → chunk-pzj1ac7x.js} +1 -1
- package/dist/bin/{chunk-gngsb689.js → chunk-q4dywv80.js} +2 -2
- package/dist/bin/{chunk-pf9dbm3b.js → chunk-q8b77zgw.js} +1 -1
- package/dist/bin/{chunk-qj6tr7bw.js → chunk-qq1f07te.js} +3 -3
- package/dist/bin/chunk-r1kg6yxp.js +1 -0
- package/dist/bin/{chunk-mgwmt2et.js → chunk-rdkr74y2.js} +2 -2
- package/dist/bin/{chunk-jh1vmant.js → chunk-rgcrsd5m.js} +1 -1
- package/dist/bin/{chunk-t80pxn04.js → chunk-rxy9fa64.js} +6 -6
- package/dist/bin/chunk-t1mmfpn1.js +1 -0
- package/dist/bin/chunk-thph4z3k.js +1 -0
- package/dist/bin/chunk-txykq6f1.js +1 -0
- package/dist/bin/{chunk-2r9tj1ac.js → chunk-v09tfezh.js} +5 -5
- package/dist/bin/{chunk-dryvqne2.js → chunk-v7t6f8aw.js} +2 -2
- package/dist/bin/{chunk-knzje4ka.js → chunk-vjg2fymw.js} +1 -1
- package/dist/bin/chunk-vt3hjh9q.js +1 -0
- package/dist/bin/{chunk-sg8hcdev.js → chunk-w29z877b.js} +1 -1
- package/dist/bin/{chunk-7593hjcq.js → chunk-xdk0gmxt.js} +1 -1
- package/dist/bin/{chunk-fkzp9sg5.js → chunk-xe527q1k.js} +1 -1
- package/dist/bin/{chunk-9eqpnanr.js → chunk-xx9mrcfs.js} +1 -1
- package/dist/bin/{chunk-vjfwnj9z.js → chunk-ym9h629y.js} +4 -4
- package/dist/bin/{chunk-cqc4e8md.js → chunk-yp3a0j9n.js} +1 -1
- package/dist/bin/{chunk-kzpzkdpd.js → chunk-z8k9mcn5.js} +1 -1
- package/dist/bin/chunk-z8scg2vy.js +1 -0
- package/dist/bin/{chunk-pnj95hwr.js → chunk-znd507q9.js} +1 -1
- package/dist/bin/cli.js +98 -98
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/{chunk-8jsf214f.js → chunk-1dbe68z7.js} +5 -5
- package/dist/{chunk-cgcthvq9.js → chunk-2sc0s7pc.js} +5 -5
- package/dist/{chunk-a102vqez.js → chunk-46bazfbh.js} +54 -54
- package/dist/chunk-4t0vj9a4.js +1 -0
- package/dist/{chunk-d02jxsxv.js → chunk-6ea5d30w.js} +1 -1
- package/dist/{chunk-0evxayn1.js → chunk-6rcj3km0.js} +2 -2
- package/dist/{chunk-e4pxs9g6.js → chunk-79snvzcx.js} +2 -2
- package/dist/{chunk-x2pxtfk0.js → chunk-astzz50p.js} +3 -3
- package/dist/chunk-bvzmbksp.js +1 -0
- package/dist/{chunk-ct72f70x.js → chunk-fh7apa5n.js} +1 -1
- package/dist/{chunk-txwnpxzf.js → chunk-j2jex596.js} +24 -24
- package/dist/{chunk-c5jyzyqw.js → chunk-j73ntebp.js} +74 -74
- package/dist/{chunk-bwtxb2hf.js → chunk-jpdpr7k6.js} +1 -1
- package/dist/{chunk-v3w791ze.js → chunk-jzpwfgg1.js} +12 -12
- package/dist/chunk-ksqhsz52.js +1 -0
- package/dist/{chunk-w78e5n94.js → chunk-nryh43p1.js} +3 -3
- package/dist/chunk-p588apka.js +1 -0
- package/dist/{chunk-3s8dtcz8.js → chunk-r86dh7h7.js} +1 -1
- package/dist/{chunk-7eaech9q.js → chunk-rpng90t9.js} +1 -1
- package/dist/chunk-s7q23exe.js +1 -0
- package/dist/{chunk-hm6pwhne.js → chunk-tj852ns1.js} +2 -2
- package/dist/{chunk-gp9tkznp.js → chunk-v1bzy3tp.js} +1 -1
- package/dist/{chunk-97gre81w.js → chunk-vb4t2r4r.js} +1 -1
- package/dist/{chunk-9e4afej1.js → chunk-vjph4eh0.js} +1 -1
- package/dist/{chunk-vkrgf3sv.js → chunk-wb7h8ag4.js} +19 -19
- package/dist/{chunk-j5x0qn7z.js → chunk-wmxw3pe4.js} +2 -2
- package/dist/chunk-x7d93rxb.js +1 -0
- package/dist/{chunk-fwcf0n8f.js → chunk-xxq1ygp9.js} +1 -1
- package/dist/{chunk-varjr6np.js → chunk-xzcpzxtj.js} +1 -1
- package/dist/{chunk-9mv07nz0.js → chunk-ynprwawa.js} +2 -2
- package/dist/{chunk-96vc5w8w.js → chunk-yxzdwe7j.js} +1 -1
- package/dist/{chunk-1w9v8g26.js → chunk-zwkm3pkb.js} +3 -3
- package/dist/deploy/index.js +1 -1
- package/dist/deploy/server-dns.d.ts +12 -1
- package/dist/dns/index.js +1 -1
- package/dist/drivers/factory.d.ts +3 -3
- package/dist/drivers/index.js +1 -1
- package/dist/fly/client.d.ts +153 -0
- package/dist/fly/deploy.d.ts +72 -0
- package/dist/fly/index.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +26 -26
- package/dist/operations/index.js +1 -1
- package/dist/protection/index.js +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/accept-invitation.html +1 -1
- package/dist/ui/access-denied.html +1 -1
- package/dist/ui/account/automation.html +5 -5
- package/dist/ui/account/security.html +2 -2
- package/dist/ui/applications/compose.html +6 -6
- package/dist/ui/applications/new.html +2 -2
- package/dist/ui/data/backups.html +6 -6
- package/dist/ui/data/services.html +6 -6
- package/dist/ui/data/volumes.html +5 -5
- package/dist/ui/index.html +6 -6
- package/dist/ui/infrastructure/topology.html +5 -5
- package/dist/ui/integrations.html +2 -2
- package/dist/ui/operations/alerts.html +6 -6
- package/dist/ui/operations/configuration.html +5 -5
- package/dist/ui/operations/jobs.html +6 -6
- package/dist/ui/operations/maintenance.html +5 -5
- package/dist/ui/operations/observability.html +5 -5
- package/dist/ui/operations/previews.html +6 -6
- package/dist/ui/operations/queue.html +6 -6
- package/dist/ui/operations/regions.html +5 -5
- package/dist/ui/operations/releases.html +6 -6
- package/dist/ui/operations/spend.html +6 -6
- package/dist/ui/operations/workloads.html +6 -6
- package/dist/ui/security.html +2 -2
- package/dist/ui/server/actions.html +5 -5
- package/dist/ui/server/activity.html +2 -2
- package/dist/ui/server/capacity.html +6 -6
- package/dist/ui/server/database.html +6 -6
- package/dist/ui/server/deployments.html +6 -6
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +6 -6
- package/dist/ui/server/fleet.html +6 -6
- package/dist/ui/server/logs.html +6 -6
- package/dist/ui/server/metrics.html +6 -6
- package/dist/ui/server/security.html +2 -2
- package/dist/ui/server/services.html +2 -2
- package/dist/ui/server/sites.html +6 -6
- package/dist/ui/server/ssh-keys.html +6 -6
- package/dist/ui/server/team.html +6 -6
- package/dist/ui/server/terminal.html +2 -2
- package/dist/ui/serverless/alarms.html +6 -6
- package/dist/ui/serverless/assets.html +2 -2
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +6 -6
- package/dist/ui/serverless/deployments.html +2 -2
- package/dist/ui/serverless/firewall.html +1 -1
- package/dist/ui/serverless/functions.html +5 -5
- package/dist/ui/serverless/logs.html +6 -6
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +6 -6
- package/dist/ui/serverless/secrets.html +6 -6
- package/dist/ui/serverless/traces.html +6 -6
- package/dist/ui/serverless.html +5 -5
- package/package.json +3 -3
- package/dist/bin/chunk-26rf5dy2.js +0 -1
- package/dist/bin/chunk-5khcwxhn.js +0 -1
- package/dist/bin/chunk-5nc1g18b.js +0 -1
- package/dist/bin/chunk-71ep1g7k.js +0 -1
- package/dist/bin/chunk-7fh7b8r1.js +0 -1
- package/dist/bin/chunk-7nsjehvx.js +0 -1
- package/dist/bin/chunk-bb08ms5q.js +0 -1
- package/dist/bin/chunk-g3a9a8bx.js +0 -1
- package/dist/bin/chunk-jv9qp13h.js +0 -1
- package/dist/bin/chunk-k9ate69x.js +0 -1
- package/dist/bin/chunk-mh3rgn0e.js +0 -1
- package/dist/bin/chunk-nfb3ew1v.js +0 -1
- package/dist/bin/chunk-qgqgdkg0.js +0 -1
- package/dist/bin/chunk-s77kny9g.js +0 -1
- package/dist/bin/chunk-vn05n5z6.js +0 -1
- package/dist/bin/chunk-yxpzm8ce.js +0 -1
- package/dist/chunk-2ns1w1fe.js +0 -1
- package/dist/chunk-c9zjh5bx.js +0 -1
- package/dist/chunk-e9z4gzmg.js +0 -1
- package/dist/chunk-g8zgpxgz.js +0 -1
- package/dist/chunk-mqwdq7w1.js +0 -1
- package/dist/chunk-qjghqymj.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{di}from"./chunk-rxy9fa64.js";import"./chunk-q8b77zgw.js";import"./chunk-gyvkravq.js";import"./chunk-xdk0gmxt.js";import"./chunk-yp3a0j9n.js";import"./chunk-12x968en.js";import"./chunk-psvqpztv.js";import"./chunk-dj03v81n.js";import"./chunk-4yym8xm4.js";export{di as resolveServerDashboardData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{W,Eo}from"./chunk-q4dywv80.js";import"./chunk-7qbxq0be.js";import"./chunk-psvqpztv.js";export{W as ACMClient,Eo as ACMDnsValidator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p}from"./chunk-
|
|
1
|
+
import{p}from"./chunk-psvqpztv.js";class lt{client;region;constructor(t="us-east-1",e){this.region=t,this.client=new p(void 0,{profile:e})}async getCallerIdentity(){let t=await this.client.request({service:"sts",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetCallerIdentity&Version=2011-06-15"});if(typeof t==="string"){let n=t.match(/<Account>(\d+)<\/Account>/),r=t.match(/<UserId>([^<]+)<\/UserId>/),i=t.match(/<Arn>([^<]+)<\/Arn>/);return{Account:n?.[1],UserId:r?.[1],Arn:i?.[1]}}let e=t?.GetCallerIdentityResponse?.GetCallerIdentityResult||t?.GetCallerIdentityResult;if(e)return{Account:String(e.Account),UserId:e.UserId,Arn:e.Arn};if(t?.Account)return{Account:String(t.Account),UserId:t.UserId,Arn:t.Arn};return{Account:void 0,UserId:void 0,Arn:void 0}}}
|
|
2
2
|
export{lt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Bp,jp,Vp,zp}from"./chunk-v7t6f8aw.js";import"./chunk-12x968en.js";import"./chunk-psvqpztv.js";import"./chunk-dj03v81n.js";import"./chunk-4yym8xm4.js";export{zp as deleteFailoverReplicaBuckets,Bp as ensureFailoverReplicaBuckets,jp as grantFailoverReplicaAccess,Vp as seedFailoverReplicas};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)}var Gd="dashboard";function jc(){return
|
|
1
|
+
import{Fe,A,Wt,Lr,Li}from"./chunk-dj03v81n.js";import{execSync as D}from"node:child_process";import{randomBytes as R}from"node:crypto";import{chmodSync as j,copyFileSync as x,existsSync as u,mkdirSync as w,readFileSync as U,statSync as N,writeFileSync as m}from"node:fs";import{tmpdir as E}from"node:os";import{basename as P,dirname as v,isAbsolute as O,join as a,resolve as B}from"node:path";import{fileURLToPath as C}from"node:url";function h(e){if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.keys(e).map((r)=>[r,""]))}function M(e){let r=JSON.parse(JSON.stringify(e??{}));if(r.hetzner)delete r.hetzner.apiToken;delete r.aws,delete r.stateDir;for(let t of Object.values(r.sites??{})){if(t?.env)t.env=h(t.env);if(t?.environment)t.environment=h(t.environment)}for(let t of Object.values(r.environments??{}))if(t?.variables)t.variables=h(t.variables);for(let t of Object.values(r.infrastructure?.databases??{}))if(t?.password)t.password="";if(r.infrastructure?.appDatabase?.password)r.infrastructure.appDatabase.password="";if(r.infrastructure?.compute?.database?.password)r.infrastructure.compute.database.password="";if(r.infrastructure?.compute?.managedServices?.vitess?.password)r.infrastructure.compute.managedServices.vitess.password="";return r}function y(e){let r=M(e);return["// Generated by ts-cloud for the management dashboard — do not edit.","//","// This is the project's resolved cloud config, inlined so it needs no","// imports on the box. Credentials are deliberately absent.",`export default ${JSON.stringify(r,null,2)}`,""].join(`
|
|
2
|
+
`)}var Gd="dashboard";function jc(){return Fe("dashboard-credentials.json")}function F(){return R(24).toString("base64url")}function Wd(e,r,t){let s=process.env.TS_CLOUD_UI_PASSWORD?.trim();if(s)return{password:s,source:"env"};if(b(process.env.TS_CLOUD_UI_PUBLIC))return{password:void 0,source:"public"};let n=jc(),i=A(e,"dashboard-credentials.json");try{if(u(i)){let o=JSON.parse(U(i,"utf8"));if(o?.password)return{password:o.password,source:"generated"}}}catch{}let d=F();try{w(v(i),{recursive:!0}),m(i,`${JSON.stringify({username:r,password:d,generatedAt:new Date().toISOString()},null,2)}
|
|
3
3
|
`),j(i,384),t.info(`Management dashboard: generated a password for '${r}' and saved it to ${n} (read it there — it is not printed). Set TS_CLOUD_UI_PASSWORD to pin your own, or TS_CLOUD_UI_PUBLIC=1 to serve without auth.`)}catch(o){t.warn(`Management dashboard: could not persist the generated password (${o?.message??o}). Using it for this deploy only — pass: ${d}
|
|
4
|
-
This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${n} is writable.`)}return{password:d,source:"generated"}}var I={info:()=>{},warn:()=>{}};function b(e){return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function J(){return
|
|
4
|
+
This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${n} is writable.`)}return{password:d,source:"generated"}}var I={info:()=>{},warn:()=>{}};function b(e){return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function J(){return Fe("dashboard-release")}function L(){let e=v(C(import.meta.url));for(let r of[a(e,"..","..","package.json"),a(e,"..","package.json")])try{let t=JSON.parse(U(r,"utf8"));if(t.name==="@stacksjs/ts-cloud"&&t.version)return`^${t.version}`}catch{}return"latest"}function z(){return process.env.TS_CLOUD_UI_VERSION?.trim()||L()}function V(e,r,t){if(!e?.project?.slug)return t.warn("Management dashboard: the cloud config has no project slug — skipping the live dashboard."),null;let s=A(r,"dashboard-release");try{w(s,{recursive:!0}),m(a(s,"cloud.config.ts"),y(e));let n=z();if(n.startsWith("file:")){let d=n.slice(5),o=O(d)?d:B(r,d);if(!u(o)||!N(o).isFile())n=L(),t.warn(`Management dashboard: TS_CLOUD_UI_VERSION points to a missing package file (${o}); using the deploying ts-cloud version ${n} instead.`);else{let c=P(o),l=a(s,c);if(o!==l)x(o,l);n=`file:./${c}`}}let i={name:"ts-cloud-dashboard",private:!0,type:"module",dependencies:{"@stacksjs/ts-cloud":n}};return m(a(s,"package.json"),`${JSON.stringify(i,null,2)}
|
|
5
5
|
`),J()}catch(n){return t.warn(`Management dashboard: could not stage the live release (${n?.message??n}) — skipping.`),null}}function wo(e){if(u(a(e,"packages","ui","pages"))||u(a(e,"packages","ui","package.json")))return{uiRoot:"packages/ui/dist",build:"cd packages/ui && bun install && bun run build"};let r=v(C(import.meta.url)),t=[a(r,"ui"),a(r,"..","ui"),a(r,"..","..","ui"),a(r,"..","dist","ui")];for(let s of t)if(u(a(s,"index.html"))||u(a(s,"serverless.html")))return{uiRoot:s,build:!1};return null}function Ao(e,r={}){let t=r.logger??I,s=r.cwd??process.cwd();if(b(process.env.TS_CLOUD_UI_DISABLE))return t.info("Management dashboard: skipped (TS_CLOUD_UI_DISABLE set)."),e;if(e.cloud?.attachTo)return t.info(`Management dashboard: ${e.project.slug} is attached to ${e.cloud.attachTo}; the server owner's dashboard monitors every attached project.`),e;if(Wt(e))return e;let n=e.environments&&Object.keys(e.environments)[0],i=process.env.TS_CLOUD_UI_DOMAIN?.trim()||void 0,d=Number(process.env.TS_CLOUD_UI_PORT)||void 0,o={...e.sites??{}};if(!b(process.env.TS_CLOUD_UI_STATIC)){let g=V(e,s,t);if(!g)return e;let p=Li(e,n??"production",{uiRoot:g,build:!1,domain:i,port:d,live:!0});if(p.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;for(let{name:k,site:_}of p)o[k]=_,t.info(`Management dashboard → https://${_.domain} (sign in with your ts-cloud account; the first deploy prints an admin password once)`);return e.sites=o,e}let c=wo(s);if(!c)return t.info("Management dashboard: UI not found (no local ui/ or packaged dist/ui) — skipping auto-deploy."),e;let l=process.env.TS_CLOUD_UI_USERNAME?.trim()||"admin",f=Wd(s,l,t),S=Li(e,n??"production",{uiRoot:c.uiRoot,build:c.build,domain:i,username:l,password:f.password,realm:process.env.TS_CLOUD_UI_REALM?.trim()||void 0,live:!1,port:d});if(S.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;let T=f.source==="public"?"NO AUTH — TS_CLOUD_UI_PUBLIC is set (dashboard is publicly reachable)":f.source==="env"?"htpasswd-protected (TS_CLOUD_UI_PASSWORD)":`htpasswd-protected (auto-generated — see ${jc()})`;t.warn("Management dashboard: static mode — one shared password, and no per-site collaborators. Unset TS_CLOUD_UI_STATIC for the live dashboard.");for(let{name:g,site:p}of S)o[g]=p,t.info(`Management dashboard → https://${p.domain} (${T})`);return e.sites=o,e}function Ro(e){return Object.keys(e.sites??{}).filter(Lr)}function xs(e,r){if(!e?.root)return null;let t=r.cwd??process.cwd(),s=r.logger??I;try{if(typeof e.build==="string"&&e.build.trim())s.info(`Management dashboard: building UI (${e.build})`),D(e.build,{cwd:t,stdio:"inherit"});let n=O(e.root)?e.root:a(t,e.root);if(!u(n))return s.warn(`Management dashboard: build output not found at ${n} — skipping dashboard artifact.`),null;let i=a(E(),`${r.slug}-${r.siteName??Gd}-${r.sha}.tar.gz`);return D(`tar czf "${i}" -C "${n}" .`,{stdio:"inherit"}),i}catch(n){return s.warn(`Management dashboard: failed to build artifact — ${n?.message??n}. Skipping dashboard deploy.`),null}}
|
|
6
6
|
export{Gd,jc,Wd,wo,Ao,Ro,xs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{J,U,Ri,Gs,Vt,Gc,Wc}from"./chunk-
|
|
1
|
+
import{J,U,Ri,Gs,Vt,Gc,Wc}from"./chunk-yp3a0j9n.js";function g(e){return`'${e.split("'").join("'\\''")}'`}function c(e){let r=e.user||"root",n=e.script.join(`
|
|
2
2
|
`),s=r==="root"?'bash -l "$TS_CLOUD_RECIPE"':`runuser -l ${g(r)} -c "bash $TS_CLOUD_RECIPE"`;return["set -uo pipefail",`echo "__TS_CLOUD_RECIPE_BEGIN__ ${e.name} (user=${r})"`,"TS_CLOUD_RECIPE=$(mktemp)",`cat > "$TS_CLOUD_RECIPE" <<'TS_CLOUD_RECIPE_EOF'`,n,"TS_CLOUD_RECIPE_EOF",'chmod +r "$TS_CLOUD_RECIPE"',s,"TS_CLOUD_RC=$?",'rm -f "$TS_CLOUD_RECIPE"',`echo "__TS_CLOUD_RECIPE_END__ ${e.name} exit=$TS_CLOUD_RC"`,"exit $TS_CLOUD_RC"]}var m={info:()=>{},warn:()=>{},error:()=>{},step:()=>{},success:()=>{}};async function l(e){return await e.driver.findComputeTargets({slug:e.slug,environment:e.environment,role:e.role||"app"})}async function js(e,r){let n=e.logger||m,s=await l(e);if(s.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};let t=J(e.slug,r.siteName),o=Vt(t,r.to||"unused"),a=r.onlyIfLive?f(o.current,r.siteName,r.onlyIfLive):[];if(r.dryRun){let i=await e.driver.runRemoteDeploy({targets:s,commands:["set -uo pipefail",...a,...Gc(o,r.to?{to:r.to}:{})],comment:`ts-cloud rollback plan ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});return{success:i.success,error:i.error,perInstance:i.perInstance}}let p=["set -uo pipefail",...a,...Wc(o,{...r.to?{to:r.to}:{},unitBase:`${e.slug}-${r.siteName}`}),`(cd ${U} && pantry restart php-fpm) 2>/dev/null || true`,`(cd ${o.current} && eval "$(cd ${U} && pantry env 2>/dev/null)" && php artisan queue:restart) 2>/dev/null || true`];n.step(`Rolling back ${r.siteName}${r.to?` to ${r.to}`:" to the previous release"} on ${s.length} server(s)...`);let u=await e.driver.runRemoteDeploy({targets:s,commands:p,comment:`ts-cloud rollback ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!u.success)n.error(`Rollback failed: ${u.error||"unknown error"}`);else n.success(`Rolled back ${r.siteName}.`);return{success:u.success,error:u.error,perInstance:u.perInstance}}function f(e,r,n){let s=n.replace(/[^0-9A-Za-z._-]/g,"");return[`TS_CLOUD_LIVE_ID=$(basename "$(readlink -f ${e} 2>/dev/null)" 2>/dev/null || true)`,`if [ -z "$TS_CLOUD_LIVE_ID" ] || [ "$TS_CLOUD_LIVE_ID" = "." ]; then echo "${r}: no live release here; left alone"; exit 0; fi`,`case "${s}" in "$TS_CLOUD_LIVE_ID"*) ;; *) echo "${r} serves $TS_CLOUD_LIVE_ID, not ${s}; left alone"; exit 0 ;; esac`]}async function um(e,r){let n=await l(e);if(n.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};let s=Gs(J(e.slug,r.siteName)),t=Math.max(1,r.limit??20),o=[`[ -f ${s} ] && tail -n ${t} ${s} || echo "no deploy history for ${r.siteName}"`],a=await e.driver.runRemoteDeploy({targets:n,commands:o,comment:`ts-cloud deploy:history ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});return{success:a.success,error:a.error,perInstance:a.perInstance}}async function pm(e,r){let n=e.logger||m,s=await l(e);if(s.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};n.step(`Running recipe '${r.name}' as ${r.user||"root"} on ${s.length} server(s)...`);let t=await e.driver.runRemoteDeploy({targets:s,commands:c({name:r.name,script:r.script,user:r.user}),comment:`ts-cloud recipe ${r.name}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!t.success)n.error(`Recipe '${r.name}' failed: ${t.error||"unknown error"}`);else n.success(`Recipe '${r.name}' completed.`);return{success:t.success,error:t.error,perInstance:t.perInstance}}async function Vs(e,r){let n=e.logger||m;if(!r.database?.name)return{success:!1,error:"No appDatabase configured to restore."};let s=await l(e);if(s.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};n.step(`Restoring database '${r.database.name}'${r.from?` from ${r.from}`:" from the latest backup"} on ${s.length} server(s)...`);let t=await e.driver.runRemoteDeploy({targets:s,commands:Ri(r.database,{from:r.from}),comment:`ts-cloud db:restore ${e.slug}/${r.database.name}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!t.success)n.error(`Restore failed: ${t.error||"unknown error"}`);else n.success(`Restored ${r.database.name}.`);return{success:t.success,error:t.error,perInstance:t.perInstance}}
|
|
3
3
|
export{js,um,pm,Vs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Gd,jc,Wd,wo,Ao,Ro,xs}from"./chunk-
|
|
1
|
+
import{Gd,jc,Wd,wo,Ao,Ro,xs}from"./chunk-gyvkravq.js";import"./chunk-dj03v81n.js";import"./chunk-4yym8xm4.js";export{Gd as MANAGEMENT_DASHBOARD_SITE,xs as buildManagementDashboardArtifact,jc as dashboardCredentialsFile,Ao as ensureManagementDashboard,Ro as managementDashboardSiteNames,Wd as resolveDashboardAuth,wo as resolveUiSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gm,fm,na,Qc,ia,oa,yn,Be,A,sa,Yc,H,$r,w,Yd,ki,aa,ca,F,Fo,Zd,eu,tu,ru,l,o,hm,ym,T,la,da,ua,bm,Sm,xe,pa,Ni,nu,vm,Cm,Fe,Et,ma,Zc,el,Tm,tl,rl,nl,jo,ga,tt,Vo,bn,xi,Sn,je,iu,zo,Ho,fa,ha,ya,ba,Sa,va,Ee,j,ou,su,il,b,L,rt,k,ol,wt,fe,Ht,Em,sl,we,qo,Ve,qt,_i,Ae,Go,_e,au,Oi,Re,Ie,ne,$i,X,Gt,At,Pe,t,vn,wm,al,Ca,Am,Rm,Im,Pm,Ta,Dm,km,Nm,xm,_m,Om,$m,Lm,Mm,Um,Bm,Fm,cu,lu,du,uu,pu,mu,gu,Wt,cl,ll,Lr,Li,jm,dl,Vm,zm,Cn,Hm,qm,Gm,Wm,Km,Jm,fu,hu,yu,bu,Su,Mi,Xm,Tn,vu,ul,Cu,Ea,he,Tu,Eu,Rt,Wo,Kt,wu,pl,Au,Ru,Iu,ml,ye,Qm,Ym,Zm,eg,Pu,tg,De,rg,ng,ig,wa,Aa,Du,gl,fl,og,sg,ag,cg,lg,ku,Ra,dg,ug,pg,mg,gg,Nu,xu,fg,hg,yg,bg,Sg,vg,Cg,_u,Tg,hl,Ia,Eg,wg,Ag,Rg,yl,bl,Sl,Ig,Pa,Ou,$u,Lu,Mu,Da,Uu,Pg,Dg,kg,Ng,xg,_g,Og,Bu,Fu,ju,Vu,vl,$g,Lg,Mg,Ug,Bg,Fg,jg,Vg,zg,zu,Hu,qu,Gu,Hg,qg,Cl,Gg,Tl,El,wl,Al,Wg,Kg,Jg,Xg,nt,Ui,Qg,Yg,Zg,ef,tf,rf,nf,of,Wu,sf,af,Rl,Il,cf,lf,Ku,df,uf,pf,mf,gf,ff,hf,yf,bf,Sf,vf,Cf,Tf,Ef,wf,Af,Rf,If,Pf,Df,kf,ka,Ju,Na,Xu,xa,Qu,_a,Yu,Oa,Zu,Mr,ep,$a,tp,Bi,rp,La,np,Ma,ip,Pl,Nf,Dl,xf,Ua,op,Ur,sp,kl,_f,Ba,ap,Nl,Of,xl,$f,_l,Lf,Fa,cp,Ol,Mf,$l,Uf,Ll,Bf,Ml,Ff,ja,lp,Va,dp,Ul,jf,Bl,Vf,Fl,zf,jl,Hf,Vl,qf,zl,Gf,za,up,Hl,Wf,ql,Kf,Gl,Jf,Wl,Xf,Kl,Qf,Jl,Yf,Xl,Ql,Yl,Zl,ed,Zf,td,eh,rd,th,nd,rh,It,id,pp,Ko,Ha,En,mp,Fi,Jt,qa,Ga,gp,fp,Wa,od,Ka,sd,nh,ih,Ja,Xa,Qa,ad,ji,cd,ld,Jo,Ya,Za,dd,hp,yp,bp,oh,ud,pd,sh,Sp,md,vp,Cp,Tp,ah,gd,wn,ec,fd,ch,Ep,Xo,Qo,tc,hd,lh,rc,wp,yd,dh,bd,uh,Sd,ph}from"./chunk-tf8qxy9k.js";import{nc,Y,ic,Yo,Ap,Pt,Rp,Ip,An,Pp,Dp,kp,Np,xp}from"./chunk-4yym8xm4.js";export{La as ABTestManager,Ve as AI,Au as AWSAPIError,xa as AWSConfigManager,wm as AWS_PSEUDO_PARAMETERS,nt as AWS_REGIONS,Go as ApiGateway,vn as Arn,ne as AssetHasher,Re as Auth,ka as BackupManager,rd as BatchProcessingManager,$a as BlueGreenManager,Gl as BounceComplaintHandler,Ml as BuildOptimizationManager,je as CDN,Xa as CHAIN_HEADER,ma as CLOUDFRONT_FAILOVER_STATUS_CODES,uf as COMMON_CROSS_ACCOUNT_ROLES,_i as Cache,Bi as CanaryManager,Ol as CertificateManager,Rt as CloudError,al as CloudFormationBuilder,Cu as CloudFormationClient,Eu as CloudFrontClient,_a as CloudTrailManager,Gu as CommandHistory,Pe as Communication,b as Compute,Wo as ConfigurationError,ja as ContainerRegistryManager,Kt as CredentialError,Tl as CrossRegionReferenceManager,lu as DASHBOARD_ENTRY,du as DASHBOARD_PORT_BASE,uu as DASHBOARD_PORT_SPAN,cu as DASHBOARD_STATE_DIR,Zc as DEFAULT_FAILOVER_STATUS_CODES,ji as DEFAULT_RECURSION_LIMITS,De as DEFAULT_SERVICE_LIMITS,na as DEFAULT_STATE_DIR,iu as DEFAULT_STORAGE_FAILOVER_STATUS_CODES,Ja as DEPTH_HEADER,td as DLQMonitoringManager,Ee as DNS,Hl as DNSSECManager,qt as Database,xl as DatabaseUserManager,ye as DebugLogger,nu as DependencyGraph,Ie as Deployment,wu as DeploymentError,Na as DisasterRecoveryManager,k as Email,Xl as EmailAdvanced,Wl as EmailAnalyticsManager,Ql as EmailHandlers,Jl as EmailTemplateManager,Ru as ErrorCodes,Ho as FAILOVER_REPLICA_POLICY_SID,ed as FIFOQueueManager,wa as FileCache,rt as FileSystem,t as Fn,El as GlobalResourceManager,Oa as GuardDutyManager,ku as HashCache,yd as HealthCheckManager,Ll as ImageScanningManager,Ht as JobLoader,fd as LARAVEL_SERVERLESS_BUILD_STEPS,Fl as LambdaConcurrencyManager,zl as LambdaDLQManager,jl as LambdaDestinationsManager,Ul as LambdaLayersManager,Vl as LambdaVPCManager,Bl as LambdaVersionsManager,Ua as LogsManager,mp as MANAGED_NODE_VERSIONS,cl as MANAGEMENT_DASHBOARD_SITE_PREFIX,_e as Messaging,Dl as MetricsManager,kl as MigrationManager,yl as MockCloudFormation,Sl as MockDynamoDB,bl as MockS3,Oi as Monitoring,Rl as MultiAccountManager,Cl as MultiRegionManager,Fu as MultiStepProgress,L as Network,bd as NetworkSecurityManager,rl as ORIGIN_CONNECTION_ATTEMPTS,nl as ORIGIN_CONNECTION_TIMEOUT,el as ORIGIN_GROUP_ALLOWED_METHODS,Tm as ORIGIN_GROUP_ID_SUFFIX,tl as ORIGIN_GROUP_SELECTION_CRITERIA,Il as OrganizationManager,Ep as PHP_DEFAULT_EXCLUDES,gp as PHP_LAYER_EXTENSIONS,X as ParameterStore,Nl as PerformanceManager,Ae as Permissions,wt as Phone,Yl as PhoneAdvanced,ol as PhoneHandlers,Pa as PreviewEnvironmentManager,Da as PreviewNotificationService,Bu as ProgressBar,Ma as ProgressiveDeploymentManager,ru as Pseudo,fe as Queue,nd as QueueManagementManager,gm as QueuePresets,Ku as RECOMMENDED_ACCOUNT_STRUCTURES,df as RECOMMENDED_SCPS,zu as REPL,qu as REPLCommandBuilder,Hu as REPLContext,Nu as RateLimiter,fm as RealtimePresets,Jo as RecursionGuard,At as Redirects,wl as RegionPairManager,Et as Registry,Ba as ReplicaManager,Sd as ResourceManagementManager,ql as Route53ResolverManager,za as Route53RoutingManager,Ea as S3Client,he as S3Error,we as SMS,Qc as STATE_DIR_ENV_VAR,zo as STORAGE_FAILOVER_METADATA_KEY,Gt as Search,$i as Secrets,Fa as SecretsManager,_l as SecretsRotationManager,j as Security,Mr as SecurityHubManager,$l as SecurityScanningManager,Kl as SenderReputationManager,Va as ServiceMeshManager,qo as Sftp,Zl as SmsAdvanced,sl as SmsHandlers,ju as Spinner,Al as StackDependencyManager,Em as StacksIntegration,hd as StaticSiteManager,Fe as Storage,rc as StorageAdvancedManager,Ur as SyntheticsManager,Qa as TRACE_HEADER,Vu as TaskList,Fo as TemplateBuilder,Aa as TemplateCache,pl as ValidationError,au as Workflow,Pl as XRayManager,np as abTestManager,il as amazonLinuxImageId,su as amazonLinuxImageParameter,vm as analyzeStackDiff,Ha as artifactKey,bn as assertOriginGroupMethods,Bg as autocomplete,Qu as awsConfigManager,Ju as backupManager,dg as batch,th as batchProcessingManager,tp as blueGreenManager,Jf as bounceComplaintHandler,ih as buildBunRuntimeLayerZip,Ca as buildCloudFormationTemplate,Sa as buildFailoverReplicaPolicyStatement,ca as buildMailEnv,nh as buildNodeRuntimeLayerZip,Ff as buildOptimizationManager,ga as buildOriginGroup,Vo as buildOriginGroups,ch as buildPhpRuntimeLayerZip,ba as buildReplicationConfiguration,ya as buildReplicationRole,rp as canaryManager,Sg as categorizeChanges,Mf as certificateManager,eg as checkIAMPermissions,ud as checkInvocation,rg as checkServiceQuotas,xu as chunk,Dp as clearSigningKeyCache,_u as cloudConfigSchema,Yu as cloudTrailManager,Qo as collectPhpAppEntries,Vm as composePresets,Ga as composeServerlessAppTemplate,lp as containerRegistryManager,km as createApiBackendPreset,Tp as createCliHandler,Xm as createCredentialProvider,Fm as createDashboardSite,$m as createDataPipelinePreset,ml as createError,Ta as createExistingStaticFullStackPreset,Dm as createFullStackAppPreset,ah as createHandlers,vp as createHttpHandler,xm as createJamstackPreset,Um as createLaravelPreset,Lm as createMLApiPreset,_m as createMicroservicesPreset,Ig as createMockAWS,Rm as createNodeJsServerPreset,Im as createNodeJsServerlessPreset,zm as createPreset,Yo as createPresignedUrl,Ap as createPresignedUrlAsync,Cp as createQueueHandler,Om as createRealtimeAppPreset,Tu as createS3Client,Bm as createServerlessLaravelPreset,Pm as createServerlessNodePreset,Am as createStaticSitePreset,Mm as createTraditionalWebAppPreset,Nm as createWordPressPreset,It as createZip,Wg as crossRegionReferenceManager,$f as databaseUserManager,hl as defaultLocalConfig,$r as deploymentCoexistenceError,pu as deriveManagementDashboardPort,Yc as detectDeploymentTargets,Ym as detectMisconfigurations,nc as detectServiceRegion,hg as diffTemplates,eh as dlqMonitoringManager,Wf as dnssecManager,Xu as drManager,Xf as emailAnalyticsManager,Yf as emailTemplateManager,Sp as eventToRequest,dl as extendPreset,Zf as fifoQueueManager,lg as findChangedFiles,ff as formatAccountStructure,Ng as formatBytes,Cm as formatDiff,xg as formatDuration,jg as formatFlagSuggestions,Hg as formatHistory,qg as formatHistoryStats,Og as formatKeyValue,_g as formatList,kg as formatProgressBar,Wu as formatRegion,sf as formatRegionList,$g as formatSuggestion,Pg as formatTable,Dg as formatTree,yu as fromEC2Metadata,bu as fromECSMetadata,fu as fromEnvironment,hu as fromSharedCredentials,Su as fromWebIdentity,ad as functionFingerprint,Ka as generateAppImageDockerfile,Df as generateApprovalConfig,id as generateBootstrap,Lu as generateCleanupWorkflow,Mu as generateCostReportWorkflow,mf as generateCrossAccountRoleCF,Rf as generateDeploymentConfig,Cf as generateDeploymentPipeline,hf as generateDeploymentWorkflow,o as generateLogicalId,Af as generateManualPipeline,vf as generateMatrixWorkflow,If as generateMultiEnvConfig,Tf as generateMultiEnvPipeline,yf as generateMultiEnvWorkflow,bf as generatePRPreviewWorkflow,kf as generateParallelConfig,gd as generatePhpFpmConfig,od as generatePhpLayerDockerfile,Ef as generatePreviewPipeline,$u as generatePreviewWorkflow,l as generateResourceName,Pf as generateScheduledConfig,wf as generateScheduledPipeline,Sf as generateScheduledWorkflow,ul as getAccountId,Qg as getAllRegions,rf as getClosestRegion,Vg as getCommandUsage,Mg as getContextualHelp,Mi as getCredentials,vg as getDeploymentStrategy,Cg as getDiffStats,yg as getDiffSummary,Iu as getErrorDetails,Ia as getLocalConfig,Ag as getLocalCredentials,wg as getLocalEndpoint,Rg as getLocalEnvVars,ng as getQuotaUsageSummary,pf as getRecommendedStructure,Ui as getRegion,af as getRegionStats,Zg as getRegionsByCompliance,Yg as getRegionsByLocation,ef as getRegionsByPricingTier,Pu as getRequiredPermissions,kp as getSigningKeyCacheSize,hm as getTimestamp,Kg as globalResourceManager,Zu as guardDutyManager,Wt as hasManagementDashboardSite,og as hashBuffer,sg as hashDirectory,gl as hashFile,ag as hashManifest,fl as hashString,dh as healthCheckManager,Bf as imageScanningManager,ld as inspectInvocation,yp as installRecursionFetch,dd as invocationContext,ou as isArmInstanceType,Lg as isLikelyTypo,Eg as isLocalDevelopment,Lr as isManagementDashboardSiteName,Np as isNodeCryptoAvailable,xi as isS3RestEndpoint,oa as isStateDirConfigured,sa as isStatePath,tf as isValidRegion,xp as isWebCryptoAvailable,zf as lambdaConcurrencyManager,Gf as lambdaDLQManager,Hf as lambdaDestinationsManager,jf as lambdaLayersManager,qf as lambdaVPCManager,Vf as lambdaVersionsManager,ec as laravelServerlessEnvDefaults,op as logsManager,Yd as mailEnabled,aa as mailFirewallPorts,Pt as makeAWSRequest,Ip as makeAWSRequestAsync,Rp as makeAWSRequestOnce,ll as managementDashboardSiteName,Cn as mergeInfrastructure,xf as metricsManager,_f as migrationManager,cf as multiAccountManager,Gg as multiRegionManager,uh as networkSecurityManager,lf as organizationManager,tc as packagePhpApp,En as packageServerlessApp,Ra as parallel,ug as parallelMap,pg as parallelWithRetry,cd as parseChain,Pp as parseJSONResponse,An as parseXMLResponse,Of as performanceManager,Wa as phpLayerBuildStage,fp as phpLayerPackages,wn as phpRuntimeLayerAssets,Ou as previewManager,Uu as previewNotifications,fg as processInChunks,ip as progressiveDeploymentManager,Ya as propagationHeaders,rh as queueManagementManager,cg as quickHash,Za as recursionBlockedResponse,Jg as regionPairManager,ap as replicaManager,bg as requiresReplacement,oh as resetRecursionRuntime,sh as resolveApp,w as resolveAppDatabase,F as resolveCloudProvider,Tn as resolveCredentials,mu as resolveDashboardDomain,gu as resolveDashboardDomains,Sm as resolveDeployBucketName,H as resolveDeploymentMode,jo as resolveFailoverStatusCodes,ki as resolveMailService,jm as resolveManagementDashboardSite,Li as resolveManagementDashboardSites,tt as resolveOriginConnection,T as resolveProjectStackName,qa as resolveQueueNames,Jt as resolveQueues,hp as resolveRecursionConfig,vu as resolveRegion,xe as resolveServerlessAppStackName,pa as resolveServerlessArtifactBucketName,Ni as resolveServerlessAssetBucketName,Fi as resolveServerlessRuntime,ua as resolveSiteBucketName,da as resolveSiteResourceName,la as resolveSiteStackName,A as resolveStatePath,bm as resolveStorageBucketName,fa as resolveStorageFailover,ph as resourceManagementManager,md as responseToResult,Kf as route53ResolverManager,up as route53RoutingManager,pp as runBuildHooks,Xo as runPhpBuildHooks,ha as s3RegionalDomain,ym as sanitizeName,Ug as searchCommands,cp as secretsManager,Lf as secretsRotationManager,ep as securityHubManager,Uf as securityScanningManager,Qf as senderReputationManager,mg as sequence,dp as serviceMeshManager,ia as setStateDir,Ko as sha256,bp as sharedRecursionGuard,sd as sharedRuntimeLoop,Y as signRequest,ic as signRequestAsync,Xg as stackDependencyManager,yn as stateDir,Be as statePath,lh as staticSiteManager,wp as storageAdvancedManager,va as storageFailoverReplicasFromTemplate,vl as suggestCommand,Fg as suggestFlags,tg as suggestIAMPolicy,ig as suggestQuotaIncrease,of as suggestRegionPairs,nf as suggestRegions,sp as syntheticsManager,Du as templateCache,gf as validateAccountStructure,Tg as validateAgainstSchema,zg as validateCommand,Qm as validateConfiguration,Zm as validateCredentials,Sn as validateOriginGroups,tu as validateResourceLimits,Zd as validateTemplate,eu as validateTemplateSize,Km as withCDN,Wm as withCache,Gm as withDatabase,pd as withInvocation,Hm as withMonitoring,Jm as withQueue,qm as withSecurity,gg as withTimeout,Nf as xrayManager};
|
|
1
|
+
import{gm,fm,na,Qc,ia,oa,yn,Fe,A,sa,Yc,H,$r,w,Yd,ki,aa,ca,B,Bo,Zd,eu,tu,ru,l,o,hm,ym,T,la,da,ua,bm,Sm,xe,pa,Ni,nu,vm,Cm,Be,Et,ma,Zc,el,Tm,tl,rl,nl,jo,ga,tt,Vo,bn,xi,Sn,je,iu,zo,Ho,fa,ha,ya,ba,Sa,va,Ee,j,ou,su,il,b,L,rt,k,ol,wt,fe,Ht,Em,sl,we,qo,Ve,qt,_i,Ae,Go,_e,au,Oi,Re,Ie,ne,$i,X,Gt,At,Pe,t,vn,wm,al,Ca,Am,Rm,Im,Pm,Ta,Dm,km,Nm,xm,_m,Om,$m,Lm,Mm,Um,Fm,Bm,cu,lu,du,uu,pu,mu,gu,Wt,cl,ll,Lr,Li,jm,dl,Vm,zm,Cn,Hm,qm,Gm,Wm,Km,Jm,fu,hu,yu,bu,Su,Mi,Xm,Tn,vu,ul,Cu,Ea,he,Tu,Eu,Rt,Wo,Kt,wu,pl,Au,Ru,Iu,ml,ye,Qm,Ym,Zm,eg,Pu,tg,De,rg,ng,ig,wa,Aa,Du,gl,fl,og,sg,ag,cg,lg,ku,Ra,dg,ug,pg,mg,gg,Nu,xu,fg,hg,yg,bg,Sg,vg,Cg,_u,Tg,hl,Ia,Eg,wg,Ag,Rg,yl,bl,Sl,Ig,Pa,Ou,$u,Lu,Mu,Da,Uu,Pg,Dg,kg,Ng,xg,_g,Og,Fu,Bu,ju,Vu,vl,$g,Lg,Mg,Ug,Fg,Bg,jg,Vg,zg,zu,Hu,qu,Gu,Hg,qg,Cl,Gg,Tl,El,wl,Al,Wg,Kg,Jg,Xg,nt,Ui,Qg,Yg,Zg,ef,tf,rf,nf,of,Wu,sf,af,Rl,Il,cf,lf,Ku,df,uf,pf,mf,gf,ff,hf,yf,bf,Sf,vf,Cf,Tf,Ef,wf,Af,Rf,If,Pf,Df,kf,ka,Ju,Na,Xu,xa,Qu,_a,Yu,Oa,Zu,Mr,ep,$a,tp,Fi,rp,La,np,Ma,ip,Pl,Nf,Dl,xf,Ua,op,Ur,sp,kl,_f,Fa,ap,Nl,Of,xl,$f,_l,Lf,Ba,cp,Ol,Mf,$l,Uf,Ll,Ff,Ml,Bf,ja,lp,Va,dp,Ul,jf,Fl,Vf,Bl,zf,jl,Hf,Vl,qf,zl,Gf,za,up,Hl,Wf,ql,Kf,Gl,Jf,Wl,Xf,Kl,Qf,Jl,Yf,Xl,Ql,Yl,Zl,ed,Zf,td,eh,rd,th,nd,rh,It,id,pp,Ko,Ha,En,mp,Bi,Jt,qa,Ga,gp,fp,Wa,od,Ka,sd,nh,ih,Ja,Xa,Qa,ad,ji,cd,ld,Jo,Ya,Za,dd,hp,yp,bp,oh,ud,pd,sh,Sp,md,vp,Cp,Tp,ah,gd,wn,ec,fd,ch,Ep,Xo,Qo,tc,hd,lh,rc,wp,yd,dh,bd,uh,Sd,ph}from"./chunk-dj03v81n.js";import{nc,Y,ic,Yo,Ap,Pt,Rp,Ip,An,Pp,Dp,kp,Np,xp}from"./chunk-4yym8xm4.js";export{La as ABTestManager,Ve as AI,Au as AWSAPIError,xa as AWSConfigManager,wm as AWS_PSEUDO_PARAMETERS,nt as AWS_REGIONS,Go as ApiGateway,vn as Arn,ne as AssetHasher,Re as Auth,ka as BackupManager,rd as BatchProcessingManager,$a as BlueGreenManager,Gl as BounceComplaintHandler,Ml as BuildOptimizationManager,je as CDN,Xa as CHAIN_HEADER,ma as CLOUDFRONT_FAILOVER_STATUS_CODES,uf as COMMON_CROSS_ACCOUNT_ROLES,_i as Cache,Fi as CanaryManager,Ol as CertificateManager,Rt as CloudError,al as CloudFormationBuilder,Cu as CloudFormationClient,Eu as CloudFrontClient,_a as CloudTrailManager,Gu as CommandHistory,Pe as Communication,b as Compute,Wo as ConfigurationError,ja as ContainerRegistryManager,Kt as CredentialError,Tl as CrossRegionReferenceManager,lu as DASHBOARD_ENTRY,du as DASHBOARD_PORT_BASE,uu as DASHBOARD_PORT_SPAN,cu as DASHBOARD_STATE_DIR,Zc as DEFAULT_FAILOVER_STATUS_CODES,ji as DEFAULT_RECURSION_LIMITS,De as DEFAULT_SERVICE_LIMITS,na as DEFAULT_STATE_DIR,iu as DEFAULT_STORAGE_FAILOVER_STATUS_CODES,Ja as DEPTH_HEADER,td as DLQMonitoringManager,Ee as DNS,Hl as DNSSECManager,qt as Database,xl as DatabaseUserManager,ye as DebugLogger,nu as DependencyGraph,Ie as Deployment,wu as DeploymentError,Na as DisasterRecoveryManager,k as Email,Xl as EmailAdvanced,Wl as EmailAnalyticsManager,Ql as EmailHandlers,Jl as EmailTemplateManager,Ru as ErrorCodes,Ho as FAILOVER_REPLICA_POLICY_SID,ed as FIFOQueueManager,wa as FileCache,rt as FileSystem,t as Fn,El as GlobalResourceManager,Oa as GuardDutyManager,ku as HashCache,yd as HealthCheckManager,Ll as ImageScanningManager,Ht as JobLoader,fd as LARAVEL_SERVERLESS_BUILD_STEPS,Bl as LambdaConcurrencyManager,zl as LambdaDLQManager,jl as LambdaDestinationsManager,Ul as LambdaLayersManager,Vl as LambdaVPCManager,Fl as LambdaVersionsManager,Ua as LogsManager,mp as MANAGED_NODE_VERSIONS,cl as MANAGEMENT_DASHBOARD_SITE_PREFIX,_e as Messaging,Dl as MetricsManager,kl as MigrationManager,yl as MockCloudFormation,Sl as MockDynamoDB,bl as MockS3,Oi as Monitoring,Rl as MultiAccountManager,Cl as MultiRegionManager,Bu as MultiStepProgress,L as Network,bd as NetworkSecurityManager,rl as ORIGIN_CONNECTION_ATTEMPTS,nl as ORIGIN_CONNECTION_TIMEOUT,el as ORIGIN_GROUP_ALLOWED_METHODS,Tm as ORIGIN_GROUP_ID_SUFFIX,tl as ORIGIN_GROUP_SELECTION_CRITERIA,Il as OrganizationManager,Ep as PHP_DEFAULT_EXCLUDES,gp as PHP_LAYER_EXTENSIONS,X as ParameterStore,Nl as PerformanceManager,Ae as Permissions,wt as Phone,Yl as PhoneAdvanced,ol as PhoneHandlers,Pa as PreviewEnvironmentManager,Da as PreviewNotificationService,Fu as ProgressBar,Ma as ProgressiveDeploymentManager,ru as Pseudo,fe as Queue,nd as QueueManagementManager,gm as QueuePresets,Ku as RECOMMENDED_ACCOUNT_STRUCTURES,df as RECOMMENDED_SCPS,zu as REPL,qu as REPLCommandBuilder,Hu as REPLContext,Nu as RateLimiter,fm as RealtimePresets,Jo as RecursionGuard,At as Redirects,wl as RegionPairManager,Et as Registry,Fa as ReplicaManager,Sd as ResourceManagementManager,ql as Route53ResolverManager,za as Route53RoutingManager,Ea as S3Client,he as S3Error,we as SMS,Qc as STATE_DIR_ENV_VAR,zo as STORAGE_FAILOVER_METADATA_KEY,Gt as Search,$i as Secrets,Ba as SecretsManager,_l as SecretsRotationManager,j as Security,Mr as SecurityHubManager,$l as SecurityScanningManager,Kl as SenderReputationManager,Va as ServiceMeshManager,qo as Sftp,Zl as SmsAdvanced,sl as SmsHandlers,ju as Spinner,Al as StackDependencyManager,Em as StacksIntegration,hd as StaticSiteManager,Be as Storage,rc as StorageAdvancedManager,Ur as SyntheticsManager,Qa as TRACE_HEADER,Vu as TaskList,Bo as TemplateBuilder,Aa as TemplateCache,pl as ValidationError,au as Workflow,Pl as XRayManager,np as abTestManager,il as amazonLinuxImageId,su as amazonLinuxImageParameter,vm as analyzeStackDiff,Ha as artifactKey,bn as assertOriginGroupMethods,Fg as autocomplete,Qu as awsConfigManager,Ju as backupManager,dg as batch,th as batchProcessingManager,tp as blueGreenManager,Jf as bounceComplaintHandler,ih as buildBunRuntimeLayerZip,Ca as buildCloudFormationTemplate,Sa as buildFailoverReplicaPolicyStatement,ca as buildMailEnv,nh as buildNodeRuntimeLayerZip,Bf as buildOptimizationManager,ga as buildOriginGroup,Vo as buildOriginGroups,ch as buildPhpRuntimeLayerZip,ba as buildReplicationConfiguration,ya as buildReplicationRole,rp as canaryManager,Sg as categorizeChanges,Mf as certificateManager,eg as checkIAMPermissions,ud as checkInvocation,rg as checkServiceQuotas,xu as chunk,Dp as clearSigningKeyCache,_u as cloudConfigSchema,Yu as cloudTrailManager,Qo as collectPhpAppEntries,Vm as composePresets,Ga as composeServerlessAppTemplate,lp as containerRegistryManager,km as createApiBackendPreset,Tp as createCliHandler,Xm as createCredentialProvider,Bm as createDashboardSite,$m as createDataPipelinePreset,ml as createError,Ta as createExistingStaticFullStackPreset,Dm as createFullStackAppPreset,ah as createHandlers,vp as createHttpHandler,xm as createJamstackPreset,Um as createLaravelPreset,Lm as createMLApiPreset,_m as createMicroservicesPreset,Ig as createMockAWS,Rm as createNodeJsServerPreset,Im as createNodeJsServerlessPreset,zm as createPreset,Yo as createPresignedUrl,Ap as createPresignedUrlAsync,Cp as createQueueHandler,Om as createRealtimeAppPreset,Tu as createS3Client,Fm as createServerlessLaravelPreset,Pm as createServerlessNodePreset,Am as createStaticSitePreset,Mm as createTraditionalWebAppPreset,Nm as createWordPressPreset,It as createZip,Wg as crossRegionReferenceManager,$f as databaseUserManager,hl as defaultLocalConfig,$r as deploymentCoexistenceError,pu as deriveManagementDashboardPort,Yc as detectDeploymentTargets,Ym as detectMisconfigurations,nc as detectServiceRegion,hg as diffTemplates,eh as dlqMonitoringManager,Wf as dnssecManager,Xu as drManager,Xf as emailAnalyticsManager,Yf as emailTemplateManager,Sp as eventToRequest,dl as extendPreset,Zf as fifoQueueManager,lg as findChangedFiles,ff as formatAccountStructure,Ng as formatBytes,Cm as formatDiff,xg as formatDuration,jg as formatFlagSuggestions,Hg as formatHistory,qg as formatHistoryStats,Og as formatKeyValue,_g as formatList,kg as formatProgressBar,Wu as formatRegion,sf as formatRegionList,$g as formatSuggestion,Pg as formatTable,Dg as formatTree,yu as fromEC2Metadata,bu as fromECSMetadata,fu as fromEnvironment,hu as fromSharedCredentials,Su as fromWebIdentity,ad as functionFingerprint,Ka as generateAppImageDockerfile,Df as generateApprovalConfig,id as generateBootstrap,Lu as generateCleanupWorkflow,Mu as generateCostReportWorkflow,mf as generateCrossAccountRoleCF,Rf as generateDeploymentConfig,Cf as generateDeploymentPipeline,hf as generateDeploymentWorkflow,o as generateLogicalId,Af as generateManualPipeline,vf as generateMatrixWorkflow,If as generateMultiEnvConfig,Tf as generateMultiEnvPipeline,yf as generateMultiEnvWorkflow,bf as generatePRPreviewWorkflow,kf as generateParallelConfig,gd as generatePhpFpmConfig,od as generatePhpLayerDockerfile,Ef as generatePreviewPipeline,$u as generatePreviewWorkflow,l as generateResourceName,Pf as generateScheduledConfig,wf as generateScheduledPipeline,Sf as generateScheduledWorkflow,ul as getAccountId,Qg as getAllRegions,rf as getClosestRegion,Vg as getCommandUsage,Mg as getContextualHelp,Mi as getCredentials,vg as getDeploymentStrategy,Cg as getDiffStats,yg as getDiffSummary,Iu as getErrorDetails,Ia as getLocalConfig,Ag as getLocalCredentials,wg as getLocalEndpoint,Rg as getLocalEnvVars,ng as getQuotaUsageSummary,pf as getRecommendedStructure,Ui as getRegion,af as getRegionStats,Zg as getRegionsByCompliance,Yg as getRegionsByLocation,ef as getRegionsByPricingTier,Pu as getRequiredPermissions,kp as getSigningKeyCacheSize,hm as getTimestamp,Kg as globalResourceManager,Zu as guardDutyManager,Wt as hasManagementDashboardSite,og as hashBuffer,sg as hashDirectory,gl as hashFile,ag as hashManifest,fl as hashString,dh as healthCheckManager,Ff as imageScanningManager,ld as inspectInvocation,yp as installRecursionFetch,dd as invocationContext,ou as isArmInstanceType,Lg as isLikelyTypo,Eg as isLocalDevelopment,Lr as isManagementDashboardSiteName,Np as isNodeCryptoAvailable,xi as isS3RestEndpoint,oa as isStateDirConfigured,sa as isStatePath,tf as isValidRegion,xp as isWebCryptoAvailable,zf as lambdaConcurrencyManager,Gf as lambdaDLQManager,Hf as lambdaDestinationsManager,jf as lambdaLayersManager,qf as lambdaVPCManager,Vf as lambdaVersionsManager,ec as laravelServerlessEnvDefaults,op as logsManager,Yd as mailEnabled,aa as mailFirewallPorts,Pt as makeAWSRequest,Ip as makeAWSRequestAsync,Rp as makeAWSRequestOnce,ll as managementDashboardSiteName,Cn as mergeInfrastructure,xf as metricsManager,_f as migrationManager,cf as multiAccountManager,Gg as multiRegionManager,uh as networkSecurityManager,lf as organizationManager,tc as packagePhpApp,En as packageServerlessApp,Ra as parallel,ug as parallelMap,pg as parallelWithRetry,cd as parseChain,Pp as parseJSONResponse,An as parseXMLResponse,Of as performanceManager,Wa as phpLayerBuildStage,fp as phpLayerPackages,wn as phpRuntimeLayerAssets,Ou as previewManager,Uu as previewNotifications,fg as processInChunks,ip as progressiveDeploymentManager,Ya as propagationHeaders,rh as queueManagementManager,cg as quickHash,Za as recursionBlockedResponse,Jg as regionPairManager,ap as replicaManager,bg as requiresReplacement,oh as resetRecursionRuntime,sh as resolveApp,w as resolveAppDatabase,B as resolveCloudProvider,Tn as resolveCredentials,mu as resolveDashboardDomain,gu as resolveDashboardDomains,Sm as resolveDeployBucketName,H as resolveDeploymentMode,jo as resolveFailoverStatusCodes,ki as resolveMailService,jm as resolveManagementDashboardSite,Li as resolveManagementDashboardSites,tt as resolveOriginConnection,T as resolveProjectStackName,qa as resolveQueueNames,Jt as resolveQueues,hp as resolveRecursionConfig,vu as resolveRegion,xe as resolveServerlessAppStackName,pa as resolveServerlessArtifactBucketName,Ni as resolveServerlessAssetBucketName,Bi as resolveServerlessRuntime,ua as resolveSiteBucketName,da as resolveSiteResourceName,la as resolveSiteStackName,A as resolveStatePath,bm as resolveStorageBucketName,fa as resolveStorageFailover,ph as resourceManagementManager,md as responseToResult,Kf as route53ResolverManager,up as route53RoutingManager,pp as runBuildHooks,Xo as runPhpBuildHooks,ha as s3RegionalDomain,ym as sanitizeName,Ug as searchCommands,cp as secretsManager,Lf as secretsRotationManager,ep as securityHubManager,Uf as securityScanningManager,Qf as senderReputationManager,mg as sequence,dp as serviceMeshManager,ia as setStateDir,Ko as sha256,bp as sharedRecursionGuard,sd as sharedRuntimeLoop,Y as signRequest,ic as signRequestAsync,Xg as stackDependencyManager,yn as stateDir,Fe as statePath,lh as staticSiteManager,wp as storageAdvancedManager,va as storageFailoverReplicasFromTemplate,vl as suggestCommand,Bg as suggestFlags,tg as suggestIAMPolicy,ig as suggestQuotaIncrease,of as suggestRegionPairs,nf as suggestRegions,sp as syntheticsManager,Du as templateCache,gf as validateAccountStructure,Tg as validateAgainstSchema,zg as validateCommand,Qm as validateConfiguration,Zm as validateCredentials,Sn as validateOriginGroups,tu as validateResourceLimits,Zd as validateTemplate,eu as validateTemplateSize,Km as withCDN,Wm as withCache,Gm as withDatabase,pd as withInvocation,Hm as withMonitoring,Jm as withQueue,qm as withSecurity,gg as withTimeout,Nf as xrayManager};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{xe,Jt}from"./chunk-tf8qxy9k.js";import{p,D}from"./chunk-dkf2kcsc.js";import{v}from"./chunk-7593hjcq.js";import{Ct,g}from"./chunk-nmqjmx30.js";import{I}from"./chunk-7p2va3nj.js";import{V}from"./chunk-9eqpnanr.js";import{Ft,z}from"./chunk-qj6tr7bw.js";import{hc}from"./chunk-5nmt4s5w.js";class G{client;region;constructor(e="us-east-1",t){this.region=e,this.client=new p(Ct(t))}async query(e){let t=new URLSearchParams(D({Version:"2010-08-01",...e})).toString();return this.client.request({service:"monitoring",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t})}async getMetricStatistics(e){let t={Action:"GetMetricStatistics",Namespace:e.Namespace,MetricName:e.MetricName,StartTime:e.StartTime.toISOString(),EndTime:e.EndTime.toISOString(),Period:e.Period};(e.Statistics??[]).forEach((o,f)=>{t[`Statistics.member.${f+1}`]=o}),(e.ExtendedStatistics??[]).forEach((o,f)=>{t[`ExtendedStatistics.member.${f+1}`]=o}),(e.Dimensions??[]).forEach((o,f)=>{t[`Dimensions.member.${f+1}.Name`]=o.Name,t[`Dimensions.member.${f+1}.Value`]=o.Value});let r=await this.query(t),s=(r.GetMetricStatisticsResult||r)?.Datapoints?.member??[];if(!Array.isArray(s))s=s?[s]:[];return s.map((o)=>{let f={},m=o.ExtendedStatistics?.entry;if(m){if(!Array.isArray(m))m=[m];for(let d of m)if(d?.key!=null)f[d.key]=Number(d.value)}return{Timestamp:o.Timestamp,Sum:o.Sum!=null?Number(o.Sum):void 0,Average:o.Average!=null?Number(o.Average):void 0,Maximum:o.Maximum!=null?Number(o.Maximum):void 0,Minimum:o.Minimum!=null?Number(o.Minimum):void 0,Percentiles:Object.keys(f).length?f:void 0,Unit:o.Unit}})}async getMetricSeries(e){let t=/^p\d/.test(e.Stat);return(await this.getMetricStatistics({Namespace:e.Namespace,MetricName:e.MetricName,Dimensions:e.Dimensions,StartTime:e.StartTime,EndTime:e.EndTime,Period:e.Period,Statistics:t?[]:[e.Stat],ExtendedStatistics:t?[e.Stat]:[]})).slice().sort((a,s)=>new Date(a.Timestamp??0).getTime()-new Date(s.Timestamp??0).getTime()).map((a)=>t?a.Percentiles?.[e.Stat]??0:a[e.Stat]??0)}async describeAlarms(e){let t={Action:"DescribeAlarms"};if(e?.AlarmNamePrefix)t.AlarmNamePrefix=e.AlarmNamePrefix;if(e?.MaxRecords)t.MaxRecords=e.MaxRecords;let r=await this.query(t),s=(r.DescribeAlarmsResult||r)?.MetricAlarms?.member??[];if(!Array.isArray(s))s=s?[s]:[];return s.map((o)=>({AlarmName:o.AlarmName,StateValue:o.StateValue,MetricName:o.MetricName,ComparisonOperator:o.ComparisonOperator,Threshold:o.Threshold!=null?Number(o.Threshold):void 0,Namespace:o.Namespace}))}async putMetricAlarm(e){let t={Action:"PutMetricAlarm",AlarmName:e.AlarmName,Namespace:e.Namespace,MetricName:e.MetricName,ComparisonOperator:e.ComparisonOperator,Threshold:e.Threshold,EvaluationPeriods:e.EvaluationPeriods,Period:e.Period,Statistic:e.Statistic};if(e.AlarmDescription)t.AlarmDescription=e.AlarmDescription;(e.Dimensions??[]).forEach((r,a)=>{t[`Dimensions.member.${a+1}.Name`]=r.Name,t[`Dimensions.member.${a+1}.Value`]=r.Value}),(e.AlarmActions??[]).forEach((r,a)=>{t[`AlarmActions.member.${a+1}`]=r}),await this.query(t)}async deleteAlarms(e){if(!e.length)return;let t={Action:"DeleteAlarms"};e.forEach((r,a)=>{t[`AlarmNames.member.${a+1}`]=r}),await this.query(t)}}class oe{client;region;constructor(e="us-east-1",t){this.region=e,this.client=new p(void 0,{profile:t})}async createLogGroup(e,t){await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.CreateLogGroup","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({logGroupName:e,...t?{tags:t}:{}})})}async putRetentionPolicy(e,t){if(![1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1096,1827,2192,2557,2922,3288,3653].includes(t))throw Error("Unsupported CloudWatch Logs retention period");await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.PutRetentionPolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({logGroupName:e,retentionInDays:t})})}async describeLogStreams(e){let t={logGroupName:e.logGroupName};if(e.logStreamNamePrefix)t.logStreamNamePrefix=e.logStreamNamePrefix;if(e.orderBy)t.orderBy=e.orderBy;if(e.descending!==void 0)t.descending=e.descending;if(e.limit)t.limit=e.limit;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.DescribeLogStreams","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}async getLogEvents(e){let t={logGroupName:e.logGroupName,logStreamName:e.logStreamName};if(e.startTime)t.startTime=e.startTime;if(e.endTime)t.endTime=e.endTime;if(e.limit)t.limit=e.limit;if(e.startFromHead!==void 0)t.startFromHead=e.startFromHead;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.GetLogEvents","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}async describeLogGroups(e){let t={};if(e?.logGroupNamePrefix)t.logGroupNamePrefix=e.logGroupNamePrefix;if(e?.limit)t.limit=e.limit;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.DescribeLogGroups","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}async deleteLogGroup(e){await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.DeleteLogGroup","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({logGroupName:e})})}async filterLogEvents(e){let t={logGroupName:e.logGroupName};if(e.logStreamNames)t.logStreamNames=e.logStreamNames;if(e.startTime)t.startTime=e.startTime;if(e.endTime)t.endTime=e.endTime;if(e.filterPattern)t.filterPattern=e.filterPattern;if(e.limit)t.limit=e.limit;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.FilterLogEvents","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}}import{createHash as le}from"node:crypto";import{existsSync as se,mkdirSync as de,readdirSync as ge,readFileSync as pe,rmSync as he,writeFileSync as ye}from"node:fs";import{homedir as fe}from"node:os";import{join as W}from"node:path";var ie=1,ae=3600000,Se=24*ae,Ce=ae,Te=30*Se;function X(){let e=process.env.XDG_CACHE_HOME;return W(e&&e.trim()?e:W(fe(),".cache"),"ts-cloud","cost-explorer")}function Q(e){return W(X(),e??"__default__")}function ne(e){let t={s:e.start,e:e.end,g:e.granularity,m:[...e.metrics].sort(),gb:[...e.groupBy].map((r)=>`${r.Type}:${r.Key}`).sort(),f:e.filter??null};return le("sha256").update(JSON.stringify(t)).digest("hex").slice(0,24)}function be(e,t){let r=Date.parse(`${t}T00:00:00Z`);if(Number.isNaN(r))return!1;let a=new Date,s=Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1);return r<=s}function Ne(e){return be(e.start,e.end)?Te:Ce}function me(e,t){let r=W(Q(e),`${ne(t)}.json`);if(!se(r))return null;let a;try{a=JSON.parse(pe(r,"utf-8"))}catch{return null}if(a.schema!==ie)return null;let s=Date.now()-a.savedAt;if(s<0||s>Ne(t))return null;return{response:a.response,ageSeconds:Math.floor(s/1000)}}function ce(e,t,r){let a=Q(e);de(a,{recursive:!0});let s={schema:ie,savedAt:Date.now(),key:t,response:r};ye(W(a,`${ne(t)}.json`),JSON.stringify(s))}function dc(e){let t=e===void 0?X():Q(e);if(!se(t))return{deletedFiles:0,scope:e??"all profiles"};let r=0;function a(s){for(let o of ge(s,{withFileTypes:!0})){let f=W(s,o.name);if(o.isDirectory())a(f);else if(o.isFile()&&o.name.endsWith(".json"))r++}}return a(t),he(t,{recursive:!0,force:!0}),{deletedFiles:r,scope:e??"all profiles"}}function uc(e){return e===void 0?X():Q(e)}class He{client;profile;useCache;lastCacheAgeSeconds=null;constructor(e,t){this.profile=e,this.useCache=t?.useCache??!0,this.client=new p(Ct(e))}async getCostByService(e){return(await this.getCostByDimension({...e,dimension:"SERVICE"})).map((r)=>({service:r.key,amount:r.amount,unit:r.unit}))}async getCostByDimension(e){let{start:t,end:r,dimension:a,granularity:s="MONTHLY",filter:o}=e,f=["UnblendedCost"],m=[{Type:"DIMENSION",Key:a}],d={start:t,end:r,granularity:s,metrics:f,groupBy:m,filter:o};if(this.useCache){let b=me(this.profile,d);if(b)return this.lastCacheAgeSeconds=b.ageSeconds,b.response}this.lastCacheAgeSeconds=null;let y=new Map,i;do{let b={TimePeriod:{Start:t,End:r},Granularity:s,Metrics:f,GroupBy:m};if(o)b.Filter=o;if(i)b.NextPageToken=i;let E=await this.client.request({service:"ce",region:"us-east-1",method:"POST",path:"/",headers:{"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSInsightsIndexService.GetCostAndUsage"},body:JSON.stringify(b)});for(let K of E?.ResultsByTime??[])for(let N of K?.Groups??[]){let F=N.Keys?.[0]??"Unknown",H=Number.parseFloat(N.Metrics?.UnblendedCost?.Amount??"0"),Y=N.Metrics?.UnblendedCost?.Unit??"USD",O=y.get(F);y.set(F,{key:F,amount:(O?.amount??0)+H,unit:Y})}i=E?.NextPageToken||void 0}while(i);let L=[...y.values()].filter((b)=>b.amount>0).sort((b,E)=>E.amount-b.amount);if(this.useCache)ce(this.profile,d,L);return L}async getDailyTotals(e){return((await this.client.request({service:"ce",region:"us-east-1",method:"POST",path:"/",headers:{"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSInsightsIndexService.GetCostAndUsage"},body:JSON.stringify({TimePeriod:{Start:e.start,End:e.end},Granularity:"DAILY",Metrics:["UnblendedCost"]})}))?.ResultsByTime??[]).map((a)=>Number.parseFloat(a.Total?.UnblendedCost?.Amount??"0"))}}class Z{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async describeFileSystems(e){let t=[];if(e?.FileSystemId)t.push(`FileSystemId=${encodeURIComponent(e.FileSystemId)}`);if(e?.CreationToken)t.push(`CreationToken=${encodeURIComponent(e.CreationToken)}`);let r=`/2015-02-01/file-systems${t.length>0?`?${t.join("&")}`:""}`;return{FileSystems:((await this.client.request({service:"elasticfilesystem",region:this.region,method:"GET",path:r,headers:{"Content-Type":"application/json"}})).FileSystems||[]).map((s)=>({FileSystemId:s.FileSystemId,Name:s.Name,CreationTime:s.CreationTime,LifeCycleState:s.LifeCycleState,NumberOfMountTargets:s.NumberOfMountTargets,SizeInBytes:s.SizeInBytes?{Value:s.SizeInBytes.Value,Timestamp:s.SizeInBytes.Timestamp}:void 0,PerformanceMode:s.PerformanceMode,Encrypted:s.Encrypted,ThroughputMode:s.ThroughputMode,Tags:s.Tags}))}}}class ee{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async call(e,t){return this.client.request({service:"wafv2",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":`AWSWAF_20190729.${e}`},body:JSON.stringify(t)})}async listWebACLs(e="REGIONAL"){return(await this.call("ListWebACLs",{Scope:e,Limit:100}))?.WebACLs??[]}async getWebACLRules(e,t,r="REGIONAL"){return((await this.call("GetWebACL",{Name:e,Id:t,Scope:r}))?.WebACL?.Rules??[]).map((o)=>({Name:o.Name,Priority:o.Priority,Action:o.Action?Object.keys(o.Action)[0]:o.OverrideAction?Object.keys(o.OverrideAction)[0]:"count"}))}}function ue(e){return String(e).padStart(2,"0")}function _(e){return`${e.getUTCFullYear()}-${ue(e.getUTCMonth()+1)}-${ue(e.getUTCDate())}`}function Ae(e){let t=Math.max(0,Math.round((Date.now()-e)/1000));if(t<60)return`${t}s ago`;let r=Math.round(t/60);if(r<60)return`${r}m ago`;let a=Math.round(r/60);if(a<48)return`${a}h ago`;return`${Math.round(a/24)}d ago`}async function B(e,t,r,a,s,o){let f=await e.getMetricStatistics({Namespace:"AWS/Lambda",MetricName:r,Dimensions:[{Name:"FunctionName",Value:t}],StartTime:s,EndTime:o,Period:86400,Statistics:[a]}).catch(()=>[]);if(!f.length)return 0;if(a==="Sum")return f.reduce((m,d)=>m+(d.Sum??0),0);if(a==="Maximum")return Math.max(...f.map((m)=>m.Maximum??0));return f.reduce((m,d)=>m+(d.Average??0),0)/f.length}async function j(e,t,r,a,s,o,f){let m=await e.getMetricStatistics({Namespace:t,MetricName:r,Dimensions:a,StartTime:o,EndTime:f,Period:86400,Statistics:[s]}).catch(()=>[]);if(!m.length)return 0;if(s==="Sum")return m.reduce((d,y)=>d+(y.Sum??0),0);if(s==="Maximum")return Math.max(...m.map((d)=>d.Maximum??0));return m.reduce((d,y)=>d+(y.Average??0),0)/m.length}async function te(e,t,r,a,s){let o=await e.getMetricStatistics({Namespace:"AWS/Lambda",MetricName:"Duration",Dimensions:[{Name:"FunctionName",Value:t}],StartTime:a,EndTime:s,Period:86400,ExtendedStatistics:[r]}).catch(()=>[]);return Math.round(o.reduce((f,m)=>f+(m.Percentiles?.[r]??0),0))}async function si(e,t){let r=await z(e,t),a=r.region,s=new G(a),o=new I(a),f=new oe(a),m=new Date,d=new Date(m.getTime()-86400000),y=e.environments?.[t]?.app,i={};i.app={name:r.slug,env:t,region:a,runtime:y?.kind==="php"?`php-${y?.phpVersion??"8.3"} (fpm)`:y?.kind??"node",url:r.endpoint??"",build:r.lastRelease?.sha?.slice(0,7)??"—",deployedAt:r.lastRelease?.timestamp??"—"},i.maintenance={enabled:!1},i.scheduler={enabled:r.scheduler!=="off",expression:r.scheduler==="sub-minute"?"rate(1 minute) · sub-minute":"rate(1 minute)",lastRun:"—"};let L=0,b=0,E=0,K=[],N=[],F=[];for(let n of r.functions){let[u,l,c,C,h,T,A,M,R]=await Promise.all([B(s,n.name,"Invocations","Sum",d,m),B(s,n.name,"Errors","Sum",d,m),B(s,n.name,"Throttles","Sum",d,m),B(s,n.name,"Duration","Average",d,m),o.getFunction(n.name).catch(()=>null),te(s,n.name,"p50",d,m),te(s,n.name,"p95",d,m),te(s,n.name,"p99",d,m),s.getMetricSeries({Namespace:"AWS/Lambda",MetricName:"Invocations",Dimensions:[{Name:"FunctionName",Value:n.name}],StartTime:new Date(m.getTime()-43200000),EndTime:m,Period:3600,Stat:"Sum"}).catch(()=>[])]);L+=u,b+=l,E=Math.max(E,C);let U=h?.Configuration?.MemorySize??0,x=Object.keys(h?.Configuration?.Environment?.Variables??{}),q=[],S=0;try{let{events:J=[]}=await f.filterLogEvents({logGroupName:`/aws/lambda/${n.name}`,startTime:d.getTime(),limit:120});for(let w of J){let k=(w.message??"").trim(),re=/Max Memory Used:\s*(\d+)\s*MB/.exec(k);if(re)S=Math.max(S,Number(re[1]));if(k&&!/^(?:START|END|REPORT|INIT_START)/.test(k))F.push({source:n.mode||n.name,timestamp:new Date(w.timestamp??0).toISOString(),when:Ae(w.timestamp??0),message:k.slice(0,400),level:/error|exception|fatal|panic|traceback/i.test(k)?"error":/warn|warning|timeout|retr(?:y|ies)|throttl/i.test(k)?"warn":"info"})}q=J.filter((w)=>!/^(?:START|END|REPORT|INIT_START)/.test((w.message??"").trim())).slice(-6).map((w)=>({ts:new Date(w.timestamp??0).toISOString().slice(11,19),msg:(w.message??"").trim().slice(0,120),err:/error|exception|fatal/i.test(w.message??"")}))}catch{}let P=Math.max(1,...R);K.push({key:n.mode,name:n.name,version:n.version,memory:U,timeout:h?.Configuration?.Timeout??0,runtime:h?.Configuration?.Runtime??"provided.al2023",invocations:Math.round(u),errors:Math.round(l),p95:A||Math.round(C),status:"active",provisioned:n.provisioned?`${n.provisioned.allocated}/${n.provisioned.requested}`:void 0}),N.push({key:n.mode,name:n.name,runtime:h?.Configuration?.Runtime??"provided.al2023",arch:h?.Configuration?.Architectures?.[0]??"x86_64",memory:U,timeout:h?.Configuration?.Timeout??0,ephemeral:h?.Configuration?.EphemeralStorage?.Size??512,version:n.version,concurrency:y?.concurrency??"—",invocations:Math.round(u),errors:Math.round(l),throttles:Math.round(c),p50:T||Math.round(C),p95:A||Math.round(C),p99:M||Math.round(C),maxMem:S,spark:R.length?R.map((J)=>Math.round(J/P*100)):[0],env:x.length?x:["(none)"],recent:q.length?q:[{ts:"—",msg:"no recent events",err:!1}]})}i.functions=K,i.functionsDetail=N,i.serverlessLogs=F.sort((n,u)=>String(u.timestamp).localeCompare(String(n.timestamp))).slice(0,600),i.serverlessLogsEmptyReason=F.length?void 0:"No recent function logs were found in CloudWatch for this environment.";let H=L?Number((b/L*100).toFixed(2)):0,Y=Math.round(await B(s,r.functions[0]?.name??"","ConcurrentExecutions","Maximum",d,m));i.metrics={invocations:Math.round(L),errorRatePct:H,p95Ms:Math.round(E),coldStartPct:void 0,concurrency:Y,estCostUsd:void 0};try{let n=new V(a),u=[],l=[],c=0;try{let{QueueUrl:h}=await n.getQueueUrl(`${r.slug}-${t}-dlq`),{Attributes:T}=await n.getQueueAttributes(h);c=Number(T.ApproximateNumberOfMessages??0)}catch{}let C=y?Jt(y,r.slug,t):[];for(let h of C){let T=h.name.replace(`${r.slug}-${t}-`,""),A=0,M=0;try{let{QueueUrl:U}=await n.getQueueUrl(h.name),{Attributes:x}=await n.getQueueAttributes(U);A=Number(x.ApproximateNumberOfMessages??0),M=Number(x.ApproximateNumberOfMessagesNotVisible??0)}catch{}let R=Math.round(await j(s,"AWS/SQS","NumberOfMessagesDeleted",[{Name:"QueueName",Value:h.name}],"Sum",d,m));u.push({name:T,visible:A,inFlight:M,processed:R,dlq:c}),l.push({name:h.name,short:T,visible:A,inFlight:M,delayed:0,processed:R,oldestSec:0,concurrency:h.concurrency??y?.queueConcurrency??"—",tries:y?.queueTries??3,visTimeout:(y?.queueTimeout??120)*6,dlq:c})}if(u.length)i.queues=u;if(l.length)i.queuesDetail=l;i.dlqItems=[]}catch{}try{let n=new v(a),{Stacks:u}=await n.describeStacks({stackName:xe(e,t)}),l={};for(let c of u?.[0]?.Outputs??[])if(c.OutputKey)l[c.OutputKey]=c.OutputValue??"";if(y?.database?.connection==="aurora-serverless"){let c=`${r.slug}-${t}-db`,C=[{Name:"DBClusterIdentifier",Value:c}],[h,T]=await Promise.all([j(s,"AWS/RDS","ServerlessDatabaseCapacity",C,"Average",d,m),j(s,"AWS/RDS","DatabaseConnections",C,"Maximum",d,m)]);if(i.aurora={id:c,engine:"aurora-mysql",minAcu:y?.database?.minCapacity??0.5,maxAcu:y?.database?.maxCapacity??4,currentAcu:h?Number(h.toFixed(1)):y?.database?.minCapacity??0.5,database:"app",connections:Math.round(T),status:l.DbEndpoint?"available":"creating"},y?.rdsProxy)i.proxy={name:`${r.slug}-${t}-proxy`,endpoint:l.DbProxyEndpoint??"—",pooledConns:Math.round(T),status:"available"}}if(y?.cache?.driver==="elasticache"){let c=`${r.slug}-${t}-cache`,C=[{Name:"CacheClusterId",Value:`${c}-001`}],[h,T]=await Promise.all([j(s,"AWS/ElastiCache","CacheHits",C,"Sum",d,m),j(s,"AWS/ElastiCache","CacheMisses",C,"Sum",d,m)]),A=h+T>0?Number((h/(h+T)*100).toFixed(1)):0;i.redis={id:c,node:"cache.t4g.micro",engine:"redis",hitRate:A,status:l.CacheEndpoint?"available":"creating"}}if(y?.efs){let c=0;try{if(l.EfsFileSystemId){let C=new Z(a),{FileSystems:h}=await C.describeFileSystems({FileSystemId:l.EfsFileSystemId});c=Number(((h?.[0]?.SizeInBytes?.Value??0)/1048576).toFixed(1))}}catch{}i.efs={id:l.EfsFileSystemId??"efs",mount:"/mnt/local",sizeMb:c,status:"available"}}i.assetsInfo=l.AssetsCdnDomain?{bucket:l.AssetsBucketName??`${r.slug}-${t}-assets`,cdn:l.AssetsCdnDomain,customDomain:y?.assetDomain??"—",assetUrl:r.assetUrl??"—",files:0,sizeMb:0,cacheHitPct:0,build:i.app.build}:void 0}catch{}if(i.assetsInfo)try{let u=await new g(a).list({bucket:i.assetsInfo.bucket,maxKeys:1000});i.assetsInfo.files=u.length,i.assetsInfo.sizeMb=Number((u.reduce((l,c)=>l+(c.Size??0),0)/1048576).toFixed(1)),i.assetsRecent=u.slice(0,8).map((l)=>({path:`/${l.Key}`,size:`${Math.max(1,Math.round((l.Size??0)/1024))} KB`,type:l.Key.split(".").pop()??""}))}catch{}try{if(y?.secrets){let n=Array.isArray(y.secrets)?y.secrets.map((u)=>({key:u.split("/").pop().toUpperCase().replace(/[^A-Z0-9_]/g,"_"),source:u})):Object.entries(y.secrets).map(([u,l])=>({key:u,source:String(l)}));i.secretsList=n.map((u)=>({...u,updated:"—"}))}}catch{}try{let n=new g(a),u=`${r.slug}-${t}-deployments`,l=await n.getObjectJson(u,`deployments/${r.slug}/${t}/history.json`).catch(()=>null);if(l?.records?.length)i.deploymentsDetail=l.records.slice(-12).reverse().map((c)=>({sha:(c.sha??"").slice(0,7),status:c.status??"success",when:c.timestamp??"—",took:c.took??"—",by:c.by??"—",version:c.version??"—",hooks:c.hooks??[]}))}catch{}i.metricsTotals={invocations:i.metrics.invocations,errors:Math.round(b),errorRatePct:H,p95Ms:i.metrics.p95Ms,throttles:N.reduce((n,u)=>n+u.throttles,0),coldStartPct:void 0,estCostUsd:void 0,concurrency:Y},i.metricsPerFn=N.map((n)=>({key:n.key,invocations:n.invocations,errors:n.errors,throttles:n.throttles,avgMs:n.p50,maxMs:n.p99,costUsd:void 0}));try{i.invSpark=await s.getMetricSeries({Namespace:"AWS/Lambda",MetricName:"Invocations",Dimensions:[{Name:"FunctionName",Value:r.functions.find((n)=>n.mode==="http")?.name??""}],StartTime:new Date(m.getTime()-86400000),EndTime:m,Period:3600,Stat:"Sum"})}catch{}try{let n=new He,u=m,l=new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),1)),c=new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth()-1,1)),[C,h]=await Promise.all([n.getCostByService({start:_(l),end:_(u),granularity:"MONTHLY"}).catch(()=>[]),n.getCostByService({start:_(c),end:_(l),granularity:"MONTHLY"}).catch(()=>[])]);if(C.length){let T=C.reduce((S,P)=>S+P.amount,0),A=h.reduce((S,P)=>S+P.amount,0),M=u.getUTCDate(),R=new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth()+1,0)).getUTCDate();i.costSummary={monthToDateUsd:Number(T.toFixed(2)),projectedUsd:Number((T/M*R).toFixed(2)),lastMonthUsd:Number(A.toFixed(2)),dailyAvgUsd:Number((T/M).toFixed(2))},i.costServices=C.filter((S)=>S.amount>0).sort((S,P)=>P.amount-S.amount).slice(0,12).map((S)=>({name:S.service,usd:Number(S.amount.toFixed(2)),note:""})),i.metrics.estCostUsd=Number((T/M).toFixed(2)),i.metricsTotals.estCostUsd=i.metrics.estCostUsd,i.costTrend=await n.getDailyTotals({start:_(l),end:_(u)}).catch(()=>[]);let U=C.find((S)=>/lambda/i.test(S.service))?.amount??0,x=(S)=>S.invocations*(S.p50/1000)*(S.memory/1024),q=N.reduce((S,P)=>S+x(P),0)||1;i.costPerFn=N.map((S)=>({key:S.key,requests:S.invocations,gbSec:Math.round(x(S)),usd:Number((U*(x(S)/q)).toFixed(2))}))}}catch{}if(y?.firewall)try{let n=await s.getMetricStatistics({Namespace:"AWS/WAFV2",MetricName:"BlockedRequests",StartTime:d,EndTime:m,Period:86400,Statistics:["Sum"]}).catch(()=>[]),u=await s.getMetricStatistics({Namespace:"AWS/WAFV2",MetricName:"AllowedRequests",StartTime:d,EndTime:m,Period:86400,Statistics:["Sum"]}).catch(()=>[]);i.waf={enabled:!0,scope:"REGIONAL",acl:`${r.slug}-${t}-waf`,allowed24h:Math.round(u.reduce((l,c)=>l+(c.Sum??0),0)),blocked24h:Math.round(n.reduce((l,c)=>l+(c.Sum??0),0))};try{let l=new ee(a),c=await l.listWebACLs("REGIONAL"),C=c.find((h)=>h.Name?.includes(`${r.slug}-${t}`))??c[0];if(C?.Name&&C.Id){i.waf.acl=C.Name;let h=await l.getWebACLRules(C.Name,C.Id,"REGIONAL");if(h.length)i.wafRules=h.map((T)=>({name:T.Name??"—",detail:`priority ${T.Priority??0}`,action:T.Action??"count",blocked24h:0}))}}catch{}}catch{}let O=[];if(i.aurora)O.push({name:"Aurora Serverless v2",detail:`${i.aurora.id} · ${i.aurora.minAcu}-${i.aurora.maxAcu} ACU`,status:i.aurora.status});if(i.proxy)O.push({name:"RDS Proxy",detail:i.proxy.name,status:i.proxy.status});if(i.redis)O.push({name:`ElastiCache (${i.redis.engine})`,detail:`${i.redis.node} · ${i.redis.hitRate}% hit rate`,status:i.redis.status});if(i.efs)O.push({name:"EFS",detail:`${i.efs.mount} · ${i.efs.sizeMb} MB`,status:i.efs.status});if(O.length)i.dataServices=O;if(r.scheduler!=="off"&&y?.kind==="php")try{let n=await Ft(e,t,"schedule:list"),u=[];for(let l of(n||"").split(`
|
|
1
|
+
import{xe,Jt}from"./chunk-dj03v81n.js";import{p,D}from"./chunk-psvqpztv.js";import{v}from"./chunk-xdk0gmxt.js";import{Ct,g}from"./chunk-12x968en.js";import{I}from"./chunk-de69nra4.js";import{V}from"./chunk-xx9mrcfs.js";import{Bt,z}from"./chunk-qq1f07te.js";import{hc}from"./chunk-5nmt4s5w.js";class G{client;region;constructor(e="us-east-1",t){this.region=e,this.client=new p(Ct(t))}async query(e){let t=new URLSearchParams(D({Version:"2010-08-01",...e})).toString();return this.client.request({service:"monitoring",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t})}async getMetricStatistics(e){let t={Action:"GetMetricStatistics",Namespace:e.Namespace,MetricName:e.MetricName,StartTime:e.StartTime.toISOString(),EndTime:e.EndTime.toISOString(),Period:e.Period};(e.Statistics??[]).forEach((o,f)=>{t[`Statistics.member.${f+1}`]=o}),(e.ExtendedStatistics??[]).forEach((o,f)=>{t[`ExtendedStatistics.member.${f+1}`]=o}),(e.Dimensions??[]).forEach((o,f)=>{t[`Dimensions.member.${f+1}.Name`]=o.Name,t[`Dimensions.member.${f+1}.Value`]=o.Value});let r=await this.query(t),s=(r.GetMetricStatisticsResult||r)?.Datapoints?.member??[];if(!Array.isArray(s))s=s?[s]:[];return s.map((o)=>{let f={},m=o.ExtendedStatistics?.entry;if(m){if(!Array.isArray(m))m=[m];for(let d of m)if(d?.key!=null)f[d.key]=Number(d.value)}return{Timestamp:o.Timestamp,Sum:o.Sum!=null?Number(o.Sum):void 0,Average:o.Average!=null?Number(o.Average):void 0,Maximum:o.Maximum!=null?Number(o.Maximum):void 0,Minimum:o.Minimum!=null?Number(o.Minimum):void 0,Percentiles:Object.keys(f).length?f:void 0,Unit:o.Unit}})}async getMetricSeries(e){let t=/^p\d/.test(e.Stat);return(await this.getMetricStatistics({Namespace:e.Namespace,MetricName:e.MetricName,Dimensions:e.Dimensions,StartTime:e.StartTime,EndTime:e.EndTime,Period:e.Period,Statistics:t?[]:[e.Stat],ExtendedStatistics:t?[e.Stat]:[]})).slice().sort((a,s)=>new Date(a.Timestamp??0).getTime()-new Date(s.Timestamp??0).getTime()).map((a)=>t?a.Percentiles?.[e.Stat]??0:a[e.Stat]??0)}async describeAlarms(e){let t={Action:"DescribeAlarms"};if(e?.AlarmNamePrefix)t.AlarmNamePrefix=e.AlarmNamePrefix;if(e?.MaxRecords)t.MaxRecords=e.MaxRecords;let r=await this.query(t),s=(r.DescribeAlarmsResult||r)?.MetricAlarms?.member??[];if(!Array.isArray(s))s=s?[s]:[];return s.map((o)=>({AlarmName:o.AlarmName,StateValue:o.StateValue,MetricName:o.MetricName,ComparisonOperator:o.ComparisonOperator,Threshold:o.Threshold!=null?Number(o.Threshold):void 0,Namespace:o.Namespace}))}async putMetricAlarm(e){let t={Action:"PutMetricAlarm",AlarmName:e.AlarmName,Namespace:e.Namespace,MetricName:e.MetricName,ComparisonOperator:e.ComparisonOperator,Threshold:e.Threshold,EvaluationPeriods:e.EvaluationPeriods,Period:e.Period,Statistic:e.Statistic};if(e.AlarmDescription)t.AlarmDescription=e.AlarmDescription;(e.Dimensions??[]).forEach((r,a)=>{t[`Dimensions.member.${a+1}.Name`]=r.Name,t[`Dimensions.member.${a+1}.Value`]=r.Value}),(e.AlarmActions??[]).forEach((r,a)=>{t[`AlarmActions.member.${a+1}`]=r}),await this.query(t)}async deleteAlarms(e){if(!e.length)return;let t={Action:"DeleteAlarms"};e.forEach((r,a)=>{t[`AlarmNames.member.${a+1}`]=r}),await this.query(t)}}class oe{client;region;constructor(e="us-east-1",t){this.region=e,this.client=new p(void 0,{profile:t})}async createLogGroup(e,t){await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.CreateLogGroup","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({logGroupName:e,...t?{tags:t}:{}})})}async putRetentionPolicy(e,t){if(![1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1096,1827,2192,2557,2922,3288,3653].includes(t))throw Error("Unsupported CloudWatch Logs retention period");await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.PutRetentionPolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({logGroupName:e,retentionInDays:t})})}async describeLogStreams(e){let t={logGroupName:e.logGroupName};if(e.logStreamNamePrefix)t.logStreamNamePrefix=e.logStreamNamePrefix;if(e.orderBy)t.orderBy=e.orderBy;if(e.descending!==void 0)t.descending=e.descending;if(e.limit)t.limit=e.limit;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.DescribeLogStreams","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}async getLogEvents(e){let t={logGroupName:e.logGroupName,logStreamName:e.logStreamName};if(e.startTime)t.startTime=e.startTime;if(e.endTime)t.endTime=e.endTime;if(e.limit)t.limit=e.limit;if(e.startFromHead!==void 0)t.startFromHead=e.startFromHead;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.GetLogEvents","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}async describeLogGroups(e){let t={};if(e?.logGroupNamePrefix)t.logGroupNamePrefix=e.logGroupNamePrefix;if(e?.limit)t.limit=e.limit;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.DescribeLogGroups","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}async deleteLogGroup(e){await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.DeleteLogGroup","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({logGroupName:e})})}async filterLogEvents(e){let t={logGroupName:e.logGroupName};if(e.logStreamNames)t.logStreamNames=e.logStreamNames;if(e.startTime)t.startTime=e.startTime;if(e.endTime)t.endTime=e.endTime;if(e.filterPattern)t.filterPattern=e.filterPattern;if(e.limit)t.limit=e.limit;return await this.client.request({service:"logs",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"Logs_20140328.FilterLogEvents","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(t)})}}import{createHash as le}from"node:crypto";import{existsSync as se,mkdirSync as de,readdirSync as ge,readFileSync as pe,rmSync as he,writeFileSync as ye}from"node:fs";import{homedir as fe}from"node:os";import{join as W}from"node:path";var ie=1,ae=3600000,Se=24*ae,Ce=ae,Te=30*Se;function X(){let e=process.env.XDG_CACHE_HOME;return W(e&&e.trim()?e:W(fe(),".cache"),"ts-cloud","cost-explorer")}function Q(e){return W(X(),e??"__default__")}function ne(e){let t={s:e.start,e:e.end,g:e.granularity,m:[...e.metrics].sort(),gb:[...e.groupBy].map((r)=>`${r.Type}:${r.Key}`).sort(),f:e.filter??null};return le("sha256").update(JSON.stringify(t)).digest("hex").slice(0,24)}function be(e,t){let r=Date.parse(`${t}T00:00:00Z`);if(Number.isNaN(r))return!1;let a=new Date,s=Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1);return r<=s}function Ne(e){return be(e.start,e.end)?Te:Ce}function me(e,t){let r=W(Q(e),`${ne(t)}.json`);if(!se(r))return null;let a;try{a=JSON.parse(pe(r,"utf-8"))}catch{return null}if(a.schema!==ie)return null;let s=Date.now()-a.savedAt;if(s<0||s>Ne(t))return null;return{response:a.response,ageSeconds:Math.floor(s/1000)}}function ce(e,t,r){let a=Q(e);de(a,{recursive:!0});let s={schema:ie,savedAt:Date.now(),key:t,response:r};ye(W(a,`${ne(t)}.json`),JSON.stringify(s))}function dc(e){let t=e===void 0?X():Q(e);if(!se(t))return{deletedFiles:0,scope:e??"all profiles"};let r=0;function a(s){for(let o of ge(s,{withFileTypes:!0})){let f=W(s,o.name);if(o.isDirectory())a(f);else if(o.isFile()&&o.name.endsWith(".json"))r++}}return a(t),he(t,{recursive:!0,force:!0}),{deletedFiles:r,scope:e??"all profiles"}}function uc(e){return e===void 0?X():Q(e)}class He{client;profile;useCache;lastCacheAgeSeconds=null;constructor(e,t){this.profile=e,this.useCache=t?.useCache??!0,this.client=new p(Ct(e))}async getCostByService(e){return(await this.getCostByDimension({...e,dimension:"SERVICE"})).map((r)=>({service:r.key,amount:r.amount,unit:r.unit}))}async getCostByDimension(e){let{start:t,end:r,dimension:a,granularity:s="MONTHLY",filter:o}=e,f=["UnblendedCost"],m=[{Type:"DIMENSION",Key:a}],d={start:t,end:r,granularity:s,metrics:f,groupBy:m,filter:o};if(this.useCache){let b=me(this.profile,d);if(b)return this.lastCacheAgeSeconds=b.ageSeconds,b.response}this.lastCacheAgeSeconds=null;let y=new Map,i;do{let b={TimePeriod:{Start:t,End:r},Granularity:s,Metrics:f,GroupBy:m};if(o)b.Filter=o;if(i)b.NextPageToken=i;let E=await this.client.request({service:"ce",region:"us-east-1",method:"POST",path:"/",headers:{"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSInsightsIndexService.GetCostAndUsage"},body:JSON.stringify(b)});for(let K of E?.ResultsByTime??[])for(let N of K?.Groups??[]){let F=N.Keys?.[0]??"Unknown",H=Number.parseFloat(N.Metrics?.UnblendedCost?.Amount??"0"),Y=N.Metrics?.UnblendedCost?.Unit??"USD",O=y.get(F);y.set(F,{key:F,amount:(O?.amount??0)+H,unit:Y})}i=E?.NextPageToken||void 0}while(i);let L=[...y.values()].filter((b)=>b.amount>0).sort((b,E)=>E.amount-b.amount);if(this.useCache)ce(this.profile,d,L);return L}async getDailyTotals(e){return((await this.client.request({service:"ce",region:"us-east-1",method:"POST",path:"/",headers:{"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSInsightsIndexService.GetCostAndUsage"},body:JSON.stringify({TimePeriod:{Start:e.start,End:e.end},Granularity:"DAILY",Metrics:["UnblendedCost"]})}))?.ResultsByTime??[]).map((a)=>Number.parseFloat(a.Total?.UnblendedCost?.Amount??"0"))}}class Z{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async describeFileSystems(e){let t=[];if(e?.FileSystemId)t.push(`FileSystemId=${encodeURIComponent(e.FileSystemId)}`);if(e?.CreationToken)t.push(`CreationToken=${encodeURIComponent(e.CreationToken)}`);let r=`/2015-02-01/file-systems${t.length>0?`?${t.join("&")}`:""}`;return{FileSystems:((await this.client.request({service:"elasticfilesystem",region:this.region,method:"GET",path:r,headers:{"Content-Type":"application/json"}})).FileSystems||[]).map((s)=>({FileSystemId:s.FileSystemId,Name:s.Name,CreationTime:s.CreationTime,LifeCycleState:s.LifeCycleState,NumberOfMountTargets:s.NumberOfMountTargets,SizeInBytes:s.SizeInBytes?{Value:s.SizeInBytes.Value,Timestamp:s.SizeInBytes.Timestamp}:void 0,PerformanceMode:s.PerformanceMode,Encrypted:s.Encrypted,ThroughputMode:s.ThroughputMode,Tags:s.Tags}))}}}class ee{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async call(e,t){return this.client.request({service:"wafv2",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":`AWSWAF_20190729.${e}`},body:JSON.stringify(t)})}async listWebACLs(e="REGIONAL"){return(await this.call("ListWebACLs",{Scope:e,Limit:100}))?.WebACLs??[]}async getWebACLRules(e,t,r="REGIONAL"){return((await this.call("GetWebACL",{Name:e,Id:t,Scope:r}))?.WebACL?.Rules??[]).map((o)=>({Name:o.Name,Priority:o.Priority,Action:o.Action?Object.keys(o.Action)[0]:o.OverrideAction?Object.keys(o.OverrideAction)[0]:"count"}))}}function ue(e){return String(e).padStart(2,"0")}function _(e){return`${e.getUTCFullYear()}-${ue(e.getUTCMonth()+1)}-${ue(e.getUTCDate())}`}function Ae(e){let t=Math.max(0,Math.round((Date.now()-e)/1000));if(t<60)return`${t}s ago`;let r=Math.round(t/60);if(r<60)return`${r}m ago`;let a=Math.round(r/60);if(a<48)return`${a}h ago`;return`${Math.round(a/24)}d ago`}async function B(e,t,r,a,s,o){let f=await e.getMetricStatistics({Namespace:"AWS/Lambda",MetricName:r,Dimensions:[{Name:"FunctionName",Value:t}],StartTime:s,EndTime:o,Period:86400,Statistics:[a]}).catch(()=>[]);if(!f.length)return 0;if(a==="Sum")return f.reduce((m,d)=>m+(d.Sum??0),0);if(a==="Maximum")return Math.max(...f.map((m)=>m.Maximum??0));return f.reduce((m,d)=>m+(d.Average??0),0)/f.length}async function j(e,t,r,a,s,o,f){let m=await e.getMetricStatistics({Namespace:t,MetricName:r,Dimensions:a,StartTime:o,EndTime:f,Period:86400,Statistics:[s]}).catch(()=>[]);if(!m.length)return 0;if(s==="Sum")return m.reduce((d,y)=>d+(y.Sum??0),0);if(s==="Maximum")return Math.max(...m.map((d)=>d.Maximum??0));return m.reduce((d,y)=>d+(y.Average??0),0)/m.length}async function te(e,t,r,a,s){let o=await e.getMetricStatistics({Namespace:"AWS/Lambda",MetricName:"Duration",Dimensions:[{Name:"FunctionName",Value:t}],StartTime:a,EndTime:s,Period:86400,ExtendedStatistics:[r]}).catch(()=>[]);return Math.round(o.reduce((f,m)=>f+(m.Percentiles?.[r]??0),0))}async function si(e,t){let r=await z(e,t),a=r.region,s=new G(a),o=new I(a),f=new oe(a),m=new Date,d=new Date(m.getTime()-86400000),y=e.environments?.[t]?.app,i={};i.app={name:r.slug,env:t,region:a,runtime:y?.kind==="php"?`php-${y?.phpVersion??"8.3"} (fpm)`:y?.kind??"node",url:r.endpoint??"",build:r.lastRelease?.sha?.slice(0,7)??"—",deployedAt:r.lastRelease?.timestamp??"—"},i.maintenance={enabled:!1},i.scheduler={enabled:r.scheduler!=="off",expression:r.scheduler==="sub-minute"?"rate(1 minute) · sub-minute":"rate(1 minute)",lastRun:"—"};let L=0,b=0,E=0,K=[],N=[],F=[];for(let n of r.functions){let[u,l,c,C,h,T,A,M,R]=await Promise.all([B(s,n.name,"Invocations","Sum",d,m),B(s,n.name,"Errors","Sum",d,m),B(s,n.name,"Throttles","Sum",d,m),B(s,n.name,"Duration","Average",d,m),o.getFunction(n.name).catch(()=>null),te(s,n.name,"p50",d,m),te(s,n.name,"p95",d,m),te(s,n.name,"p99",d,m),s.getMetricSeries({Namespace:"AWS/Lambda",MetricName:"Invocations",Dimensions:[{Name:"FunctionName",Value:n.name}],StartTime:new Date(m.getTime()-43200000),EndTime:m,Period:3600,Stat:"Sum"}).catch(()=>[])]);L+=u,b+=l,E=Math.max(E,C);let U=h?.Configuration?.MemorySize??0,x=Object.keys(h?.Configuration?.Environment?.Variables??{}),q=[],S=0;try{let{events:J=[]}=await f.filterLogEvents({logGroupName:`/aws/lambda/${n.name}`,startTime:d.getTime(),limit:120});for(let w of J){let k=(w.message??"").trim(),re=/Max Memory Used:\s*(\d+)\s*MB/.exec(k);if(re)S=Math.max(S,Number(re[1]));if(k&&!/^(?:START|END|REPORT|INIT_START)/.test(k))F.push({source:n.mode||n.name,timestamp:new Date(w.timestamp??0).toISOString(),when:Ae(w.timestamp??0),message:k.slice(0,400),level:/error|exception|fatal|panic|traceback/i.test(k)?"error":/warn|warning|timeout|retr(?:y|ies)|throttl/i.test(k)?"warn":"info"})}q=J.filter((w)=>!/^(?:START|END|REPORT|INIT_START)/.test((w.message??"").trim())).slice(-6).map((w)=>({ts:new Date(w.timestamp??0).toISOString().slice(11,19),msg:(w.message??"").trim().slice(0,120),err:/error|exception|fatal/i.test(w.message??"")}))}catch{}let P=Math.max(1,...R);K.push({key:n.mode,name:n.name,version:n.version,memory:U,timeout:h?.Configuration?.Timeout??0,runtime:h?.Configuration?.Runtime??"provided.al2023",invocations:Math.round(u),errors:Math.round(l),p95:A||Math.round(C),status:"active",provisioned:n.provisioned?`${n.provisioned.allocated}/${n.provisioned.requested}`:void 0}),N.push({key:n.mode,name:n.name,runtime:h?.Configuration?.Runtime??"provided.al2023",arch:h?.Configuration?.Architectures?.[0]??"x86_64",memory:U,timeout:h?.Configuration?.Timeout??0,ephemeral:h?.Configuration?.EphemeralStorage?.Size??512,version:n.version,concurrency:y?.concurrency??"—",invocations:Math.round(u),errors:Math.round(l),throttles:Math.round(c),p50:T||Math.round(C),p95:A||Math.round(C),p99:M||Math.round(C),maxMem:S,spark:R.length?R.map((J)=>Math.round(J/P*100)):[0],env:x.length?x:["(none)"],recent:q.length?q:[{ts:"—",msg:"no recent events",err:!1}]})}i.functions=K,i.functionsDetail=N,i.serverlessLogs=F.sort((n,u)=>String(u.timestamp).localeCompare(String(n.timestamp))).slice(0,600),i.serverlessLogsEmptyReason=F.length?void 0:"No recent function logs were found in CloudWatch for this environment.";let H=L?Number((b/L*100).toFixed(2)):0,Y=Math.round(await B(s,r.functions[0]?.name??"","ConcurrentExecutions","Maximum",d,m));i.metrics={invocations:Math.round(L),errorRatePct:H,p95Ms:Math.round(E),coldStartPct:void 0,concurrency:Y,estCostUsd:void 0};try{let n=new V(a),u=[],l=[],c=0;try{let{QueueUrl:h}=await n.getQueueUrl(`${r.slug}-${t}-dlq`),{Attributes:T}=await n.getQueueAttributes(h);c=Number(T.ApproximateNumberOfMessages??0)}catch{}let C=y?Jt(y,r.slug,t):[];for(let h of C){let T=h.name.replace(`${r.slug}-${t}-`,""),A=0,M=0;try{let{QueueUrl:U}=await n.getQueueUrl(h.name),{Attributes:x}=await n.getQueueAttributes(U);A=Number(x.ApproximateNumberOfMessages??0),M=Number(x.ApproximateNumberOfMessagesNotVisible??0)}catch{}let R=Math.round(await j(s,"AWS/SQS","NumberOfMessagesDeleted",[{Name:"QueueName",Value:h.name}],"Sum",d,m));u.push({name:T,visible:A,inFlight:M,processed:R,dlq:c}),l.push({name:h.name,short:T,visible:A,inFlight:M,delayed:0,processed:R,oldestSec:0,concurrency:h.concurrency??y?.queueConcurrency??"—",tries:y?.queueTries??3,visTimeout:(y?.queueTimeout??120)*6,dlq:c})}if(u.length)i.queues=u;if(l.length)i.queuesDetail=l;i.dlqItems=[]}catch{}try{let n=new v(a),{Stacks:u}=await n.describeStacks({stackName:xe(e,t)}),l={};for(let c of u?.[0]?.Outputs??[])if(c.OutputKey)l[c.OutputKey]=c.OutputValue??"";if(y?.database?.connection==="aurora-serverless"){let c=`${r.slug}-${t}-db`,C=[{Name:"DBClusterIdentifier",Value:c}],[h,T]=await Promise.all([j(s,"AWS/RDS","ServerlessDatabaseCapacity",C,"Average",d,m),j(s,"AWS/RDS","DatabaseConnections",C,"Maximum",d,m)]);if(i.aurora={id:c,engine:"aurora-mysql",minAcu:y?.database?.minCapacity??0.5,maxAcu:y?.database?.maxCapacity??4,currentAcu:h?Number(h.toFixed(1)):y?.database?.minCapacity??0.5,database:"app",connections:Math.round(T),status:l.DbEndpoint?"available":"creating"},y?.rdsProxy)i.proxy={name:`${r.slug}-${t}-proxy`,endpoint:l.DbProxyEndpoint??"—",pooledConns:Math.round(T),status:"available"}}if(y?.cache?.driver==="elasticache"){let c=`${r.slug}-${t}-cache`,C=[{Name:"CacheClusterId",Value:`${c}-001`}],[h,T]=await Promise.all([j(s,"AWS/ElastiCache","CacheHits",C,"Sum",d,m),j(s,"AWS/ElastiCache","CacheMisses",C,"Sum",d,m)]),A=h+T>0?Number((h/(h+T)*100).toFixed(1)):0;i.redis={id:c,node:"cache.t4g.micro",engine:"redis",hitRate:A,status:l.CacheEndpoint?"available":"creating"}}if(y?.efs){let c=0;try{if(l.EfsFileSystemId){let C=new Z(a),{FileSystems:h}=await C.describeFileSystems({FileSystemId:l.EfsFileSystemId});c=Number(((h?.[0]?.SizeInBytes?.Value??0)/1048576).toFixed(1))}}catch{}i.efs={id:l.EfsFileSystemId??"efs",mount:"/mnt/local",sizeMb:c,status:"available"}}i.assetsInfo=l.AssetsCdnDomain?{bucket:l.AssetsBucketName??`${r.slug}-${t}-assets`,cdn:l.AssetsCdnDomain,customDomain:y?.assetDomain??"—",assetUrl:r.assetUrl??"—",files:0,sizeMb:0,cacheHitPct:0,build:i.app.build}:void 0}catch{}if(i.assetsInfo)try{let u=await new g(a).list({bucket:i.assetsInfo.bucket,maxKeys:1000});i.assetsInfo.files=u.length,i.assetsInfo.sizeMb=Number((u.reduce((l,c)=>l+(c.Size??0),0)/1048576).toFixed(1)),i.assetsRecent=u.slice(0,8).map((l)=>({path:`/${l.Key}`,size:`${Math.max(1,Math.round((l.Size??0)/1024))} KB`,type:l.Key.split(".").pop()??""}))}catch{}try{if(y?.secrets){let n=Array.isArray(y.secrets)?y.secrets.map((u)=>({key:u.split("/").pop().toUpperCase().replace(/[^A-Z0-9_]/g,"_"),source:u})):Object.entries(y.secrets).map(([u,l])=>({key:u,source:String(l)}));i.secretsList=n.map((u)=>({...u,updated:"—"}))}}catch{}try{let n=new g(a),u=`${r.slug}-${t}-deployments`,l=await n.getObjectJson(u,`deployments/${r.slug}/${t}/history.json`).catch(()=>null);if(l?.records?.length)i.deploymentsDetail=l.records.slice(-12).reverse().map((c)=>({sha:(c.sha??"").slice(0,7),status:c.status??"success",when:c.timestamp??"—",took:c.took??"—",by:c.by??"—",version:c.version??"—",hooks:c.hooks??[]}))}catch{}i.metricsTotals={invocations:i.metrics.invocations,errors:Math.round(b),errorRatePct:H,p95Ms:i.metrics.p95Ms,throttles:N.reduce((n,u)=>n+u.throttles,0),coldStartPct:void 0,estCostUsd:void 0,concurrency:Y},i.metricsPerFn=N.map((n)=>({key:n.key,invocations:n.invocations,errors:n.errors,throttles:n.throttles,avgMs:n.p50,maxMs:n.p99,costUsd:void 0}));try{i.invSpark=await s.getMetricSeries({Namespace:"AWS/Lambda",MetricName:"Invocations",Dimensions:[{Name:"FunctionName",Value:r.functions.find((n)=>n.mode==="http")?.name??""}],StartTime:new Date(m.getTime()-86400000),EndTime:m,Period:3600,Stat:"Sum"})}catch{}try{let n=new He,u=m,l=new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),1)),c=new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth()-1,1)),[C,h]=await Promise.all([n.getCostByService({start:_(l),end:_(u),granularity:"MONTHLY"}).catch(()=>[]),n.getCostByService({start:_(c),end:_(l),granularity:"MONTHLY"}).catch(()=>[])]);if(C.length){let T=C.reduce((S,P)=>S+P.amount,0),A=h.reduce((S,P)=>S+P.amount,0),M=u.getUTCDate(),R=new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth()+1,0)).getUTCDate();i.costSummary={monthToDateUsd:Number(T.toFixed(2)),projectedUsd:Number((T/M*R).toFixed(2)),lastMonthUsd:Number(A.toFixed(2)),dailyAvgUsd:Number((T/M).toFixed(2))},i.costServices=C.filter((S)=>S.amount>0).sort((S,P)=>P.amount-S.amount).slice(0,12).map((S)=>({name:S.service,usd:Number(S.amount.toFixed(2)),note:""})),i.metrics.estCostUsd=Number((T/M).toFixed(2)),i.metricsTotals.estCostUsd=i.metrics.estCostUsd,i.costTrend=await n.getDailyTotals({start:_(l),end:_(u)}).catch(()=>[]);let U=C.find((S)=>/lambda/i.test(S.service))?.amount??0,x=(S)=>S.invocations*(S.p50/1000)*(S.memory/1024),q=N.reduce((S,P)=>S+x(P),0)||1;i.costPerFn=N.map((S)=>({key:S.key,requests:S.invocations,gbSec:Math.round(x(S)),usd:Number((U*(x(S)/q)).toFixed(2))}))}}catch{}if(y?.firewall)try{let n=await s.getMetricStatistics({Namespace:"AWS/WAFV2",MetricName:"BlockedRequests",StartTime:d,EndTime:m,Period:86400,Statistics:["Sum"]}).catch(()=>[]),u=await s.getMetricStatistics({Namespace:"AWS/WAFV2",MetricName:"AllowedRequests",StartTime:d,EndTime:m,Period:86400,Statistics:["Sum"]}).catch(()=>[]);i.waf={enabled:!0,scope:"REGIONAL",acl:`${r.slug}-${t}-waf`,allowed24h:Math.round(u.reduce((l,c)=>l+(c.Sum??0),0)),blocked24h:Math.round(n.reduce((l,c)=>l+(c.Sum??0),0))};try{let l=new ee(a),c=await l.listWebACLs("REGIONAL"),C=c.find((h)=>h.Name?.includes(`${r.slug}-${t}`))??c[0];if(C?.Name&&C.Id){i.waf.acl=C.Name;let h=await l.getWebACLRules(C.Name,C.Id,"REGIONAL");if(h.length)i.wafRules=h.map((T)=>({name:T.Name??"—",detail:`priority ${T.Priority??0}`,action:T.Action??"count",blocked24h:0}))}}catch{}}catch{}let O=[];if(i.aurora)O.push({name:"Aurora Serverless v2",detail:`${i.aurora.id} · ${i.aurora.minAcu}-${i.aurora.maxAcu} ACU`,status:i.aurora.status});if(i.proxy)O.push({name:"RDS Proxy",detail:i.proxy.name,status:i.proxy.status});if(i.redis)O.push({name:`ElastiCache (${i.redis.engine})`,detail:`${i.redis.node} · ${i.redis.hitRate}% hit rate`,status:i.redis.status});if(i.efs)O.push({name:"EFS",detail:`${i.efs.mount} · ${i.efs.sizeMb} MB`,status:i.efs.status});if(O.length)i.dataServices=O;if(r.scheduler!=="off"&&y?.kind==="php")try{let n=await Bt(e,t,"schedule:list"),u=[];for(let l of(n||"").split(`
|
|
2
2
|
`)){let c=/^\s*([\d*/,\-\s]+?)\s{2,}(.+?)(?:\s{2,}Next Due.*)?$/.exec(l);if(c&&/[*\d]/.test(c[1])&&c[1].trim().split(/\s+/).length===5)u.push({command:c[2].trim().replace(/^php artisan /,""),cron:c[1].trim(),desc:"",lastRun:"—",lastStatus:"ok"})}if(u.length)i.schedulerTasks=u}catch{}return i.topology=hc(i,{project:e.project.name,environment:t}),i}
|
|
3
3
|
export{oe,G,dc,uc,He,si};
|