@stacksjs/ts-cloud 0.12.7 → 0.12.9

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 (119) hide show
  1. package/dist/aws/index.d.ts +1 -0
  2. package/dist/aws/index.js +1 -1
  3. package/dist/aws/sms-voice.d.ts +41 -0
  4. package/dist/bin/{chunk-1jetwd47.js → chunk-04dkwaqp.js} +1 -1
  5. package/dist/bin/{chunk-h5wbsxce.js → chunk-0thy7q96.js} +48 -48
  6. package/dist/bin/{chunk-rpn3mzkh.js → chunk-aw8bhggq.js} +1 -1
  7. package/dist/bin/{chunk-vjzkfd63.js → chunk-azymqbcy.js} +1 -1
  8. package/dist/bin/{chunk-js12scjn.js → chunk-sg1g92cf.js} +1 -1
  9. package/dist/bin/{chunk-39pe9tc3.js → chunk-vj2dp0nh.js} +9 -9
  10. package/dist/bin/cli.js +113 -113
  11. package/dist/bin/dashboard-server.js +1 -1
  12. package/dist/{chunk-13qjvbqh.js → chunk-0hw5wjjg.js} +1 -1
  13. package/dist/chunk-1bj94sc2.js +1 -0
  14. package/dist/{chunk-3mgj3hrh.js → chunk-2k0mt6j5.js} +2 -2
  15. package/dist/chunk-2qm3rw8b.js +4 -0
  16. package/dist/{chunk-vtvfg2f2.js → chunk-3swnmwfc.js} +74 -74
  17. package/dist/{chunk-aj025v2s.js → chunk-557qj7q9.js} +2 -2
  18. package/dist/{chunk-86ss83s2.js → chunk-5hkq5081.js} +2 -2
  19. package/dist/chunk-5pbtmy2k.js +1 -0
  20. package/dist/{chunk-152he7m3.js → chunk-70v77sqv.js} +2 -2
  21. package/dist/{chunk-by2bwzk6.js → chunk-7j100g7w.js} +2 -2
  22. package/dist/chunk-7sc8t7v1.js +1 -0
  23. package/dist/{chunk-m8fs0233.js → chunk-82gezmen.js} +2 -2
  24. package/dist/{chunk-y4xkj2f1.js → chunk-982rye5b.js} +2 -2
  25. package/dist/{chunk-mz0dk78z.js → chunk-a368cs92.js} +1 -1
  26. package/dist/{chunk-t0xgmhd6.js → chunk-a5213256.js} +8 -8
  27. package/dist/{chunk-hn40z11p.js → chunk-bcffjsnj.js} +1 -1
  28. package/dist/chunk-c1hr34a5.js +2 -0
  29. package/dist/{chunk-wavjkdb8.js → chunk-c8cadhgc.js} +2 -2
  30. package/dist/{chunk-xcj8zfmg.js → chunk-fbwpm0zm.js} +2 -2
  31. package/dist/{chunk-s5q2k7a0.js → chunk-fgfm7cfm.js} +120 -114
  32. package/dist/{chunk-jm5mg890.js → chunk-fsssdd5k.js} +2 -2
  33. package/dist/chunk-gny5s4kp.js +1 -0
  34. package/dist/{chunk-73ztr55z.js → chunk-jphewtbx.js} +2 -2
  35. package/dist/{chunk-h42zck7h.js → chunk-jxrs1219.js} +3 -3
  36. package/dist/{chunk-x3hay61c.js → chunk-pb47hr0h.js} +1 -1
  37. package/dist/chunk-qpjcd415.js +22 -0
  38. package/dist/{chunk-6kpbveb8.js → chunk-qrte4gy2.js} +1 -1
  39. package/dist/{chunk-tz9myq9a.js → chunk-rg7d67xk.js} +2 -2
  40. package/dist/{chunk-1qdne0bf.js → chunk-w2ddj42w.js} +1 -1
  41. package/dist/chunk-xkw7h4pw.js +1 -0
  42. package/dist/deploy/index.d.ts +2 -0
  43. package/dist/deploy/index.js +1 -1
  44. package/dist/deploy/site-config-editor.d.ts +26 -0
  45. package/dist/deploy/site-ports.d.ts +20 -2
  46. package/dist/dns/index.js +1 -1
  47. package/dist/drivers/index.js +1 -1
  48. package/dist/drivers/shared/mail-provision.d.ts +21 -1
  49. package/dist/index.d.ts +4 -2
  50. package/dist/index.js +8 -8
  51. package/dist/operations/index.d.ts +24 -0
  52. package/dist/operations/index.js +1 -0
  53. package/dist/operations/inventory.d.ts +168 -0
  54. package/dist/operations/inventory.test.d.ts +1 -0
  55. package/dist/operations/site-attach.d.ts +95 -0
  56. package/dist/operations/site-attach.test.d.ts +1 -0
  57. package/dist/protection/index.js +1 -1
  58. package/dist/push/index.js +1 -1
  59. package/dist/spend/index.js +1 -1
  60. package/dist/ui/404.html +1 -1
  61. package/dist/ui/accept-invitation.html +1 -1
  62. package/dist/ui/access-denied.html +1 -1
  63. package/dist/ui/account/automation.html +6 -6
  64. package/dist/ui/account/security.html +2 -2
  65. package/dist/ui/applications/compose.html +5 -5
  66. package/dist/ui/applications/new.html +2 -2
  67. package/dist/ui/data/backups.html +6 -6
  68. package/dist/ui/data/services.html +6 -6
  69. package/dist/ui/data/volumes.html +6 -6
  70. package/dist/ui/index.html +6 -6
  71. package/dist/ui/infrastructure/topology.html +6 -6
  72. package/dist/ui/integrations.html +2 -2
  73. package/dist/ui/operations/alerts.html +6 -6
  74. package/dist/ui/operations/configuration.html +6 -6
  75. package/dist/ui/operations/jobs.html +6 -6
  76. package/dist/ui/operations/maintenance.html +6 -6
  77. package/dist/ui/operations/observability.html +6 -6
  78. package/dist/ui/operations/previews.html +6 -6
  79. package/dist/ui/operations/queue.html +6 -6
  80. package/dist/ui/operations/regions.html +6 -6
  81. package/dist/ui/operations/releases.html +6 -6
  82. package/dist/ui/operations/spend.html +6 -6
  83. package/dist/ui/operations/workloads.html +6 -6
  84. package/dist/ui/security.html +2 -2
  85. package/dist/ui/server/actions.html +6 -6
  86. package/dist/ui/server/activity.html +1 -1
  87. package/dist/ui/server/capacity.html +5 -5
  88. package/dist/ui/server/database.html +5 -5
  89. package/dist/ui/server/deployments.html +5 -5
  90. package/dist/ui/server/diagnostics.html +2 -2
  91. package/dist/ui/server/firewall.html +6 -6
  92. package/dist/ui/server/fleet.html +6 -6
  93. package/dist/ui/server/logs.html +5 -5
  94. package/dist/ui/server/metrics.html +5 -5
  95. package/dist/ui/server/security.html +2 -2
  96. package/dist/ui/server/services.html +2 -2
  97. package/dist/ui/server/sites.html +6 -6
  98. package/dist/ui/server/ssh-keys.html +5 -5
  99. package/dist/ui/server/team.html +6 -6
  100. package/dist/ui/server/terminal.html +2 -2
  101. package/dist/ui/serverless/alarms.html +6 -6
  102. package/dist/ui/serverless/assets.html +2 -2
  103. package/dist/ui/serverless/cost.html +2 -2
  104. package/dist/ui/serverless/data.html +5 -5
  105. package/dist/ui/serverless/deployments.html +2 -2
  106. package/dist/ui/serverless/firewall.html +1 -1
  107. package/dist/ui/serverless/functions.html +6 -6
  108. package/dist/ui/serverless/logs.html +6 -6
  109. package/dist/ui/serverless/metrics.html +2 -2
  110. package/dist/ui/serverless/queues.html +6 -6
  111. package/dist/ui/serverless/secrets.html +5 -5
  112. package/dist/ui/serverless/traces.html +6 -6
  113. package/dist/ui/serverless.html +6 -6
  114. package/package.json +7 -3
  115. package/dist/chunk-a84gmpyh.js +0 -1
  116. package/dist/chunk-nms5q44e.js +0 -1
  117. package/dist/chunk-qm32ytbr.js +0 -1
  118. package/dist/chunk-t3t9ymec.js +0 -1
  119. package/dist/chunk-y2v22hkv.js +0 -1
@@ -1 +1 @@
1
- import{ul as w}from"./chunk-x3hay61c.js";var L="\x00";function k(t,i){if(t==="*"||t==="**")return!0;let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*");return new RegExp(`^${e}$`).test(i)}function y(t,i){if(t.startsWith("*.")){let e=t.slice(1);return i.endsWith(e)&&i.length>e.length}return t===i}function d(t,i){if(t.enabled===!1)return!1;if(t.methods?.length&&!t.methods.some((e)=>e.toUpperCase()===i.method.toUpperCase()))return!1;if(t.path&&!k(t.path,i.path))return!1;if(t.host&&!y(t.host,i.host??""))return!1;return!0}function m(t,i){let e=t.key??{source:"ip"},o=e.fallbackToIp!==!1,r;if(e.source==="ip")r=i.ip;else if(e.source==="global")r="global";else if(e.source==="host")r=i.host??"";else if(e.source==="path")r=i.path;else if(e.source==="header")r=e.name?i.headers?.[e.name.toLowerCase()]:void 0;else if(e.source==="cookie")r=e.name?i.cookies?.[e.name]:void 0;if(!r&&e.source!=="global")r=o?i.ip:"__missing__";return`${t.id}\x00${r}`}class A{clock;maxTrackedKeys;buckets=new Map;windows=new Map;rules;constructor(t,i=()=>Date.now(),e=1e5){this.clock=i;this.maxTrackedKeys=e;this.rules=[...t].sort((o,r)=>(o.priority??0)-(r.priority??0))}check(t){let i=this.clock(),e=this.rules.filter((n)=>d(n,t)),o;for(let n of e){let s=this.test(n,t,i);if(s.allowed)continue;if(!o||p(s.action)>p(o.action))o=s}if(o)return o;let r={action:"allow",allowed:!0};for(let n of e){let s=this.consume(n,t,i);if(s.remaining!=null&&(r.remaining??1/0)>s.remaining)r=s}return r}test(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let n=t.burst??t.limit,s=this.buckets.get(o),a=s?Math.min(n,s.tokens+this.refill(t,e-s.updatedAt)):n;if(a>=1)return{action:"allow",allowed:!0};return this.blocked(t,o,0,this.msPerToken(t)*(1-a),e)}let r=(this.windows.get(o)?.hits??[]).filter((n)=>n>e-t.windowMs);if(r.length<t.limit)return{action:"allow",allowed:!0};return this.blocked(t,o,0,r[0]+t.windowMs-e,e)}peek(t){let i=this.clock();for(let e of this.rules){if(!d(e,t))continue;let o=this.test(e,t,i);if(!o.allowed)return o}return{action:"allow",allowed:!0}}msPerToken(t){return t.windowMs/Math.max(1,t.limit)}refill(t,i){return Math.max(0,i)/this.msPerToken(t)}blocked(t,i,e,o,r){let n=t.action??"deny";return{action:n,allowed:n==="allow"||n==="log",ruleId:t.id,limit:t.limit,remaining:e,retryAfterMs:Math.max(0,Math.ceil(o)),resetAt:r+Math.max(0,o),key:i}}consume(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let l=t.burst??t.limit,u=this.buckets.get(o)??{tokens:l,updatedAt:e},c=Math.min(l,u.tokens+this.refill(t,e-u.updatedAt));if(c<1)return this.buckets.set(o,{tokens:c,updatedAt:e}),this.blocked(t,o,0,this.msPerToken(t)*(1-c),e);return this.evictIfNeeded(this.buckets),this.buckets.set(o,{tokens:c-1,updatedAt:e}),{action:"allow",allowed:!0,ruleId:t.id,limit:l,remaining:Math.floor(c-1),resetAt:e+this.msPerToken(t)*(l-(c-1)),key:o}}let n=this.windows.get(o)??{hits:[]},s=e-t.windowMs,a=n.hits.filter((l)=>l>s);if(a.length>=t.limit)return this.windows.set(o,{hits:a}),this.blocked(t,o,0,a[0]+t.windowMs-e,e);return a.push(e),this.evictIfNeeded(this.windows),this.windows.set(o,{hits:a}),{action:"allow",allowed:!0,ruleId:t.id,limit:t.limit,remaining:t.limit-a.length,resetAt:a[0]+t.windowMs,key:o}}evictIfNeeded(t){if(t.size<this.maxTrackedKeys)return;let i=t.size-this.maxTrackedKeys+1,e=0;for(let o of t.keys())if(t.delete(o),++e>=i)break}sweep(){let t=this.clock(),i=0;for(let[e,o]of this.windows){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n){this.windows.delete(e),i++;continue}if(o.hits.every((s)=>s<=t-n.windowMs))this.windows.delete(e),i++}for(let[e,o]of this.buckets){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n||t-o.updatedAt>n.windowMs*2)this.buckets.delete(e),i++}return i}get trackedKeys(){return this.buckets.size+this.windows.size}}function p(t){return{allow:0,log:1,throttle:2,challenge:3,deny:4}[t]}function I(t){let i={};if(t.limit!=null)i["ratelimit-limit"]=String(t.limit);if(t.remaining!=null)i["ratelimit-remaining"]=String(t.remaining);if(t.resetAt!=null)i["ratelimit-reset"]=String(Math.max(0,Math.ceil((t.resetAt-Date.now())/1000)));if(!t.allowed&&t.retryAfterMs!=null)i["retry-after"]=String(Math.max(1,Math.ceil(t.retryAfterMs/1000)));return i}function C(){return[{id:"global-ip",limit:600,windowMs:60000,burst:100,key:{source:"ip"},action:"deny",priority:100},{id:"api-ip",limit:120,windowMs:60000,burst:30,path:"/api/**",key:{source:"ip"},action:"deny",priority:50},{id:"auth-ip",limit:10,windowMs:60000,algorithm:"sliding_window",path:"/auth/**",methods:["POST"],key:{source:"ip"},action:"challenge",priority:10}]}var h="protection.controls",b=24,x=4,M={ipRules:{allow:[],block:[]}};function f(t,i){if(!t?.enabled)return;return new Date(t.expiresAt).getTime()>i.getTime()?t:void 0}function g(t,i){let e=Number.isFinite(t)?Number(t):i;return Math.min(b,Math.max(0.25,e))}var R=500;class P{controlPlane;options;constructor(t,i={}){this.controlPlane=t;this.options=i}now(){return this.options.now?.()??new Date}read(){let t=this.controlPlane.getSetting(h);if(!t||typeof t!=="object"||Array.isArray(t))return{...M,ipRules:{allow:[],block:[]}};let i=t;return{attackMode:i.attackMode,mitigationPause:i.mitigationPause,ipRules:{allow:Array.isArray(i.ipRules?.allow)?i.ipRules.allow:[],block:Array.isArray(i.ipRules?.block)?i.ipRules.block:[]},updatedAt:i.updatedAt}}write(t){let i={...t,updatedAt:this.now().toISOString()};return this.controlPlane.setSetting(h,i),i}raw(){return this.read()}current(){let t=this.now(),i=this.read();return{attackMode:f(i.attackMode,t),mitigationPause:f(i.mitigationPause,t),ipRules:i.ipRules}}enableAttackMode(t){let i=this.now(),e={enabled:!0,startedAt:i.toISOString(),expiresAt:new Date(i.getTime()+g(t.hours,x)*3600000).toISOString(),reason:t.reason.trim()||"Attack mode enabled by an operator.",actorId:t.actorId};return this.write({...this.read(),attackMode:e}),e}disableAttackMode(){let t=this.read();if(!t.attackMode?.enabled)return!1;return this.write({...t,attackMode:{...t.attackMode,enabled:!1}}),!0}pauseMitigations(t){let i=t.reason.trim();if(!i)throw Error("Pausing mitigations requires a reason: you are liable for the traffic it admits.");let e=this.now(),o={enabled:!0,startedAt:e.toISOString(),expiresAt:new Date(e.getTime()+g(t.hours,b)*3600000).toISOString(),reason:i,actorId:t.actorId};return this.write({...this.read(),mitigationPause:o}),o}resumeMitigations(){let t=this.read();if(!t.mitigationPause?.enabled)return!1;return this.write({...t,mitigationPause:{...t.mitigationPause,enabled:!1}}),!0}addIpRule(t,i){let e=i.trim();if(!w(e))throw Error(`Not a valid IP or CIDR: ${i}`);let o=this.read(),r={...o.ipRules,[t]:[...new Set([...o.ipRules[t],e])]};if(r[t].length>R)throw Error(`At most ${R} ${t} rules are supported.`);let n=t==="allow"?"block":"allow";return r[n]=r[n].filter((s)=>s!==e),this.write({...o,ipRules:r}),r}removeIpRule(t,i){let e=this.read(),o={...e.ipRules,[t]:e.ipRules[t].filter((r)=>r!==i.trim())};return this.write({...e,ipRules:o}),o}}function D(t){if(t.mitigationPause)return{attackMode:!!t.attackMode,mitigationPaused:!0,summary:`Automatic mitigation is paused until ${t.mitigationPause.expiresAt}. All traffic is being served and billed.`,expiresAt:t.mitigationPause.expiresAt};if(t.attackMode)return{attackMode:!0,mitigationPaused:!1,summary:`Attack mode is on until ${t.attackMode.expiresAt}. Every visitor is being challenged.`,expiresAt:t.attackMode.expiresAt};return{attackMode:!1,mitigationPaused:!1,summary:"Protection is in its normal posture."}}function E(t,i){if(i.mitigationPause)return t.map((e)=>({...e,enabled:!1}));if(!i.attackMode)return[...t];return t.map((e)=>({...e,action:e.action==="deny"?"deny":"challenge",burst:Math.max(1,Math.min(e.burst??e.limit,5))}))}function T(t,i){let e=[...new Set([...t.allowlist??[],...i.ipRules.allow])],o=[...new Set([...t.blocklist??[],...i.ipRules.block])];if(i.mitigationPause)return{...t,allowlist:e,blocklist:o,monitorOnly:!0};if(!i.attackMode)return{...t,allowlist:e,blocklist:o};let r=t.thresholds??{};return{...t,allowlist:e,blocklist:o,thresholds:{...r,newConnectionsPerSecond:Math.max(1,Math.floor((r.newConnectionsPerSecond??50)/5)),concurrentPerSource:Math.max(1,Math.floor((r.concurrentPerSource??100)/5))}}}function v(t,i){let e=t?.infrastructure?.compute;if(!e||e.ddos===!1)return t;let o=typeof e.ddos==="object"&&e.ddos!==null?e.ddos:{};return{...t,infrastructure:{...t.infrastructure,compute:{...e,ddos:T(o,i)}}}}export{L as _k,k as $k,d as al,m as bl,A as cl,I as dl,C as el,h as fl,b as gl,x as hl,P as il,D as jl,E as kl,T as ll,v as ml};
1
+ import{Gm as w}from"./chunk-pb47hr0h.js";var L="\x00";function k(t,i){if(t==="*"||t==="**")return!0;let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*");return new RegExp(`^${e}$`).test(i)}function y(t,i){if(t.startsWith("*.")){let e=t.slice(1);return i.endsWith(e)&&i.length>e.length}return t===i}function d(t,i){if(t.enabled===!1)return!1;if(t.methods?.length&&!t.methods.some((e)=>e.toUpperCase()===i.method.toUpperCase()))return!1;if(t.path&&!k(t.path,i.path))return!1;if(t.host&&!y(t.host,i.host??""))return!1;return!0}function m(t,i){let e=t.key??{source:"ip"},o=e.fallbackToIp!==!1,r;if(e.source==="ip")r=i.ip;else if(e.source==="global")r="global";else if(e.source==="host")r=i.host??"";else if(e.source==="path")r=i.path;else if(e.source==="header")r=e.name?i.headers?.[e.name.toLowerCase()]:void 0;else if(e.source==="cookie")r=e.name?i.cookies?.[e.name]:void 0;if(!r&&e.source!=="global")r=o?i.ip:"__missing__";return`${t.id}\x00${r}`}class A{clock;maxTrackedKeys;buckets=new Map;windows=new Map;rules;constructor(t,i=()=>Date.now(),e=1e5){this.clock=i;this.maxTrackedKeys=e;this.rules=[...t].sort((o,r)=>(o.priority??0)-(r.priority??0))}check(t){let i=this.clock(),e=this.rules.filter((n)=>d(n,t)),o;for(let n of e){let s=this.test(n,t,i);if(s.allowed)continue;if(!o||p(s.action)>p(o.action))o=s}if(o)return o;let r={action:"allow",allowed:!0};for(let n of e){let s=this.consume(n,t,i);if(s.remaining!=null&&(r.remaining??1/0)>s.remaining)r=s}return r}test(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let n=t.burst??t.limit,s=this.buckets.get(o),a=s?Math.min(n,s.tokens+this.refill(t,e-s.updatedAt)):n;if(a>=1)return{action:"allow",allowed:!0};return this.blocked(t,o,0,this.msPerToken(t)*(1-a),e)}let r=(this.windows.get(o)?.hits??[]).filter((n)=>n>e-t.windowMs);if(r.length<t.limit)return{action:"allow",allowed:!0};return this.blocked(t,o,0,r[0]+t.windowMs-e,e)}peek(t){let i=this.clock();for(let e of this.rules){if(!d(e,t))continue;let o=this.test(e,t,i);if(!o.allowed)return o}return{action:"allow",allowed:!0}}msPerToken(t){return t.windowMs/Math.max(1,t.limit)}refill(t,i){return Math.max(0,i)/this.msPerToken(t)}blocked(t,i,e,o,r){let n=t.action??"deny";return{action:n,allowed:n==="allow"||n==="log",ruleId:t.id,limit:t.limit,remaining:e,retryAfterMs:Math.max(0,Math.ceil(o)),resetAt:r+Math.max(0,o),key:i}}consume(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let l=t.burst??t.limit,u=this.buckets.get(o)??{tokens:l,updatedAt:e},c=Math.min(l,u.tokens+this.refill(t,e-u.updatedAt));if(c<1)return this.buckets.set(o,{tokens:c,updatedAt:e}),this.blocked(t,o,0,this.msPerToken(t)*(1-c),e);return this.evictIfNeeded(this.buckets),this.buckets.set(o,{tokens:c-1,updatedAt:e}),{action:"allow",allowed:!0,ruleId:t.id,limit:l,remaining:Math.floor(c-1),resetAt:e+this.msPerToken(t)*(l-(c-1)),key:o}}let n=this.windows.get(o)??{hits:[]},s=e-t.windowMs,a=n.hits.filter((l)=>l>s);if(a.length>=t.limit)return this.windows.set(o,{hits:a}),this.blocked(t,o,0,a[0]+t.windowMs-e,e);return a.push(e),this.evictIfNeeded(this.windows),this.windows.set(o,{hits:a}),{action:"allow",allowed:!0,ruleId:t.id,limit:t.limit,remaining:t.limit-a.length,resetAt:a[0]+t.windowMs,key:o}}evictIfNeeded(t){if(t.size<this.maxTrackedKeys)return;let i=t.size-this.maxTrackedKeys+1,e=0;for(let o of t.keys())if(t.delete(o),++e>=i)break}sweep(){let t=this.clock(),i=0;for(let[e,o]of this.windows){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n){this.windows.delete(e),i++;continue}if(o.hits.every((s)=>s<=t-n.windowMs))this.windows.delete(e),i++}for(let[e,o]of this.buckets){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n||t-o.updatedAt>n.windowMs*2)this.buckets.delete(e),i++}return i}get trackedKeys(){return this.buckets.size+this.windows.size}}function p(t){return{allow:0,log:1,throttle:2,challenge:3,deny:4}[t]}function I(t){let i={};if(t.limit!=null)i["ratelimit-limit"]=String(t.limit);if(t.remaining!=null)i["ratelimit-remaining"]=String(t.remaining);if(t.resetAt!=null)i["ratelimit-reset"]=String(Math.max(0,Math.ceil((t.resetAt-Date.now())/1000)));if(!t.allowed&&t.retryAfterMs!=null)i["retry-after"]=String(Math.max(1,Math.ceil(t.retryAfterMs/1000)));return i}function C(){return[{id:"global-ip",limit:600,windowMs:60000,burst:100,key:{source:"ip"},action:"deny",priority:100},{id:"api-ip",limit:120,windowMs:60000,burst:30,path:"/api/**",key:{source:"ip"},action:"deny",priority:50},{id:"auth-ip",limit:10,windowMs:60000,algorithm:"sliding_window",path:"/auth/**",methods:["POST"],key:{source:"ip"},action:"challenge",priority:10}]}var h="protection.controls",b=24,x=4,M={ipRules:{allow:[],block:[]}};function f(t,i){if(!t?.enabled)return;return new Date(t.expiresAt).getTime()>i.getTime()?t:void 0}function g(t,i){let e=Number.isFinite(t)?Number(t):i;return Math.min(b,Math.max(0.25,e))}var R=500;class P{controlPlane;options;constructor(t,i={}){this.controlPlane=t;this.options=i}now(){return this.options.now?.()??new Date}read(){let t=this.controlPlane.getSetting(h);if(!t||typeof t!=="object"||Array.isArray(t))return{...M,ipRules:{allow:[],block:[]}};let i=t;return{attackMode:i.attackMode,mitigationPause:i.mitigationPause,ipRules:{allow:Array.isArray(i.ipRules?.allow)?i.ipRules.allow:[],block:Array.isArray(i.ipRules?.block)?i.ipRules.block:[]},updatedAt:i.updatedAt}}write(t){let i={...t,updatedAt:this.now().toISOString()};return this.controlPlane.setSetting(h,i),i}raw(){return this.read()}current(){let t=this.now(),i=this.read();return{attackMode:f(i.attackMode,t),mitigationPause:f(i.mitigationPause,t),ipRules:i.ipRules}}enableAttackMode(t){let i=this.now(),e={enabled:!0,startedAt:i.toISOString(),expiresAt:new Date(i.getTime()+g(t.hours,x)*3600000).toISOString(),reason:t.reason.trim()||"Attack mode enabled by an operator.",actorId:t.actorId};return this.write({...this.read(),attackMode:e}),e}disableAttackMode(){let t=this.read();if(!t.attackMode?.enabled)return!1;return this.write({...t,attackMode:{...t.attackMode,enabled:!1}}),!0}pauseMitigations(t){let i=t.reason.trim();if(!i)throw Error("Pausing mitigations requires a reason: you are liable for the traffic it admits.");let e=this.now(),o={enabled:!0,startedAt:e.toISOString(),expiresAt:new Date(e.getTime()+g(t.hours,b)*3600000).toISOString(),reason:i,actorId:t.actorId};return this.write({...this.read(),mitigationPause:o}),o}resumeMitigations(){let t=this.read();if(!t.mitigationPause?.enabled)return!1;return this.write({...t,mitigationPause:{...t.mitigationPause,enabled:!1}}),!0}addIpRule(t,i){let e=i.trim();if(!w(e))throw Error(`Not a valid IP or CIDR: ${i}`);let o=this.read(),r={...o.ipRules,[t]:[...new Set([...o.ipRules[t],e])]};if(r[t].length>R)throw Error(`At most ${R} ${t} rules are supported.`);let n=t==="allow"?"block":"allow";return r[n]=r[n].filter((s)=>s!==e),this.write({...o,ipRules:r}),r}removeIpRule(t,i){let e=this.read(),o={...e.ipRules,[t]:e.ipRules[t].filter((r)=>r!==i.trim())};return this.write({...e,ipRules:o}),o}}function D(t){if(t.mitigationPause)return{attackMode:!!t.attackMode,mitigationPaused:!0,summary:`Automatic mitigation is paused until ${t.mitigationPause.expiresAt}. All traffic is being served and billed.`,expiresAt:t.mitigationPause.expiresAt};if(t.attackMode)return{attackMode:!0,mitigationPaused:!1,summary:`Attack mode is on until ${t.attackMode.expiresAt}. Every visitor is being challenged.`,expiresAt:t.attackMode.expiresAt};return{attackMode:!1,mitigationPaused:!1,summary:"Protection is in its normal posture."}}function E(t,i){if(i.mitigationPause)return t.map((e)=>({...e,enabled:!1}));if(!i.attackMode)return[...t];return t.map((e)=>({...e,action:e.action==="deny"?"deny":"challenge",burst:Math.max(1,Math.min(e.burst??e.limit,5))}))}function T(t,i){let e=[...new Set([...t.allowlist??[],...i.ipRules.allow])],o=[...new Set([...t.blocklist??[],...i.ipRules.block])];if(i.mitigationPause)return{...t,allowlist:e,blocklist:o,monitorOnly:!0};if(!i.attackMode)return{...t,allowlist:e,blocklist:o};let r=t.thresholds??{};return{...t,allowlist:e,blocklist:o,thresholds:{...r,newConnectionsPerSecond:Math.max(1,Math.floor((r.newConnectionsPerSecond??50)/5)),concurrentPerSource:Math.max(1,Math.floor((r.concurrentPerSource??100)/5))}}}function v(t,i){let e=t?.infrastructure?.compute;if(!e||e.ddos===!1)return t;let o=typeof e.ddos==="object"&&e.ddos!==null?e.ddos:{};return{...t,infrastructure:{...t.infrastructure,compute:{...e,ddos:T(o,i)}}}}export{L as a,k as b,d as c,m as d,A as e,I as f,C as g,h,b as i,x as j,P as k,D as l,E as m,T as n,v as o};
@@ -0,0 +1 @@
1
+ import{Wf as a}from"./chunk-fbwpm0zm.js";import"./chunk-a368cs92.js";import"./chunk-0hw5wjjg.js";export{a as RDSClient};
@@ -3,6 +3,8 @@
3
3
  * High-level deployment functions for common AWS architectures
4
4
  */
5
5
  export * from './site-target';
6
+ export * from './site-config-editor';
7
+ export * from './site-ports';
6
8
  export * from './server-dns';
7
9
  export * from './dashboard-control-plane';
8
10
  export * from './dashboard-route-manifest';
@@ -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-s5q2k7a0.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-h42zck7h.js";import{Id as _}from"../chunk-3mgj3hrh.js";import"../chunk-t0xgmhd6.js";import"../chunk-m8fs0233.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-vtvfg2f2.js";import"../chunk-aj025v2s.js";import"../chunk-wavjkdb8.js";import"../chunk-152he7m3.js";import"../chunk-mz0dk78z.js";import"../chunk-86ss83s2.js";import"../chunk-hn40z11p.js";import"../chunk-x3hay61c.js";import"../chunk-jm5mg890.js";import"../chunk-13qjvbqh.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{$c as ra,Ac as I,Bc as J,Cc as K,Dc as L,Ec as M,Fc as N,Gc as O,Hc as P,Ic as Q,Jc as R,Kc as S,Lc as T,Mc as U,Nc as V,Oc as W,Pc as X,Pd as Ha,Qc as ga,Qd as Ia,Rc as ha,Rd as Ja,Sc as ia,Sd as Ka,Tc as ja,Uc as ka,Vc as la,Wc as ma,Xc as na,Yc as oa,Zc as pa,_c as qa,ad as ta,bd as ua,cd as va,dd as wa,ed as xa,fd as ya,gd as za,hd as Aa,id as Ba,jd as Ca,kd as Da,ld as Ea,md as Fa,nd as Ga,xc as F,yc as G,zc as H}from"../chunk-fgfm7cfm.js";import{$d as fa,Td as Y,Ud as Z,Vd as _,Wd as aa,Xd as ba,Yd as ca,Zd as da,_d as ea}from"../chunk-jxrs1219.js";import{he as sa}from"../chunk-2k0mt6j5.js";import"../chunk-a5213256.js";import"../chunk-82gezmen.js";import"../chunk-7j100g7w.js";import"../chunk-jphewtbx.js";import"../chunk-fbwpm0zm.js";import"../chunk-rg7d67xk.js";import"../chunk-982rye5b.js";import{$h as D,Ag as y,Xh as z,Yh as A,Zh as B,_h as C,ai as E,ug as s,vg as t,wg as u,xg as v,yg as w,zg as x}from"../chunk-3swnmwfc.js";import"../chunk-bcffjsnj.js";import"../chunk-557qj7q9.js";import"../chunk-c8cadhgc.js";import"../chunk-70v77sqv.js";import"../chunk-a368cs92.js";import{rj as l,sj as m,tj as n,uj as o,vj as p,wj as q,xj as r}from"../chunk-2qm3rw8b.js";import{Aj as c,Bj as d,Cj as e,Dj as f,Ej as g,Fj as h,Gj as i,Hj as j,Ij as k,yj as a,zj as b}from"../chunk-c1hr34a5.js";import"../chunk-5hkq5081.js";import"../chunk-pb47hr0h.js";import"../chunk-fsssdd5k.js";import"../chunk-0hw5wjjg.js";export{m as DEFAULT_SITE_PORT_RANGE,l as HOST_SITES_DIR,v as IPV6_EXCLUDED_HOST_LABELS,z as MANAGEMENT_DASHBOARD_SITE,F as addSiteToCloudConfig,r as allocateSitePorts,ra as buildAndPushContainerImage,sa as buildAndPushServerlessImage,ua as buildFunctionEnv,p as buildHostSitePortsScript,E as buildManagementDashboardArtifact,Aa as buildServerTopology,Ba as buildServerlessTopology,Ca as buildTopology,Ga as collectEgressMetrics,s as collectServerDnsDomains,qa as createContainerImageDependencies,la as createExistingStaticFullStackDependencies,ha as createStaticApiOriginDependencies,Ia as dashboardActions,A as dashboardCredentialsFile,V as dashboardPageRoutes,ea as deleteStaticSite,na as deployExistingStaticFullStack,va as deployServerlessApp,k as deployShipsFiles,ga as deploySite,ia as deployStaticApiOrigin,ba as deployStaticSite,fa as deployStaticSiteFull,Z as deployStaticSiteWithExternalDns,_ as deployStaticSiteWithExternalDnsFull,Ea as egressReportMetrics,R as ensureDashboardActor,D as ensureManagementDashboard,oa as estimateExistingStaticFullStackMonthlyCost,ka as estimateStaticApiOriginMonthlyCost,Fa as fetchEgressReport,ma as generateExistingStaticFullStackTemplate,Y as generateExternalDnsStaticSiteTemplate,aa as generateStaticSiteTemplate,g as hasComputeConfigured,d as hasProxyUpstream,pa as hashContainerContext,w as hostAcceptsIpv6,ta as infraEnvFromOutputs,S as initializeDashboardControlPlane,da as invalidateCache,b as isPhpSite,M as isValidHostname,u as normalizePublicIpv6,o as occupiedHostPorts,q as parseHostSiteFragments,n as parseUpstreamPort,x as reconcileAddressRecords,wa as redeployServerlessApp,G as removeSiteFromCloudConfig,t as removeStaleServerAddressRecords,N as renderAliasesValue,L as renderEnvValue,O as renderRedirectsValue,P as renderSiteSnippet,J as renderSslValue,K as renderStringValue,Ja as resolveDashboardAction,B as resolveDashboardAuth,Da as resolveDashboardData,W as resolveLegacyDashboardRoute,c as resolveProxyUpstreams,e as resolveSiteDeployTarget,f as resolveSiteKind,C as resolveUiSource,xa as rollbackServerlessApp,X as routesForDashboard,za as runRemoteCommand,Ha as sanitizeCloudConfig,Q as setAttachToInCloudConfig,ya as setMaintenance,I as setSitePropertyInCloudConfig,i as shipsARelease,j as shipsToBucket,a as siteInstallBase,Ka as startLocalDashboardServer,T as synchronizeDashboardUsers,U as trackDashboardOperation,H as updateSiteInCloudConfig,ca as uploadStaticFiles,h as validateDeploymentConfig,y as verifyAddressRecord,ja as verifyStaticApiOrigin};
@@ -56,3 +56,29 @@ export declare function renderAliasesValue(aliases: string[]): string;
56
56
  /** Render a site's `redirects` map (`from` path/host → `to` URL). Both are quoted strings. */
57
57
  export declare function renderRedirectsValue(redirects: Record<string, string>): string;
58
58
  export declare function renderSiteSnippet(input: Omit<AddSiteConfigInput, 'configText'>): string;
59
+ export interface SetAttachToInput {
60
+ configText: string;
61
+ /** Slug of the project that owns the box this one is joining. */
62
+ owner: string;
63
+ }
64
+ /**
65
+ * Set `cloud.attachTo`, joining this project to a server another project owns.
66
+ *
67
+ * Deliberately narrow. This edits TypeScript source with text, which is only
68
+ * defensible while it refuses everything it does not certainly understand, so
69
+ * it handles exactly the shape the templates generate:
70
+ *
71
+ * cloud: {
72
+ * provider: 'hetzner',
73
+ * },
74
+ *
75
+ * Anything else - two `cloud:` blocks, a nested object inside one, no block at
76
+ * all - throws with what it saw, and the caller prints the edit for a person to
77
+ * make. A config mangled by a clever regex is a far worse outcome than a config
78
+ * the tool declined to touch.
79
+ *
80
+ * Idempotent: a config already attached to `owner` comes back byte for byte.
81
+ *
82
+ * @see https://github.com/stacksjs/ts-cloud/issues/167
83
+ */
84
+ export declare function setAttachToInCloudConfig(input: SetAttachToInput): string;
@@ -63,13 +63,31 @@ export declare const DEFAULT_SITE_PORT_RANGE: SitePortRange;
63
63
  * One project's registry fragment, as written by the deploy:
64
64
  * `JSON.stringify({ slug, ...RpxGatewayConfig })`.
65
65
  *
66
- * Only the fields this module reads are declared. A fragment written by an older
67
- * ts-cloud may be missing `slug`, which the writer defaults to `'app'`.
66
+ * Only the fields a reader here needs are declared. A fragment written by an
67
+ * older ts-cloud may be missing `slug`, which the writer defaults to `'app'`.
68
+ *
69
+ * The route fields beyond `from` are declared for the fleet inventory
70
+ * (`operations/inventory`), which answers "what is this box serving, for
71
+ * whom" from these same files. They are optional and additive: this module's
72
+ * port allocator still reads only `from`.
68
73
  */
69
74
  export interface HostSiteFragment {
70
75
  slug?: string;
71
76
  proxies?: Array<{
77
+ /** Public host the route is served under. */
78
+ to?: string;
79
+ /** Path prefix within the host. Omitted means `/`. */
80
+ path?: string;
81
+ /** Upstream(s) for an app route. */
72
82
  from?: string | string[];
83
+ /** Served directory for a static route. */
84
+ static?: string | {
85
+ dir?: string;
86
+ };
87
+ /** Target for a redirect route. */
88
+ redirect?: string | {
89
+ to?: string;
90
+ };
73
91
  }>;
74
92
  }
75
93
  /** Port -> the slug of the project that already serves it on this box. */
package/dist/dns/index.js CHANGED
@@ -1 +1 @@
1
- import{Af as e,Bf as f,Cf as g,Df as h,Ef as i,Ff as j,Gf as k,Hf as l,If as m,Jf as n,Kf as o,Lf as p,Mf as q,Nf as r,Of as s,Pf as t,Qf as u,vf as a,wf as b,xf as c,zf as d}from"../chunk-tz9myq9a.js";import"../chunk-y4xkj2f1.js";import"../chunk-mz0dk78z.js";import"../chunk-13qjvbqh.js";export{d as CloudflareProvider,t as DnsProviderFactory,c as GoDaddyProvider,a as PROXIABLE_RECORD_TYPES,b as PorkbunProvider,i as Route53Provider,n as UnifiedDnsValidator,l as applyZoneMigration,r as createDnsProvider,p as createGoDaddyValidator,o as createPorkbunValidator,q as createRoute53Validator,s as detectDnsProvider,u as dnsProviders,j as exportRoute53Zone,k as planZoneMigration,e as policyTag,f as qualifyName,h as reconcileDeclaredRecords,g as resolveDeclaredRecords,m as verifyZoneParity};
1
+ import{$f as d,Xf as a,Yf as b,Zf as c,ag as e,bg as f,cg as g,dg as h,eg as i,fg as j,gg as k,hg as l,ig as m,jg as n,kg as o,lg as p,mg as q,ng as r,og as s,pg as t,qg as u}from"../chunk-rg7d67xk.js";import"../chunk-982rye5b.js";import"../chunk-a368cs92.js";import"../chunk-0hw5wjjg.js";export{d as CloudflareProvider,t as DnsProviderFactory,c as GoDaddyProvider,a as PROXIABLE_RECORD_TYPES,b as PorkbunProvider,i as Route53Provider,n as UnifiedDnsValidator,l as applyZoneMigration,r as createDnsProvider,p as createGoDaddyValidator,o as createPorkbunValidator,q as createRoute53Validator,s as detectDnsProvider,u as dnsProviders,j as exportRoute53Zone,k as planZoneMigration,e as policyTag,f as qualifyName,h as reconcileDeclaredRecords,g as resolveDeclaredRecords,m as verifyZoneParity};
@@ -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,Jg as p,Kg as q,Lg as r,Mg as s,Ng as t,Nh as ka,Og as u,Oh as la,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-vtvfg2f2.js";import"../chunk-aj025v2s.js";import"../chunk-wavjkdb8.js";import"../chunk-152he7m3.js";import"../chunk-mz0dk78z.js";import"../chunk-hn40z11p.js";import"../chunk-x3hay61c.js";import"../chunk-jm5mg890.js";import"../chunk-13qjvbqh.js";export{ba as AwsBoxProvisioner,o as AwsDriver,D as CloudDriverFactory,a as DEFAULT_RPX_CERTS_DIR,aa as HetznerBoxProvisioner,v as HetznerClient,z as HetznerDriver,A 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,p as buildSshArgs,fa as buildStaticSiteDeployScript,E as cloudDrivers,O as collectHetznerHostOptimizationReport,I as collectHetznerResizeManifest,ca as createBoxProvisioner,C as createCloudDriver,la as deployAllComputeSites,ka as deploySiteRelease,e as deriveRouteId,W as ensureFirewall,X as ensureServer,V as ensureSshKey,H as executeHetznerServerResize,c as gatewayHostnames,n as generateUbuntuAppCloudInit,b as hasAutoWwwVariant,B as isBoxMode,G as isHetznerCapacityError,d as normalizeRoutePath,x as normalizeSshPublicKey,F 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,w as resolveHetznerApiToken,L as resolveHetznerHostOptimizationPlan,s as scpUpload,Y as serverPublicIpv4,q as sshExec,r as sshExecOrThrow,P as verifyHetznerHostOptimization,K as verifyHetznerResize,u as waitForCloudInit,t as waitForSsh,y as wrapCloudInitUserData,T as writeResizeCheckpoint};
1
+ import{$g as q,Ah as Q,Bh as R,Ch as S,Dh as T,Eh as U,Fh as V,Gh as W,Hh as X,Ih as Y,Jh as Z,Kh as _,Lg as a,Lh as aa,Mg as b,Mh as ba,Ng as c,Nh as ca,Og as d,Pg as e,Qg as f,Qh as da,Rg as g,Rh as ea,Sg as h,Sh as fa,Tg as i,Th as ga,Ug as j,Uh as ha,Vg as k,Vh as ia,Wg as l,Wh as ja,Xg as m,Yg as n,Zg as o,_g as p,ah as r,bh as s,ch as t,ci as ka,dh as u,di as la,ei as ma,fh as v,fi as na,gh as w,gi as oa,hh as x,hi as pa,ih as y,ii as qa,jh as z,ji as ra,kh as A,lh as B,mh as C,nh as D,oh as E,ph as F,qh as G,rh as H,sh as I,th as J,uh as K,vh as L,wh as M,xh as N,yh as O,zh as P}from"../chunk-3swnmwfc.js";import"../chunk-bcffjsnj.js";import"../chunk-557qj7q9.js";import"../chunk-c8cadhgc.js";import"../chunk-70v77sqv.js";import"../chunk-a368cs92.js";import"../chunk-c1hr34a5.js";import"../chunk-pb47hr0h.js";import"../chunk-fsssdd5k.js";import"../chunk-0hw5wjjg.js";export{ba as AwsBoxProvisioner,o as AwsDriver,D as CloudDriverFactory,a as DEFAULT_RPX_CERTS_DIR,aa as HetznerBoxProvisioner,v as HetznerClient,z as HetznerDriver,A 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,p as buildSshArgs,fa as buildStaticSiteDeployScript,E as cloudDrivers,O as collectHetznerHostOptimizationReport,I as collectHetznerResizeManifest,ca as createBoxProvisioner,C as createCloudDriver,la as deployAllComputeSites,ka as deploySiteRelease,e as deriveRouteId,W as ensureFirewall,X as ensureServer,V as ensureSshKey,H as executeHetznerServerResize,c as gatewayHostnames,n as generateUbuntuAppCloudInit,b as hasAutoWwwVariant,B as isBoxMode,G as isHetznerCapacityError,d as normalizeRoutePath,x as normalizeSshPublicKey,F 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,w as resolveHetznerApiToken,L as resolveHetznerHostOptimizationPlan,s as scpUpload,Y as serverPublicIpv4,q as sshExec,r as sshExecOrThrow,P as verifyHetznerHostOptimization,K as verifyHetznerResize,u as waitForCloudInit,t as waitForSsh,y as wrapCloudInitUserData,T as writeResizeCheckpoint};
@@ -39,6 +39,24 @@ export declare const MAIL_UNIT = "mail";
39
39
  export declare function mailPackages(mail: ResolvedMailService): string[];
40
40
  /** Absolute path of a domain's DKIM private key. */
41
41
  export declare function dkimKeyPath(mail: ResolvedMailService, domain: string): string;
42
+ /**
43
+ * Absolute path of the account database.
44
+ *
45
+ * One function rather than the string written twice, because the two places
46
+ * that need it are the env file the server reads and the `user:local` calls
47
+ * that create accounts, and those two disagreeing is not a visible error. The
48
+ * accounts get written to a database nothing opens, every `create` reports
49
+ * success, and the failure surfaces later as mailboxes that authenticate
50
+ * against nothing.
51
+ *
52
+ * Named `smtp.db` because that is what deployed servers already have: it is
53
+ * the value in their `SMTP_DB_PATH`, the file their accounts live in, and the
54
+ * fallback the Stacks deploy path uses when it reads the env to find the DB.
55
+ * This used to say `mail.db`, which no running server was using — see
56
+ * {@link buildMailProvisionScript} for why an existing value still wins over
57
+ * this default.
58
+ */
59
+ export declare function mailDbPath(mail: ResolvedMailService): string;
42
60
  /**
43
61
  * The mail server's `config.toml`.
44
62
  *
@@ -103,7 +121,9 @@ export declare function buildDkimScript(mail: ResolvedMailService): string[];
103
121
  * has already installed and started the server, and each runs as the service
104
122
  * account with the server's own `SMTP_DB_PATH` — as root it would create a
105
123
  * second database beside the one the server reads, and the accounts would
106
- * exist in a file nothing opens.
124
+ * exist in a file nothing opens. That is also why the path comes from
125
+ * `$TS_CLOUD_MAIL_DB` rather than being written in twice: see
126
+ * {@link mailDbPath}.
107
127
  */
108
128
  export declare function buildMailAccountScript(mail: ResolvedMailService): string[];
109
129
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './config';
2
+ export * from './operations';
2
3
  export * from './auth';
3
4
  export * from './automation';
4
5
  export * from './api';
@@ -25,14 +26,15 @@ export * from './media';
25
26
  export * from './generators';
26
27
  export { validateTemplate, validateTemplateSize, validateResourceLimits } from './validation';
27
28
  export type { ValidationError as TemplateValidationError, ValidationResult as TemplateValidationResult, } from './validation';
28
- export { AWSClient, CloudFormationClient, CloudFormationClient as AWSCloudFormationClient, CloudFrontClient, CloudFrontClient as AWSCloudFrontClient, EC2Client, S3Client, Route53Client, Route53DomainsClient, ACMClient, ACMDnsValidator, ECRClient, ECSClient, STSClient, SSMClient, SecretsManagerClient, SESClient, EmailClient, SNSClient, SQSClient, LambdaClient, CloudWatchLogsClient, ConnectClient, ELBv2Client, RDSClient, DynamoDBClient, OpenSearchClient, TranscribeClient, BedrockClient, BedrockRuntimeClient, ComprehendClient, RekognitionClient, TextractClient, PollyClient, TranslateClient, PersonalizeClient, KendraClient, EventBridgeClient, ElastiCacheClient, SchedulerClient, IAMClient, ApplicationAutoScalingClient, SmsClient, VoiceClient, SupportClient, EFSClient, } from './aws';
29
+ export { AWSClient, CloudFormationClient, CloudFormationClient as AWSCloudFormationClient, CloudFrontClient, CloudFrontClient as AWSCloudFrontClient, EC2Client, S3Client, Route53Client, Route53DomainsClient, ACMClient, ACMDnsValidator, ECRClient, ECSClient, STSClient, SSMClient, SecretsManagerClient, SESClient, EmailClient, SNSClient, SQSClient, LambdaClient, CloudWatchLogsClient, ConnectClient, ELBv2Client, RDSClient, DynamoDBClient, OpenSearchClient, TranscribeClient, BedrockClient, BedrockRuntimeClient, ComprehendClient, RekognitionClient, TextractClient, PollyClient, TranslateClient, PersonalizeClient, KendraClient, EventBridgeClient, ElastiCacheClient, SchedulerClient, IAMClient, ApplicationAutoScalingClient, SmsClient, VoiceClient, SupportClient, EFSClient, setupSmsInfrastructure, getSmsInfrastructureStatus, createSmsInfrastructure, SmsVoiceClient, } from './aws';
30
+ export type { SmsSetupConfig, SmsSetupResult, OriginationPhoneNumber, DescribePhoneNumbersParams, DescribePhoneNumbersResult, } from './aws';
29
31
  export type { AWSRequestOptions, AWSClientConfig, AWSError, AWSCredentials as AWSClientCredentials, StackParameter, StackTag, CreateStackOptions, UpdateStackOptions, DescribeStacksOptions, StackEvent, Stack, InvalidationOptions, Distribution, S3SyncOptions, S3CopyOptions, S3ListOptions, S3Object, CertificateDetail, Certificate as ELBv2Certificate, RekognitionS3Object, RekognitionBoundingBox, TextractS3Object, TextractBoundingBox, CountryCode, ContactType, ContactDetail, KendraCreateDataSourceCommandInput, KendraCreateDataSourceCommandOutput, KendraListDataSourcesCommandInput, KendraListDataSourcesCommandOutput, InvokeModelCommandInput, InvokeModelCommandOutput, InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput, CreateModelCustomizationJobCommandInput, CreateModelCustomizationJobCommandOutput, GetModelCustomizationJobCommandInput, GetModelCustomizationJobCommandOutput, ListFoundationModelsCommandInput, ListFoundationModelsCommandOutput, AttributeValue as DynamoDBAttributeValue, KeySchemaElement, AttributeDefinition as DynamoDBAttributeDefinition, } from './aws';
30
32
  export { createObjectStorageClient, providerEndpoint, resolveObjectStorage } from './object-storage';
31
33
  export type { ObjectStorageConfig, ObjectStorageCredentials, ObjectStorageProvider, ResolvedObjectStorage, } from './object-storage';
32
34
  export { keyMatchesFilters, migrateObjectStorage, remapKey } from './object-storage/migrate';
33
35
  export type { MigrateEndpoint, MigrateError, MigrateOptions, MigratePlanItem, MigrateProgress, MigrateResult, MigrateVerification, } from './object-storage/migrate';
34
36
  export * from './ssl';
35
- export { deployStaticSite, deployStaticSiteFull, uploadStaticFiles, invalidateCache, deleteStaticSite, generateStaticSiteTemplate, deployStaticSiteWithExternalDns, deployStaticSiteWithExternalDnsFull, generateExternalDnsStaticSiteTemplate, deploySite, hasProxyUpstream, resolveProxyUpstreams, resolveSiteDeployTarget, resolveSiteKind, shipsARelease, validateDeploymentConfig, buildAndPushServerlessImage, buildFunctionEnv, deployServerlessApp, infraEnvFromOutputs, redeployServerlessApp, rollbackServerlessApp, runRemoteCommand, setMaintenance, buildManagementDashboardArtifact, dashboardCredentialsFile, ensureManagementDashboard, MANAGEMENT_DASHBOARD_SITE, resolveDashboardAuth, resolveUiSource, } from './deploy';
37
+ export { deployStaticSite, deployStaticSiteFull, uploadStaticFiles, invalidateCache, deleteStaticSite, generateStaticSiteTemplate, deployStaticSiteWithExternalDns, deployStaticSiteWithExternalDnsFull, generateExternalDnsStaticSiteTemplate, deploySite, hasProxyUpstream, resolveProxyUpstreams, resolveSiteDeployTarget, resolveSiteKind, shipsARelease, siteInstallBase, validateDeploymentConfig, addSiteToCloudConfig, allocateSitePorts, buildHostSitePortsScript, HOST_SITES_DIR, occupiedHostPorts, parseHostSiteFragments, parseUpstreamPort, removeSiteFromCloudConfig, setAttachToInCloudConfig, setSitePropertyInCloudConfig, updateSiteInCloudConfig, buildAndPushServerlessImage, buildFunctionEnv, deployServerlessApp, infraEnvFromOutputs, redeployServerlessApp, rollbackServerlessApp, runRemoteCommand, setMaintenance, buildManagementDashboardArtifact, dashboardCredentialsFile, ensureManagementDashboard, MANAGEMENT_DASHBOARD_SITE, resolveDashboardAuth, resolveUiSource, } from './deploy';
36
38
  export { collectServerDnsDomains, hostAcceptsIpv6, IPV6_EXCLUDED_HOST_LABELS, normalizePublicIpv6, reconcileAddressRecords, removeStaleServerAddressRecords, verifyAddressRecord, } from './deploy/server-dns';
37
39
  export type { AddressRecordReport } from './deploy/server-dns';
38
40
  export * from './cdn';