@stacksjs/ts-cloud 0.16.34 → 0.16.36

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 (194) hide show
  1. package/dist/aws/index.js +1 -1
  2. package/dist/aws/s3.d.ts +9 -1
  3. package/dist/bin/{chunk-qay67r71.js → chunk-0870bs4x.js} +112 -112
  4. package/dist/bin/chunk-1k9sw5y7.js +1 -0
  5. package/dist/bin/{chunk-nnxkw5pn.js → chunk-2ax1rm70.js} +2 -2
  6. package/dist/bin/chunk-2cx4k97r.js +1 -0
  7. package/dist/bin/{chunk-wef81maa.js → chunk-2qdktx9h.js} +2 -2
  8. package/dist/bin/chunk-2rcwhdx9.js +1 -0
  9. package/dist/bin/chunk-3gg55dkc.js +1 -0
  10. package/dist/bin/{chunk-3kyny1x7.js → chunk-4f5hhqh9.js} +6 -6
  11. package/dist/bin/{chunk-a3vraghd.js → chunk-4mt7rspg.js} +2 -2
  12. package/dist/bin/{chunk-s38txg38.js → chunk-5yv95sqs.js} +2 -2
  13. package/dist/bin/chunk-683zr91n.js +1 -0
  14. package/dist/bin/chunk-691k55nw.js +1 -0
  15. package/dist/bin/{chunk-7x727gt5.js → chunk-71jh460j.js} +7 -7
  16. package/dist/bin/chunk-7n84q4np.js +1 -0
  17. package/dist/bin/{chunk-s6qnx8a8.js → chunk-7rwc5bvv.js} +6 -6
  18. package/dist/bin/chunk-7s3wtq40.js +1 -0
  19. package/dist/bin/chunk-8bb6kyhm.js +1 -0
  20. package/dist/bin/{chunk-wq4hkbgj.js → chunk-8p2v1gat.js} +69 -69
  21. package/dist/bin/{chunk-szpqbbyr.js → chunk-9n3wmdd6.js} +5 -5
  22. package/dist/bin/chunk-9pvkb6br.js +1 -0
  23. package/dist/bin/{chunk-8za3y7q3.js → chunk-ar6bxdv4.js} +3 -3
  24. package/dist/bin/{chunk-5tfxp3d9.js → chunk-bfzdbe4g.js} +7 -7
  25. package/dist/bin/{chunk-66g6jdgy.js → chunk-bpw8m7rw.js} +3 -3
  26. package/dist/bin/{chunk-v0va4547.js → chunk-c8439azc.js} +2 -2
  27. package/dist/bin/{chunk-hs5a6dhm.js → chunk-cnwncp50.js} +5 -5
  28. package/dist/bin/chunk-dd567z84.js +1 -0
  29. package/dist/bin/chunk-dzx0w4zb.js +1 -0
  30. package/dist/bin/chunk-e7h2j23x.js +1 -0
  31. package/dist/bin/chunk-e9mkg5dn.js +1 -0
  32. package/dist/bin/{chunk-dgad3hwh.js → chunk-exc2mqcc.js} +16 -16
  33. package/dist/bin/{chunk-59f6mqkj.js → chunk-f76wtb7d.js} +28 -28
  34. package/dist/bin/{chunk-4c4s5yph.js → chunk-gbpmgae9.js} +2 -2
  35. package/dist/bin/{chunk-47q37egd.js → chunk-h42xsxhm.js} +3 -3
  36. package/dist/bin/chunk-h5darb19.js +1 -0
  37. package/dist/bin/chunk-h6n5v6rf.js +1 -0
  38. package/dist/bin/{chunk-hpzbvc4a.js → chunk-haqap7d1.js} +2 -2
  39. package/dist/bin/chunk-hc4s84v1.js +1 -0
  40. package/dist/bin/chunk-hfswzdzj.js +1 -0
  41. package/dist/bin/{chunk-rkd3x7fw.js → chunk-j01jx36v.js} +2 -2
  42. package/dist/bin/{chunk-8ba9t3hv.js → chunk-kcsjaam6.js} +3 -3
  43. package/dist/bin/chunk-p5k5z7gm.js +1 -0
  44. package/dist/bin/{chunk-sfb9q18c.js → chunk-qbagghsb.js} +283 -295
  45. package/dist/bin/chunk-qxg95ndf.js +2 -0
  46. package/dist/bin/{chunk-a1zagtx1.js → chunk-r3gxhy1k.js} +6 -6
  47. package/dist/bin/{chunk-7kjy2hng.js → chunk-r8e263ne.js} +5 -5
  48. package/dist/bin/{chunk-70w9nss5.js → chunk-s7f24j6k.js} +1 -1
  49. package/dist/bin/chunk-svrgx20b.js +14 -0
  50. package/dist/bin/chunk-tj589nbw.js +1 -0
  51. package/dist/bin/chunk-tv0rtc0s.js +2 -0
  52. package/dist/bin/{chunk-7k52s3qm.js → chunk-twmeg17s.js} +6 -6
  53. package/dist/bin/{chunk-mzzrnkk5.js → chunk-v3prk467.js} +5 -5
  54. package/dist/bin/{chunk-4vbnagyd.js → chunk-v4gpkkzh.js} +1 -1
  55. package/dist/bin/{chunk-49y286vw.js → chunk-vkdw6sxn.js} +1 -1
  56. package/dist/bin/chunk-w68hker6.js +1 -0
  57. package/dist/bin/chunk-x8wvsf1k.js +1 -0
  58. package/dist/bin/chunk-y1qk3df2.js +1 -0
  59. package/dist/bin/{chunk-hbrb314y.js → chunk-y2qz4vw1.js} +1 -1
  60. package/dist/bin/chunk-y4pfvx0x.js +1 -0
  61. package/dist/bin/{chunk-wc5swv1a.js → chunk-ymfnqae6.js} +2 -2
  62. package/dist/bin/{chunk-0wtnhxdt.js → chunk-yt95wsqg.js} +1 -1
  63. package/dist/bin/chunk-zjw9sdr5.js +1 -0
  64. package/dist/bin/{chunk-mb2fh91q.js → chunk-zmp0mksb.js} +2 -2
  65. package/dist/bin/cli.js +347 -347
  66. package/dist/bin/dashboard-server.js +1 -1
  67. package/dist/{chunk-pkpmz35j.js → chunk-0kddm2mt.js} +7 -7
  68. package/dist/chunk-0my5jwq8.js +1 -0
  69. package/dist/{chunk-qad1mjmc.js → chunk-2x636sgn.js} +9 -9
  70. package/dist/chunk-3nqtbyfp.js +14 -0
  71. package/dist/{chunk-v9t4751b.js → chunk-50m6sq01.js} +5 -5
  72. package/dist/{chunk-pqm7fz1d.js → chunk-78shfb0z.js} +165 -165
  73. package/dist/{chunk-g3f3ccdw.js → chunk-7gvnrx46.js} +4 -4
  74. package/dist/{chunk-0pe1dfy0.js → chunk-9aaj9a0s.js} +520 -533
  75. package/dist/{chunk-jp57js5y.js → chunk-ajn6xp8v.js} +3 -3
  76. package/dist/{chunk-6n72pe9x.js → chunk-ctkzxq0d.js} +2 -2
  77. package/dist/{chunk-9r32w840.js → chunk-fszn9rnn.js} +43 -43
  78. package/dist/chunk-fxk29btr.js +1 -0
  79. package/dist/chunk-fz62nas4.js +1 -0
  80. package/dist/chunk-gyp7jcgw.js +1 -0
  81. package/dist/{chunk-wctam3r1.js → chunk-hvwqct5q.js} +2 -2
  82. package/dist/{chunk-29dcfx1g.js → chunk-k3mazfb2.js} +81 -81
  83. package/dist/chunk-kcj92xx7.js +2 -0
  84. package/dist/chunk-kzjvasjs.js +2 -0
  85. package/dist/{chunk-k3azr9e3.js → chunk-mhv7dbr1.js} +3 -3
  86. package/dist/{chunk-v1wqxgra.js → chunk-mxw5gkd8.js} +2 -2
  87. package/dist/{chunk-n4gkyye3.js → chunk-my6yn5sd.js} +2 -2
  88. package/dist/{chunk-y3dj8xwk.js → chunk-n4z75mk8.js} +4 -4
  89. package/dist/{chunk-45116tdd.js → chunk-ncsb3sdn.js} +31 -31
  90. package/dist/{chunk-nmm287ym.js → chunk-nr6z3e1p.js} +4 -4
  91. package/dist/{chunk-s958jt49.js → chunk-p0ksat08.js} +1 -1
  92. package/dist/{chunk-m1jp1abp.js → chunk-pdjap529.js} +2 -2
  93. package/dist/{chunk-e08h4q50.js → chunk-pfav9qnt.js} +7 -7
  94. package/dist/{chunk-444h366b.js → chunk-q9rdxpmg.js} +6 -6
  95. package/dist/{chunk-y3h0ybmn.js → chunk-sekw1nyx.js} +19 -19
  96. package/dist/{chunk-tzvtq055.js → chunk-tez0qfv9.js} +1 -1
  97. package/dist/chunk-wxtr8sv8.js +1 -0
  98. package/dist/chunk-yhjagaff.js +1 -0
  99. package/dist/{chunk-c6nw88s3.js → chunk-yzns0k2b.js} +2 -2
  100. package/dist/deploy/index.js +1 -1
  101. package/dist/dns/index.js +1 -1
  102. package/dist/drivers/index.js +1 -1
  103. package/dist/index.js +87 -87
  104. package/dist/operations/index.js +1 -1
  105. package/dist/protection/index.js +1 -1
  106. package/dist/spend/index.js +1 -1
  107. package/dist/ui/404.html +1 -1
  108. package/dist/ui/accept-invitation.html +1 -1
  109. package/dist/ui/access-denied.html +1 -1
  110. package/dist/ui/account/automation.html +6 -6
  111. package/dist/ui/account/security.html +1 -1
  112. package/dist/ui/applications/compose.html +5 -5
  113. package/dist/ui/applications/new.html +2 -2
  114. package/dist/ui/data/backups.html +6 -6
  115. package/dist/ui/data/services.html +6 -6
  116. package/dist/ui/data/volumes.html +6 -6
  117. package/dist/ui/index.html +5 -5
  118. package/dist/ui/infrastructure/topology.html +6 -6
  119. package/dist/ui/integrations.html +2 -2
  120. package/dist/ui/operations/alerts.html +6 -6
  121. package/dist/ui/operations/configuration.html +6 -6
  122. package/dist/ui/operations/jobs.html +5 -5
  123. package/dist/ui/operations/maintenance.html +5 -5
  124. package/dist/ui/operations/observability.html +5 -5
  125. package/dist/ui/operations/previews.html +6 -6
  126. package/dist/ui/operations/queue.html +6 -6
  127. package/dist/ui/operations/regions.html +5 -5
  128. package/dist/ui/operations/releases.html +5 -5
  129. package/dist/ui/operations/spend.html +5 -5
  130. package/dist/ui/operations/workloads.html +6 -6
  131. package/dist/ui/security.html +2 -2
  132. package/dist/ui/server/actions.html +5 -5
  133. package/dist/ui/server/activity.html +1 -1
  134. package/dist/ui/server/capacity.html +6 -6
  135. package/dist/ui/server/database.html +6 -6
  136. package/dist/ui/server/deployments.html +5 -5
  137. package/dist/ui/server/diagnostics.html +1 -1
  138. package/dist/ui/server/firewall.html +5 -5
  139. package/dist/ui/server/fleet.html +5 -5
  140. package/dist/ui/server/logs.html +6 -6
  141. package/dist/ui/server/metrics.html +5 -5
  142. package/dist/ui/server/security.html +1 -1
  143. package/dist/ui/server/services.html +1 -1
  144. package/dist/ui/server/sites.html +5 -5
  145. package/dist/ui/server/ssh-keys.html +6 -6
  146. package/dist/ui/server/team.html +6 -6
  147. package/dist/ui/server/terminal.html +1 -1
  148. package/dist/ui/serverless/alarms.html +6 -6
  149. package/dist/ui/serverless/assets.html +2 -2
  150. package/dist/ui/serverless/cost.html +2 -2
  151. package/dist/ui/serverless/data.html +6 -6
  152. package/dist/ui/serverless/deployments.html +2 -2
  153. package/dist/ui/serverless/firewall.html +2 -2
  154. package/dist/ui/serverless/functions.html +6 -6
  155. package/dist/ui/serverless/logs.html +6 -6
  156. package/dist/ui/serverless/metrics.html +1 -1
  157. package/dist/ui/serverless/queues.html +6 -6
  158. package/dist/ui/serverless/secrets.html +6 -6
  159. package/dist/ui/serverless/traces.html +6 -6
  160. package/dist/ui/serverless.html +6 -6
  161. package/package.json +3 -3
  162. package/dist/bin/chunk-1ye6ky7s.js +0 -1
  163. package/dist/bin/chunk-2njcbs0c.js +0 -1
  164. package/dist/bin/chunk-35ct309x.js +0 -1
  165. package/dist/bin/chunk-3ybxaehy.js +0 -1
  166. package/dist/bin/chunk-5p9jnpg2.js +0 -1
  167. package/dist/bin/chunk-9aram0sm.js +0 -1
  168. package/dist/bin/chunk-9jmt42fx.js +0 -1
  169. package/dist/bin/chunk-axwpxssn.js +0 -1
  170. package/dist/bin/chunk-cqc4pc2h.js +0 -1
  171. package/dist/bin/chunk-cxde3tbf.js +0 -1
  172. package/dist/bin/chunk-d0xz1vh3.js +0 -1
  173. package/dist/bin/chunk-d2wm1zy3.js +0 -1
  174. package/dist/bin/chunk-hnwdjkrt.js +0 -1
  175. package/dist/bin/chunk-hrvfz72e.js +0 -1
  176. package/dist/bin/chunk-j4d7h8rh.js +0 -1
  177. package/dist/bin/chunk-jsncf48k.js +0 -2
  178. package/dist/bin/chunk-k178k5re.js +0 -1
  179. package/dist/bin/chunk-k5h2a7a8.js +0 -1
  180. package/dist/bin/chunk-nw8wmbmq.js +0 -2
  181. package/dist/bin/chunk-prz0w9pq.js +0 -1
  182. package/dist/bin/chunk-rhjjdhhq.js +0 -1
  183. package/dist/bin/chunk-rv7epkg1.js +0 -1
  184. package/dist/bin/chunk-tftcv9rt.js +0 -1
  185. package/dist/bin/chunk-yd2155bj.js +0 -1
  186. package/dist/bin/chunk-yqefsck4.js +0 -1
  187. package/dist/bin/chunk-yzyt35ys.js +0 -1
  188. package/dist/chunk-4nfjkggt.js +0 -1
  189. package/dist/chunk-7r2qc39k.js +0 -2
  190. package/dist/chunk-8nafnyax.js +0 -1
  191. package/dist/chunk-e3831mvy.js +0 -1
  192. package/dist/chunk-rqe0sfqw.js +0 -2
  193. package/dist/chunk-xask9f1n.js +0 -1
  194. package/dist/chunk-xrr334m5.js +0 -1
@@ -0,0 +1,14 @@
1
+ var v;try{v=await import("node:crypto")}catch{}var C=new Map,_=100,ee={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"};function vl(e){let n=typeof e==="string"?new URL(e):e,{hostname:t,pathname:s}=n;if(t.endsWith(".on.aws")){let a=t.match(/^[^.]+\.lambda-url\.([^.]+)\.on\.aws$/);if(a)return{service:"lambda",region:a[1]};return{service:"",region:""}}if(t.endsWith(".r2.cloudflarestorage.com"))return{service:"s3",region:"auto"};if(t.endsWith(".backblazeb2.com")){let a=t.match(/^(?:[^.]+\.)?s3\.([^.]+)\.backblazeb2\.com$/);if(a)return{service:"s3",region:a[1]};return{service:"",region:""}}let c=t.replace("dualstack.","").match(/([^.]+)\.(?:([^.]+)\.)?amazonaws\.com(?:\.cn)?$/);if(!c)return{service:"",region:""};let r=c[1],i=c[2]||"";if(i==="us-gov")i="us-gov-west-1";else if(i==="s3"||i==="s3-accelerate")i="us-east-1",r="s3";else if(r==="iot")if(t.startsWith("iot."))r="execute-api";else if(t.startsWith("data.jobs.iot."))r="iot-jobs-data";else r=s==="/mqtt"?"iotdevicegateway":"iotdata";else if(r==="autoscaling");else if(!i&&r.startsWith("s3-"))i=r.slice(3).replace(/^fips-|^external-1/,""),r="s3";else if(r.endsWith("-fips"))r=r.slice(0,-5);else if(i&&/-\d$/.test(r)&&!/-\d$/.test(i))[r,i]=[i,r];return r=ee[r]||r,{service:r,region:i||"us-east-1"}}function R(e){let{method:n,url:t,body:s="",accessKeyId:c,secretAccessKey:r,sessionToken:i,signQuery:a=!1,expiresIn:h=86400,datetime:m}=e,d=new URL(t),f=d.hostname,p=vl(d),u=e.service||p.service,g=e.region||p.region;if(!u)throw Error("Could not detect service from URL. Please provide service explicitly.");if(!g)throw Error("Could not detect region from URL. Please provide region explicitly.");let o=m||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),y=o.substring(0,8),S=[y,g,u,"aws4_request"].join("/"),b="AWS4-HMAC-SHA256";if(a)return te({urlObj:d,method:n,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:u,region:g,timestamp:o,date:y,credentialScope:S,algorithm:b,expiresIn:h,cache:e.cache});let A=d.pathname||"/",x=j(d.searchParams),l={host:f,"x-amz-date":o,...e.headers};if(i)l["x-amz-security-token"]=i;let P=Object.keys(l).some((B)=>B.toLowerCase()==="content-type");if(s&&!P)l["content-type"]="application/x-amz-json-1.0";if(u==="s3"&&!l["x-amz-content-sha256"])l["x-amz-content-sha256"]=U(s);let q=N(l),w=G(l),k=l["x-amz-content-sha256"]||U(s),M=[n,O(A),x,q,w,k].join(`
2
+ `),K=U(M),W=[b,o,S,K].join(`
3
+ `),L=e.cache??C,X=J(r,y,g,u,W,L),D=[`${b} Credential=${c}/${S}`,`SignedHeaders=${w}`,`Signature=${X}`].join(", ");return l.authorization=D,{url:t,method:n,headers:l,body:s||void 0}}async function Tl(e){let{method:n,url:t,body:s="",accessKeyId:c,secretAccessKey:r,sessionToken:i,signQuery:a=!1,expiresIn:h=86400,datetime:m}=e,d=new URL(t),f=d.hostname,p=vl(d),u=e.service||p.service,g=e.region||p.region;if(!u)throw Error("Could not detect service from URL. Please provide service explicitly.");if(!g)throw Error("Could not detect region from URL. Please provide region explicitly.");let o=m||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),y=o.substring(0,8),S=[y,g,u,"aws4_request"].join("/"),b="AWS4-HMAC-SHA256";if(a)return ne({urlObj:d,method:n,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:u,region:g,timestamp:o,date:y,credentialScope:S,algorithm:b,expiresIn:h,cache:e.cache});let A=d.pathname||"/",x=j(d.searchParams),l={host:f,"x-amz-date":o,...e.headers};if(i)l["x-amz-security-token"]=i;let P=Object.keys(l).some((F)=>F.toLowerCase()==="content-type");if(s&&!P)l["content-type"]="application/x-amz-json-1.0";let q=await T(s);if(u==="s3"&&!l["x-amz-content-sha256"])l["x-amz-content-sha256"]=q;let w=N(l),k=G(l),M=l["x-amz-content-sha256"]||q,K=[n,O(A),x,w,k,M].join(`
4
+ `),W=await T(K),L=[b,o,S,W].join(`
5
+ `),X=e.cache??C,D=await V(r,y,g,u,L,X),B=[`${b} Credential=${c}/${S}`,`SignedHeaders=${k}`,`Signature=${D}`].join(", ");return l.authorization=B,{url:t,method:n,headers:l,body:s||void 0}}function te(e){let{urlObj:n,method:t,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:a,region:h,timestamp:m,date:d,credentialScope:f,algorithm:p,expiresIn:u,cache:g}=e,o=new URL(n.toString());o.searchParams.set("X-Amz-Algorithm",p),o.searchParams.set("X-Amz-Credential",`${c}/${f}`),o.searchParams.set("X-Amz-Date",m),o.searchParams.set("X-Amz-Expires",String(u));let y=a==="s3"?"UNSIGNED-PAYLOAD":U(s);if(a==="s3")o.searchParams.set("X-Amz-Content-Sha256",y);let S="host";if(o.searchParams.set("X-Amz-SignedHeaders",S),i)o.searchParams.set("X-Amz-Security-Token",i);let b=O(o.pathname||"/"),A=`host:${o.hostname}
6
+ `,x=j(o.searchParams),l=[t,b,x,A,S,y].join(`
7
+ `),P=[p,m,f,U(l)].join(`
8
+ `),w=J(r,d,h,a,P,g??C);return o.searchParams.set("X-Amz-Signature",w),{url:o.toString(),method:t,headers:{},body:s||void 0}}async function ne(e){let{urlObj:n,method:t,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:a,region:h,timestamp:m,date:d,credentialScope:f,algorithm:p,expiresIn:u,cache:g}=e,o=new URL(n.toString());o.searchParams.set("X-Amz-Algorithm",p),o.searchParams.set("X-Amz-Credential",`${c}/${f}`),o.searchParams.set("X-Amz-Date",m),o.searchParams.set("X-Amz-Expires",String(u));let y=a==="s3"?"UNSIGNED-PAYLOAD":await T(s);if(a==="s3")o.searchParams.set("X-Amz-Content-Sha256",y);let S="host";if(o.searchParams.set("X-Amz-SignedHeaders",S),i)o.searchParams.set("X-Amz-Security-Token",i);let b=O(o.pathname||"/"),A=`host:${o.hostname}
9
+ `,x=j(o.searchParams),l=[t,b,x,A,S,y].join(`
10
+ `),P=[p,m,f,await T(l)].join(`
11
+ `),w=await V(r,d,h,a,P,g??C);return o.searchParams.set("X-Amz-Signature",w),{url:o.toString(),method:t,headers:{},body:s||void 0}}function Oo(e){let{url:n,method:t="GET",expiresIn:s=3600,...c}=e,r=Math.min(s,604800);return R({...c,url:n,method:t,signQuery:!0,expiresIn:r}).url}async function Qy(e){let{url:n,method:t="GET",expiresIn:s=3600,...c}=e,r=Math.min(s,604800);return(await Tl({...c,url:n,method:t,signQuery:!0,expiresIn:r})).url}function N(e){return Object.keys(e).sort().map((n)=>`${n.toLowerCase()}:${e[n].trim().replace(/\s+/g," ")}`).join(`
12
+ `)+`
13
+ `}function G(e){return Object.keys(e).sort().map((n)=>n.toLowerCase()).join(";")}function j(e){let n=[];return e.forEach((t,s)=>{n.push([Q(s),Q(t)])}),n.sort((t,s)=>{if(t[0]<s[0])return-1;if(t[0]>s[0])return 1;if(t[1]<s[1])return-1;if(t[1]>s[1])return 1;return 0}),n.map(([t,s])=>`${t}=${s}`).join("&")}function O(e){return e.split("/").map((n)=>Q(n)).join("/")}function Q(e){return encodeURIComponent(e).replace(/[!'()*]/g,(n)=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`)}function U(e){if(!v)throw Error("Synchronous hash not available in browser. Use signRequestAsync() instead.");return v.createHash("sha256").update(e,"utf8").digest("hex")}function z(e,n){if(!v)throw Error("Synchronous hmac not available in browser. Use signRequestAsync() instead.");return v.createHmac("sha256",e).update(n,"utf8").digest()}async function T(e){let t=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",t);return Y(new Uint8Array(s))}async function E(e,n){let t=new TextEncoder,s=typeof e==="string"?t.encode(e):e,c=t.encode(n),r=await crypto.subtle.importKey("raw",s.buffer,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await crypto.subtle.sign("HMAC",r,c.buffer);return new Uint8Array(i)}function Y(e){return Array.from(e).map((n)=>n.toString(16).padStart(2,"0")).join("")}function J(e,n,t,s,c,r){let i=`${e}:${n}:${t}:${s}`,a=r.get(i);if(!a){let h=z(`AWS4${e}`,n),m=z(h,t),d=z(m,s);if(a=z(d,"aws4_request"),r.size>=_){let f=r.keys().next().value;if(f)r.delete(f)}r.set(i,a)}return z(a,c).toString("hex")}async function V(e,n,t,s,c,r){let i=`${e}:${n}:${t}:${s}`,a=r.get(i);if(!a){let m=await E(`AWS4${e}`,n),d=await E(m,t),f=await E(d,s);if(a=await E(f,"aws4_request"),r.size>=_){let p=r.keys().next().value;if(p)r.delete(p)}r.set(i,a)}let h=await E(a,c);return Y(h)}function Z(e,n){return n.includes(e)}function H(e,n,t){let s=n*Math.pow(2,e),c=Math.random()*0.3*s;return Math.min(s+c,t)}function I(e){return new Promise((n)=>setTimeout(n,e))}async function cf(e,n){let{maxRetries:t=3,initialDelayMs:s=100,maxDelayMs:c=5000,retryableStatusCodes:r=[429,500,502,503,504],timeoutMs:i=30000}=n??{},a,h;for(let m=0;m<=t;m++){let d=R(e),f={method:d.method,headers:d.headers};if(d.body)f.body=d.body;let p=new AbortController,u=setTimeout(()=>p.abort(),i);f.signal=p.signal;try{let g=await fetch(d.url,f);if(clearTimeout(u),h=g,g.ok)return g;if(m<t&&Z(g.status,r)){let y=H(m,s,c);await I(y);continue}let o=await g.text();throw Error(`AWS API request failed (${g.status}): ${o}`)}catch(g){if(clearTimeout(u),a=g,g instanceof Error&&g.name==="AbortError")a=Error(`Request timed out after ${i}ms`);if(m<t&&!(g instanceof Error&&g.message.includes("AWS API request failed"))){let o=H(m,s,c);await I(o);continue}throw a}}throw a??Error("Request failed after retries")}async function Hy(e){return cf(e,{maxRetries:0})}async function Gy(e,n){let{maxRetries:t=3,initialDelayMs:s=100,maxDelayMs:c=5000,retryableStatusCodes:r=[429,500,502,503,504],timeoutMs:i=30000}=n??{},a;for(let h=0;h<=t;h++){let m=await Tl(e),d={method:m.method,headers:m.headers};if(m.body)d.body=m.body;let f=new AbortController,p=setTimeout(()=>f.abort(),i);d.signal=f.signal;try{let u=await fetch(m.url,d);if(clearTimeout(p),u.ok)return u;if(h<t&&Z(u.status,r)){let o=H(h,s,c);await I(o);continue}let g=await u.text();throw Error(`AWS API request failed (${u.status}): ${g}`)}catch(u){if(clearTimeout(p),a=u,u instanceof Error&&u.name==="AbortError")a=Error(`Request timed out after ${i}ms`);if(h<t&&!(u instanceof Error&&u.message.includes("AWS API request failed"))){let g=H(h,s,c);await I(g);continue}throw a}}throw a??Error("Request failed after retries")}async function Vy(e){let n=await e.text(),t={},s=/<(\w+)>([^<]+)<\/\1>/g,c;while((c=s.exec(n))!==null){let[,r,i]=c;t[r]=i}return t}async function qy(e){return await e.json()}function jy(){C.clear()}function zy(){return C.size}function Ky(){return v!==void 0}function Wy(){return typeof crypto<"u"&&typeof crypto.subtle<"u"}
14
+ export{vl,R,Tl,Oo,Qy,cf,Hy,Gy,Vy,qy,jy,zy,Ky,Wy};
@@ -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 Y(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/[\r\n]+/g," ")}function ci(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?Ms(n.path):".*";if(!ci(c)){o.push({ruleId:n.id,reason:"The path pattern compiles to an unsafe regular expression."});continue}let u=[`SecRule REQUEST_URI "@rx ${Y(c)}"`];if(n.methods?.length)u.push(` "chain,id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${Y(n.id)}'"`);else u.push(` "id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${Y(n.id)}'"`);if(t.push(`# Marks requests governed by the ts-cloud rate limit "${Y(n.id)}".`),t.push(u.join(" \\\n")),n.methods?.length)t.push(` SecRule REQUEST_METHOD "@within ${Y(n.methods.join(" ").toUpperCase())}" "t:none"`);t.push(""),s++}return{lines:t,unmapped:o}}function Ms(e){return`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*")}$`}function _c(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 Z(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/[\r\n]+/g," ")}function mi(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?js(n.path):".*";if(!mi(c)){o.push({ruleId:n.id,reason:"The path pattern compiles to an unsafe regular expression."});continue}let u=[`SecRule REQUEST_URI "@rx ${Z(c)}"`];if(n.methods?.length)u.push(` "chain,id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${Z(n.id)}'"`);else u.push(` "id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${Z(n.id)}'"`);if(t.push(`# Marks requests governed by the ts-cloud rate limit "${Z(n.id)}".`),t.push(u.join(" \\\n")),n.methods?.length)t.push(` SecRule REQUEST_METHOD "@within ${Z(n.methods.join(" ").toUpperCase())}" "t:none"`);t.push(""),s++}return{lines:t,unmapped:o}}function js(e){return`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*")}$`}function Uc(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 ${Y(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=Ms(a);if(!ci(y)){o.push(`Bypass path "${a}" was dropped: it compiles to an unsafe regular expression.`);continue}i.push(`# Inspection bypass for ${Y(a)}. Every bypass is an unguarded route.`,`SecRule REQUEST_URI "@rx ${Y(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(`# ${Y(a.reason)}`),a.pathPattern){if(!ci(a.pathPattern)){o.push(`Exclusion for rule ${a.ruleId} was dropped: its path pattern is unsafe.`);continue}i.push(`SecRule REQUEST_URI "@rx ${Y(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 ${Z(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=js(a);if(!mi(y)){o.push(`Bypass path "${a}" was dropped: it compiles to an unsafe regular expression.`);continue}i.push(`# Inspection bypass for ${Z(a)}. Every bypass is an unguarded route.`,`SecRule REQUEST_URI "@rx ${Z(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(`# ${Z(a.reason)}`),a.pathPattern){if(!mi(a.pathPattern)){o.push(`Exclusion for rule ${a.ruleId} was dropped: its path pattern is unsafe.`);continue}i.push(`SecRule REQUEST_URI "@rx ${Z(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 di(e={},r=[],t={}){let o=t.binary??"/usr/local/bin/zig-waf",s=t.configPath??"/etc/ts-cloud/waf.conf",n=_c(e,r);return`#!/usr/bin/env bash
5
+ `,unmappedRateLimits:p.unmapped,warnings:o,mode:t}}function fi(e={},r=[],t={}){let o=t.binary??"/usr/local/bin/zig-waf",s=t.configPath??"/etc/ts-cloud/waf.conf",n=Uc(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 yp(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{Y,ci,Ms,_c,di,yp};
36
+ `}function qg(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{Z,mi,js,Uc,fi,qg};