@stacksjs/ts-cloud 0.11.5 → 0.11.7

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.
Files changed (67) hide show
  1. package/dist/bin/{chunk-fdrbeb7p.js → chunk-5nsqz5n3.js} +46 -46
  2. package/dist/bin/{chunk-ayhqt80q.js → chunk-j447p8t4.js} +1 -1
  3. package/dist/bin/{chunk-6wxxe560.js → chunk-yw6f160x.js} +1 -1
  4. package/dist/bin/cli.js +78 -78
  5. package/dist/bin/dashboard-server.js +1 -1
  6. package/dist/cdn/cloudflare-rules.d.ts +37 -0
  7. package/dist/{chunk-t2a6r38z.js → chunk-aw0spg20.js} +64 -64
  8. package/dist/{chunk-9pa96r7f.js → chunk-ywjkyg8p.js} +1 -1
  9. package/dist/deploy/index.js +1 -1
  10. package/dist/drivers/index.js +1 -1
  11. package/dist/drivers/shared/deploy-script.d.ts +49 -0
  12. package/dist/index.js +25 -25
  13. package/dist/ui/404.html +1 -1
  14. package/dist/ui/accept-invitation.html +1 -1
  15. package/dist/ui/access-denied.html +1 -1
  16. package/dist/ui/account/automation.html +5 -5
  17. package/dist/ui/account/security.html +2 -2
  18. package/dist/ui/applications/compose.html +6 -6
  19. package/dist/ui/applications/new.html +1 -1
  20. package/dist/ui/data/backups.html +6 -6
  21. package/dist/ui/data/services.html +5 -5
  22. package/dist/ui/data/volumes.html +5 -5
  23. package/dist/ui/index.html +6 -6
  24. package/dist/ui/infrastructure/topology.html +5 -5
  25. package/dist/ui/integrations.html +1 -1
  26. package/dist/ui/operations/alerts.html +6 -6
  27. package/dist/ui/operations/configuration.html +6 -6
  28. package/dist/ui/operations/jobs.html +5 -5
  29. package/dist/ui/operations/maintenance.html +5 -5
  30. package/dist/ui/operations/observability.html +6 -6
  31. package/dist/ui/operations/previews.html +6 -6
  32. package/dist/ui/operations/queue.html +6 -6
  33. package/dist/ui/operations/regions.html +5 -5
  34. package/dist/ui/operations/releases.html +6 -6
  35. package/dist/ui/operations/spend.html +6 -6
  36. package/dist/ui/operations/workloads.html +6 -6
  37. package/dist/ui/security.html +1 -1
  38. package/dist/ui/server/actions.html +6 -6
  39. package/dist/ui/server/activity.html +2 -2
  40. package/dist/ui/server/capacity.html +6 -6
  41. package/dist/ui/server/database.html +6 -6
  42. package/dist/ui/server/deployments.html +5 -5
  43. package/dist/ui/server/diagnostics.html +2 -2
  44. package/dist/ui/server/firewall.html +6 -6
  45. package/dist/ui/server/fleet.html +6 -6
  46. package/dist/ui/server/logs.html +6 -6
  47. package/dist/ui/server/metrics.html +5 -5
  48. package/dist/ui/server/security.html +2 -2
  49. package/dist/ui/server/services.html +2 -2
  50. package/dist/ui/server/sites.html +6 -6
  51. package/dist/ui/server/ssh-keys.html +6 -6
  52. package/dist/ui/server/team.html +6 -6
  53. package/dist/ui/server/terminal.html +2 -2
  54. package/dist/ui/serverless/alarms.html +6 -6
  55. package/dist/ui/serverless/assets.html +2 -2
  56. package/dist/ui/serverless/cost.html +2 -2
  57. package/dist/ui/serverless/data.html +6 -6
  58. package/dist/ui/serverless/deployments.html +2 -2
  59. package/dist/ui/serverless/firewall.html +2 -2
  60. package/dist/ui/serverless/functions.html +6 -6
  61. package/dist/ui/serverless/logs.html +6 -6
  62. package/dist/ui/serverless/metrics.html +2 -2
  63. package/dist/ui/serverless/queues.html +6 -6
  64. package/dist/ui/serverless/secrets.html +6 -6
  65. package/dist/ui/serverless/traces.html +6 -6
  66. package/dist/ui/serverless.html +5 -5
  67. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import{ud as Sp}from"./chunk-zam6ecam.js";import{Bd as to,Cd as zp,Dd as es,Ed as Mt,Fd as ct,Gd as ns,Hd as Up}from"./chunk-dr4pj8hp.js";import{Jd as ai,Kd as Us,Oe as Mv,Pe as Ms,Rd as Zp,Td as Ta,Ud as Yr,Wd as _n,Xd as kt,Yd as ci,nf as Xp}from"./chunk-q0rc1ax9.js";import{of as Xo}from"./chunk-kasdm9tx.js";import{sf as Rn}from"./chunk-by2bwzk6.js";import{tf as Pp}from"./chunk-73ztr55z.js";import{uf as Fn}from"./chunk-xcj8zfmg.js";import{Jg as Cy,Jh as Wu,Mh as Ja,Rg as ir,cg as jo,dg as Xy,eg as ev,fg as vu,gg as Cu,hg as gv,jg as yn,og as zr,xh as fv,yh as hv}from"./chunk-t2a6r38z.js";import{Wh as qb}from"./chunk-aj025v2s.js";import{Xh as Er}from"./chunk-wavjkdb8.js";import{Yh as Qp,Zh as ur}from"./chunk-nk7sav4r.js";import{$h as pi,ai as Gp}from"./chunk-mz0dk78z.js";import{Ak as Fb,Di as Pb,Dj as Hm,Dk as db,Ei as _b,Ek as zb,Hi as As,Hk as ec,Ii as $e,Ik as Ub,Ji as Tb,Ki as Bm,Li as hs,Oi as xb,Pi as Db,Ui as Ob,Vi as $b,Vk as ie,Wi as Nb,Xi as jb,Xk as Uc,Yk as Jm,Zk as Wm,aj as ys,ei as ks,fi as fp,hi as er,ii as qo,ik as Km,pi as Oe,qi as hp,qk as Mb,ri as Cb,tk as Bb,uk as Gi,vi as fs,yk as zo,zk as Lb}from"./chunk-aw0cgv5w.js";import{$l as gt,Bs as jp,Cs as as,Ds as Mp,Es as Bp,Tl as hh,Vl as ho,Wl as yt,Xl as Cp,Zl as Fr,em as Zl,gn as Ep,ln as Rp,lt as Lp,rm as li,rt as Fp,sm as Dp,tm as Op,ys as $p,zs as Np}from"./chunk-zz52xje8.js";import{Ct as rt}from"./chunk-z2qqwy7e.js";import{createHash as sS}from"node:crypto";function aS(e){return sS("sha256").update(En(e)).digest("hex")}function En(e){if(Array.isArray(e))return`[${e.map((t)=>En(t)).join(",")}]`;if(e&&typeof e==="object")return`{${Object.entries(e).filter(([,t])=>t!==void 0&&typeof t!=="function").sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${En(r)}`).join(",")}}`;return JSON.stringify(e)??"null"}function Ye(e,t){let r=`dashboard:${t.username.toLowerCase()}`;return e.getActorByExternalId("user",r)??e.createActor({kind:"user",externalId:r,displayName:t.name??t.username,metadata:{source:"dashboard",role:t.role}})}function yp(e,t){let r=new hp({cwd:e}),n=aS(t),i=r.getProjectBySlug(t.project.slug),o=t.project.slug.length>=3?t.project.slug:`${t.project.slug}-org`,s=(i?.organizationId?r.getOrganization(i.organizationId):void 0)??r.getOrganizationBySlug(o)??r.createOrganization({id:i?.organizationId,slug:o,name:t.project.name}),c=i?i.name!==t.project.name||i.desiredConfigHash!==n||i.organizationId!==s.id?r.updateProject(i.id,i.version,{name:t.project.name,organizationId:s.id,desiredConfigHash:n}):i:r.createProject({organizationId:s.id,slug:t.project.slug,name:t.project.name,desiredConfigHash:n}),d=new Map;for(let[h,y]of Object.entries(t.environments??{})){let k=r.getEnvironmentBySlug(c.id,h)??r.createEnvironment({projectId:c.id,slug:h,name:h.replace(/(^|[-_])(\w)/g,(O,U,q)=>q.toUpperCase()),kind:String(y?.type??h),region:y?.region??t.project.region,desiredState:Oe(y)});d.set(h,k);let C=new Map(r.listResources(c.id,k.id).map((O)=>[`${O.kind}:${O.slug}`,O])),T=(O,U,q,N)=>{let Q=`${O}:${U}`,D=C.get(Q),Y=Oe(N);if(D){if(D.name!==q||En(D.desiredState)!==En(Y))C.set(Q,r.updateResource(D.id,D.version,{name:q,desiredState:Y}));return}let se=r.createResource({projectId:c.id,environmentId:k.id,kind:O,slug:U,name:q,provider:t.cloud?.provider,desiredState:Y,metadata:{source:"cloud-config"}});C.set(Q,se)};for(let[O,U]of Object.entries(t.sites??{}))T("application",O,O,U);let M=y?.app;if(M)for(let O of["http","queue","cli"])T("function",O,`${O.toUpperCase()} function`,{...Oe(M),function:O});let P=t.infrastructure;for(let[O,U]of Object.entries(P?.functions??{}))T("function",O,O,U);if(P?.compute)T("server",`${c.slug}-server`,c.name,{...Oe(P.compute),label:c.name});for(let[O,U]of Object.entries(P?.databases??{}))T("database",O,O,U);if(P?.appDatabase)T("database","application-database","Application database",P.appDatabase);else if(P?.database)T("database","application-database","Application database",{engine:P.database})}let a=new $e(r).recoverExpired(),u=r.reconcileOrphanedOperations({policy:"fail"}),m={requeued:a.requeued+u.requeued,failed:a.failed+a.cancelled+u.failed};return{store:r,organization:s,project:c,environments:d,reconciliation:m}}var cS=["project:read","config:read","deployments:read","deployments:create","runtime:read","runtime:logs"];function Zo(e,t){let{store:r,organization:n,project:i}=e,o=new Set;for(let s of t){let c=Ye(r,s);o.add(c.id);let d=r.getMembershipForActor(n.id,c.id);if(d&&d.source!=="legacy")continue;let a=r.listResources(i.id).filter((w)=>w.kind==="application"&&Object.hasOwn(s.sites,w.slug)),u=s.role==="admin"?"owner":"viewer",m=s.role==="admin"||a.length===0?{type:"organization"}:{type:"resource",id:a[0].id},h=d?d.roleTemplate!==u||En(d.scope)!==En(m)?r.updateMembership({id:d.id,roleTemplate:u,scope:m,actorId:c.id}):d:r.createMembership({organizationId:n.id,actorId:c.id,roleTemplate:u,scope:m,source:"legacy"}),y=new Set;if(s.role==="member"&&a.length===0)for(let w of fp("viewer"))y.add(`deny|${w}|organization|`);for(let w of a){let k=s.sites[w.slug];for(let C of cS)y.add(`allow|${C}|resource|${w.id}`);if(k==="owner")y.add(`allow|config:write|resource|${w.id}`)}for(let w of r.listGrants(h.id).filter((k)=>k.source==="legacy")){let k=`${w.effect}|${w.capability}|${w.scope.type}|${w.scope.id??""}`;if(!y.has(k))r.removeGrant(w.id,c.id)}for(let w of y){let[k,C,T,M]=w.split("|");r.upsertGrant({organizationId:n.id,membershipId:h.id,effect:k,capability:C,scope:T==="organization"?{type:"organization"}:{type:T,id:M},source:"legacy"})}}for(let s of r.listMemberships(n.id))if(s.source==="legacy"&&!o.has(s.actorId))r.revokeMembership(s.id)}async function Ir(e){let{controlPlane:t,environment:r,actor:n}=e,i=Ye(t.store,n),o=t.environments.get(r),s=e.resourceSlug&&o?t.store.listResources(t.project.id,o.id).find((u)=>u.slug===e.resourceSlug):void 0,c=new $e(t.store,{workerId:`dashboard:${process.pid}`}),d=c.enqueue({projectId:t.project.id,environmentId:o?.id,resourceId:s?.id,actorId:i.id,kind:e.kind,input:e.input??{},lockKey:s?`resource:${s.id}`:o?`environment:${o.id}`:`project:${t.project.id}`,providerKey:s?.provider??"dashboard",buildSlot:e.kind.includes("deploy"),maxAttempts:1,timeoutSeconds:3600,resumePolicy:"fail",cancellationMode:"provider_non_cancellable",retentionDays:90}).operation;if(!c.claim(d.id)?.operation)throw Error(`Could not claim control-plane operation ${d.id}`);try{let u=await e.execute(),m=typeof u.stdout==="string"?String(u.stdout):"",h=typeof u.stderr==="string"?String(u.stderr):"";if(m)c.appendLog(d.id,m,{stream:"stdout"});if(h)c.appendLog(d.id,h,{stream:"stderr"});let y=u.ok?c.complete(d.id,gp(u)):c.fail(d.id,dS(u),gp(u));return{result:u,operation:y}}catch(u){throw c.fail(d.id,u instanceof Error?u.message:String(u),{ok:!1,threw:!0}),u}}function dS(e){let t=e;return String(t.error??t.stderr??"Operation failed")}function gp(e){let t=e,r=typeof t.stdout==="string"?t.stdout:"",n=typeof t.stderr==="string"?t.stderr:"",i={ok:e.ok,stdoutBytes:Buffer.byteLength(r),stderrBytes:Buffer.byteLength(n)};if(typeof t.operation==="string")i.operation=t.operation;if(typeof t.error==="string")i.error=t.error;return Oe(i)}var vp=[{id:"server.overview",path:"/",label:"Dashboard",group:"overview",modes:["server"],adminOnly:!0,legacyPaths:["/server"]},{id:"server.activity",path:"/server/activity",label:"Activity",group:"overview",modes:["server"],adminOnly:!0,legacyPaths:["/activity"]},{id:"services.list",path:"/server/sites",label:"Services",group:"applications",modes:["server"],adminOnly:!1,legacyPaths:["/sites","/services"]},{id:"deployments.list",path:"/server/deployments",label:"Deployments",group:"applications",modes:["server"],adminOnly:!1,legacyPaths:["/deployments"]},{id:"logs.list",path:"/server/logs",label:"Logs",group:"applications",modes:["server"],adminOnly:!1,legacyPaths:["/logs"]},{id:"sources.integrations",path:"/integrations",label:"Git integrations",group:"applications",modes:["server","serverless"],adminOnly:!1},{id:"applications.create",path:"/applications/new",label:"Create application",group:"applications",modes:["server","serverless"],adminOnly:!1},{id:"applications.compose",path:"/applications/compose",label:"Compose applications",group:"applications",modes:["server"],adminOnly:!1},{id:"operations.queue",path:"/operations/queue",label:"Deployment queue",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"operations.previews",path:"/operations/previews",label:"Preview environments",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"operations.releases",path:"/operations/releases",label:"Releases & promotion",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"runtime.workloads",path:"/operations/workloads",label:"Workloads",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"observability.overview",path:"/operations/observability",label:"Observability",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"alerts.overview",path:"/operations/alerts",label:"Alerts & health",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"spend.overview",path:"/operations/spend",label:"Spend & budgets",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"automation.jobs",path:"/operations/jobs",label:"Workers & schedules",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/server/workers","/serverless/scheduler"]},{id:"configuration.entries",path:"/operations/configuration",label:"Environment & secrets",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/serverless/secrets"]},{id:"metrics.overview",path:"/server/metrics",label:"Metrics",group:"operations",modes:["server"],adminOnly:!0},{id:"runtime.services",path:"/server/services",label:"Runtime services",group:"operations",modes:["server"],adminOnly:!0},{id:"backups.list",path:"/data/backups",label:"Backups & recovery",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/server/backups"]},{id:"volumes.list",path:"/data/volumes",label:"Persistent volumes",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:[]},{id:"fleet.list",path:"/server/fleet",label:"Fleet inventory",group:"operations",modes:["server"],adminOnly:!1,legacyPaths:[]},{id:"operations.run",path:"/server/actions",label:"Run operations",group:"operations",modes:["server"],adminOnly:!0},{id:"infrastructure.topology",path:"/infrastructure/topology",label:"Infrastructure map",group:"infrastructure",modes:["server","serverless"],adminOnly:!0,legacyPaths:["/topology"]},{id:"data.services",path:"/data/services",label:"Data services",group:"infrastructure",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/database","/databases","/server/database","/serverless/data"]},{id:"network.firewall",path:"/server/firewall",label:"Network & firewall",group:"infrastructure",modes:["server"],adminOnly:!0},{id:"security.posture",path:"/security",label:"Security posture",group:"infrastructure",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/server/security"]},{id:"access.ssh",path:"/server/ssh-keys",label:"SSH keys",group:"infrastructure",modes:["server"],adminOnly:!0},{id:"runtime.terminal",path:"/server/terminal",label:"Terminal",group:"infrastructure",modes:["server"],adminOnly:!0},{id:"organization.people",path:"/server/team",label:"People & access",group:"organization",modes:["server","serverless"],adminOnly:!0,legacyPaths:["/team"]},{id:"organization.automation",path:"/account/automation",label:"API & automation",group:"organization",modes:["server","serverless"],adminOnly:!0},{id:"serverless.overview",path:"/serverless",label:"Dashboard",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.deployments",path:"/serverless/deployments",label:"Deployments",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.logs",path:"/serverless/logs",label:"Logs",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.metrics",path:"/serverless/metrics",label:"Metrics",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.traces",path:"/serverless/traces",label:"Traces",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.functions",path:"/serverless/functions",label:"Functions",group:"compute-data",modes:["serverless"],adminOnly:!0},{id:"serverless.queues",path:"/serverless/queues",label:"Queues",group:"compute-data",modes:["serverless"],adminOnly:!0},{id:"serverless.assets",path:"/serverless/assets",label:"Assets",group:"compute-data",modes:["serverless"],adminOnly:!0},{id:"serverless.network",path:"/serverless/firewall",label:"Network",group:"settings",modes:["serverless"],adminOnly:!0},{id:"serverless.alerts",path:"/serverless/alarms",label:"Alerts",group:"settings",modes:["serverless"],adminOnly:!0},{id:"serverless.cost",path:"/serverless/cost",label:"Costs",group:"settings",modes:["serverless"],adminOnly:!0}],lS=new Map(vp.flatMap((e)=>(e.legacyPaths??[]).map((t)=>[t,e.path])));function bp(e){return lS.get(e)}function j_(e,t){return vp.filter((r)=>r.modes.includes(e)&&(!t||!r.adminOnly))}import Qr from"node:process";import{existsSync as uS}from"node:fs";import{join as pS}from"node:path";async function U_(e){let t=Date.now(),r=e.sourceDir??"dist";if(!uS(pS(r,"index.html")))return pc(t,`${r}/ has no index.html — build first.`);if(!Qr.env.AWS_ACCESS_KEY_ID||!Qr.env.AWS_SECRET_ACCESS_KEY)return pc(t,"Missing AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY in env.");let n=mS(e.dnsProvider);if("error"in n)return pc(t,n.error);let i=await Sp({siteName:e.siteName,region:e.region??"us-east-1",domain:e.domain,bucket:e.bucket,stackName:e.stackName,certificateArn:e.certificateArn,defaultRootObject:e.defaultRootObject??"index.html",errorDocument:e.errorDocument??"404.html",cacheControl:e.cacheControl??"max-age=3600, public",sourceDir:r,cleanBucket:e.cleanBucket??!1,singlePageApp:e.singlePageApp??!1,dnsProvider:n,tags:{ManagedBy:"ts-cloud",Application:e.siteName,...e.tags},onProgress:e.onProgress});return{success:!!i.success,domain:i.domain,url:i.domain?`https://${i.domain}`:i.distributionDomain?`https://${i.distributionDomain}`:void 0,bucket:i.bucket,distributionId:i.distributionId,distributionDomain:i.distributionDomain,certificateArn:i.certificateArn,filesUploaded:i.filesUploaded,filesSkipped:i.filesSkipped,message:i.message,durationMs:Date.now()-t}}function mS(e){let t=typeof e==="string"?{provider:e}:e??{provider:"porkbun"};if(t.provider==="porkbun"){let r=t,n=r?.apiKey??Qr.env.PORKBUN_API_KEY,i=r?.secretKey??Qr.env.PORKBUN_SECRET_KEY??Qr.env.PORKBUN_SECRET_API_KEY;if(!n||!i)return{error:"Missing PORKBUN_API_KEY / PORKBUN_SECRET_KEY in env."};return{provider:"porkbun",apiKey:n,secretKey:i}}if(t.provider==="godaddy"){let r=t,n=r?.apiKey??Qr.env.GODADDY_API_KEY,i=r?.secretKey??Qr.env.GODADDY_API_SECRET,o=r?.environment??Qr.env.GODADDY_ENVIRONMENT;if(!n||!i)return{error:"Missing GODADDY_API_KEY / GODADDY_API_SECRET in env."};return{provider:"godaddy",apiKey:n,apiSecret:i,environment:o}}return{error:`Unsupported DNS provider: ${t.provider}`}}function pc(e,t){return{success:!1,message:t,durationMs:Date.now()-e}}import{createHash as gS}from"node:crypto";var fS=`let coldStart = true
1
+ import{ud as Sp}from"./chunk-zam6ecam.js";import{Bd as to,Cd as zp,Dd as es,Ed as Mt,Fd as ct,Gd as ns,Hd as Up}from"./chunk-dr4pj8hp.js";import{Jd as ai,Kd as Us,Oe as Mv,Pe as Ms,Rd as Zp,Td as Ta,Ud as Yr,Wd as _n,Xd as kt,Yd as ci,nf as Xp}from"./chunk-q0rc1ax9.js";import{of as Xo}from"./chunk-kasdm9tx.js";import{sf as Rn}from"./chunk-by2bwzk6.js";import{tf as Pp}from"./chunk-73ztr55z.js";import{uf as Fn}from"./chunk-xcj8zfmg.js";import{Jg as Cy,Jh as Wu,Mh as Ja,Rg as ir,cg as jo,dg as Xy,eg as ev,fg as vu,gg as Cu,hg as gv,jg as yn,og as zr,xh as fv,yh as hv}from"./chunk-aw0spg20.js";import{Wh as qb}from"./chunk-aj025v2s.js";import{Xh as Er}from"./chunk-wavjkdb8.js";import{Yh as Qp,Zh as ur}from"./chunk-nk7sav4r.js";import{$h as pi,ai as Gp}from"./chunk-mz0dk78z.js";import{Ak as Fb,Di as Pb,Dj as Hm,Dk as db,Ei as _b,Ek as zb,Hi as As,Hk as ec,Ii as $e,Ik as Ub,Ji as Tb,Ki as Bm,Li as hs,Oi as xb,Pi as Db,Ui as Ob,Vi as $b,Vk as ie,Wi as Nb,Xi as jb,Xk as Uc,Yk as Jm,Zk as Wm,aj as ys,ei as ks,fi as fp,hi as er,ii as qo,ik as Km,pi as Oe,qi as hp,qk as Mb,ri as Cb,tk as Bb,uk as Gi,vi as fs,yk as zo,zk as Lb}from"./chunk-aw0cgv5w.js";import{$l as gt,Bs as jp,Cs as as,Ds as Mp,Es as Bp,Tl as hh,Vl as ho,Wl as yt,Xl as Cp,Zl as Fr,em as Zl,gn as Ep,ln as Rp,lt as Lp,rm as li,rt as Fp,sm as Dp,tm as Op,ys as $p,zs as Np}from"./chunk-zz52xje8.js";import{Ct as rt}from"./chunk-z2qqwy7e.js";import{createHash as sS}from"node:crypto";function aS(e){return sS("sha256").update(En(e)).digest("hex")}function En(e){if(Array.isArray(e))return`[${e.map((t)=>En(t)).join(",")}]`;if(e&&typeof e==="object")return`{${Object.entries(e).filter(([,t])=>t!==void 0&&typeof t!=="function").sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${En(r)}`).join(",")}}`;return JSON.stringify(e)??"null"}function Ye(e,t){let r=`dashboard:${t.username.toLowerCase()}`;return e.getActorByExternalId("user",r)??e.createActor({kind:"user",externalId:r,displayName:t.name??t.username,metadata:{source:"dashboard",role:t.role}})}function yp(e,t){let r=new hp({cwd:e}),n=aS(t),i=r.getProjectBySlug(t.project.slug),o=t.project.slug.length>=3?t.project.slug:`${t.project.slug}-org`,s=(i?.organizationId?r.getOrganization(i.organizationId):void 0)??r.getOrganizationBySlug(o)??r.createOrganization({id:i?.organizationId,slug:o,name:t.project.name}),c=i?i.name!==t.project.name||i.desiredConfigHash!==n||i.organizationId!==s.id?r.updateProject(i.id,i.version,{name:t.project.name,organizationId:s.id,desiredConfigHash:n}):i:r.createProject({organizationId:s.id,slug:t.project.slug,name:t.project.name,desiredConfigHash:n}),d=new Map;for(let[h,y]of Object.entries(t.environments??{})){let k=r.getEnvironmentBySlug(c.id,h)??r.createEnvironment({projectId:c.id,slug:h,name:h.replace(/(^|[-_])(\w)/g,(O,U,q)=>q.toUpperCase()),kind:String(y?.type??h),region:y?.region??t.project.region,desiredState:Oe(y)});d.set(h,k);let C=new Map(r.listResources(c.id,k.id).map((O)=>[`${O.kind}:${O.slug}`,O])),T=(O,U,q,N)=>{let Q=`${O}:${U}`,D=C.get(Q),Y=Oe(N);if(D){if(D.name!==q||En(D.desiredState)!==En(Y))C.set(Q,r.updateResource(D.id,D.version,{name:q,desiredState:Y}));return}let se=r.createResource({projectId:c.id,environmentId:k.id,kind:O,slug:U,name:q,provider:t.cloud?.provider,desiredState:Y,metadata:{source:"cloud-config"}});C.set(Q,se)};for(let[O,U]of Object.entries(t.sites??{}))T("application",O,O,U);let M=y?.app;if(M)for(let O of["http","queue","cli"])T("function",O,`${O.toUpperCase()} function`,{...Oe(M),function:O});let P=t.infrastructure;for(let[O,U]of Object.entries(P?.functions??{}))T("function",O,O,U);if(P?.compute)T("server",`${c.slug}-server`,c.name,{...Oe(P.compute),label:c.name});for(let[O,U]of Object.entries(P?.databases??{}))T("database",O,O,U);if(P?.appDatabase)T("database","application-database","Application database",P.appDatabase);else if(P?.database)T("database","application-database","Application database",{engine:P.database})}let a=new $e(r).recoverExpired(),u=r.reconcileOrphanedOperations({policy:"fail"}),m={requeued:a.requeued+u.requeued,failed:a.failed+a.cancelled+u.failed};return{store:r,organization:s,project:c,environments:d,reconciliation:m}}var cS=["project:read","config:read","deployments:read","deployments:create","runtime:read","runtime:logs"];function Zo(e,t){let{store:r,organization:n,project:i}=e,o=new Set;for(let s of t){let c=Ye(r,s);o.add(c.id);let d=r.getMembershipForActor(n.id,c.id);if(d&&d.source!=="legacy")continue;let a=r.listResources(i.id).filter((w)=>w.kind==="application"&&Object.hasOwn(s.sites,w.slug)),u=s.role==="admin"?"owner":"viewer",m=s.role==="admin"||a.length===0?{type:"organization"}:{type:"resource",id:a[0].id},h=d?d.roleTemplate!==u||En(d.scope)!==En(m)?r.updateMembership({id:d.id,roleTemplate:u,scope:m,actorId:c.id}):d:r.createMembership({organizationId:n.id,actorId:c.id,roleTemplate:u,scope:m,source:"legacy"}),y=new Set;if(s.role==="member"&&a.length===0)for(let w of fp("viewer"))y.add(`deny|${w}|organization|`);for(let w of a){let k=s.sites[w.slug];for(let C of cS)y.add(`allow|${C}|resource|${w.id}`);if(k==="owner")y.add(`allow|config:write|resource|${w.id}`)}for(let w of r.listGrants(h.id).filter((k)=>k.source==="legacy")){let k=`${w.effect}|${w.capability}|${w.scope.type}|${w.scope.id??""}`;if(!y.has(k))r.removeGrant(w.id,c.id)}for(let w of y){let[k,C,T,M]=w.split("|");r.upsertGrant({organizationId:n.id,membershipId:h.id,effect:k,capability:C,scope:T==="organization"?{type:"organization"}:{type:T,id:M},source:"legacy"})}}for(let s of r.listMemberships(n.id))if(s.source==="legacy"&&!o.has(s.actorId))r.revokeMembership(s.id)}async function Ir(e){let{controlPlane:t,environment:r,actor:n}=e,i=Ye(t.store,n),o=t.environments.get(r),s=e.resourceSlug&&o?t.store.listResources(t.project.id,o.id).find((u)=>u.slug===e.resourceSlug):void 0,c=new $e(t.store,{workerId:`dashboard:${process.pid}`}),d=c.enqueue({projectId:t.project.id,environmentId:o?.id,resourceId:s?.id,actorId:i.id,kind:e.kind,input:e.input??{},lockKey:s?`resource:${s.id}`:o?`environment:${o.id}`:`project:${t.project.id}`,providerKey:s?.provider??"dashboard",buildSlot:e.kind.includes("deploy"),maxAttempts:1,timeoutSeconds:3600,resumePolicy:"fail",cancellationMode:"provider_non_cancellable",retentionDays:90}).operation;if(!c.claim(d.id)?.operation)throw Error(`Could not claim control-plane operation ${d.id}`);try{let u=await e.execute(),m=typeof u.stdout==="string"?String(u.stdout):"",h=typeof u.stderr==="string"?String(u.stderr):"";if(m)c.appendLog(d.id,m,{stream:"stdout"});if(h)c.appendLog(d.id,h,{stream:"stderr"});let y=u.ok?c.complete(d.id,gp(u)):c.fail(d.id,dS(u),gp(u));return{result:u,operation:y}}catch(u){throw c.fail(d.id,u instanceof Error?u.message:String(u),{ok:!1,threw:!0}),u}}function dS(e){let t=e;return String(t.error??t.stderr??"Operation failed")}function gp(e){let t=e,r=typeof t.stdout==="string"?t.stdout:"",n=typeof t.stderr==="string"?t.stderr:"",i={ok:e.ok,stdoutBytes:Buffer.byteLength(r),stderrBytes:Buffer.byteLength(n)};if(typeof t.operation==="string")i.operation=t.operation;if(typeof t.error==="string")i.error=t.error;return Oe(i)}var vp=[{id:"server.overview",path:"/",label:"Dashboard",group:"overview",modes:["server"],adminOnly:!0,legacyPaths:["/server"]},{id:"server.activity",path:"/server/activity",label:"Activity",group:"overview",modes:["server"],adminOnly:!0,legacyPaths:["/activity"]},{id:"services.list",path:"/server/sites",label:"Services",group:"applications",modes:["server"],adminOnly:!1,legacyPaths:["/sites","/services"]},{id:"deployments.list",path:"/server/deployments",label:"Deployments",group:"applications",modes:["server"],adminOnly:!1,legacyPaths:["/deployments"]},{id:"logs.list",path:"/server/logs",label:"Logs",group:"applications",modes:["server"],adminOnly:!1,legacyPaths:["/logs"]},{id:"sources.integrations",path:"/integrations",label:"Git integrations",group:"applications",modes:["server","serverless"],adminOnly:!1},{id:"applications.create",path:"/applications/new",label:"Create application",group:"applications",modes:["server","serverless"],adminOnly:!1},{id:"applications.compose",path:"/applications/compose",label:"Compose applications",group:"applications",modes:["server"],adminOnly:!1},{id:"operations.queue",path:"/operations/queue",label:"Deployment queue",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"operations.previews",path:"/operations/previews",label:"Preview environments",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"operations.releases",path:"/operations/releases",label:"Releases & promotion",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"runtime.workloads",path:"/operations/workloads",label:"Workloads",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"observability.overview",path:"/operations/observability",label:"Observability",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"alerts.overview",path:"/operations/alerts",label:"Alerts & health",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"spend.overview",path:"/operations/spend",label:"Spend & budgets",group:"operations",modes:["server","serverless"],adminOnly:!1},{id:"automation.jobs",path:"/operations/jobs",label:"Workers & schedules",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/server/workers","/serverless/scheduler"]},{id:"configuration.entries",path:"/operations/configuration",label:"Environment & secrets",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/serverless/secrets"]},{id:"metrics.overview",path:"/server/metrics",label:"Metrics",group:"operations",modes:["server"],adminOnly:!0},{id:"runtime.services",path:"/server/services",label:"Runtime services",group:"operations",modes:["server"],adminOnly:!0},{id:"backups.list",path:"/data/backups",label:"Backups & recovery",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/server/backups"]},{id:"volumes.list",path:"/data/volumes",label:"Persistent volumes",group:"operations",modes:["server","serverless"],adminOnly:!1,legacyPaths:[]},{id:"fleet.list",path:"/server/fleet",label:"Fleet inventory",group:"operations",modes:["server"],adminOnly:!1,legacyPaths:[]},{id:"operations.run",path:"/server/actions",label:"Run operations",group:"operations",modes:["server"],adminOnly:!0},{id:"infrastructure.topology",path:"/infrastructure/topology",label:"Infrastructure map",group:"infrastructure",modes:["server","serverless"],adminOnly:!0,legacyPaths:["/topology"]},{id:"data.services",path:"/data/services",label:"Data services",group:"infrastructure",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/database","/databases","/server/database","/serverless/data"]},{id:"network.firewall",path:"/server/firewall",label:"Network & firewall",group:"infrastructure",modes:["server"],adminOnly:!0},{id:"security.posture",path:"/security",label:"Security posture",group:"infrastructure",modes:["server","serverless"],adminOnly:!1,legacyPaths:["/server/security"]},{id:"access.ssh",path:"/server/ssh-keys",label:"SSH keys",group:"infrastructure",modes:["server"],adminOnly:!0},{id:"runtime.terminal",path:"/server/terminal",label:"Terminal",group:"infrastructure",modes:["server"],adminOnly:!0},{id:"organization.people",path:"/server/team",label:"People & access",group:"organization",modes:["server","serverless"],adminOnly:!0,legacyPaths:["/team"]},{id:"organization.automation",path:"/account/automation",label:"API & automation",group:"organization",modes:["server","serverless"],adminOnly:!0},{id:"serverless.overview",path:"/serverless",label:"Dashboard",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.deployments",path:"/serverless/deployments",label:"Deployments",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.logs",path:"/serverless/logs",label:"Logs",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.metrics",path:"/serverless/metrics",label:"Metrics",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.traces",path:"/serverless/traces",label:"Traces",group:"overview",modes:["serverless"],adminOnly:!0},{id:"serverless.functions",path:"/serverless/functions",label:"Functions",group:"compute-data",modes:["serverless"],adminOnly:!0},{id:"serverless.queues",path:"/serverless/queues",label:"Queues",group:"compute-data",modes:["serverless"],adminOnly:!0},{id:"serverless.assets",path:"/serverless/assets",label:"Assets",group:"compute-data",modes:["serverless"],adminOnly:!0},{id:"serverless.network",path:"/serverless/firewall",label:"Network",group:"settings",modes:["serverless"],adminOnly:!0},{id:"serverless.alerts",path:"/serverless/alarms",label:"Alerts",group:"settings",modes:["serverless"],adminOnly:!0},{id:"serverless.cost",path:"/serverless/cost",label:"Costs",group:"settings",modes:["serverless"],adminOnly:!0}],lS=new Map(vp.flatMap((e)=>(e.legacyPaths??[]).map((t)=>[t,e.path])));function bp(e){return lS.get(e)}function j_(e,t){return vp.filter((r)=>r.modes.includes(e)&&(!t||!r.adminOnly))}import Qr from"node:process";import{existsSync as uS}from"node:fs";import{join as pS}from"node:path";async function U_(e){let t=Date.now(),r=e.sourceDir??"dist";if(!uS(pS(r,"index.html")))return pc(t,`${r}/ has no index.html — build first.`);if(!Qr.env.AWS_ACCESS_KEY_ID||!Qr.env.AWS_SECRET_ACCESS_KEY)return pc(t,"Missing AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY in env.");let n=mS(e.dnsProvider);if("error"in n)return pc(t,n.error);let i=await Sp({siteName:e.siteName,region:e.region??"us-east-1",domain:e.domain,bucket:e.bucket,stackName:e.stackName,certificateArn:e.certificateArn,defaultRootObject:e.defaultRootObject??"index.html",errorDocument:e.errorDocument??"404.html",cacheControl:e.cacheControl??"max-age=3600, public",sourceDir:r,cleanBucket:e.cleanBucket??!1,singlePageApp:e.singlePageApp??!1,dnsProvider:n,tags:{ManagedBy:"ts-cloud",Application:e.siteName,...e.tags},onProgress:e.onProgress});return{success:!!i.success,domain:i.domain,url:i.domain?`https://${i.domain}`:i.distributionDomain?`https://${i.distributionDomain}`:void 0,bucket:i.bucket,distributionId:i.distributionId,distributionDomain:i.distributionDomain,certificateArn:i.certificateArn,filesUploaded:i.filesUploaded,filesSkipped:i.filesSkipped,message:i.message,durationMs:Date.now()-t}}function mS(e){let t=typeof e==="string"?{provider:e}:e??{provider:"porkbun"};if(t.provider==="porkbun"){let r=t,n=r?.apiKey??Qr.env.PORKBUN_API_KEY,i=r?.secretKey??Qr.env.PORKBUN_SECRET_KEY??Qr.env.PORKBUN_SECRET_API_KEY;if(!n||!i)return{error:"Missing PORKBUN_API_KEY / PORKBUN_SECRET_KEY in env."};return{provider:"porkbun",apiKey:n,secretKey:i}}if(t.provider==="godaddy"){let r=t,n=r?.apiKey??Qr.env.GODADDY_API_KEY,i=r?.secretKey??Qr.env.GODADDY_API_SECRET,o=r?.environment??Qr.env.GODADDY_ENVIRONMENT;if(!n||!i)return{error:"Missing GODADDY_API_KEY / GODADDY_API_SECRET in env."};return{provider:"godaddy",apiKey:n,apiSecret:i,environment:o}}return{error:`Unsupported DNS provider: ${t.provider}`}}function pc(e,t){return{success:!1,message:t,durationMs:Date.now()-e}}import{createHash as gS}from"node:crypto";var fS=`let coldStart = true
2
2
  const initializedAt = new Date().toISOString()
3
3
  export const handler = async (event) => {
4
4
  const currentColdStart = coldStart
@@ -1 +1 @@
1
- import{Ac as Z,Bc as aa,Cc as ba,Dc as ca,Ec as da,Fc as ea,Gc as fa,Hc as ga,Ic as ha,Jc as ia,Kc as ja,Lc as ka,Mc as la,Nc as ma,Oc as na,ic as y,jc as z,kc as A,lc as B,mc as C,nc as D,oc as E,od as oa,pc as O,pd as pa,qc as P,qd as qa,rc as Q,rd as ra,sc as R,tc as S,uc as T,vc as U,wc as V,xc as W,yc as X,zc as Y}from"../chunk-9pa96r7f.js";import{Ad as N,sd as F,td as G,ud as H,vd as I,wd as J,xd as K,yd as L,zd as M}from"../chunk-zam6ecam.js";import{Id as _}from"../chunk-dr4pj8hp.js";import"../chunk-q0rc1ax9.js";import"../chunk-kasdm9tx.js";import"../chunk-by2bwzk6.js";import"../chunk-73ztr55z.js";import"../chunk-xcj8zfmg.js";import"../chunk-tz9myq9a.js";import"../chunk-y4xkj2f1.js";import{Gh as s,Hh as t,Ih as u,Jh as v,Kh as w,Lh as x,Uf as a,Vf as b,Wf as c,Xf as d,Yf as e,Zf as f,_f as g,jg as h,kg as i,lg as j,mg as k,ng as l,og as m,pg as n,qg as o,rg as p,sg as q,tg as r}from"../chunk-t2a6r38z.js";import"../chunk-aj025v2s.js";import"../chunk-wavjkdb8.js";import"../chunk-nk7sav4r.js";import"../chunk-mz0dk78z.js";import"../chunk-aw0cgv5w.js";import"../chunk-hn40z11p.js";import"../chunk-x3hay61c.js";import"../chunk-zz52xje8.js";import"../chunk-z2qqwy7e.js";export{d as IPV6_EXCLUDED_HOST_LABELS,s as MANAGEMENT_DASHBOARD_SITE,Z as buildAndPushContainerImage,_ as buildAndPushServerlessImage,ba as buildFunctionEnv,x as buildManagementDashboardArtifact,ha as buildServerTopology,ia as buildServerlessTopology,ja as buildTopology,na as collectEgressMetrics,a as collectServerDnsDomains,Y as createContainerImageDependencies,T as createExistingStaticFullStackDependencies,P as createStaticApiOriginDependencies,pa as dashboardActions,t as dashboardCredentialsFile,C as dashboardPageRoutes,M as deleteStaticSite,V as deployExistingStaticFullStack,ca as deployServerlessApp,r as deployShipsFiles,O as deploySite,Q as deployStaticApiOrigin,J as deployStaticSite,N as deployStaticSiteFull,G as deployStaticSiteWithExternalDns,H as deployStaticSiteWithExternalDnsFull,la as egressReportMetrics,y as ensureDashboardActor,w as ensureManagementDashboard,W as estimateExistingStaticFullStackMonthlyCost,S as estimateStaticApiOriginMonthlyCost,ma as fetchEgressReport,U as generateExistingStaticFullStackTemplate,F as generateExternalDnsStaticSiteTemplate,I as generateStaticSiteTemplate,n as hasComputeConfigured,k as hasProxyUpstream,X as hashContainerContext,e as hostAcceptsIpv6,aa as infraEnvFromOutputs,z as initializeDashboardControlPlane,L as invalidateCache,i as isPhpSite,c as normalizePublicIpv6,f as reconcileAddressRecords,da as redeployServerlessApp,b as removeStaleServerAddressRecords,qa as resolveDashboardAction,u as resolveDashboardAuth,ka as resolveDashboardData,D as resolveLegacyDashboardRoute,j as resolveProxyUpstreams,l as resolveSiteDeployTarget,m as resolveSiteKind,v as resolveUiSource,ea as rollbackServerlessApp,E as routesForDashboard,ga as runRemoteCommand,oa as sanitizeCloudConfig,fa as setMaintenance,p as shipsARelease,q as shipsToBucket,h as siteInstallBase,ra as startLocalDashboardServer,A as synchronizeDashboardUsers,B as trackDashboardOperation,K as uploadStaticFiles,o as validateDeploymentConfig,g as verifyAddressRecord,R as verifyStaticApiOrigin};
1
+ import{Ac as Z,Bc as aa,Cc as ba,Dc as ca,Ec as da,Fc as ea,Gc as fa,Hc as ga,Ic as ha,Jc as ia,Kc as ja,Lc as ka,Mc as la,Nc as ma,Oc as na,ic as y,jc as z,kc as A,lc as B,mc as C,nc as D,oc as E,od as oa,pc as O,pd as pa,qc as P,qd as qa,rc as Q,rd as ra,sc as R,tc as S,uc as T,vc as U,wc as V,xc as W,yc as X,zc as Y}from"../chunk-ywjkyg8p.js";import{Ad as N,sd as F,td as G,ud as H,vd as I,wd as J,xd as K,yd as L,zd as M}from"../chunk-zam6ecam.js";import{Id as _}from"../chunk-dr4pj8hp.js";import"../chunk-q0rc1ax9.js";import"../chunk-kasdm9tx.js";import"../chunk-by2bwzk6.js";import"../chunk-73ztr55z.js";import"../chunk-xcj8zfmg.js";import"../chunk-tz9myq9a.js";import"../chunk-y4xkj2f1.js";import{Gh as s,Hh as t,Ih as u,Jh as v,Kh as w,Lh as x,Uf as a,Vf as b,Wf as c,Xf as d,Yf as e,Zf as f,_f as g,jg as h,kg as i,lg as j,mg as k,ng as l,og as m,pg as n,qg as o,rg as p,sg as q,tg as r}from"../chunk-aw0spg20.js";import"../chunk-aj025v2s.js";import"../chunk-wavjkdb8.js";import"../chunk-nk7sav4r.js";import"../chunk-mz0dk78z.js";import"../chunk-aw0cgv5w.js";import"../chunk-hn40z11p.js";import"../chunk-x3hay61c.js";import"../chunk-zz52xje8.js";import"../chunk-z2qqwy7e.js";export{d as IPV6_EXCLUDED_HOST_LABELS,s as MANAGEMENT_DASHBOARD_SITE,Z as buildAndPushContainerImage,_ as buildAndPushServerlessImage,ba as buildFunctionEnv,x as buildManagementDashboardArtifact,ha as buildServerTopology,ia as buildServerlessTopology,ja as buildTopology,na as collectEgressMetrics,a as collectServerDnsDomains,Y as createContainerImageDependencies,T as createExistingStaticFullStackDependencies,P as createStaticApiOriginDependencies,pa as dashboardActions,t as dashboardCredentialsFile,C as dashboardPageRoutes,M as deleteStaticSite,V as deployExistingStaticFullStack,ca as deployServerlessApp,r as deployShipsFiles,O as deploySite,Q as deployStaticApiOrigin,J as deployStaticSite,N as deployStaticSiteFull,G as deployStaticSiteWithExternalDns,H as deployStaticSiteWithExternalDnsFull,la as egressReportMetrics,y as ensureDashboardActor,w as ensureManagementDashboard,W as estimateExistingStaticFullStackMonthlyCost,S as estimateStaticApiOriginMonthlyCost,ma as fetchEgressReport,U as generateExistingStaticFullStackTemplate,F as generateExternalDnsStaticSiteTemplate,I as generateStaticSiteTemplate,n as hasComputeConfigured,k as hasProxyUpstream,X as hashContainerContext,e as hostAcceptsIpv6,aa as infraEnvFromOutputs,z as initializeDashboardControlPlane,L as invalidateCache,i as isPhpSite,c as normalizePublicIpv6,f as reconcileAddressRecords,da as redeployServerlessApp,b as removeStaleServerAddressRecords,qa as resolveDashboardAction,u as resolveDashboardAuth,ka as resolveDashboardData,D as resolveLegacyDashboardRoute,j as resolveProxyUpstreams,l as resolveSiteDeployTarget,m as resolveSiteKind,v as resolveUiSource,ea as rollbackServerlessApp,E as routesForDashboard,ga as runRemoteCommand,oa as sanitizeCloudConfig,fa as setMaintenance,p as shipsARelease,q as shipsToBucket,h as siteInstallBase,ra as startLocalDashboardServer,A as synchronizeDashboardUsers,B as trackDashboardOperation,K as uploadStaticFiles,o as validateDeploymentConfig,g as verifyAddressRecord,R as verifyStaticApiOrigin};
@@ -1 +1 @@
1
- import{$g as G,Ag as g,Ah as ea,Bg as h,Bh as fa,Cg as i,Ch as ga,Dg as j,Dh as ha,Eg as k,Eh as ia,Fg as l,Fh as ja,Gg as m,Hg as n,Ig as o,Kg as p,Lg as q,Mg as r,Ng as s,Nh as ka,Og as t,Oh as la,Pg as u,Ph as ma,Qg as v,Qh as na,Rg as w,Rh as oa,Sg as x,Sh as pa,Tg as y,Th as qa,Ug as z,Uh as ra,Vg as A,Wg as B,Xg as C,Yg as D,Zg as E,_g as F,ah as H,bh as I,ch as J,dh as K,eh as L,fh as M,gh as N,hh as O,ih as P,jh as Q,kh as R,lh as S,mh as T,nh as U,oh as V,ph as W,qh as X,rh as Y,sh as Z,th as _,ug as a,uh as aa,vg as b,vh as ba,wg as c,wh as ca,xg as d,yg as e,zg as f,zh as da}from"../chunk-t2a6r38z.js";import"../chunk-aj025v2s.js";import"../chunk-wavjkdb8.js";import"../chunk-nk7sav4r.js";import"../chunk-mz0dk78z.js";import"../chunk-hn40z11p.js";import"../chunk-x3hay61c.js";import"../chunk-zz52xje8.js";import"../chunk-z2qqwy7e.js";export{ba as AwsBoxProvisioner,o as AwsDriver,x as CloudDriverFactory,a as DEFAULT_RPX_CERTS_DIR,aa as HetznerBoxProvisioner,p as HetznerClient,t as HetznerDriver,u as LocalBoxDriver,pa as MANAGED_CACHE_POLICY_DISABLED,oa as MANAGED_CACHE_POLICY_OPTIMIZED,qa as MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,i as RPX_DIR,j as RPX_LAUNCHER_PATH,k as RPX_SERVICE_NAME,Z as UBUNTU_2404_AMI_PARAM,U as acquireResizeLock,N as applyHetznerHostOptimization,ha as buildAwsArtifactFetch,_ as buildBoxUserData,ra as buildCloudFrontOriginConfig,M as buildHetznerHostOptimizationScript,ja as buildHostCleanupScript,ia as buildLocalArtifactFetch,f as buildRpxConfig,m as buildRpxFragmentRefreshScript,g as buildRpxLbConfig,l as buildRpxProvisionScript,ea as buildSiteDeployScript,C as buildSshArgs,fa as buildStaticSiteDeployScript,y as cloudDrivers,O as collectHetznerHostOptimizationReport,I as collectHetznerResizeManifest,ca as createBoxProvisioner,w as createCloudDriver,la as deployAllComputeSites,ka as deploySiteRelease,e as deriveRouteId,W as ensureFirewall,X as ensureServer,V as ensureSshKey,B as executeHetznerServerResize,c as gatewayHostnames,n as generateUbuntuAppCloudInit,b as hasAutoWwwVariant,v as isBoxMode,A as isHetznerCapacityError,d as normalizeRoutePath,r as normalizeSshPublicKey,z as planHetznerServerResize,J as prepareHetznerResize,S as readResizeCheckpoint,ga as releaseTarballTmpPath,ma as reloadRpxGateway,h as renderRpxLauncher,na as renewRpxCertificates,Q as resizeCheckpointPath,R as resizeLockPath,da as resolveExecStart,q as resolveHetznerApiToken,L as resolveHetznerHostOptimizationPlan,F as scpUpload,Y as serverPublicIpv4,D as sshExec,E as sshExecOrThrow,P as verifyHetznerHostOptimization,K as verifyHetznerResize,H as waitForCloudInit,G as waitForSsh,s as wrapCloudInitUserData,T as writeResizeCheckpoint};
1
+ import{$g as G,Ag as g,Ah as ea,Bg as h,Bh as fa,Cg as i,Ch as ga,Dg as j,Dh as ha,Eg as k,Eh as ia,Fg as l,Fh as ja,Gg as m,Hg as n,Ig as o,Kg as p,Lg as q,Mg as r,Ng as s,Nh as ka,Og as t,Oh as la,Pg as u,Ph as ma,Qg as v,Qh as na,Rg as w,Rh as oa,Sg as x,Sh as pa,Tg as y,Th as qa,Ug as z,Uh as ra,Vg as A,Wg as B,Xg as C,Yg as D,Zg as E,_g as F,ah as H,bh as I,ch as J,dh as K,eh as L,fh as M,gh as N,hh as O,ih as P,jh as Q,kh as R,lh as S,mh as T,nh as U,oh as V,ph as W,qh as X,rh as Y,sh as Z,th as _,ug as a,uh as aa,vg as b,vh as ba,wg as c,wh as ca,xg as d,yg as e,zg as f,zh as da}from"../chunk-aw0spg20.js";import"../chunk-aj025v2s.js";import"../chunk-wavjkdb8.js";import"../chunk-nk7sav4r.js";import"../chunk-mz0dk78z.js";import"../chunk-hn40z11p.js";import"../chunk-x3hay61c.js";import"../chunk-zz52xje8.js";import"../chunk-z2qqwy7e.js";export{ba as AwsBoxProvisioner,o as AwsDriver,x as CloudDriverFactory,a as DEFAULT_RPX_CERTS_DIR,aa as HetznerBoxProvisioner,p as HetznerClient,t as HetznerDriver,u as LocalBoxDriver,pa as MANAGED_CACHE_POLICY_DISABLED,oa as MANAGED_CACHE_POLICY_OPTIMIZED,qa as MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,i as RPX_DIR,j as RPX_LAUNCHER_PATH,k as RPX_SERVICE_NAME,Z as UBUNTU_2404_AMI_PARAM,U as acquireResizeLock,N as applyHetznerHostOptimization,ha as buildAwsArtifactFetch,_ as buildBoxUserData,ra as buildCloudFrontOriginConfig,M as buildHetznerHostOptimizationScript,ja as buildHostCleanupScript,ia as buildLocalArtifactFetch,f as buildRpxConfig,m as buildRpxFragmentRefreshScript,g as buildRpxLbConfig,l as buildRpxProvisionScript,ea as buildSiteDeployScript,C as buildSshArgs,fa as buildStaticSiteDeployScript,y as cloudDrivers,O as collectHetznerHostOptimizationReport,I as collectHetznerResizeManifest,ca as createBoxProvisioner,w as createCloudDriver,la as deployAllComputeSites,ka as deploySiteRelease,e as deriveRouteId,W as ensureFirewall,X as ensureServer,V as ensureSshKey,B as executeHetznerServerResize,c as gatewayHostnames,n as generateUbuntuAppCloudInit,b as hasAutoWwwVariant,v as isBoxMode,A as isHetznerCapacityError,d as normalizeRoutePath,r as normalizeSshPublicKey,z as planHetznerServerResize,J as prepareHetznerResize,S as readResizeCheckpoint,ga as releaseTarballTmpPath,ma as reloadRpxGateway,h as renderRpxLauncher,na as renewRpxCertificates,Q as resizeCheckpointPath,R as resizeLockPath,da as resolveExecStart,q as resolveHetznerApiToken,L as resolveHetznerHostOptimizationPlan,F as scpUpload,Y as serverPublicIpv4,D as sshExec,E as sshExecOrThrow,P as verifyHetznerHostOptimization,K as verifyHetznerResize,H as waitForCloudInit,G as waitForSsh,s as wrapCloudInitUserData,T as writeResizeCheckpoint};
@@ -16,6 +16,30 @@ import type { SharedPathEntry } from '@ts-cloud/core';
16
16
  * systemd ExecStart by swapping the leading runtime word for its absolute path.
17
17
  */
18
18
  export declare function resolveExecStart(start: string, runtime: 'bun' | 'node' | 'deno'): string;
19
+ /**
20
+ * Shell that installs a recurring liveness check for one ported service.
21
+ *
22
+ * Three files: a check script, a oneshot service that runs it, and a timer.
23
+ * The script resolves the unit to probe at run time rather than baking in a
24
+ * release id, so it keeps working after the next deploy replaces the instance.
25
+ *
26
+ * `curl` without `-f`: any HTTP response means the process is answering, and a
27
+ * 404 on `/` is a routing opinion, not a wedged event loop. Only a connection
28
+ * failure or a timeout counts against it.
29
+ *
30
+ * A restart needs N consecutive failures, counted in a file under /run, so a
31
+ * single slow moment cannot bounce a healthy service; the counter resets on the
32
+ * first good response. flock keeps two ticks from overlapping.
33
+ */
34
+ export declare function buildLivenessUnits(options: {
35
+ unitBase: string;
36
+ /** systemd unit to restart. A `<base>@*.service` glob resolves at run time. */
37
+ unitPattern: string;
38
+ port: number;
39
+ path?: string;
40
+ intervalSeconds?: number;
41
+ failuresBeforeRestart?: number;
42
+ }): string[];
19
43
  export interface BuildSiteDeployScriptOptions {
20
44
  siteName: string;
21
45
  slug: string;
@@ -74,6 +98,31 @@ export interface BuildSiteDeployScriptOptions {
74
98
  * @default 5
75
99
  */
76
100
  healthGateSeconds?: number;
101
+ /**
102
+ * Recurring liveness check for a ported site: a timer that asks the service
103
+ * for an HTTP response and restarts it when it stops answering.
104
+ *
105
+ * `Restart=always` only covers a process that EXITS. A process that is alive
106
+ * and no longer serving is invisible to systemd: it reports `active`, the
107
+ * port stays bound, and connections pile up in the accept backlog. One app
108
+ * on a shared box sat like that for eight days with `active (running)` and
109
+ * 46 queued connections, and nothing anywhere noticed.
110
+ *
111
+ * The probe is an HTTP request rather than a listener check for that exact
112
+ * reason — `ss` would have called the wedged process healthy.
113
+ *
114
+ * Set `false` to opt out (a service that legitimately answers nothing on its
115
+ * port, or one where a restart is more dangerous than an outage).
116
+ * @default enabled, `/` every 60s, restart after 3 consecutive failures
117
+ */
118
+ liveness?: false | {
119
+ /** Path to request. @default '/' */
120
+ path?: string;
121
+ /** Seconds between checks. @default 60 */
122
+ intervalSeconds?: number;
123
+ /** Consecutive failures before a restart. @default 3 */
124
+ failuresBeforeRestart?: number;
125
+ };
77
126
  /**
78
127
  * systemd `MemoryHigh` for the app unit. See {@link SiteConfig.memoryHigh}.
79
128
  * @default '2G'