@stacksjs/ts-cloud 0.16.39 → 0.16.41

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 (207) hide show
  1. package/dist/aws/ec2-launch.test.d.ts +1 -0
  2. package/dist/aws/ec2.d.ts +47 -0
  3. package/dist/aws/index.js +1 -1
  4. package/dist/bin/chunk-040x6j9v.js +1 -0
  5. package/dist/bin/chunk-2b9e10db.js +1 -0
  6. package/dist/bin/chunk-2tvtr5fy.js +1 -0
  7. package/dist/bin/{chunk-r0yapyqc.js → chunk-35x7z78g.js} +1 -1
  8. package/dist/bin/chunk-45a8yv3j.js +6 -0
  9. package/dist/bin/{chunk-4bp4k1x2.js → chunk-4azcshw6.js} +2 -2
  10. package/dist/bin/{chunk-55cckkb2.js → chunk-4yym8xm4.js} +5 -5
  11. package/dist/bin/chunk-5dqnj5n9.js +1 -0
  12. package/dist/bin/chunk-5khcwxhn.js +1 -0
  13. package/dist/bin/{chunk-zmp0mksb.js → chunk-5nmt4s5w.js} +2 -2
  14. package/dist/bin/{chunk-8zn63v9h.js → chunk-5wx26yjy.js} +3 -3
  15. package/dist/bin/chunk-6kt12934.js +1 -0
  16. package/dist/bin/{chunk-0ynfqf9t.js → chunk-7593hjcq.js} +1 -1
  17. package/dist/bin/chunk-7nsjehvx.js +1 -0
  18. package/dist/bin/{chunk-wga7gj0h.js → chunk-7p2va3nj.js} +1 -1
  19. package/dist/bin/chunk-89hvgp5e.js +1 -0
  20. package/dist/bin/{chunk-hjq05rxh.js → chunk-8e4ck7cg.js} +5 -5
  21. package/dist/bin/{chunk-sqmays54.js → chunk-9eqpnanr.js} +1 -1
  22. package/dist/bin/{chunk-d8x60kvn.js → chunk-a06d7cyt.js} +2 -2
  23. package/dist/bin/chunk-aptdpa3m.js +1 -0
  24. package/dist/bin/chunk-bb08ms5q.js +1 -0
  25. package/dist/bin/chunk-c23r6gjb.js +1 -0
  26. package/dist/bin/chunk-cxcgqqdb.js +1 -0
  27. package/dist/bin/{chunk-q8hp4dfy.js → chunk-ddwp5np9.js} +94 -94
  28. package/dist/bin/{chunk-dmwfnbg0.js → chunk-dkf2kcsc.js} +6 -6
  29. package/dist/bin/{chunk-85k5gvnc.js → chunk-e8jwnsee.js} +3 -3
  30. package/dist/bin/{chunk-aykdp1wv.js → chunk-eaet154r.js} +2 -2
  31. package/dist/bin/chunk-ecd4swb7.js +2 -0
  32. package/dist/bin/{chunk-gc8p1tdr.js → chunk-f64jvh96.js} +2 -2
  33. package/dist/bin/{chunk-0c1fv0xt.js → chunk-f7jpzyhr.js} +5 -5
  34. package/dist/bin/{chunk-4h60xsat.js → chunk-f8689v5g.js} +3 -3
  35. package/dist/bin/chunk-fhq31xzt.js +1 -0
  36. package/dist/bin/{chunk-c7z8et78.js → chunk-fkzp9sg5.js} +1 -1
  37. package/dist/bin/chunk-gj26v5hg.js +1 -0
  38. package/dist/bin/{chunk-5wqjqh6c.js → chunk-gn03w47w.js} +23 -23
  39. package/dist/bin/{chunk-48nz63ab.js → chunk-grwth4nw.js} +3 -3
  40. package/dist/bin/chunk-jrztbsnb.js +1 -0
  41. package/dist/bin/chunk-jv9qp13h.js +1 -0
  42. package/dist/bin/{chunk-cqhtnsby.js → chunk-k0p394bn.js} +5 -5
  43. package/dist/bin/{chunk-mbr9j2fw.js → chunk-k343q24p.js} +6 -6
  44. package/dist/bin/chunk-k9ate69x.js +1 -0
  45. package/dist/bin/chunk-kbwm0sqv.js +2 -0
  46. package/dist/bin/chunk-ky4xdskt.js +1 -0
  47. package/dist/bin/chunk-kzgt05w5.js +1 -0
  48. package/dist/bin/{chunk-x0ywfbk5.js → chunk-kzpzkdpd.js} +1 -1
  49. package/dist/bin/chunk-m8p7mw67.js +1 -0
  50. package/dist/bin/chunk-mh3rgn0e.js +1 -0
  51. package/dist/bin/{chunk-07qwk0sj.js → chunk-n7yefy09.js} +5 -5
  52. package/dist/bin/{chunk-pyr0dc6j.js → chunk-ndf3t76p.js} +63 -63
  53. package/dist/bin/{chunk-7rpj0qhb.js → chunk-nj9x0tb8.js} +2 -2
  54. package/dist/bin/{chunk-tt3m3fda.js → chunk-nmqjmx30.js} +22 -22
  55. package/dist/bin/{chunk-e0kapeev.js → chunk-p8xy9qm7.js} +14 -14
  56. package/dist/bin/chunk-p9baztvr.js +1 -0
  57. package/dist/bin/chunk-pf9dbm3b.js +4 -0
  58. package/dist/bin/{chunk-qxg95ndf.js → chunk-q40k9jvk.js} +2 -2
  59. package/dist/bin/chunk-qgqgdkg0.js +1 -0
  60. package/dist/bin/chunk-s64d5nw2.js +1 -0
  61. package/dist/bin/chunk-s77kny9g.js +1 -0
  62. package/dist/bin/{chunk-ygsdntxq.js → chunk-x6w8jvs1.js} +5 -5
  63. package/dist/bin/{chunk-ehnevjt4.js → chunk-xe9p2q8f.js} +99 -99
  64. package/dist/bin/{chunk-6r5mehaj.js → chunk-xq7ngz6q.js} +4 -4
  65. package/dist/bin/{chunk-w6yx9bhb.js → chunk-zvbc92pc.js} +1 -1
  66. package/dist/bin/cli.js +173 -173
  67. package/dist/bin/dashboard-server.js +1 -1
  68. package/dist/{chunk-yrcv3hrj.js → chunk-0evxayn1.js} +7 -7
  69. package/dist/chunk-1yhrkahz.js +1 -0
  70. package/dist/chunk-27y037yh.js +1 -0
  71. package/dist/chunk-2ns1w1fe.js +1 -0
  72. package/dist/chunk-2vrv31sk.js +37 -0
  73. package/dist/{chunk-n1r9313b.js → chunk-3s8dtcz8.js} +2 -2
  74. package/dist/chunk-3w7q4sjs.js +2 -0
  75. package/dist/{chunk-tbn385ak.js → chunk-5n1y5ehd.js} +94 -94
  76. package/dist/chunk-74yycwrd.js +1 -0
  77. package/dist/{chunk-t52wetq8.js → chunk-7eaech9q.js} +1 -1
  78. package/dist/{chunk-2n4ktft4.js → chunk-97gre81w.js} +1 -1
  79. package/dist/{chunk-zvyrpmvd.js → chunk-9e4afej1.js} +1 -1
  80. package/dist/{chunk-3cyszqzh.js → chunk-9mv07nz0.js} +2 -2
  81. package/dist/{chunk-kpjhfgbh.js → chunk-bfbahave.js} +4 -4
  82. package/dist/{chunk-xr7ew64s.js → chunk-bwtxb2hf.js} +3 -3
  83. package/dist/{chunk-dg834141.js → chunk-cgcthvq9.js} +5 -5
  84. package/dist/{chunk-ffjgw5m6.js → chunk-ckqjqw4w.js} +108 -108
  85. package/dist/chunk-e9z4gzmg.js +1 -0
  86. package/dist/chunk-fwcf0n8f.js +4 -0
  87. package/dist/{chunk-q08s698e.js → chunk-jaswfk6g.js} +71 -71
  88. package/dist/{chunk-ffba3270.js → chunk-jbtnyhrh.js} +2 -2
  89. package/dist/{chunk-gcqq9m4b.js → chunk-kexwq2h0.js} +4 -4
  90. package/dist/{chunk-p4rknh9f.js → chunk-mxprxjd4.js} +1 -1
  91. package/dist/{chunk-c45ay9fx.js → chunk-my61jkg1.js} +5 -5
  92. package/dist/{chunk-kkeb1dk1.js → chunk-qbbap3bt.js} +1 -1
  93. package/dist/{chunk-jsnhb1p4.js → chunk-qg03hfb6.js} +19 -19
  94. package/dist/{chunk-bx3jmgd0.js → chunk-r3m1fjd4.js} +2 -2
  95. package/dist/{chunk-nzmangkw.js → chunk-v6hysd5c.js} +5 -5
  96. package/dist/{chunk-kyn6a4zf.js → chunk-varjr6np.js} +1 -1
  97. package/dist/chunk-vd2jqt9w.js +1 -0
  98. package/dist/{chunk-n8g8t8hf.js → chunk-w78e5n94.js} +3 -3
  99. package/dist/{chunk-0rvnerbw.js → chunk-ype3pqh5.js} +5 -5
  100. package/dist/{chunk-qhtgfjhd.js → chunk-yt6m703r.js} +23 -23
  101. package/dist/deploy/index.js +1 -1
  102. package/dist/dns/index.js +1 -1
  103. package/dist/drivers/index.js +1 -1
  104. package/dist/index.d.ts +1 -0
  105. package/dist/index.js +42 -42
  106. package/dist/operations/index.js +1 -1
  107. package/dist/protection/index.js +1 -1
  108. package/dist/r2/index.d.ts +8 -0
  109. package/dist/r2/provider.d.ts +303 -0
  110. package/dist/r2/provider.test.d.ts +1 -0
  111. package/dist/r2/reconcile.d.ts +98 -0
  112. package/dist/r2/reconcile.test.d.ts +1 -0
  113. package/dist/r2/test-fetch.d.ts +32 -0
  114. package/dist/spend/index.js +1 -1
  115. package/dist/ui/404.html +1 -1
  116. package/dist/ui/accept-invitation.html +1 -1
  117. package/dist/ui/access-denied.html +1 -1
  118. package/dist/ui/account/automation.html +6 -6
  119. package/dist/ui/account/security.html +2 -2
  120. package/dist/ui/applications/compose.html +6 -6
  121. package/dist/ui/applications/new.html +2 -2
  122. package/dist/ui/data/backups.html +6 -6
  123. package/dist/ui/data/services.html +6 -6
  124. package/dist/ui/data/volumes.html +6 -6
  125. package/dist/ui/index.html +6 -6
  126. package/dist/ui/infrastructure/topology.html +5 -5
  127. package/dist/ui/integrations.html +2 -2
  128. package/dist/ui/operations/alerts.html +6 -6
  129. package/dist/ui/operations/configuration.html +6 -6
  130. package/dist/ui/operations/jobs.html +6 -6
  131. package/dist/ui/operations/maintenance.html +5 -5
  132. package/dist/ui/operations/observability.html +6 -6
  133. package/dist/ui/operations/previews.html +6 -6
  134. package/dist/ui/operations/queue.html +6 -6
  135. package/dist/ui/operations/regions.html +5 -5
  136. package/dist/ui/operations/releases.html +6 -6
  137. package/dist/ui/operations/spend.html +6 -6
  138. package/dist/ui/operations/workloads.html +6 -6
  139. package/dist/ui/security.html +2 -2
  140. package/dist/ui/server/actions.html +6 -6
  141. package/dist/ui/server/activity.html +2 -2
  142. package/dist/ui/server/capacity.html +5 -5
  143. package/dist/ui/server/database.html +6 -6
  144. package/dist/ui/server/deployments.html +6 -6
  145. package/dist/ui/server/diagnostics.html +2 -2
  146. package/dist/ui/server/firewall.html +6 -6
  147. package/dist/ui/server/fleet.html +6 -6
  148. package/dist/ui/server/logs.html +6 -6
  149. package/dist/ui/server/metrics.html +6 -6
  150. package/dist/ui/server/security.html +2 -2
  151. package/dist/ui/server/services.html +2 -2
  152. package/dist/ui/server/sites.html +6 -6
  153. package/dist/ui/server/ssh-keys.html +6 -6
  154. package/dist/ui/server/team.html +6 -6
  155. package/dist/ui/server/terminal.html +2 -2
  156. package/dist/ui/serverless/alarms.html +6 -6
  157. package/dist/ui/serverless/assets.html +2 -2
  158. package/dist/ui/serverless/cost.html +2 -2
  159. package/dist/ui/serverless/data.html +6 -6
  160. package/dist/ui/serverless/deployments.html +2 -2
  161. package/dist/ui/serverless/firewall.html +1 -1
  162. package/dist/ui/serverless/functions.html +6 -6
  163. package/dist/ui/serverless/logs.html +6 -6
  164. package/dist/ui/serverless/metrics.html +1 -1
  165. package/dist/ui/serverless/queues.html +6 -6
  166. package/dist/ui/serverless/secrets.html +6 -6
  167. package/dist/ui/serverless/traces.html +5 -5
  168. package/dist/ui/serverless.html +6 -6
  169. package/package.json +3 -3
  170. package/dist/bin/chunk-0c5vn8rp.js +0 -1
  171. package/dist/bin/chunk-1wf1s8db.js +0 -1
  172. package/dist/bin/chunk-4dtrry0t.js +0 -1
  173. package/dist/bin/chunk-6kcxf3b2.js +0 -1
  174. package/dist/bin/chunk-6ksbfg6t.js +0 -1
  175. package/dist/bin/chunk-7rkg1yph.js +0 -1
  176. package/dist/bin/chunk-989j6ezd.js +0 -1
  177. package/dist/bin/chunk-bgdvhp6m.js +0 -1
  178. package/dist/bin/chunk-cvc9bxd4.js +0 -2
  179. package/dist/bin/chunk-czzrfhn7.js +0 -1
  180. package/dist/bin/chunk-d5arnf2f.js +0 -1
  181. package/dist/bin/chunk-dnmb3sr0.js +0 -4
  182. package/dist/bin/chunk-e06m9m6z.js +0 -1
  183. package/dist/bin/chunk-e51ajfyr.js +0 -1
  184. package/dist/bin/chunk-e6mfcw0v.js +0 -6
  185. package/dist/bin/chunk-fh5bjm3d.js +0 -1
  186. package/dist/bin/chunk-fw6hbyeg.js +0 -1
  187. package/dist/bin/chunk-h7gfd2yq.js +0 -1
  188. package/dist/bin/chunk-jxnw879g.js +0 -1
  189. package/dist/bin/chunk-k3yq569a.js +0 -1
  190. package/dist/bin/chunk-nhrwct94.js +0 -1
  191. package/dist/bin/chunk-pa4fymr0.js +0 -1
  192. package/dist/bin/chunk-s9xven24.js +0 -1
  193. package/dist/bin/chunk-w8jfw39t.js +0 -2
  194. package/dist/bin/chunk-wgv9nv0z.js +0 -1
  195. package/dist/bin/chunk-y5980ycr.js +0 -1
  196. package/dist/bin/chunk-y5ez6ba7.js +0 -1
  197. package/dist/bin/chunk-ya71t2ed.js +0 -1
  198. package/dist/bin/chunk-zb1nh252.js +0 -1
  199. package/dist/chunk-1ty76ybd.js +0 -1
  200. package/dist/chunk-2mypcz4a.js +0 -1
  201. package/dist/chunk-5vk7nss8.js +0 -2
  202. package/dist/chunk-fe5sbczg.js +0 -1
  203. package/dist/chunk-gtc1gvfj.js +0 -1
  204. package/dist/chunk-j1aq97br.js +0 -4
  205. package/dist/chunk-j5t1amn0.js +0 -1
  206. package/dist/chunk-s20830hg.js +0 -1
  207. package/dist/chunk-v83qx041.js +0 -37
@@ -1,6 +1,6 @@
1
- import{Ue,A,Wt,_r,xi}from"./chunk-q8hp4dfy.js";import{execSync as D}from"node:child_process";import{randomBytes as R}from"node:crypto";import{chmodSync as j,copyFileSync as x,existsSync as u,mkdirSync as w,readFileSync as U,statSync as N,writeFileSync as m}from"node:fs";import{tmpdir as E}from"node:os";import{basename as P,dirname as v,isAbsolute as O,join as a,resolve as B}from"node:path";import{fileURLToPath as C}from"node:url";function h(e){if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.keys(e).map((r)=>[r,""]))}function M(e){let r=JSON.parse(JSON.stringify(e??{}));if(r.hetzner)delete r.hetzner.apiToken;delete r.aws,delete r.stateDir;for(let t of Object.values(r.sites??{})){if(t?.env)t.env=h(t.env);if(t?.environment)t.environment=h(t.environment)}for(let t of Object.values(r.environments??{}))if(t?.variables)t.variables=h(t.variables);for(let t of Object.values(r.infrastructure?.databases??{}))if(t?.password)t.password="";if(r.infrastructure?.appDatabase?.password)r.infrastructure.appDatabase.password="";if(r.infrastructure?.compute?.database?.password)r.infrastructure.compute.database.password="";if(r.infrastructure?.compute?.managedServices?.vitess?.password)r.infrastructure.compute.managedServices.vitess.password="";return r}function y(e){let r=M(e);return["// Generated by ts-cloud for the management dashboard — do not edit.","//","// This is the project's resolved cloud config, inlined so it needs no","// imports on the box. Credentials are deliberately absent.",`export default ${JSON.stringify(r,null,2)}`,""].join(`
2
- `)}var Vd="dashboard";function Mc(){return Ue("dashboard-credentials.json")}function F(){return R(24).toString("base64url")}function zd(e,r,t){let s=process.env.TS_CLOUD_UI_PASSWORD?.trim();if(s)return{password:s,source:"env"};if(b(process.env.TS_CLOUD_UI_PUBLIC))return{password:void 0,source:"public"};let n=Mc(),i=A(e,"dashboard-credentials.json");try{if(u(i)){let o=JSON.parse(U(i,"utf8"));if(o?.password)return{password:o.password,source:"generated"}}}catch{}let d=F();try{w(v(i),{recursive:!0}),m(i,`${JSON.stringify({username:r,password:d,generatedAt:new Date().toISOString()},null,2)}
1
+ import{Be,A,Wt,Lr,Li}from"./chunk-ddwp5np9.js";import{execSync as D}from"node:child_process";import{randomBytes as R}from"node:crypto";import{chmodSync as j,copyFileSync as x,existsSync as u,mkdirSync as w,readFileSync as U,statSync as N,writeFileSync as m}from"node:fs";import{tmpdir as E}from"node:os";import{basename as P,dirname as v,isAbsolute as O,join as a,resolve as B}from"node:path";import{fileURLToPath as C}from"node:url";function h(e){if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.keys(e).map((r)=>[r,""]))}function M(e){let r=JSON.parse(JSON.stringify(e??{}));if(r.hetzner)delete r.hetzner.apiToken;delete r.aws,delete r.stateDir;for(let t of Object.values(r.sites??{})){if(t?.env)t.env=h(t.env);if(t?.environment)t.environment=h(t.environment)}for(let t of Object.values(r.environments??{}))if(t?.variables)t.variables=h(t.variables);for(let t of Object.values(r.infrastructure?.databases??{}))if(t?.password)t.password="";if(r.infrastructure?.appDatabase?.password)r.infrastructure.appDatabase.password="";if(r.infrastructure?.compute?.database?.password)r.infrastructure.compute.database.password="";if(r.infrastructure?.compute?.managedServices?.vitess?.password)r.infrastructure.compute.managedServices.vitess.password="";return r}function y(e){let r=M(e);return["// Generated by ts-cloud for the management dashboard — do not edit.","//","// This is the project's resolved cloud config, inlined so it needs no","// imports on the box. Credentials are deliberately absent.",`export default ${JSON.stringify(r,null,2)}`,""].join(`
2
+ `)}var Gd="dashboard";function jc(){return Be("dashboard-credentials.json")}function F(){return R(24).toString("base64url")}function Wd(e,r,t){let s=process.env.TS_CLOUD_UI_PASSWORD?.trim();if(s)return{password:s,source:"env"};if(b(process.env.TS_CLOUD_UI_PUBLIC))return{password:void 0,source:"public"};let n=jc(),i=A(e,"dashboard-credentials.json");try{if(u(i)){let o=JSON.parse(U(i,"utf8"));if(o?.password)return{password:o.password,source:"generated"}}}catch{}let d=F();try{w(v(i),{recursive:!0}),m(i,`${JSON.stringify({username:r,password:d,generatedAt:new Date().toISOString()},null,2)}
3
3
  `),j(i,384),t.info(`Management dashboard: generated a password for '${r}' and saved it to ${n} (read it there — it is not printed). Set TS_CLOUD_UI_PASSWORD to pin your own, or TS_CLOUD_UI_PUBLIC=1 to serve without auth.`)}catch(o){t.warn(`Management dashboard: could not persist the generated password (${o?.message??o}). Using it for this deploy only — pass: ${d}
4
- This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${n} is writable.`)}return{password:d,source:"generated"}}var I={info:()=>{},warn:()=>{}};function b(e){return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function J(){return Ue("dashboard-release")}function L(){let e=v(C(import.meta.url));for(let r of[a(e,"..","..","package.json"),a(e,"..","package.json")])try{let t=JSON.parse(U(r,"utf8"));if(t.name==="@stacksjs/ts-cloud"&&t.version)return`^${t.version}`}catch{}return"latest"}function z(){return process.env.TS_CLOUD_UI_VERSION?.trim()||L()}function V(e,r,t){if(!e?.project?.slug)return t.warn("Management dashboard: the cloud config has no project slug — skipping the live dashboard."),null;let s=A(r,"dashboard-release");try{w(s,{recursive:!0}),m(a(s,"cloud.config.ts"),y(e));let n=z();if(n.startsWith("file:")){let d=n.slice(5),o=O(d)?d:B(r,d);if(!u(o)||!N(o).isFile())n=L(),t.warn(`Management dashboard: TS_CLOUD_UI_VERSION points to a missing package file (${o}); using the deploying ts-cloud version ${n} instead.`);else{let c=P(o),l=a(s,c);if(o!==l)x(o,l);n=`file:./${c}`}}let i={name:"ts-cloud-dashboard",private:!0,type:"module",dependencies:{"@stacksjs/ts-cloud":n}};return m(a(s,"package.json"),`${JSON.stringify(i,null,2)}
5
- `),J()}catch(n){return t.warn(`Management dashboard: could not stage the live release (${n?.message??n}) — skipping.`),null}}function vo(e){if(u(a(e,"packages","ui","pages"))||u(a(e,"packages","ui","package.json")))return{uiRoot:"packages/ui/dist",build:"cd packages/ui && bun install && bun run build"};let r=v(C(import.meta.url)),t=[a(r,"ui"),a(r,"..","ui"),a(r,"..","..","ui"),a(r,"..","dist","ui")];for(let s of t)if(u(a(s,"index.html"))||u(a(s,"serverless.html")))return{uiRoot:s,build:!1};return null}function Co(e,r={}){let t=r.logger??I,s=r.cwd??process.cwd();if(b(process.env.TS_CLOUD_UI_DISABLE))return t.info("Management dashboard: skipped (TS_CLOUD_UI_DISABLE set)."),e;if(e.cloud?.attachTo)return t.info(`Management dashboard: ${e.project.slug} is attached to ${e.cloud.attachTo}; the server owner's dashboard monitors every attached project.`),e;if(Wt(e))return e;let n=e.environments&&Object.keys(e.environments)[0],i=process.env.TS_CLOUD_UI_DOMAIN?.trim()||void 0,d=Number(process.env.TS_CLOUD_UI_PORT)||void 0,o={...e.sites??{}};if(!b(process.env.TS_CLOUD_UI_STATIC)){let g=V(e,s,t);if(!g)return e;let p=xi(e,n??"production",{uiRoot:g,build:!1,domain:i,port:d,live:!0});if(p.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;for(let{name:k,site:_}of p)o[k]=_,t.info(`Management dashboard → https://${_.domain} (sign in with your ts-cloud account; the first deploy prints an admin password once)`);return e.sites=o,e}let c=vo(s);if(!c)return t.info("Management dashboard: UI not found (no local ui/ or packaged dist/ui) — skipping auto-deploy."),e;let l=process.env.TS_CLOUD_UI_USERNAME?.trim()||"admin",f=zd(s,l,t),S=xi(e,n??"production",{uiRoot:c.uiRoot,build:c.build,domain:i,username:l,password:f.password,realm:process.env.TS_CLOUD_UI_REALM?.trim()||void 0,live:!1,port:d});if(S.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;let T=f.source==="public"?"NO AUTH — TS_CLOUD_UI_PUBLIC is set (dashboard is publicly reachable)":f.source==="env"?"htpasswd-protected (TS_CLOUD_UI_PASSWORD)":`htpasswd-protected (auto-generated — see ${Mc()})`;t.warn("Management dashboard: static mode — one shared password, and no per-site collaborators. Unset TS_CLOUD_UI_STATIC for the live dashboard.");for(let{name:g,site:p}of S)o[g]=p,t.info(`Management dashboard → https://${p.domain} (${T})`);return e.sites=o,e}function To(e){return Object.keys(e.sites??{}).filter(_r)}function Ps(e,r){if(!e?.root)return null;let t=r.cwd??process.cwd(),s=r.logger??I;try{if(typeof e.build==="string"&&e.build.trim())s.info(`Management dashboard: building UI (${e.build})`),D(e.build,{cwd:t,stdio:"inherit"});let n=O(e.root)?e.root:a(t,e.root);if(!u(n))return s.warn(`Management dashboard: build output not found at ${n} — skipping dashboard artifact.`),null;let i=a(E(),`${r.slug}-${r.siteName??Vd}-${r.sha}.tar.gz`);return D(`tar czf "${i}" -C "${n}" .`,{stdio:"inherit"}),i}catch(n){return s.warn(`Management dashboard: failed to build artifact — ${n?.message??n}. Skipping dashboard deploy.`),null}}
6
- export{Vd,Mc,zd,vo,Co,To,Ps};
4
+ This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${n} is writable.`)}return{password:d,source:"generated"}}var I={info:()=>{},warn:()=>{}};function b(e){return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function J(){return Be("dashboard-release")}function L(){let e=v(C(import.meta.url));for(let r of[a(e,"..","..","package.json"),a(e,"..","package.json")])try{let t=JSON.parse(U(r,"utf8"));if(t.name==="@stacksjs/ts-cloud"&&t.version)return`^${t.version}`}catch{}return"latest"}function z(){return process.env.TS_CLOUD_UI_VERSION?.trim()||L()}function V(e,r,t){if(!e?.project?.slug)return t.warn("Management dashboard: the cloud config has no project slug — skipping the live dashboard."),null;let s=A(r,"dashboard-release");try{w(s,{recursive:!0}),m(a(s,"cloud.config.ts"),y(e));let n=z();if(n.startsWith("file:")){let d=n.slice(5),o=O(d)?d:B(r,d);if(!u(o)||!N(o).isFile())n=L(),t.warn(`Management dashboard: TS_CLOUD_UI_VERSION points to a missing package file (${o}); using the deploying ts-cloud version ${n} instead.`);else{let c=P(o),l=a(s,c);if(o!==l)x(o,l);n=`file:./${c}`}}let i={name:"ts-cloud-dashboard",private:!0,type:"module",dependencies:{"@stacksjs/ts-cloud":n}};return m(a(s,"package.json"),`${JSON.stringify(i,null,2)}
5
+ `),J()}catch(n){return t.warn(`Management dashboard: could not stage the live release (${n?.message??n}) — skipping.`),null}}function wo(e){if(u(a(e,"packages","ui","pages"))||u(a(e,"packages","ui","package.json")))return{uiRoot:"packages/ui/dist",build:"cd packages/ui && bun install && bun run build"};let r=v(C(import.meta.url)),t=[a(r,"ui"),a(r,"..","ui"),a(r,"..","..","ui"),a(r,"..","dist","ui")];for(let s of t)if(u(a(s,"index.html"))||u(a(s,"serverless.html")))return{uiRoot:s,build:!1};return null}function Ao(e,r={}){let t=r.logger??I,s=r.cwd??process.cwd();if(b(process.env.TS_CLOUD_UI_DISABLE))return t.info("Management dashboard: skipped (TS_CLOUD_UI_DISABLE set)."),e;if(e.cloud?.attachTo)return t.info(`Management dashboard: ${e.project.slug} is attached to ${e.cloud.attachTo}; the server owner's dashboard monitors every attached project.`),e;if(Wt(e))return e;let n=e.environments&&Object.keys(e.environments)[0],i=process.env.TS_CLOUD_UI_DOMAIN?.trim()||void 0,d=Number(process.env.TS_CLOUD_UI_PORT)||void 0,o={...e.sites??{}};if(!b(process.env.TS_CLOUD_UI_STATIC)){let g=V(e,s,t);if(!g)return e;let p=Li(e,n??"production",{uiRoot:g,build:!1,domain:i,port:d,live:!0});if(p.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;for(let{name:k,site:_}of p)o[k]=_,t.info(`Management dashboard → https://${_.domain} (sign in with your ts-cloud account; the first deploy prints an admin password once)`);return e.sites=o,e}let c=wo(s);if(!c)return t.info("Management dashboard: UI not found (no local ui/ or packaged dist/ui) — skipping auto-deploy."),e;let l=process.env.TS_CLOUD_UI_USERNAME?.trim()||"admin",f=Wd(s,l,t),S=Li(e,n??"production",{uiRoot:c.uiRoot,build:c.build,domain:i,username:l,password:f.password,realm:process.env.TS_CLOUD_UI_REALM?.trim()||void 0,live:!1,port:d});if(S.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;let T=f.source==="public"?"NO AUTH — TS_CLOUD_UI_PUBLIC is set (dashboard is publicly reachable)":f.source==="env"?"htpasswd-protected (TS_CLOUD_UI_PASSWORD)":`htpasswd-protected (auto-generated — see ${jc()})`;t.warn("Management dashboard: static mode — one shared password, and no per-site collaborators. Unset TS_CLOUD_UI_STATIC for the live dashboard.");for(let{name:g,site:p}of S)o[g]=p,t.info(`Management dashboard → https://${p.domain} (${T})`);return e.sites=o,e}function Ro(e){return Object.keys(e.sites??{}).filter(Lr)}function xs(e,r){if(!e?.root)return null;let t=r.cwd??process.cwd(),s=r.logger??I;try{if(typeof e.build==="string"&&e.build.trim())s.info(`Management dashboard: building UI (${e.build})`),D(e.build,{cwd:t,stdio:"inherit"});let n=O(e.root)?e.root:a(t,e.root);if(!u(n))return s.warn(`Management dashboard: build output not found at ${n} — skipping dashboard artifact.`),null;let i=a(E(),`${r.slug}-${r.siteName??Gd}-${r.sha}.tar.gz`);return D(`tar czf "${i}" -C "${n}" .`,{stdio:"inherit"}),i}catch(n){return s.warn(`Management dashboard: failed to build artifact — ${n?.message??n}. Skipping dashboard deploy.`),null}}
6
+ export{Gd,jc,Wd,wo,Ao,Ro,xs};
@@ -1,6 +1,6 @@
1
- var Md={newConnectionsPerSecond:50,concurrentPerSource:100,synPerSecond:2000,burst:100,icmpPerSecond:5,banSeconds:600};function h(e){return{...Md,...e.thresholds}}var _=/^(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,2})?$|^[0-9a-f:]+(?:\/\d{1,3})?$/i;function uo(e){if(!_.test(e))return!1;let[t,n]=e.split("/");if(t.includes(":"))return n==null||Number(n)>=0&&Number(n)<=128;let s=t.split(".");if(s.length!==4||s.some((a)=>Number(a)>255||a===""))return!1;return n==null||Number(n)>=0&&Number(n)<=32}function f(e){return[...new Set((e??[]).map((t)=>t.trim()).filter(uo))]}function y(e){let t=(e??[80,443]).filter((n)=>Number.isInteger(n)&&n>=1&&n<=65535);return[...new Set(t)].sort((n,s)=>n-s)}function Ud(e={}){let t=h(e);return{"net.ipv4.tcp_syncookies":"1","net.ipv4.tcp_max_syn_backlog":String(Math.max(4096,t.synPerSecond*4)),"net.ipv4.tcp_synack_retries":"2","net.ipv4.tcp_abort_on_overflow":"1","net.ipv4.tcp_fin_timeout":"15","net.ipv4.tcp_keepalive_time":"300","net.ipv4.tcp_keepalive_intvl":"30","net.ipv4.tcp_keepalive_probes":"3","net.core.somaxconn":"4096","net.core.netdev_max_backlog":"16384","net.ipv4.conf.all.rp_filter":"1","net.ipv4.conf.default.rp_filter":"1","net.ipv4.conf.all.accept_source_route":"0","net.ipv4.conf.all.accept_redirects":"0","net.ipv4.conf.all.send_redirects":"0","net.ipv6.conf.all.accept_redirects":"0","net.ipv6.conf.all.accept_source_route":"0","net.ipv4.icmp_echo_ignore_broadcasts":"1","net.ipv4.icmp_ignore_bogus_error_responses":"1","net.netfilter.nf_conntrack_max":"262144","net.netfilter.nf_conntrack_tcp_timeout_established":"3600"}}function Fd(e={}){let t=["# Managed by ts-cloud. Edits are overwritten on the next deploy.","# Network hardening against L3/L4 floods.",""];for(let[n,s]of Object.entries(Ud(e)))t.push(`${n} = ${s}`);return`${t.join(`
1
+ var jd={newConnectionsPerSecond:50,concurrentPerSource:100,synPerSecond:2000,burst:100,icmpPerSecond:5,banSeconds:600};function h(e){return{...jd,...e.thresholds}}var _=/^(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,2})?$|^[0-9a-f:]+(?:\/\d{1,3})?$/i;function fo(e){if(!_.test(e))return!1;let[t,n]=e.split("/");if(t.includes(":"))return n==null||Number(n)>=0&&Number(n)<=128;let s=t.split(".");if(s.length!==4||s.some((a)=>Number(a)>255||a===""))return!1;return n==null||Number(n)>=0&&Number(n)<=32}function f(e){return[...new Set((e??[]).map((t)=>t.trim()).filter(fo))]}function y(e){let t=(e??[80,443]).filter((n)=>Number.isInteger(n)&&n>=1&&n<=65535);return[...new Set(t)].sort((n,s)=>n-s)}function Vd(e={}){let t=h(e);return{"net.ipv4.tcp_syncookies":"1","net.ipv4.tcp_max_syn_backlog":String(Math.max(4096,t.synPerSecond*4)),"net.ipv4.tcp_synack_retries":"2","net.ipv4.tcp_abort_on_overflow":"1","net.ipv4.tcp_fin_timeout":"15","net.ipv4.tcp_keepalive_time":"300","net.ipv4.tcp_keepalive_intvl":"30","net.ipv4.tcp_keepalive_probes":"3","net.core.somaxconn":"4096","net.core.netdev_max_backlog":"16384","net.ipv4.conf.all.rp_filter":"1","net.ipv4.conf.default.rp_filter":"1","net.ipv4.conf.all.accept_source_route":"0","net.ipv4.conf.all.accept_redirects":"0","net.ipv4.conf.all.send_redirects":"0","net.ipv6.conf.all.accept_redirects":"0","net.ipv6.conf.all.accept_source_route":"0","net.ipv4.icmp_echo_ignore_broadcasts":"1","net.ipv4.icmp_ignore_bogus_error_responses":"1","net.netfilter.nf_conntrack_max":"262144","net.netfilter.nf_conntrack_tcp_timeout_established":"3600"}}function zd(e={}){let t=["# Managed by ts-cloud. Edits are overwritten on the next deploy.","# Network hardening against L3/L4 floods.",""];for(let[n,s]of Object.entries(Vd(e)))t.push(`${n} = ${s}`);return`${t.join(`
2
2
  `)}
3
- `}function Bd(e={}){let t=h(e),n=y(e.ports),s=f(e.allowlist),a=f(e.blocklist),l=e.monitorOnly?"counter":"counter drop",i=e.originProtection?.enabled?f(e.originProtection.cdnRanges):[],c=s.filter((r)=>!r.includes(":")),p=s.filter((r)=>r.includes(":")),u=a.filter((r)=>!r.includes(":")),o=["#!/usr/sbin/nft -f","# Managed by ts-cloud. Edits are overwritten on the next deploy.","","table inet ts_cloud_ddos","delete table inet ts_cloud_ddos","","table inet ts_cloud_ddos {"," # Sources that tripped a limit, with a timeout so a ban self-expires.",` set banned4 { type ipv4_addr; flags timeout; timeout ${t.banSeconds}s; }`,` set banned6 { type ipv6_addr; flags timeout; timeout ${t.banSeconds}s; }`];if(c.length>0)o.push(` set allow4 { type ipv4_addr; flags interval; elements = { ${c.join(", ")} } }`);if(p.length>0)o.push(` set allow6 { type ipv6_addr; flags interval; elements = { ${p.join(", ")} } }`);if(u.length>0)o.push(` set block4 { type ipv4_addr; flags interval; elements = { ${u.join(", ")} } }`);if(i.length>0)o.push(` set cdn4 { type ipv4_addr; flags interval; elements = { ${i.filter((r)=>!r.includes(":")).join(", ")} } }`);if(o.push(""," chain input {"," type filter hook input priority -150; policy accept;",""," # Established traffic is already paid for; never re-inspect it."," ct state established,related accept"," iif lo accept",""," # Invalid packets are never legitimate and are cheap to drop early."," ct state invalid counter drop"),c.length>0)o.push(" ip saddr @allow4 accept");if(p.length>0)o.push(" ip6 saddr @allow6 accept");if(u.length>0)o.push(" ip saddr @block4 counter drop");if(o.push(" ip saddr @banned4 counter drop"," ip6 saddr @banned6 counter drop",""),o.push(" # Nonsense TCP flag combinations: scanners and stack fingerprinting."," tcp flags & (fin|syn) == (fin|syn) counter drop"," tcp flags & (syn|rst) == (syn|rst) counter drop"," tcp flags & (fin|rst) == (fin|rst) counter drop"," tcp flags & (fin|ack) == fin counter drop"," tcp flags & (syn|fin|ack|rst|psh|urg) == 0x0 counter drop",""," # Ping stays usable, ping floods do not.",` ip protocol icmp icmp type echo-request limit rate ${t.icmpPerSecond}/second burst ${t.burst} packets accept`," ip protocol icmp icmp type echo-request counter drop",""),n.length>0){let r=n.join(", ");if(o.push(" # Platform-wide SYN ceiling. Above it the kernel falls back to cookies.",` tcp dport { ${r} } ct state new limit rate ${t.synPerSecond}/second burst ${t.burst} packets accept`,""," # Per-source new-connection rate. This is what stops one host hammering.",` tcp dport { ${r} } ct state new meter conn_rate4 { ip saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned4 { ip saddr } ${l}`,` tcp dport { ${r} } ct state new meter conn_rate6 { ip6 saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned6 { ip6 saddr } ${l}`,""," # Concurrency ceiling per source: the slow-loris defence.",` tcp dport { ${r} } ct state new meter conn_count4 { ip saddr ct count over ${t.concurrentPerSource} } ${l}`,` tcp dport { ${r} } ct state new meter conn_count6 { ip6 saddr ct count over ${t.concurrentPerSource} } ${l}`,""),i.length>0)o.push(" # Origin protection: reject traffic that skipped the CDN and came"," # straight to the box, which is how an attacker bypasses the edge.",` tcp dport { ${r} } ip saddr != @cdn4 counter drop`,"")}return o.push(" }","}",""),o.join(`
3
+ `}function Hd(e={}){let t=h(e),n=y(e.ports),s=f(e.allowlist),a=f(e.blocklist),l=e.monitorOnly?"counter":"counter drop",i=e.originProtection?.enabled?f(e.originProtection.cdnRanges):[],c=s.filter((r)=>!r.includes(":")),p=s.filter((r)=>r.includes(":")),u=a.filter((r)=>!r.includes(":")),o=["#!/usr/sbin/nft -f","# Managed by ts-cloud. Edits are overwritten on the next deploy.","","table inet ts_cloud_ddos","delete table inet ts_cloud_ddos","","table inet ts_cloud_ddos {"," # Sources that tripped a limit, with a timeout so a ban self-expires.",` set banned4 { type ipv4_addr; flags timeout; timeout ${t.banSeconds}s; }`,` set banned6 { type ipv6_addr; flags timeout; timeout ${t.banSeconds}s; }`];if(c.length>0)o.push(` set allow4 { type ipv4_addr; flags interval; elements = { ${c.join(", ")} } }`);if(p.length>0)o.push(` set allow6 { type ipv6_addr; flags interval; elements = { ${p.join(", ")} } }`);if(u.length>0)o.push(` set block4 { type ipv4_addr; flags interval; elements = { ${u.join(", ")} } }`);if(i.length>0)o.push(` set cdn4 { type ipv4_addr; flags interval; elements = { ${i.filter((r)=>!r.includes(":")).join(", ")} } }`);if(o.push(""," chain input {"," type filter hook input priority -150; policy accept;",""," # Established traffic is already paid for; never re-inspect it."," ct state established,related accept"," iif lo accept",""," # Invalid packets are never legitimate and are cheap to drop early."," ct state invalid counter drop"),c.length>0)o.push(" ip saddr @allow4 accept");if(p.length>0)o.push(" ip6 saddr @allow6 accept");if(u.length>0)o.push(" ip saddr @block4 counter drop");if(o.push(" ip saddr @banned4 counter drop"," ip6 saddr @banned6 counter drop",""),o.push(" # Nonsense TCP flag combinations: scanners and stack fingerprinting."," tcp flags & (fin|syn) == (fin|syn) counter drop"," tcp flags & (syn|rst) == (syn|rst) counter drop"," tcp flags & (fin|rst) == (fin|rst) counter drop"," tcp flags & (fin|ack) == fin counter drop"," tcp flags & (syn|fin|ack|rst|psh|urg) == 0x0 counter drop",""," # Ping stays usable, ping floods do not.",` ip protocol icmp icmp type echo-request limit rate ${t.icmpPerSecond}/second burst ${t.burst} packets accept`," ip protocol icmp icmp type echo-request counter drop",""),n.length>0){let r=n.join(", ");if(o.push(" # Platform-wide SYN ceiling. Above it the kernel falls back to cookies.",` tcp dport { ${r} } ct state new limit rate ${t.synPerSecond}/second burst ${t.burst} packets accept`,""," # Per-source new-connection rate. This is what stops one host hammering.",` tcp dport { ${r} } ct state new meter conn_rate4 { ip saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned4 { ip saddr } ${l}`,` tcp dport { ${r} } ct state new meter conn_rate6 { ip6 saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned6 { ip6 saddr } ${l}`,""," # Concurrency ceiling per source: the slow-loris defence.",` tcp dport { ${r} } ct state new meter conn_count4 { ip saddr ct count over ${t.concurrentPerSource} } ${l}`,` tcp dport { ${r} } ct state new meter conn_count6 { ip6 saddr ct count over ${t.concurrentPerSource} } ${l}`,""),i.length>0)o.push(" # Origin protection: reject traffic that skipped the CDN and came"," # straight to the box, which is how an attacker bypasses the edge.",` tcp dport { ${r} } ip saddr != @cdn4 counter drop`,"")}return o.push(" }","}",""),o.join(`
4
4
  `)}function Cr(e={}){return`#!/usr/bin/env bash
5
5
  # Managed by ts-cloud. Installs L3/L4 flood mitigation.
6
6
  set -euo pipefail
@@ -13,11 +13,11 @@ fi
13
13
 
14
14
  install -d -m 0755 /etc/ts-cloud /etc/nftables.d
15
15
  cat > /etc/sysctl.d/90-ts-cloud-ddos.conf <<'SYSCTL_EOF'
16
- ${Fd(e)}SYSCTL_EOF
16
+ ${zd(e)}SYSCTL_EOF
17
17
  sysctl --system >/dev/null
18
18
 
19
19
  cat > /etc/nftables.d/ts-cloud-ddos.nft.new <<'NFT_EOF'
20
- ${Bd(e)}NFT_EOF
20
+ ${Hd(e)}NFT_EOF
21
21
 
22
22
  # Syntax-check before applying: a bad ruleset would leave the box unprotected.
23
23
  if ! nft -c -f /etc/nftables.d/ts-cloud-ddos.nft.new; then
@@ -40,5 +40,5 @@ include "/etc/nftables.d/ts-cloud-ddos.nft"
40
40
  fi
41
41
  systemctl enable nftables >/dev/null 2>&1 || true
42
42
  echo "ts-cloud: L3/L4 mitigation active"
43
- `}var b=["off","monitor","rate_limit","challenge","lockdown"];function tm(e,t=[]){let n=[],s=Math.max(1,e.baselineRequestsPerSecond),a=e.requestsPerSecond/s,l=0,i=(g,v)=>{n.push(v),l=Math.max(l,b.indexOf(g))},c=a>=3;if(c)i("monitor",`Traffic is ${a.toFixed(1)}x the baseline.`);let p=e.topSourceShare>=0.25,u=e.errorRate>=0.25,o=(e.suspiciousAgentShare??0)>=0.5,r=e.uniqueSources>0&&e.requestsPerSecond/e.uniqueSources>=50;if(c&&p)i("rate_limit",`One source accounts for ${(e.topSourceShare*100).toFixed(0)}% of traffic.`);if(c&&r)i("rate_limit","Request rate per unique source is far above what a browser produces.");if(c&&u)i("challenge",`Error rate is ${(e.errorRate*100).toFixed(0)}% under load.`);if(c&&o)i("challenge","Most requests carry no recognisable browser agent.");if(a>=20&&(p||u||o||r))i("lockdown",`Traffic is ${a.toFixed(0)}x the baseline with attack-shaped characteristics.`);if(!c&&e.topSourceShare>=0.6&&e.requestsPerSecond>s)i("rate_limit","A single source dominates traffic without an overall surge.");let d=b[l],m={off:1,monitor:1,rate_limit:0.5,challenge:0.25,lockdown:0.1}[d];return{level:d,reasons:n,rateLimitFactor:m,challengeEnabled:d==="challenge"||d==="lockdown",staticOnly:d==="lockdown",banCandidates:d==="off"||d==="monitor"?[]:f(t)}}function po(e,t){return Math.max(1,Math.floor(e*t.rateLimitFactor))}
44
- export{Md,uo,Ud,Fd,Bd,Cr,tm,po};
43
+ `}var b=["off","monitor","rate_limit","challenge","lockdown"];function om(e,t=[]){let n=[],s=Math.max(1,e.baselineRequestsPerSecond),a=e.requestsPerSecond/s,l=0,i=(g,v)=>{n.push(v),l=Math.max(l,b.indexOf(g))},c=a>=3;if(c)i("monitor",`Traffic is ${a.toFixed(1)}x the baseline.`);let p=e.topSourceShare>=0.25,u=e.errorRate>=0.25,o=(e.suspiciousAgentShare??0)>=0.5,r=e.uniqueSources>0&&e.requestsPerSecond/e.uniqueSources>=50;if(c&&p)i("rate_limit",`One source accounts for ${(e.topSourceShare*100).toFixed(0)}% of traffic.`);if(c&&r)i("rate_limit","Request rate per unique source is far above what a browser produces.");if(c&&u)i("challenge",`Error rate is ${(e.errorRate*100).toFixed(0)}% under load.`);if(c&&o)i("challenge","Most requests carry no recognisable browser agent.");if(a>=20&&(p||u||o||r))i("lockdown",`Traffic is ${a.toFixed(0)}x the baseline with attack-shaped characteristics.`);if(!c&&e.topSourceShare>=0.6&&e.requestsPerSecond>s)i("rate_limit","A single source dominates traffic without an overall surge.");let d=b[l],m={off:1,monitor:1,rate_limit:0.5,challenge:0.25,lockdown:0.1}[d];return{level:d,reasons:n,rateLimitFactor:m,challengeEnabled:d==="challenge"||d==="lockdown",staticOnly:d==="lockdown",banCandidates:d==="off"||d==="monitor"?[]:f(t)}}function ho(e,t){return Math.max(1,Math.floor(e*t.rateLimitFactor))}
44
+ export{jd,fo,Vd,zd,Hd,Cr,om,ho};
@@ -0,0 +1 @@
1
+ import{g}from"./chunk-nmqjmx30.js";import"./chunk-dkf2kcsc.js";export{g as S3Client};
@@ -0,0 +1,2 @@
1
+ function _(n,r){return(n?.[`${r}Response`]??n)?.[`${r}Result`]}function N(n){if(n===void 0||n===null||n==="")return[];return Array.isArray(n)?n:[n]}function ea(n){return n===!0||n==="true"}
2
+ export{_,N,ea};
@@ -0,0 +1 @@
1
+ import{Gd,jc,Wd,wo,Ao,Ro,xs}from"./chunk-k0p394bn.js";import"./chunk-ddwp5np9.js";import"./chunk-4yym8xm4.js";export{Gd as MANAGEMENT_DASHBOARD_SITE,xs as buildManagementDashboardArtifact,jc as dashboardCredentialsFile,Ao as ensureManagementDashboard,Ro as managementDashboardSiteNames,Wd as resolveDashboardAuth,wo as resolveUiSource};
@@ -0,0 +1 @@
1
+ import{gm,fm,na,Qc,ia,oa,yn,Be,A,sa,Yc,H,$r,w,Yd,ki,aa,ca,F,Fo,Zd,eu,tu,ru,l,o,hm,ym,T,la,da,ua,bm,Sm,xe,pa,Ni,nu,vm,Cm,Fe,Et,ma,Zc,el,Tm,tl,rl,nl,jo,ga,tt,Vo,bn,xi,Sn,je,iu,zo,Ho,fa,ha,ya,ba,Sa,va,Te,j,ou,su,il,b,L,rt,k,ol,wt,ge,Ht,Em,sl,Ee,qo,Ve,qt,_i,we,Go,_e,au,Oi,Ae,Re,ne,$i,X,Gt,At,Ie,t,vn,wm,al,Ca,Am,Rm,Im,Pm,Ta,Dm,km,Nm,xm,_m,Om,$m,Lm,Mm,Um,Bm,Fm,cu,lu,du,uu,pu,mu,gu,Wt,cl,ll,Lr,Li,jm,dl,Vm,zm,Cn,Hm,qm,Gm,Wm,Km,Jm,fu,hu,yu,bu,Su,Mi,Xm,Tn,vu,ul,Cu,Ea,fe,Tu,Eu,Rt,Wo,Kt,wu,pl,Au,Ru,Iu,ml,he,Qm,Ym,Zm,eg,Pu,tg,Pe,rg,ng,ig,wa,Aa,Du,gl,fl,og,sg,ag,cg,lg,ku,Ra,dg,ug,pg,mg,gg,Nu,xu,fg,hg,yg,bg,Sg,vg,Cg,_u,Tg,hl,Ia,Eg,wg,Ag,Rg,yl,bl,Sl,Ig,Pa,Ou,$u,Lu,Mu,Da,Uu,Pg,Dg,kg,Ng,xg,_g,Og,Bu,Fu,ju,Vu,vl,$g,Lg,Mg,Ug,Bg,Fg,jg,Vg,zg,zu,Hu,qu,Gu,Hg,qg,Cl,Gg,Tl,El,wl,Al,Wg,Kg,Jg,Xg,nt,Ui,Qg,Yg,Zg,ef,tf,rf,nf,of,Wu,sf,af,Rl,Il,cf,lf,Ku,df,uf,pf,mf,gf,ff,hf,yf,bf,Sf,vf,Cf,Tf,Ef,wf,Af,Rf,If,Pf,Df,kf,ka,Ju,Na,Xu,xa,Qu,_a,Yu,Oa,Zu,Mr,ep,$a,tp,Bi,rp,La,np,Ma,ip,Pl,Nf,Dl,xf,Ua,op,Ur,sp,kl,_f,Ba,ap,Nl,Of,xl,$f,_l,Lf,Fa,cp,Ol,Mf,$l,Uf,Ll,Bf,Ml,Ff,ja,lp,Va,dp,Ul,jf,Bl,Vf,Fl,zf,jl,Hf,Vl,qf,zl,Gf,za,up,Hl,Wf,ql,Kf,Gl,Jf,Wl,Xf,Kl,Qf,Jl,Yf,Xl,Ql,Yl,Zl,ed,Zf,td,eh,rd,th,nd,rh,It,id,pp,Ko,Ha,En,mp,Fi,Jt,qa,Ga,gp,fp,Wa,od,Ka,sd,nh,ih,Ja,Xa,Qa,ad,ji,cd,ld,Jo,Ya,Za,dd,hp,yp,bp,oh,ud,pd,sh,Sp,md,vp,Cp,Tp,ah,gd,wn,ec,fd,ch,Ep,Xo,Qo,tc,hd,lh,rc,wp,yd,dh,bd,uh,Sd,ph}from"./chunk-ddwp5np9.js";import{nc,Y,ic,Yo,Ap,Pt,Rp,Ip,An,Pp,Dp,kp,Np,xp}from"./chunk-4yym8xm4.js";export{La as ABTestManager,Ve as AI,Au as AWSAPIError,xa as AWSConfigManager,wm as AWS_PSEUDO_PARAMETERS,nt as AWS_REGIONS,Go as ApiGateway,vn as Arn,ne as AssetHasher,Ae as Auth,ka as BackupManager,rd as BatchProcessingManager,$a as BlueGreenManager,Gl as BounceComplaintHandler,Ml as BuildOptimizationManager,je as CDN,Xa as CHAIN_HEADER,ma as CLOUDFRONT_FAILOVER_STATUS_CODES,uf as COMMON_CROSS_ACCOUNT_ROLES,_i as Cache,Bi as CanaryManager,Ol as CertificateManager,Rt as CloudError,al as CloudFormationBuilder,Cu as CloudFormationClient,Eu as CloudFrontClient,_a as CloudTrailManager,Gu as CommandHistory,Ie as Communication,b as Compute,Wo as ConfigurationError,ja as ContainerRegistryManager,Kt as CredentialError,Tl as CrossRegionReferenceManager,lu as DASHBOARD_ENTRY,du as DASHBOARD_PORT_BASE,uu as DASHBOARD_PORT_SPAN,cu as DASHBOARD_STATE_DIR,Zc as DEFAULT_FAILOVER_STATUS_CODES,ji as DEFAULT_RECURSION_LIMITS,Pe as DEFAULT_SERVICE_LIMITS,na as DEFAULT_STATE_DIR,iu as DEFAULT_STORAGE_FAILOVER_STATUS_CODES,Ja as DEPTH_HEADER,td as DLQMonitoringManager,Te as DNS,Hl as DNSSECManager,qt as Database,xl as DatabaseUserManager,he as DebugLogger,nu as DependencyGraph,Re as Deployment,wu as DeploymentError,Na as DisasterRecoveryManager,k as Email,Xl as EmailAdvanced,Wl as EmailAnalyticsManager,Ql as EmailHandlers,Jl as EmailTemplateManager,Ru as ErrorCodes,Ho as FAILOVER_REPLICA_POLICY_SID,ed as FIFOQueueManager,wa as FileCache,rt as FileSystem,t as Fn,El as GlobalResourceManager,Oa as GuardDutyManager,ku as HashCache,yd as HealthCheckManager,Ll as ImageScanningManager,Ht as JobLoader,fd as LARAVEL_SERVERLESS_BUILD_STEPS,Fl as LambdaConcurrencyManager,zl as LambdaDLQManager,jl as LambdaDestinationsManager,Ul as LambdaLayersManager,Vl as LambdaVPCManager,Bl as LambdaVersionsManager,Ua as LogsManager,mp as MANAGED_NODE_VERSIONS,cl as MANAGEMENT_DASHBOARD_SITE_PREFIX,_e as Messaging,Dl as MetricsManager,kl as MigrationManager,yl as MockCloudFormation,Sl as MockDynamoDB,bl as MockS3,Oi as Monitoring,Rl as MultiAccountManager,Cl as MultiRegionManager,Fu as MultiStepProgress,L as Network,bd as NetworkSecurityManager,rl as ORIGIN_CONNECTION_ATTEMPTS,nl as ORIGIN_CONNECTION_TIMEOUT,el as ORIGIN_GROUP_ALLOWED_METHODS,Tm as ORIGIN_GROUP_ID_SUFFIX,tl as ORIGIN_GROUP_SELECTION_CRITERIA,Il as OrganizationManager,Ep as PHP_DEFAULT_EXCLUDES,gp as PHP_LAYER_EXTENSIONS,X as ParameterStore,Nl as PerformanceManager,we as Permissions,wt as Phone,Yl as PhoneAdvanced,ol as PhoneHandlers,Pa as PreviewEnvironmentManager,Da as PreviewNotificationService,Bu as ProgressBar,Ma as ProgressiveDeploymentManager,ru as Pseudo,ge as Queue,nd as QueueManagementManager,gm as QueuePresets,Ku as RECOMMENDED_ACCOUNT_STRUCTURES,df as RECOMMENDED_SCPS,zu as REPL,qu as REPLCommandBuilder,Hu as REPLContext,Nu as RateLimiter,fm as RealtimePresets,Jo as RecursionGuard,At as Redirects,wl as RegionPairManager,Et as Registry,Ba as ReplicaManager,Sd as ResourceManagementManager,ql as Route53ResolverManager,za as Route53RoutingManager,Ea as S3Client,fe as S3Error,Ee as SMS,Qc as STATE_DIR_ENV_VAR,zo as STORAGE_FAILOVER_METADATA_KEY,Gt as Search,$i as Secrets,Fa as SecretsManager,_l as SecretsRotationManager,j as Security,Mr as SecurityHubManager,$l as SecurityScanningManager,Kl as SenderReputationManager,Va as ServiceMeshManager,qo as Sftp,Zl as SmsAdvanced,sl as SmsHandlers,ju as Spinner,Al as StackDependencyManager,Em as StacksIntegration,hd as StaticSiteManager,Fe as Storage,rc as StorageAdvancedManager,Ur as SyntheticsManager,Qa as TRACE_HEADER,Vu as TaskList,Fo as TemplateBuilder,Aa as TemplateCache,pl as ValidationError,au as Workflow,Pl as XRayManager,np as abTestManager,il as amazonLinuxImageId,su as amazonLinuxImageParameter,vm as analyzeStackDiff,Ha as artifactKey,bn as assertOriginGroupMethods,Bg as autocomplete,Qu as awsConfigManager,Ju as backupManager,dg as batch,th as batchProcessingManager,tp as blueGreenManager,Jf as bounceComplaintHandler,ih as buildBunRuntimeLayerZip,Ca as buildCloudFormationTemplate,Sa as buildFailoverReplicaPolicyStatement,ca as buildMailEnv,nh as buildNodeRuntimeLayerZip,Ff as buildOptimizationManager,ga as buildOriginGroup,Vo as buildOriginGroups,ch as buildPhpRuntimeLayerZip,ba as buildReplicationConfiguration,ya as buildReplicationRole,rp as canaryManager,Sg as categorizeChanges,Mf as certificateManager,eg as checkIAMPermissions,ud as checkInvocation,rg as checkServiceQuotas,xu as chunk,Dp as clearSigningKeyCache,_u as cloudConfigSchema,Yu as cloudTrailManager,Qo as collectPhpAppEntries,Vm as composePresets,Ga as composeServerlessAppTemplate,lp as containerRegistryManager,km as createApiBackendPreset,Tp as createCliHandler,Xm as createCredentialProvider,Fm as createDashboardSite,$m as createDataPipelinePreset,ml as createError,Ta as createExistingStaticFullStackPreset,Dm as createFullStackAppPreset,ah as createHandlers,vp as createHttpHandler,xm as createJamstackPreset,Um as createLaravelPreset,Lm as createMLApiPreset,_m as createMicroservicesPreset,Ig as createMockAWS,Rm as createNodeJsServerPreset,Im as createNodeJsServerlessPreset,zm as createPreset,Yo as createPresignedUrl,Ap as createPresignedUrlAsync,Cp as createQueueHandler,Om as createRealtimeAppPreset,Tu as createS3Client,Bm as createServerlessLaravelPreset,Pm as createServerlessNodePreset,Am as createStaticSitePreset,Mm as createTraditionalWebAppPreset,Nm as createWordPressPreset,It as createZip,Wg as crossRegionReferenceManager,$f as databaseUserManager,hl as defaultLocalConfig,$r as deploymentCoexistenceError,pu as deriveManagementDashboardPort,Yc as detectDeploymentTargets,Ym as detectMisconfigurations,nc as detectServiceRegion,hg as diffTemplates,eh as dlqMonitoringManager,Wf as dnssecManager,Xu as drManager,Xf as emailAnalyticsManager,Yf as emailTemplateManager,Sp as eventToRequest,dl as extendPreset,Zf as fifoQueueManager,lg as findChangedFiles,ff as formatAccountStructure,Ng as formatBytes,Cm as formatDiff,xg as formatDuration,jg as formatFlagSuggestions,Hg as formatHistory,qg as formatHistoryStats,Og as formatKeyValue,_g as formatList,kg as formatProgressBar,Wu as formatRegion,sf as formatRegionList,$g as formatSuggestion,Pg as formatTable,Dg as formatTree,yu as fromEC2Metadata,bu as fromECSMetadata,fu as fromEnvironment,hu as fromSharedCredentials,Su as fromWebIdentity,ad as functionFingerprint,Ka as generateAppImageDockerfile,Df as generateApprovalConfig,id as generateBootstrap,Lu as generateCleanupWorkflow,Mu as generateCostReportWorkflow,mf as generateCrossAccountRoleCF,Rf as generateDeploymentConfig,Cf as generateDeploymentPipeline,hf as generateDeploymentWorkflow,o as generateLogicalId,Af as generateManualPipeline,vf as generateMatrixWorkflow,If as generateMultiEnvConfig,Tf as generateMultiEnvPipeline,yf as generateMultiEnvWorkflow,bf as generatePRPreviewWorkflow,kf as generateParallelConfig,gd as generatePhpFpmConfig,od as generatePhpLayerDockerfile,Ef as generatePreviewPipeline,$u as generatePreviewWorkflow,l as generateResourceName,Pf as generateScheduledConfig,wf as generateScheduledPipeline,Sf as generateScheduledWorkflow,ul as getAccountId,Qg as getAllRegions,rf as getClosestRegion,Vg as getCommandUsage,Mg as getContextualHelp,Mi as getCredentials,vg as getDeploymentStrategy,Cg as getDiffStats,yg as getDiffSummary,Iu as getErrorDetails,Ia as getLocalConfig,Ag as getLocalCredentials,wg as getLocalEndpoint,Rg as getLocalEnvVars,ng as getQuotaUsageSummary,pf as getRecommendedStructure,Ui as getRegion,af as getRegionStats,Zg as getRegionsByCompliance,Yg as getRegionsByLocation,ef as getRegionsByPricingTier,Pu as getRequiredPermissions,kp as getSigningKeyCacheSize,hm as getTimestamp,Kg as globalResourceManager,Zu as guardDutyManager,Wt as hasManagementDashboardSite,og as hashBuffer,sg as hashDirectory,gl as hashFile,ag as hashManifest,fl as hashString,dh as healthCheckManager,Bf as imageScanningManager,ld as inspectInvocation,yp as installRecursionFetch,dd as invocationContext,ou as isArmInstanceType,Lg as isLikelyTypo,Eg as isLocalDevelopment,Lr as isManagementDashboardSiteName,Np as isNodeCryptoAvailable,xi as isS3RestEndpoint,oa as isStateDirConfigured,sa as isStatePath,tf as isValidRegion,xp as isWebCryptoAvailable,zf as lambdaConcurrencyManager,Gf as lambdaDLQManager,Hf as lambdaDestinationsManager,jf as lambdaLayersManager,qf as lambdaVPCManager,Vf as lambdaVersionsManager,ec as laravelServerlessEnvDefaults,op as logsManager,Yd as mailEnabled,aa as mailFirewallPorts,Pt as makeAWSRequest,Ip as makeAWSRequestAsync,Rp as makeAWSRequestOnce,ll as managementDashboardSiteName,Cn as mergeInfrastructure,xf as metricsManager,_f as migrationManager,cf as multiAccountManager,Gg as multiRegionManager,uh as networkSecurityManager,lf as organizationManager,tc as packagePhpApp,En as packageServerlessApp,Ra as parallel,ug as parallelMap,pg as parallelWithRetry,cd as parseChain,Pp as parseJSONResponse,An as parseXMLResponse,Of as performanceManager,Wa as phpLayerBuildStage,fp as phpLayerPackages,wn as phpRuntimeLayerAssets,Ou as previewManager,Uu as previewNotifications,fg as processInChunks,ip as progressiveDeploymentManager,Ya as propagationHeaders,rh as queueManagementManager,cg as quickHash,Za as recursionBlockedResponse,Jg as regionPairManager,ap as replicaManager,bg as requiresReplacement,oh as resetRecursionRuntime,sh as resolveApp,w as resolveAppDatabase,F as resolveCloudProvider,Tn as resolveCredentials,mu as resolveDashboardDomain,gu as resolveDashboardDomains,Sm as resolveDeployBucketName,H as resolveDeploymentMode,jo as resolveFailoverStatusCodes,ki as resolveMailService,jm as resolveManagementDashboardSite,Li as resolveManagementDashboardSites,tt as resolveOriginConnection,T as resolveProjectStackName,qa as resolveQueueNames,Jt as resolveQueues,hp as resolveRecursionConfig,vu as resolveRegion,xe as resolveServerlessAppStackName,pa as resolveServerlessArtifactBucketName,Ni as resolveServerlessAssetBucketName,Fi as resolveServerlessRuntime,ua as resolveSiteBucketName,da as resolveSiteResourceName,la as resolveSiteStackName,A as resolveStatePath,bm as resolveStorageBucketName,fa as resolveStorageFailover,ph as resourceManagementManager,md as responseToResult,Kf as route53ResolverManager,up as route53RoutingManager,pp as runBuildHooks,Xo as runPhpBuildHooks,ha as s3RegionalDomain,ym as sanitizeName,Ug as searchCommands,cp as secretsManager,Lf as secretsRotationManager,ep as securityHubManager,Uf as securityScanningManager,Qf as senderReputationManager,mg as sequence,dp as serviceMeshManager,ia as setStateDir,Ko as sha256,bp as sharedRecursionGuard,sd as sharedRuntimeLoop,Y as signRequest,ic as signRequestAsync,Xg as stackDependencyManager,yn as stateDir,Be as statePath,lh as staticSiteManager,wp as storageAdvancedManager,va as storageFailoverReplicasFromTemplate,vl as suggestCommand,Fg as suggestFlags,tg as suggestIAMPolicy,ig as suggestQuotaIncrease,of as suggestRegionPairs,nf as suggestRegions,sp as syntheticsManager,Du as templateCache,gf as validateAccountStructure,Tg as validateAgainstSchema,zg as validateCommand,Qm as validateConfiguration,Zm as validateCredentials,Sn as validateOriginGroups,tu as validateResourceLimits,Zd as validateTemplate,eu as validateTemplateSize,Km as withCDN,Wm as withCache,Gm as withDatabase,pd as withInvocation,Hm as withMonitoring,Jm as withQueue,qm as withSecurity,gg as withTimeout,Nf as xrayManager};
@@ -1,2 +1,2 @@
1
- import{u,D}from"./chunk-dmwfnbg0.js";import{k}from"./chunk-cvc9bxd4.js";class me{client;region;constructor(e="us-east-1"){this.region=e,this.client=new u}async describeDBInstances(e){let r={Action:"DescribeDBInstances",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((a,o)=>{r[`Filters.Filter.${o+1}.Name`]=a.Name,a.Values.forEach((c,d)=>{r[`Filters.Filter.${o+1}.Values.Value.${d+1}`]=c})});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBInstancesResult||n,s=i.DBInstances?.DBInstance||[];if(!Array.isArray(s))s=s?[s]:[];return{DBInstances:s,Marker:i.Marker}}async describeDBInstance(e){return(await this.describeDBInstances({DBInstanceIdentifier:e})).DBInstances?.[0]}async describeDBClusters(e){let r={Action:"DescribeDBClusters",Version:"2014-10-31"};if(e?.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((a,o)=>{r[`Filters.Filter.${o+1}.Name`]=a.Name,a.Values.forEach((c,d)=>{r[`Filters.Filter.${o+1}.Values.Value.${d+1}`]=c})});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBClustersResult||n,s=i.DBClusters?.DBCluster||[];if(!Array.isArray(s))s=s?[s]:[];return{DBClusters:s,Marker:i.Marker}}async describeDBSnapshots(e){let r={Action:"DescribeDBSnapshots",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;if(e?.SnapshotType)r.SnapshotType=e.SnapshotType;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBSnapshotsResult||n,s=i.DBSnapshots?.DBSnapshot||[];if(!Array.isArray(s))s=s?[s]:[];return{DBSnapshots:s,Marker:i.Marker}}async describeDBSubnetGroups(e){let r={Action:"DescribeDBSubnetGroups",Version:"2014-10-31"};if(e?.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBSubnetGroupsResult||n,s=i.DBSubnetGroups?.DBSubnetGroup||[];if(!Array.isArray(s))s=s?[s]:[];return{DBSubnetGroups:s,Marker:i.Marker}}async createDBInstance(e){let r={Action:"CreateDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBInstanceClass:e.DBInstanceClass,Engine:e.Engine};if(e.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DBName)r.DBName=e.DBName;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.LicenseModel)r.LicenseModel=e.LicenseModel;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.StorageType)r.StorageType=e.StorageType;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});if(e.Tags)e.Tags.forEach((s,a)=>{r[`Tags.Tag.${a+1}.Key`]=s.Key,r[`Tags.Tag.${a+1}.Value`]=s.Value});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.CreateDBInstanceResult||n).DBInstance}}async createDBCluster(e){let r={Action:"CreateDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DatabaseName)r.DatabaseName=e.DatabaseName;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;e.VpcSecurityGroupIds?.forEach((i,s)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${s+1}`]=i});let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()});return{DBCluster:(t.CreateDBClusterResult||t).DBCluster}}async deleteDBInstance(e){let r={Action:"DeleteDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.SkipFinalSnapshot!==void 0)r.SkipFinalSnapshot=e.SkipFinalSnapshot;if(e.FinalDBSnapshotIdentifier)r.FinalDBSnapshotIdentifier=e.FinalDBSnapshotIdentifier;if(e.DeleteAutomatedBackups!==void 0)r.DeleteAutomatedBackups=e.DeleteAutomatedBackups;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.DeleteDBInstanceResult||n).DBInstance}}async modifyDBInstance(e){let r={Action:"ModifyDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.ModifyDBInstanceResult||n).DBInstance}}async modifyDBCluster(e){let r={Action:"ModifyDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier};if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBCluster:(n.ModifyDBClusterResult||n).DBCluster}}async rebootDBCluster(e){let r={Action:"FailoverDBCluster",Version:"2014-10-31",DBClusterIdentifier:e},t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()});return{DBCluster:(t.FailoverDBClusterResult||t).DBCluster}}async createDBClusterSnapshot(e,r){let t={Action:"CreateDBClusterSnapshot",Version:"2014-10-31",DBClusterIdentifier:e,DBClusterSnapshotIdentifier:r};return this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(t)).toString()})}async describeDBClusterSnapshots(e={}){let r={Action:"DescribeDBClusterSnapshots",Version:"2014-10-31",...e},t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()}),n=t.DescribeDBClusterSnapshotsResult||t;return{DBClusterSnapshots:k(n.DBClusterSnapshots?.DBClusterSnapshot)}}async deleteDBClusterSnapshot(e){await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D({Action:"DeleteDBClusterSnapshot",Version:"2014-10-31",DBClusterSnapshotIdentifier:e})).toString()})}async deleteDBCluster(e,r){let t={Action:"DeleteDBCluster",Version:"2014-10-31",DBClusterIdentifier:e,SkipFinalSnapshot:!r};if(r)t.FinalDBSnapshotIdentifier=r;let n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(t)).toString()});return{DBCluster:(n.DeleteDBClusterResult||n).DBCluster}}async restoreDBClusterToPointInTime(e){let r={Action:"RestoreDBClusterToPointInTime",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SourceDBClusterIdentifier:e.SourceDBClusterIdentifier};if(e.RestoreToTime)r.RestoreToTime=e.RestoreToTime.toISOString();if(e.UseLatestRestorableTime)r.UseLatestRestorableTime=!0;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBCluster:(n.RestoreDBClusterToPointInTimeResult||n).DBCluster}}async restoreDBClusterFromSnapshot(e){let r={Action:"RestoreDBClusterFromSnapshot",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SnapshotIdentifier:e.SnapshotIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds?.forEach((i,s)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${s+1}`]=i}),e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()});return{DBCluster:(t.RestoreDBClusterFromSnapshotResult||t).DBCluster}}async startDBInstance(e){let t=new URLSearchParams(D({Action:"StartDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e})).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.StartDBInstanceResult||n).DBInstance}}async stopDBInstance(e){let r={Action:"StopDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.StopDBInstanceResult||n).DBInstance}}async rebootDBInstance(e){let r={Action:"RebootDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.ForceFailover!==void 0)r.ForceFailover=e.ForceFailover;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.RebootDBInstanceResult||n).DBInstance}}async createDBSnapshot(e){let r={Action:"CreateDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.Tags)e.Tags.forEach((s,a)=>{r[`Tags.Tag.${a+1}.Key`]=s.Key,r[`Tags.Tag.${a+1}.Value`]=s.Value});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBSnapshot:(n.CreateDBSnapshotResult||n).DBSnapshot}}async deleteDBSnapshot(e){let t=new URLSearchParams(D({Action:"DeleteDBSnapshot",Version:"2014-10-31",DBSnapshotIdentifier:e})).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBSnapshot:(n.DeleteDBSnapshotResult||n).DBSnapshot}}async restoreDBInstanceFromDBSnapshot(e){let r={Action:"RestoreDBInstanceFromDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.Port)r.Port=e.Port;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});if(e.Tags)e.Tags.forEach((s,a)=>{r[`Tags.Tag.${a+1}.Key`]=s.Key,r[`Tags.Tag.${a+1}.Value`]=s.Value});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.RestoreDBInstanceFromDBSnapshotResult||n).DBInstance}}async waitForDBInstanceAvailable(e,r=60,t=30000){for(let n=0;n<r;n++){let i=await this.describeDBInstance(e);if(i?.DBInstanceStatus==="available")return i;if(["deleted","failed","incompatible-restore","incompatible-parameters"].includes(i?.DBInstanceStatus||""))throw Error(`DB instance ${e} is in terminal state: ${i?.DBInstanceStatus}`);await new Promise((s)=>setTimeout(s,t))}throw Error(`Timeout waiting for DB instance ${e} to become available`)}async waitForDBInstanceDeleted(e,r=60,t=30000){for(let n=0;n<r;n++)try{let i=await this.describeDBInstance(e);if(i?.DBInstanceStatus==="deleting"){await new Promise((s)=>setTimeout(s,t));continue}throw Error(`DB instance ${e} is in state: ${i?.DBInstanceStatus}`)}catch(i){if(i.code==="DBInstanceNotFound"||i.code==="DBInstanceNotFoundFault")return;throw i}throw Error(`Timeout waiting for DB instance ${e} to be deleted`)}}
1
+ import{p,D}from"./chunk-dkf2kcsc.js";import{N}from"./chunk-kbwm0sqv.js";class me{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async describeDBInstances(e){let r={Action:"DescribeDBInstances",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((a,o)=>{r[`Filters.Filter.${o+1}.Name`]=a.Name,a.Values.forEach((c,u)=>{r[`Filters.Filter.${o+1}.Values.Value.${u+1}`]=c})});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBInstancesResult||n,s=i.DBInstances?.DBInstance||[];if(!Array.isArray(s))s=s?[s]:[];return{DBInstances:s,Marker:i.Marker}}async describeDBInstance(e){return(await this.describeDBInstances({DBInstanceIdentifier:e})).DBInstances?.[0]}async describeDBClusters(e){let r={Action:"DescribeDBClusters",Version:"2014-10-31"};if(e?.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((a,o)=>{r[`Filters.Filter.${o+1}.Name`]=a.Name,a.Values.forEach((c,u)=>{r[`Filters.Filter.${o+1}.Values.Value.${u+1}`]=c})});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBClustersResult||n,s=i.DBClusters?.DBCluster||[];if(!Array.isArray(s))s=s?[s]:[];return{DBClusters:s,Marker:i.Marker}}async describeDBSnapshots(e){let r={Action:"DescribeDBSnapshots",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;if(e?.SnapshotType)r.SnapshotType=e.SnapshotType;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBSnapshotsResult||n,s=i.DBSnapshots?.DBSnapshot||[];if(!Array.isArray(s))s=s?[s]:[];return{DBSnapshots:s,Marker:i.Marker}}async describeDBSubnetGroups(e){let r={Action:"DescribeDBSubnetGroups",Version:"2014-10-31"};if(e?.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBSubnetGroupsResult||n,s=i.DBSubnetGroups?.DBSubnetGroup||[];if(!Array.isArray(s))s=s?[s]:[];return{DBSubnetGroups:s,Marker:i.Marker}}async createDBInstance(e){let r={Action:"CreateDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBInstanceClass:e.DBInstanceClass,Engine:e.Engine};if(e.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DBName)r.DBName=e.DBName;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.LicenseModel)r.LicenseModel=e.LicenseModel;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.StorageType)r.StorageType=e.StorageType;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});if(e.Tags)e.Tags.forEach((s,a)=>{r[`Tags.Tag.${a+1}.Key`]=s.Key,r[`Tags.Tag.${a+1}.Value`]=s.Value});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.CreateDBInstanceResult||n).DBInstance}}async createDBCluster(e){let r={Action:"CreateDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DatabaseName)r.DatabaseName=e.DatabaseName;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;e.VpcSecurityGroupIds?.forEach((i,s)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${s+1}`]=i});let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()});return{DBCluster:(t.CreateDBClusterResult||t).DBCluster}}async deleteDBInstance(e){let r={Action:"DeleteDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.SkipFinalSnapshot!==void 0)r.SkipFinalSnapshot=e.SkipFinalSnapshot;if(e.FinalDBSnapshotIdentifier)r.FinalDBSnapshotIdentifier=e.FinalDBSnapshotIdentifier;if(e.DeleteAutomatedBackups!==void 0)r.DeleteAutomatedBackups=e.DeleteAutomatedBackups;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.DeleteDBInstanceResult||n).DBInstance}}async modifyDBInstance(e){let r={Action:"ModifyDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.ModifyDBInstanceResult||n).DBInstance}}async modifyDBCluster(e){let r={Action:"ModifyDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier};if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBCluster:(n.ModifyDBClusterResult||n).DBCluster}}async rebootDBCluster(e){let r={Action:"FailoverDBCluster",Version:"2014-10-31",DBClusterIdentifier:e},t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()});return{DBCluster:(t.FailoverDBClusterResult||t).DBCluster}}async createDBClusterSnapshot(e,r){let t={Action:"CreateDBClusterSnapshot",Version:"2014-10-31",DBClusterIdentifier:e,DBClusterSnapshotIdentifier:r};return this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(t)).toString()})}async describeDBClusterSnapshots(e={}){let r={Action:"DescribeDBClusterSnapshots",Version:"2014-10-31",...e},t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()}),n=t.DescribeDBClusterSnapshotsResult||t;return{DBClusterSnapshots:N(n.DBClusterSnapshots?.DBClusterSnapshot)}}async deleteDBClusterSnapshot(e){await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D({Action:"DeleteDBClusterSnapshot",Version:"2014-10-31",DBClusterSnapshotIdentifier:e})).toString()})}async deleteDBCluster(e,r){let t={Action:"DeleteDBCluster",Version:"2014-10-31",DBClusterIdentifier:e,SkipFinalSnapshot:!r};if(r)t.FinalDBSnapshotIdentifier=r;let n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(t)).toString()});return{DBCluster:(n.DeleteDBClusterResult||n).DBCluster}}async restoreDBClusterToPointInTime(e){let r={Action:"RestoreDBClusterToPointInTime",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SourceDBClusterIdentifier:e.SourceDBClusterIdentifier};if(e.RestoreToTime)r.RestoreToTime=e.RestoreToTime.toISOString();if(e.UseLatestRestorableTime)r.UseLatestRestorableTime=!0;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBCluster:(n.RestoreDBClusterToPointInTimeResult||n).DBCluster}}async restoreDBClusterFromSnapshot(e){let r={Action:"RestoreDBClusterFromSnapshot",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SnapshotIdentifier:e.SnapshotIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds?.forEach((i,s)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${s+1}`]=i}),e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(D(r)).toString()});return{DBCluster:(t.RestoreDBClusterFromSnapshotResult||t).DBCluster}}async startDBInstance(e){let t=new URLSearchParams(D({Action:"StartDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e})).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.StartDBInstanceResult||n).DBInstance}}async stopDBInstance(e){let r={Action:"StopDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.StopDBInstanceResult||n).DBInstance}}async rebootDBInstance(e){let r={Action:"RebootDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.ForceFailover!==void 0)r.ForceFailover=e.ForceFailover;let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.RebootDBInstanceResult||n).DBInstance}}async createDBSnapshot(e){let r={Action:"CreateDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.Tags)e.Tags.forEach((s,a)=>{r[`Tags.Tag.${a+1}.Key`]=s.Key,r[`Tags.Tag.${a+1}.Value`]=s.Value});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBSnapshot:(n.CreateDBSnapshotResult||n).DBSnapshot}}async deleteDBSnapshot(e){let t=new URLSearchParams(D({Action:"DeleteDBSnapshot",Version:"2014-10-31",DBSnapshotIdentifier:e})).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBSnapshot:(n.DeleteDBSnapshotResult||n).DBSnapshot}}async restoreDBInstanceFromDBSnapshot(e){let r={Action:"RestoreDBInstanceFromDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.Port)r.Port=e.Port;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,a)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${a+1}`]=s});if(e.Tags)e.Tags.forEach((s,a)=>{r[`Tags.Tag.${a+1}.Key`]=s.Key,r[`Tags.Tag.${a+1}.Value`]=s.Value});let t=new URLSearchParams(D(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.RestoreDBInstanceFromDBSnapshotResult||n).DBInstance}}async waitForDBInstanceAvailable(e,r=60,t=30000){for(let n=0;n<r;n++){let i=await this.describeDBInstance(e);if(i?.DBInstanceStatus==="available")return i;if(["deleted","failed","incompatible-restore","incompatible-parameters"].includes(i?.DBInstanceStatus||""))throw Error(`DB instance ${e} is in terminal state: ${i?.DBInstanceStatus}`);await new Promise((s)=>setTimeout(s,t))}throw Error(`Timeout waiting for DB instance ${e} to become available`)}async waitForDBInstanceDeleted(e,r=60,t=30000){for(let n=0;n<r;n++)try{let i=await this.describeDBInstance(e);if(i?.DBInstanceStatus==="deleting"){await new Promise((s)=>setTimeout(s,t));continue}throw Error(`DB instance ${e} is in state: ${i?.DBInstanceStatus}`)}catch(i){if(i.code==="DBInstanceNotFound"||i.code==="DBInstanceNotFoundFault")return;throw i}throw Error(`Timeout waiting for DB instance ${e} to be deleted`)}}
2
2
  export{me};
@@ -0,0 +1 @@
1
+ import{nc,Y,ic,Yo,Ap,Pt,Rp,Ip,An,Pp,Dp,kp,Np,xp}from"./chunk-4yym8xm4.js";export{Dp as clearSigningKeyCache,Yo as createPresignedUrl,Ap as createPresignedUrlAsync,nc as detectServiceRegion,kp as getSigningKeyCacheSize,Np as isNodeCryptoAvailable,xp as isWebCryptoAvailable,Pt as makeAWSRequest,Ip as makeAWSRequestAsync,Rp as makeAWSRequestOnce,Pp as parseJSONResponse,An as parseXMLResponse,Y as signRequest,ic as signRequestAsync};
@@ -0,0 +1 @@
1
+ import{me}from"./chunk-kzpzkdpd.js";import"./chunk-dkf2kcsc.js";export{me as RDSClient};
@@ -1,8 +1,8 @@
1
- var l={mode:"detection",paranoiaLevel:1,inboundThreshold:5,outboundThreshold:4,maxBodyBytes:13107200,rejectOversizedBody:!0,auditLogPath:"/var/log/ts-cloud/waf-audit.log",blockStatus:403},d={bypassBase:1e5,exclusionBase:101000,rateLimitBase:102000,customBase:109000};function We(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/[\r\n]+/g," ")}function as(e){if(e.length>1000)return!1;if(/\([^)]*[+*]\)[+*]/.test(e))return!1;if(/\[[^\]]*\][+*]\{/.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}function b(e,r){let t=[],o=[],s=r;for(let n of e){if(n.enabled===!1)continue;if(n.key&&(n.key.source==="cookie"||n.key.source==="header")&&!n.key.name){o.push({ruleId:n.id,reason:"The rule keys on a header or cookie but names none."});continue}let c=n.path?uc(n.path):".*";if(!as(c)){o.push({ruleId:n.id,reason:"The path pattern compiles to an unsafe regular expression."});continue}let u=[`SecRule REQUEST_URI "@rx ${We(c)}"`];if(n.methods?.length)u.push(` "chain,id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${We(n.id)}'"`);else u.push(` "id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${We(n.id)}'"`);if(t.push(`# Marks requests governed by the ts-cloud rate limit "${We(n.id)}".`),t.push(u.join(" \\\n")),n.methods?.length)t.push(` SecRule REQUEST_METHOD "@within ${We(n.methods.join(" ").toUpperCase())}" "t:none"`);t.push(""),s++}return{lines:t,unmapped:o}}function uc(e){return`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*")}$`}function ci(e={},r=[]){let t=e.mode??l.mode,o=[],s=e.paranoiaLevel??l.paranoiaLevel,n=e.inboundThreshold??l.inboundThreshold,c=e.outboundThreshold??l.outboundThreshold,u=e.maxBodyBytes??l.maxBodyBytes,h=e.rejectOversizedBody!==!1;if(t==="blocking"&&s>=3)o.push(`Paranoia level ${s} blocks legitimate traffic on most applications until it is tuned. Run it in detection mode first.`);if(t==="blocking")o.push("zig-waf is pre-alpha. Blocking mode makes it a failure path for every request.");if(!h)o.push("Oversized bodies are passed through uninspected, so padding a request bypasses every rule.");if(e.bypassPaths?.length)o.push(`${e.bypassPaths.length} path(s) bypass inspection entirely.`);let i=["# Managed by ts-cloud. Edits are overwritten on the next deploy.",`# Mode: ${t}. Paranoia level: ${s}.`,""];if(t==="off")return i.push("SecRuleEngine Off",""),{config:`${i.join(`
1
+ var l={mode:"detection",paranoiaLevel:1,inboundThreshold:5,outboundThreshold:4,maxBodyBytes:13107200,rejectOversizedBody:!0,auditLogPath:"/var/log/ts-cloud/waf-audit.log",blockStatus:403},d={bypassBase:1e5,exclusionBase:101000,rateLimitBase:102000,customBase:109000};function Ke(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/[\r\n]+/g," ")}function us(e){if(e.length>1000)return!1;if(/\([^)]*[+*]\)[+*]/.test(e))return!1;if(/\[[^\]]*\][+*]\{/.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}function b(e,r){let t=[],o=[],s=r;for(let n of e){if(n.enabled===!1)continue;if(n.key&&(n.key.source==="cookie"||n.key.source==="header")&&!n.key.name){o.push({ruleId:n.id,reason:"The rule keys on a header or cookie but names none."});continue}let c=n.path?fc(n.path):".*";if(!us(c)){o.push({ruleId:n.id,reason:"The path pattern compiles to an unsafe regular expression."});continue}let u=[`SecRule REQUEST_URI "@rx ${Ke(c)}"`];if(n.methods?.length)u.push(` "chain,id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${Ke(n.id)}'"`);else u.push(` "id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${Ke(n.id)}'"`);if(t.push(`# Marks requests governed by the ts-cloud rate limit "${Ke(n.id)}".`),t.push(u.join(" \\\n")),n.methods?.length)t.push(` SecRule REQUEST_METHOD "@within ${Ke(n.methods.join(" ").toUpperCase())}" "t:none"`);t.push(""),s++}return{lines:t,unmapped:o}}function fc(e){return`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*")}$`}function ui(e={},r=[]){let t=e.mode??l.mode,o=[],s=e.paranoiaLevel??l.paranoiaLevel,n=e.inboundThreshold??l.inboundThreshold,c=e.outboundThreshold??l.outboundThreshold,u=e.maxBodyBytes??l.maxBodyBytes,h=e.rejectOversizedBody!==!1;if(t==="blocking"&&s>=3)o.push(`Paranoia level ${s} blocks legitimate traffic on most applications until it is tuned. Run it in detection mode first.`);if(t==="blocking")o.push("zig-waf is pre-alpha. Blocking mode makes it a failure path for every request.");if(!h)o.push("Oversized bodies are passed through uninspected, so padding a request bypasses every rule.");if(e.bypassPaths?.length)o.push(`${e.bypassPaths.length} path(s) bypass inspection entirely.`);let i=["# Managed by ts-cloud. Edits are overwritten on the next deploy.",`# Mode: ${t}. Paranoia level: ${s}.`,""];if(t==="off")return i.push("SecRuleEngine Off",""),{config:`${i.join(`
2
2
  `)}
3
- `,unmappedRateLimits:[],warnings:o,mode:t};i.push(`SecRuleEngine ${t==="blocking"?"On":"DetectionOnly"}`,"SecRequestBodyAccess On","SecResponseBodyAccess Off",`SecRequestBodyLimit ${u}`,`SecRequestBodyNoFilesLimit ${Math.min(u,131072)}`,`SecRequestBodyLimitAction ${h?"Reject":"ProcessPartial"}`,"SecRequestBodyInMemoryLimit 131072",`SecAuditEngine ${t==="blocking"?"RelevantOnly":"On"}`,"SecAuditLogParts ABIJDEFHZ",`SecAuditLog ${We(e.auditLogPath??l.auditLogPath)}`,"SecAuditLogType Serial",`SecDefaultAction "phase:1,log,auditlog,${t==="blocking"?`deny,status:${e.blockStatus??l.blockStatus}`:"pass"}"`,"","# CRS anomaly scoring setup.",`SecAction "id:900000,phase:1,pass,nolog,t:none,setvar:tx.paranoia_level=${s}"`,`SecAction "id:900001,phase:1,pass,nolog,t:none,setvar:tx.inbound_anomaly_score_threshold=${n}"`,`SecAction "id:900002,phase:1,pass,nolog,t:none,setvar:tx.outbound_anomaly_score_threshold=${c}"`,'SecAction "id:900003,phase:1,pass,nolog,t:none,setvar:tx.critical_anomaly_score=5,setvar:tx.error_anomaly_score=4,setvar:tx.warning_anomaly_score=3,setvar:tx.notice_anomaly_score=2"','SecAction "id:900004,phase:1,pass,nolog,t:none,setvar:tx.anomaly_score=0"',"");let g=d.bypassBase;for(let a of e.bypassPaths??[]){let y=uc(a);if(!as(y)){o.push(`Bypass path "${a}" was dropped: it compiles to an unsafe regular expression.`);continue}i.push(`# Inspection bypass for ${We(a)}. Every bypass is an unguarded route.`,`SecRule REQUEST_URI "@rx ${We(y)}" "id:${g},phase:1,pass,nolog,ctl:ruleEngine=Off"`,""),g++}let m=d.exclusionBase;for(let a of e.exclusions??[]){if(!Number.isInteger(a.ruleId)||a.ruleId<=0){o.push(`Exclusion with rule id "${a.ruleId}" was dropped: the id is not a positive integer.`);continue}if(i.push(`# ${We(a.reason)}`),a.pathPattern){if(!as(a.pathPattern)){o.push(`Exclusion for rule ${a.ruleId} was dropped: its path pattern is unsafe.`);continue}i.push(`SecRule REQUEST_URI "@rx ${We(a.pathPattern)}" "id:${m},phase:1,pass,nolog,ctl:ruleRemoveById=${a.ruleId}"`),m++}else i.push(`SecRuleRemoveById ${a.ruleId}`);i.push("")}let p=b(r,d.rateLimitBase);if(p.lines.length>0)i.push("# Rate-limit route markers. SecLang has no counters, so the tag is set","# here and the counting stays in the ts-cloud limiter.",...p.lines);let f=d.customBase;for(let a of e.customRules??[])i.push(`# Operator-supplied rule ${f}.`,a.trim(),""),f++;if(t==="blocking")i.push("# Blocking decision: one rule, at the end, on the accumulated score.",`SecRule TX:ANOMALY_SCORE "@ge %{tx.inbound_anomaly_score_threshold}" "id:949110,phase:2,deny,status:${e.blockStatus??l.blockStatus},log,msg:'Inbound anomaly score exceeded (total: %{tx.anomaly_score})'"`,"");return{config:`${i.join(`
3
+ `,unmappedRateLimits:[],warnings:o,mode:t};i.push(`SecRuleEngine ${t==="blocking"?"On":"DetectionOnly"}`,"SecRequestBodyAccess On","SecResponseBodyAccess Off",`SecRequestBodyLimit ${u}`,`SecRequestBodyNoFilesLimit ${Math.min(u,131072)}`,`SecRequestBodyLimitAction ${h?"Reject":"ProcessPartial"}`,"SecRequestBodyInMemoryLimit 131072",`SecAuditEngine ${t==="blocking"?"RelevantOnly":"On"}`,"SecAuditLogParts ABIJDEFHZ",`SecAuditLog ${Ke(e.auditLogPath??l.auditLogPath)}`,"SecAuditLogType Serial",`SecDefaultAction "phase:1,log,auditlog,${t==="blocking"?`deny,status:${e.blockStatus??l.blockStatus}`:"pass"}"`,"","# CRS anomaly scoring setup.",`SecAction "id:900000,phase:1,pass,nolog,t:none,setvar:tx.paranoia_level=${s}"`,`SecAction "id:900001,phase:1,pass,nolog,t:none,setvar:tx.inbound_anomaly_score_threshold=${n}"`,`SecAction "id:900002,phase:1,pass,nolog,t:none,setvar:tx.outbound_anomaly_score_threshold=${c}"`,'SecAction "id:900003,phase:1,pass,nolog,t:none,setvar:tx.critical_anomaly_score=5,setvar:tx.error_anomaly_score=4,setvar:tx.warning_anomaly_score=3,setvar:tx.notice_anomaly_score=2"','SecAction "id:900004,phase:1,pass,nolog,t:none,setvar:tx.anomaly_score=0"',"");let g=d.bypassBase;for(let a of e.bypassPaths??[]){let y=fc(a);if(!us(y)){o.push(`Bypass path "${a}" was dropped: it compiles to an unsafe regular expression.`);continue}i.push(`# Inspection bypass for ${Ke(a)}. Every bypass is an unguarded route.`,`SecRule REQUEST_URI "@rx ${Ke(y)}" "id:${g},phase:1,pass,nolog,ctl:ruleEngine=Off"`,""),g++}let m=d.exclusionBase;for(let a of e.exclusions??[]){if(!Number.isInteger(a.ruleId)||a.ruleId<=0){o.push(`Exclusion with rule id "${a.ruleId}" was dropped: the id is not a positive integer.`);continue}if(i.push(`# ${Ke(a.reason)}`),a.pathPattern){if(!us(a.pathPattern)){o.push(`Exclusion for rule ${a.ruleId} was dropped: its path pattern is unsafe.`);continue}i.push(`SecRule REQUEST_URI "@rx ${Ke(a.pathPattern)}" "id:${m},phase:1,pass,nolog,ctl:ruleRemoveById=${a.ruleId}"`),m++}else i.push(`SecRuleRemoveById ${a.ruleId}`);i.push("")}let p=b(r,d.rateLimitBase);if(p.lines.length>0)i.push("# Rate-limit route markers. SecLang has no counters, so the tag is set","# here and the counting stays in the ts-cloud limiter.",...p.lines);let f=d.customBase;for(let a of e.customRules??[])i.push(`# Operator-supplied rule ${f}.`,a.trim(),""),f++;if(t==="blocking")i.push("# Blocking decision: one rule, at the end, on the accumulated score.",`SecRule TX:ANOMALY_SCORE "@ge %{tx.inbound_anomaly_score_threshold}" "id:949110,phase:2,deny,status:${e.blockStatus??l.blockStatus},log,msg:'Inbound anomaly score exceeded (total: %{tx.anomaly_score})'"`,"");return{config:`${i.join(`
4
4
  `)}
5
- `,unmappedRateLimits:p.unmapped,warnings:o,mode:t}}function cs(e={},r=[],t={}){let o=t.binary??"/usr/local/bin/zig-waf",s=t.configPath??"/etc/ts-cloud/waf.conf",n=ci(e,r);return`#!/usr/bin/env bash
5
+ `,unmappedRateLimits:p.unmapped,warnings:o,mode:t}}function ps(e={},r=[],t={}){let o=t.binary??"/usr/local/bin/zig-waf",s=t.configPath??"/etc/ts-cloud/waf.conf",n=ui(e,r);return`#!/usr/bin/env bash
6
6
  # Managed by ts-cloud. Installs the zig-waf ruleset.
7
7
  set -euo pipefail
8
8
 
@@ -33,5 +33,5 @@ fi
33
33
 
34
34
  mv "${s}.new" "${s}"
35
35
  echo "ts-cloud: WAF config installed (mode: ${n.mode})"
36
- `}function Bp(e,r){return e.map((t)=>({projectId:r.projectId,environmentId:r.environmentId,resourceId:r.resourceId,kind:"event",source:"zig-waf",name:t.action==="blocked"?"waf.blocked":"waf.matched",timestamp:t.timestamp,value:1,host:t.host,pathTemplate:t.path,method:t.method,attributes:{ruleId:t.ruleId??null,anomalyScore:t.anomalyScore,action:t.action,messages:t.messages.slice(0,5)}}))}
37
- export{We,as,uc,ci,cs,Bp};
36
+ `}function Hp(e,r){return e.map((t)=>({projectId:r.projectId,environmentId:r.environmentId,resourceId:r.resourceId,kind:"event",source:"zig-waf",name:t.action==="blocked"?"waf.blocked":"waf.matched",timestamp:t.timestamp,value:1,host:t.host,pathTemplate:t.path,method:t.method,attributes:{ruleId:t.ruleId??null,anomalyScore:t.anomalyScore,action:t.action,messages:t.messages.slice(0,5)}}))}
37
+ export{Ke,us,fc,ui,ps,Hp};