@stacksjs/ts-cloud 0.16.16 → 0.16.18

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/bin/chunk-0h6cggyt.js +1 -0
  3. package/dist/bin/{chunk-tfasfg4a.js → chunk-0trtkv9g.js} +4 -4
  4. package/dist/bin/{chunk-2v91xnqx.js → chunk-148x1zq8.js} +2 -2
  5. package/dist/bin/{chunk-xxf1vhfr.js → chunk-1j8b1d58.js} +1 -1
  6. package/dist/bin/chunk-2g2zrtjs.js +2 -0
  7. package/dist/bin/{chunk-3qfd0vnc.js → chunk-2mv692y4.js} +5 -5
  8. package/dist/bin/{chunk-grs2cwm7.js → chunk-3n733cgx.js} +2 -2
  9. package/dist/bin/chunk-4cs098d1.js +1 -0
  10. package/dist/bin/chunk-52fhq35h.js +1 -0
  11. package/dist/bin/{chunk-j0wfftk1.js → chunk-5a7sxtwn.js} +1 -1
  12. package/dist/bin/{chunk-yk4p2k8w.js → chunk-6kx50dyc.js} +2 -2
  13. package/dist/bin/chunk-6se7ygxa.js +1 -0
  14. package/dist/bin/chunk-72g1hr4z.js +1 -0
  15. package/dist/bin/chunk-75ak501k.js +3 -0
  16. package/dist/{chunk-fdn4wnd8.js → bin/chunk-8jbkphmg.js} +7 -7
  17. package/dist/bin/{chunk-edfh9ts2.js → chunk-90102shh.js} +1 -1
  18. package/dist/bin/{chunk-pd8tk3z5.js → chunk-9vmtm7nq.js} +1 -1
  19. package/dist/bin/chunk-a7kmjq4y.js +1 -0
  20. package/dist/bin/{chunk-whww424p.js → chunk-acqj5mfq.js} +108 -108
  21. package/dist/bin/chunk-c7vxdwth.js +1 -0
  22. package/dist/bin/chunk-ckk70zc9.js +1 -0
  23. package/dist/bin/{chunk-90c3rkd8.js → chunk-cnbvm43k.js} +5 -5
  24. package/dist/bin/chunk-d9yzg97w.js +1 -0
  25. package/dist/bin/{chunk-zacbzz1w.js → chunk-djjj62c0.js} +2 -2
  26. package/dist/bin/chunk-dk9f6h0m.js +1 -0
  27. package/dist/bin/{chunk-1baj8p0r.js → chunk-dmdg23a5.js} +1 -1
  28. package/dist/bin/{chunk-y4c26gaf.js → chunk-dyh0vndw.js} +1 -1
  29. package/dist/bin/chunk-e0c3agf2.js +1 -0
  30. package/dist/bin/{chunk-khta83xb.js → chunk-e24bscb0.js} +15 -15
  31. package/dist/bin/{chunk-bhay1f8a.js → chunk-egn33pr9.js} +1 -1
  32. package/dist/bin/{chunk-3x4p2s2r.js → chunk-eyvxsaaz.js} +3 -3
  33. package/dist/bin/{chunk-b3yp7bak.js → chunk-ezhbcpw1.js} +3 -3
  34. package/dist/bin/{chunk-2943bszc.js → chunk-gfnw9nhq.js} +30 -30
  35. package/dist/bin/{chunk-gv9deppc.js → chunk-h1rb8qvt.js} +2 -2
  36. package/dist/bin/chunk-hagakkgm.js +1 -0
  37. package/dist/bin/chunk-hr3vbg6y.js +1 -0
  38. package/dist/bin/chunk-hyb5v8wr.js +1 -0
  39. package/dist/bin/{chunk-fjz07v7g.js → chunk-k7wh1wr5.js} +1 -1
  40. package/dist/bin/{chunk-cs6a98r1.js → chunk-mx9ppkmn.js} +4 -4
  41. package/dist/bin/{chunk-zzmk290g.js → chunk-mxvekmdx.js} +126 -126
  42. package/dist/bin/chunk-nagvc7e4.js +1 -0
  43. package/dist/bin/{chunk-0znhykt9.js → chunk-ngyqqy6d.js} +5 -5
  44. package/dist/bin/chunk-nqb1faqj.js +1 -0
  45. package/dist/bin/chunk-nrrprf04.js +724 -0
  46. package/dist/bin/chunk-p831sptd.js +1 -0
  47. package/dist/bin/chunk-padk76ac.js +1 -0
  48. package/dist/bin/chunk-qxwkg8yg.js +2 -0
  49. package/dist/bin/chunk-qxx1a51w.js +1 -0
  50. package/dist/bin/{chunk-80295akq.js → chunk-rbtt23vx.js} +3 -3
  51. package/dist/bin/chunk-swfmx4f8.js +1 -0
  52. package/dist/bin/{chunk-dczw0nxw.js → chunk-t10e32an.js} +7 -7
  53. package/dist/bin/{chunk-vx9qk1g1.js → chunk-vjkyj3xy.js} +1 -1
  54. package/dist/bin/chunk-w8k1gyzr.js +1 -0
  55. package/dist/bin/chunk-wagzxm7z.js +1 -0
  56. package/dist/bin/{chunk-n02421y9.js → chunk-x63yz8xg.js} +1 -1
  57. package/dist/bin/chunk-xdxk6baf.js +1 -0
  58. package/dist/bin/{chunk-tvv6vdx6.js → chunk-ys5n5c84.js} +4 -4
  59. package/dist/bin/{chunk-tc24txss.js → chunk-z1dtdw3j.js} +5 -5
  60. package/dist/bin/chunk-zww0xfdp.js +1 -0
  61. package/dist/bin/cli.js +281 -281
  62. package/dist/bin/dashboard-server.js +1 -1
  63. package/dist/{chunk-wdrqt329.js → chunk-2p71e3x7.js} +162 -162
  64. package/dist/{chunk-yxn6tpbg.js → chunk-31tvc877.js} +1 -1
  65. package/dist/{chunk-gstz8w2d.js → chunk-3m9ghthh.js} +2 -2
  66. package/dist/{chunk-4xta1s4z.js → chunk-5far81q7.js} +2 -2
  67. package/dist/{chunk-a6aw2jtz.js → chunk-60nr1ehk.js} +14 -14
  68. package/dist/chunk-6kcmbymp.js +1 -0
  69. package/dist/{chunk-0bbrbzf9.js → chunk-7xnwa0s8.js} +4 -4
  70. package/dist/{chunk-whwg2nzb.js → chunk-9syc8s7r.js} +5 -5
  71. package/dist/{chunk-emx1j2yt.js → chunk-9wmer0zx.js} +1 -1
  72. package/dist/{chunk-4twnkjyq.js → chunk-bxrzsth8.js} +2 -2
  73. package/dist/{chunk-a21phhyj.js → chunk-c3f89ryr.js} +7 -7
  74. package/dist/chunk-dak9hfrd.js +1 -0
  75. package/dist/{chunk-jgv0x24e.js → chunk-e52me1c6.js} +1 -1
  76. package/dist/{chunk-v9t92ak2.js → chunk-e8e1h2h9.js} +2 -2
  77. package/dist/{bin/chunk-dp2fsnpe.js → chunk-g6g33pt9.js} +7 -7
  78. package/dist/chunk-hjgjbkhk.js +1 -0
  79. package/dist/{chunk-6eq5xfcx.js → chunk-k53agv2m.js} +1 -1
  80. package/dist/{chunk-rmn71xjb.js → chunk-kczzc599.js} +25 -25
  81. package/dist/{chunk-g0yyw5k8.js → chunk-ptq9v346.js} +1 -1
  82. package/dist/{chunk-fz70vxrk.js → chunk-qcaqc5b8.js} +2 -2
  83. package/dist/chunk-rtn4gj6y.js +1 -0
  84. package/dist/chunk-s2ve9zxn.js +584 -0
  85. package/dist/{chunk-pekptc1b.js → chunk-srrscggm.js} +5 -5
  86. package/dist/{chunk-jncbm332.js → chunk-v2p7c7s4.js} +325 -325
  87. package/dist/{chunk-gn42mekr.js → chunk-vs0qrm09.js} +1 -1
  88. package/dist/{chunk-rgw06xbk.js → chunk-w9jhyy09.js} +4 -4
  89. package/dist/{chunk-z87dekhm.js → chunk-yd40pg8g.js} +21 -21
  90. package/dist/{chunk-sm5rn3db.js → chunk-z3wynefj.js} +19 -19
  91. package/dist/chunk-z4xzd43p.js +1 -0
  92. package/dist/{chunk-ss4q8kge.js → chunk-zx8ecz8b.js} +4 -4
  93. package/dist/deploy/index.d.ts +1 -0
  94. package/dist/deploy/index.js +1 -1
  95. package/dist/deploy/storage-failover.d.ts +54 -0
  96. package/dist/dns/index.js +1 -1
  97. package/dist/drivers/index.d.ts +2 -0
  98. package/dist/drivers/index.js +1 -1
  99. package/dist/drivers/shared/cloudfront-origin.d.ts +9 -2
  100. package/dist/drivers/shared/deploy-script.d.ts +7 -5
  101. package/dist/drivers/shared/host-cleanup.d.ts +90 -0
  102. package/dist/generators/infrastructure.d.ts +9 -1
  103. package/dist/index.d.ts +2 -2
  104. package/dist/index.js +49 -49
  105. package/dist/operations/index.js +1 -1
  106. package/dist/protection/index.js +1 -1
  107. package/dist/spend/index.js +1 -1
  108. package/dist/ui/404.html +1 -1
  109. package/dist/ui/accept-invitation.html +1 -1
  110. package/dist/ui/access-denied.html +1 -1
  111. package/dist/ui/account/automation.html +6 -6
  112. package/dist/ui/account/security.html +2 -2
  113. package/dist/ui/applications/compose.html +6 -6
  114. package/dist/ui/applications/new.html +2 -2
  115. package/dist/ui/data/backups.html +6 -6
  116. package/dist/ui/data/services.html +6 -6
  117. package/dist/ui/data/volumes.html +6 -6
  118. package/dist/ui/index.html +6 -6
  119. package/dist/ui/infrastructure/topology.html +6 -6
  120. package/dist/ui/integrations.html +1 -1
  121. package/dist/ui/operations/alerts.html +6 -6
  122. package/dist/ui/operations/configuration.html +5 -5
  123. package/dist/ui/operations/jobs.html +6 -6
  124. package/dist/ui/operations/maintenance.html +5 -5
  125. package/dist/ui/operations/observability.html +5 -5
  126. package/dist/ui/operations/previews.html +6 -6
  127. package/dist/ui/operations/queue.html +5 -5
  128. package/dist/ui/operations/regions.html +5 -5
  129. package/dist/ui/operations/releases.html +6 -6
  130. package/dist/ui/operations/spend.html +6 -6
  131. package/dist/ui/operations/workloads.html +6 -6
  132. package/dist/ui/security.html +1 -1
  133. package/dist/ui/server/actions.html +6 -6
  134. package/dist/ui/server/activity.html +1 -1
  135. package/dist/ui/server/capacity.html +5 -5
  136. package/dist/ui/server/database.html +6 -6
  137. package/dist/ui/server/deployments.html +5 -5
  138. package/dist/ui/server/diagnostics.html +2 -2
  139. package/dist/ui/server/firewall.html +6 -6
  140. package/dist/ui/server/fleet.html +6 -6
  141. package/dist/ui/server/logs.html +6 -6
  142. package/dist/ui/server/metrics.html +5 -5
  143. package/dist/ui/server/security.html +2 -2
  144. package/dist/ui/server/services.html +2 -2
  145. package/dist/ui/server/sites.html +6 -6
  146. package/dist/ui/server/ssh-keys.html +6 -6
  147. package/dist/ui/server/team.html +6 -6
  148. package/dist/ui/server/terminal.html +2 -2
  149. package/dist/ui/serverless/alarms.html +6 -6
  150. package/dist/ui/serverless/assets.html +2 -2
  151. package/dist/ui/serverless/cost.html +2 -2
  152. package/dist/ui/serverless/data.html +6 -6
  153. package/dist/ui/serverless/deployments.html +2 -2
  154. package/dist/ui/serverless/firewall.html +2 -2
  155. package/dist/ui/serverless/functions.html +6 -6
  156. package/dist/ui/serverless/logs.html +6 -6
  157. package/dist/ui/serverless/metrics.html +2 -2
  158. package/dist/ui/serverless/queues.html +6 -6
  159. package/dist/ui/serverless/secrets.html +6 -6
  160. package/dist/ui/serverless/traces.html +6 -6
  161. package/dist/ui/serverless.html +5 -5
  162. package/package.json +3 -3
  163. package/dist/bin/chunk-2tn43y0d.js +0 -1
  164. package/dist/bin/chunk-2w591cvg.js +0 -1
  165. package/dist/bin/chunk-4v6f496n.js +0 -1
  166. package/dist/bin/chunk-64cdtvar.js +0 -1
  167. package/dist/bin/chunk-66egshmp.js +0 -1
  168. package/dist/bin/chunk-7raskz63.js +0 -1
  169. package/dist/bin/chunk-9bxyy4th.js +0 -1
  170. package/dist/bin/chunk-bbt0vyzj.js +0 -1
  171. package/dist/bin/chunk-cpcae7e2.js +0 -1
  172. package/dist/bin/chunk-dsc7ef1w.js +0 -1
  173. package/dist/bin/chunk-f2wn46nw.js +0 -1
  174. package/dist/bin/chunk-fddwwac7.js +0 -1
  175. package/dist/bin/chunk-ffcyj2jj.js +0 -1
  176. package/dist/bin/chunk-gbejgj71.js +0 -1
  177. package/dist/bin/chunk-j76935z3.js +0 -3
  178. package/dist/bin/chunk-kjbkwzxd.js +0 -1
  179. package/dist/bin/chunk-knthwdhz.js +0 -1
  180. package/dist/bin/chunk-m2kr333s.js +0 -2
  181. package/dist/bin/chunk-m5wc1ent.js +0 -1
  182. package/dist/bin/chunk-nm000jpj.js +0 -725
  183. package/dist/bin/chunk-pjgbnk3q.js +0 -1
  184. package/dist/bin/chunk-rn0pgnt4.js +0 -1
  185. package/dist/bin/chunk-v93xyx1p.js +0 -1
  186. package/dist/bin/chunk-vx9mmpaz.js +0 -1
  187. package/dist/bin/chunk-xtzy90zh.js +0 -1
  188. package/dist/bin/chunk-z6mnhd0j.js +0 -1
  189. package/dist/chunk-051jwkd2.js +0 -1
  190. package/dist/chunk-1gne7rkf.js +0 -1
  191. package/dist/chunk-38c310s1.js +0 -1
  192. package/dist/chunk-acpxtkfy.js +0 -585
  193. package/dist/chunk-dk3t3hgq.js +0 -1
  194. package/dist/chunk-qc2v4h2q.js +0 -1
@@ -1,6 +1,6 @@
1
- import*as T from"node:crypto";import{existsSync as W,readFileSync as J}from"node:fs";import{homedir as B}from"node:os";import{join as K}from"node:path";var z={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"},H={nbsp:" ",copy:"©",reg:"®",trade:"™",euro:"€",pound:"£",yen:"¥",cent:"¢",deg:"°",micro:"µ",middot:"·",bull:"•",hellip:"…",prime:"′",Prime:"″",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",ndash:"–",mdash:"—",iexcl:"¡",iquest:"¿",sect:"§",para:"¶",dagger:"†",Dagger:"‡",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",times:"×",divide:"÷",plusmn:"±",ne:"≠",le:"≤",ge:"≥",infin:"∞",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",equiv:"≡",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜"};class R{customEntities={};useHtmlEntities;constructor(t=!1){this.useHtmlEntities=t}addEntity(t,e){this.customEntities[t]=e}decodeEntities(t){let e=t.indexOf("&");if(e===-1)return t;let r=t.length,i="",s=0;while(e!==-1&&e<r){if(e>s)i+=t.substring(s,e);let a=t.indexOf(";",e+1);if(a===-1||a-e>32){i+="&",s=e+1,e=t.indexOf("&",s);continue}let o=t.substring(e+1,a);if(o.charCodeAt(0)===35){let c=o.length,h=0,A=!1;if(c>2&&(o.charCodeAt(1)===120||o.charCodeAt(1)===88)){A=!0;for(let m=2;m<c;m++){let f=o.charCodeAt(m);if(f>=48&&f<=57)h=h<<4|f-48;else if(f>=65&&f<=70)h=h<<4|f-55;else if(f>=97&&f<=102)h=h<<4|f-87;else{A=!1;break}}}else if(c>1){A=!0;for(let m=1;m<c;m++){let f=o.charCodeAt(m);if(f>=48&&f<=57)h=h*10+(f-48);else{A=!1;break}}}if(A)i+=String.fromCodePoint(h);else i+=t.substring(e,a+1)}else{let c=this.customEntities[o];if(c===void 0){let h=o.length;if(h>=2&&h<=4){let A=o.charCodeAt(0);if(A===108&&h===2&&o.charCodeAt(1)===116)c="<";else if(A===103&&h===2&&o.charCodeAt(1)===116)c=">";else if(A===97&&h===3&&o.charCodeAt(1)===109&&o.charCodeAt(2)===112)c="&";else if(A===113&&h===4)c=o==="quot"?'"':void 0;else if(A===97&&h===4)c=o==="apos"?"'":void 0}if(c===void 0)c=z[o]??(this.useHtmlEntities?H[o]:void 0)}if(c!==void 0)i+=c;else i+=t.substring(e,a+1)}s=a+1,e=t.indexOf("&",s)}if(s<r)i+=t.substring(s);return i}}var P=[];P[38]="&amp;";P[60]="&lt;";P[62]="&gt;";P[34]="&quot;";P[39]="&apos;";var L={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,alwaysCreateTextNode:!1,trimValues:!0,parseTagValue:!0,parseAttributeValue:!1,processEntities:!0,htmlEntities:!1,commentPropName:!1,cdataPropName:!1,piPropName:!1,preserveOrder:!1,stopNodes:[],unpairedTags:[],isArray:void 0,tagValueProcessor:void 0,attributeValueProcessor:void 0,updateTag:void 0,numberParseOptions:{hex:!0,leadingZeros:!0,scientific:!0},ignorePiTags:!1,transformAttributeName:void 0,transformTagName:void 0,ignoreDeclaration:!1};function _(t){return t===32||t===9||t===10||t===13}function x(t){return t>=65&&t<=90||t>=97&&t<=122||t===95||t===58||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533}function V(t){return x(t)||t===45||t===46||t>=48&&t<=57||t===183||t>=768&&t<=879||t>=8255&&t<=8256}var X=/^0x[\da-fA-F]+$/,M=/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/,G=/^[+-]?(\d+\.?\d*|\.\d+)$/;function D(t,e){return t.charCodeAt(e)===91&&t.charCodeAt(e+1)===67&&t.charCodeAt(e+2)===68&&t.charCodeAt(e+3)===65&&t.charCodeAt(e+4)===84&&t.charCodeAt(e+5)===65&&t.charCodeAt(e+6)===91}function k(t,e){let r=t.charCodeAt(e),i=t.charCodeAt(e+1),s=t.charCodeAt(e+2),a=t.charCodeAt(e+3),o=t.charCodeAt(e+4),c=t.charCodeAt(e+5),h=t.charCodeAt(e+6);return(r===68||r===100)&&(i===79||i===111)&&(s===67||s===99)&&(a===84||a===116)&&(o===89||o===121)&&(c===80||c===112)&&(h===69||h===101)}function Y(t,e,r){if(e>=r||!x(t.charCodeAt(e)))return e;e++;while(e<r&&V(t.charCodeAt(e)))e++;return e}class v{options;entityDecoder;unpairedSet;exactStopNodes;wildcardStopSuffixes;needsJPath;_ignoreAttributes=!0;_textNodeName="#text";_commentPropName=!1;_cdataPropName=!1;_piPropName=!1;_alwaysCreateTextNode=!1;_trimValues=!0;_processEntities=!0;_parseTagValue=!0;_parseAttributeValue=!1;_removeNSPrefix=!1;_attrPrefix="@_";_attrsGroupName=!1;_ignorePiTags=!1;_ignoreDeclaration=!1;constructor(t){this.options={...L,...t},this.entityDecoder=new R(this.options.htmlEntities),this.unpairedSet=new Set(this.options.unpairedTags),this.exactStopNodes=new Set,this.wildcardStopSuffixes=[];for(let e of this.options.stopNodes)if(e.startsWith("*."))this.wildcardStopSuffixes.push(e.substring(2));else this.exactStopNodes.add(e);this._ignoreAttributes=this.options.ignoreAttributes,this._textNodeName=this.options.textNodeName,this._commentPropName=this.options.commentPropName,this._cdataPropName=this.options.cdataPropName,this._piPropName=this.options.piPropName,this._alwaysCreateTextNode=this.options.alwaysCreateTextNode,this._trimValues=this.options.trimValues,this._processEntities=this.options.processEntities,this._parseTagValue=this.options.parseTagValue,this._parseAttributeValue=this.options.parseAttributeValue,this._removeNSPrefix=this.options.removeNSPrefix,this._attrPrefix=this.options.attributeNamePrefix,this._attrsGroupName=this.options.attributesGroupName,this._ignorePiTags=this.options.ignorePiTags,this._ignoreDeclaration=this.options.ignoreDeclaration,this.needsJPath=this.options.stopNodes.length>0||this.options.isArray!==void 0||this.options.updateTag!==void 0||this.options.tagValueProcessor!==void 0||this.options.attributeValueProcessor!==void 0}addEntity(t,e){this.entityDecoder.addEntity(t,e)}parse(t){if(t instanceof Uint8Array)t=new TextDecoder().decode(t);let e=t;if(this.options.preserveOrder)return this.parseOrdered(e);return this.parseUnordered(e)}parseUnordered(t){let e={},r=t.length,i=0;if(r>0&&t.charCodeAt(0)===65279)i=1;return i=this.parseChildren(t,i,r,e,"",[]),e}parseOrdered(t){let e=t.length,r=0;if(e>0&&t.charCodeAt(0)===65279)r=1;let i=[];return this.parseChildrenOrdered(t,r,e,i,""),i}readTagName(t,e,r){return Y(t,e,r)}extractTagName(t,e,r){let i=t.substring(e,r);if(this._removeNSPrefix){let s=i.indexOf(":");if(s!==-1)i=i.substring(s+1)}if(this.options.transformTagName)i=this.options.transformTagName(i);return i}parseAttributes(t,e,r,i,s){let a=0,o=this._removeNSPrefix,c=this.options.transformAttributeName,h=this._trimValues,A=this._processEntities,m=this.options.attributeValueProcessor;while(e<r){let f=t.charCodeAt(e);while(f===32||f===9||f===10||f===13){if(e++,e>=r)break;f=t.charCodeAt(e)}if(e>=r)break;if(f===62||f===47)break;let b=e;if(!x(f))break;e++;while(e<r&&V(t.charCodeAt(e)))e++;let p=t.substring(b,e);if(o){let C=p.indexOf(":");if(C!==-1)p=p.substring(C+1)}if(c)p=c(p);while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===61){e++;while(e<r&&_(t.charCodeAt(e)))e++;if(e>=r)break;let C=t.charCodeAt(e);if(C===34||C===39){e++;let E=e;while(e<r&&t.charCodeAt(e)!==C)e++;let d=t.substring(E,e);if(h&&d.length>0){let u=d.charCodeAt(0),g=d.charCodeAt(d.length-1);if(u<=32||g<=32)d=d.trim()}if(A)d=this.entityDecoder.decodeEntities(d);if(m)d=m(p,d,i)??d;if(s[p]=d,a++,e<r)e++}}else s[p]="true",a++}return a>0?-e-1:e}processTagValue(t,e,r,i,s){if(this._trimValues){let a=t.length;if(a>0){let o=t.charCodeAt(0),c=t.charCodeAt(a-1);if(o<=32||c<=32)t=t.trim()}}if(this._processEntities)t=this.entityDecoder.decodeEntities(t);if(this.options.tagValueProcessor){let a=this.options.tagValueProcessor(e,t,r,i,s);if(a!==void 0)t=a}if(!t)return t;if(this._parseTagValue)return this.parseValue(t);return t}parseValue(t){if(t==="true")return!0;if(t==="false")return!1;if(!t)return t;let e=t.charCodeAt(0);if(!(e>=48&&e<=57||e===43||e===45||e===46))return t;let i=this.options.numberParseOptions;if(i.skipLike?.test(t))return t;if(i.hex&&e===48&&X.test(t))return Number.parseInt(t,16);if(t.length>1&&e===48&&t.charCodeAt(1)!==46){if(i.leadingZeros)return t}if(i.scientific&&M.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}if(G.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}return t}parseAttributeValue(t){if(!this._parseAttributeValue)return t;return this.parseValue(t)}isStopNode(t){if(this.exactStopNodes.has(t))return!0;for(let e of this.wildcardStopSuffixes)if(t.endsWith(`.${e}`)||t===e)return!0;return!1}readStopNodeContent(t,e,r,i){let s=`</${i}`,a=t.indexOf(s,e);if(a===-1)return{content:t.substring(e),pos:r};let o=t.substring(e,a),c=a+s.length;while(c<r&&t.charCodeAt(c)!==62)c++;if(c<r)c++;return{content:o,pos:c}}addToObj(t,e,r,i,s,a){let o=t[e];if(o!==void 0)if(!Array.isArray(o))t[e]=[o,r];else o.push(r);else if(this.options.isArray?.(e,i,s,a))t[e]=[r];else t[e]=r}flushText(t,e,r,i){if(!t&&!e)return;let s=this._textNodeName;if(e){let a=t;if(a&&this._processEntities)a=this.entityDecoder.decodeEntities(a);let o=e+a;if(this._trimValues&&o.length>0){let c=o.charCodeAt(0),h=o.charCodeAt(o.length-1);if(c<=32||h<=32)o=o.trim()}if(this.options.tagValueProcessor){let c=this.options.tagValueProcessor(s,o,r,!1,!0);if(c!==void 0)o=c}if(o){let c=this._parseTagValue?this.parseValue(o):o;if(c!==void 0&&c!=="")this.addToObj(i,s,c,r,!0,!1)}}else{let a=this.processTagValue(t,s,r,!1,!0);if(a!==void 0&&a!=="")this.addToObj(i,s,a,r,!0,!1)}}parseChildren(t,e,r,i,s,a){let o="",c="",h=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let u=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!o)o=t.substring(u,e);else o+=t.substring(u,e);continue}if(e+1>=r)break;let m=t.charCodeAt(e+1);if(m===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(o||c)this.flushText(o,c,s,i),o="",c="";e+=4;let u=t.indexOf("-->",e);if(u===-1){e=r;break}if(this._commentPropName){let g=t.substring(e,u);this.addToObj(i,this._commentPropName,g,s,!0,!1)}e=u+3;continue}if(m===33&&e+8<r&&D(t,e+2)){e+=9;let u=t.indexOf("]]>",e);if(u===-1){e=r;break}let g=t.substring(e,u);if(this._cdataPropName)this.flushText(o,c,s,i),o="",c="",this.addToObj(i,this._cdataPropName,g,s,!0,!1);else{if(o){let y=o;if(this._processEntities)y=this.entityDecoder.decodeEntities(y);c+=y,o=""}c+=g}e=u+3;continue}if(m===33&&e+9<r&&k(t,e+2)){e+=9;let u=1;while(e<r&&u>0){let g=t.charCodeAt(e);if(g===60)u++;else if(g===62)u--;e++}continue}if(m===63){e+=2;let u=e;while(e<r&&!_(t.charCodeAt(e))&&t.charCodeAt(e)!==63)e++;let g=t.substring(u,e),y=t.indexOf("?>",e);if(y===-1){e=r;break}let N=t.substring(e,y).trim();if(g==="xml"){if(!this._ignoreDeclaration&&this._piPropName){let w=this.parsePiAttributes(N);this.addToObj(i,this._piPropName,{[g]:w},s,!0,!1)}}else if(!this._ignorePiTags&&this._piPropName)this.addToObj(i,this._piPropName,{[g]:N},s,!0,!1);e=y+2;continue}if(m===47){if(o||c)this.flushText(o,c,s,i),o="",c="";e+=2;let u=e,g=this.readTagName(t,e,r),y=this.extractTagName(t,u,g);e=g;while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;if(a.length>0&&a[a.length-1]===y){a.pop();continue}return e}if(o||c)this.flushText(o,c,s,i),o="",c="";e++;let f=e,b=this.readTagName(t,e,r),p=this.extractTagName(t,f,b);if(!p){e=b+1;continue}e=b;let C=h?s?`${s}.${p}`:p:"",E={},d=!1;if(!this._ignoreAttributes){let u=this.parseAttributes(t,e,r,C,E);if(u<0)e=-u-1,d=!0;else e=u}else while(e<r){let u=t.charCodeAt(e);if(u===62||u===47)break;if(u===34||u===39){e++;while(e<r&&t.charCodeAt(e)!==u)e++}e++}if(this.options.updateTag){if(this.options.updateTag(p,C,E)===!1){while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47)e+=2;else if(e<r&&t.charCodeAt(e)===62){e++;let g=`</${p}>`,y=t.indexOf(g,e);if(y!==-1)e=y+g.length}continue}}while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47){if(e+=2,d||this._alwaysCreateTextNode){let u={};if(d)this.applyAttributes(u,E,C);if(this._alwaysCreateTextNode)u[this._textNodeName]="";this.addToObj(i,p,u,C,!0,!1)}else this.addToObj(i,p,"",C,!0,!1);continue}if(e<r&&t.charCodeAt(e)===62){if(e++,this.unpairedSet.has(p)){if(d){let N={};this.applyAttributes(N,E,C),this.addToObj(i,p,N,C,!0,!1)}else this.addToObj(i,p,"",C,!0,!1);a.push(p);continue}if(this.exactStopNodes.size>0||this.wildcardStopSuffixes.length>0){if(this.isStopNode(C)){let N=this.readStopNodeContent(t,e,r,p),w={};if(d)this.applyAttributes(w,E,C);if(N.content)w[this._textNodeName]=N.content;this.addToObj(i,p,w,C,!0,!1),e=N.pos;continue}}let u={};if(d)this.applyAttributes(u,E,C);e=this.parseChildren(t,e,r,u,C,a);let g=this._textNodeName,y=u[g];if(!d&&!this._alwaysCreateTextNode){let N=!0;for(let w in u)if(w!==g){N=!1;break}if(N){this.addToObj(i,p,y!==void 0?y:"",C,!0,!1);continue}}this.addToObj(i,p,u,C,!1,!1)}}if(o||c)this.flushText(o,c,s,i);return e}parseChildrenOrdered(t,e,r,i,s){let a="",o=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let d=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!a)a=t.substring(d,e);else a+=t.substring(d,e);continue}if(e+1>=r)break;let h=t.charCodeAt(e+1);if(h===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(a){let u=this.processTagValue(a,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});a=""}e+=4;let d=t.indexOf("-->",e);if(d===-1){e=r;break}if(this._commentPropName)i.push({[this._commentPropName]:[{[this._textNodeName]:t.substring(e,d)}]});e=d+3;continue}if(h===33&&e+8<r&&D(t,e+2)){e+=9;let d=t.indexOf("]]>",e);if(d===-1){e=r;break}let u=t.substring(e,d);if(this._cdataPropName){if(a){let g=this.processTagValue(a,this._textNodeName,s,!1,!0);if(g!==void 0&&g!=="")i.push({[this._textNodeName]:g});a=""}i.push({[this._cdataPropName]:[{[this._textNodeName]:u}]})}else a+=u;e=d+3;continue}if(h===33&&e+9<r&&k(t,e+2)){e+=9;let d=1;while(e<r&&d>0){let u=t.charCodeAt(e);if(u===60)d++;else if(u===62)d--;e++}continue}if(h===63){e+=2;let d=t.indexOf("?>",e);if(d===-1){e=r;break}e=d+2;continue}if(h===47){if(a){let u=this.processTagValue(a,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});a=""}e+=2,e=this.readTagName(t,e,r);while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;return e}if(a){let d=this.processTagValue(a,this._textNodeName,s,!1,!0);if(d!==void 0&&d!=="")i.push({[this._textNodeName]:d});a=""}e++;let A=e,m=this.readTagName(t,e,r),f=this.extractTagName(t,A,m);if(!f){e=m+1;continue}e=m;let b=o?s?`${s}.${f}`:f:"",p={},C=!1;if(!this._ignoreAttributes){let d=this.parseAttributes(t,e,r,b,p);if(d<0)e=-d-1,C=!0;else e=d}else while(e<r){let d=t.charCodeAt(e);if(d===62||d===47)break;if(d===34||d===39){e++;while(e<r&&t.charCodeAt(e)!==d)e++}e++}while(e<r&&_(t.charCodeAt(e)))e++;let E={[f]:[]};if(C){E[":@"]={};for(let u in p)E[":@"][this._attrPrefix+u]=this.parseAttributeValue(p[u])}if(e<r&&t.charCodeAt(e)===47){e+=2,i.push(E);continue}if(e<r&&t.charCodeAt(e)===62)e++,e=this.parseChildrenOrdered(t,e,r,E[f],b),i.push(E)}if(a){let c=this.processTagValue(a,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c})}return e}applyAttributes(t,e,r){let i=this._attrPrefix;if(this._attrsGroupName){let s={};for(let a in e)s[i+a]=this.parseAttributeValue(e[a]);t[this._attrsGroupName]=s}else for(let s in e)t[i+s]=this.parseAttributeValue(e[s])}parsePiAttributes(t){let e={},r=0,i=t.length;while(r<i){while(r<i&&_(t.charCodeAt(r)))r++;if(r>=i)break;let s=r;while(r<i&&!_(t.charCodeAt(r))&&t.charCodeAt(r)!==61)r++;let a=t.substring(s,r);if(!a)break;while(r<i&&_(t.charCodeAt(r)))r++;if(r<i&&t.charCodeAt(r)===61){r++;while(r<i&&_(t.charCodeAt(r)))r++;if(r<i){let o=t.charCodeAt(r);if(o===34||o===39){r++;let c=r;while(r<i&&t.charCodeAt(r)!==o)r++;if(e[a]=t.substring(c,r),r<i)r++}}}}return e}}function yr(t){let e=t.endpoint||`s3.${t.region}.amazonaws.com`,r=new URL(/^https?:\/\//i.test(e)?e:`https://${e}`);if(r.protocol!=="http:"&&r.protocol!=="https:"||r.pathname!=="/"&&r.pathname!==""||r.search||r.hash||r.username||r.password)throw Error("S3 endpoint must be an HTTP(S) origin without a path");let i=r.protocol.slice(0,-1),s=r.host;if(!t.bucket)return{protocol:i,host:s,path:t.path};if(t.forcePathStyle){let a=t.path==="/"?`/${t.bucket}`:`/${t.bucket}${t.path}`;return{protocol:i,host:s,path:a}}return{protocol:i,host:`${t.bucket}.${s}`,path:t.path}}class n{credentials;config;cache;xmlParser;constructor(t,e){this.config={maxRetries:3,retryDelay:1000,cacheEnabled:!0,defaultCacheTTL:60000,...e},this.credentials=t||this.loadCredentials(),this.cache=new Map,this.xmlParser=new v({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseAttributeValue:!0,trimValues:!0})}loadCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=process.env.AWS_SESSION_TOKEN;if(t&&e)return{accessKeyId:t,secretAccessKey:e,sessionToken:r};let i=this.loadCredentialsFromFile();if(i)return i;return{accessKeyId:"",secretAccessKey:""}}loadCredentialsFromFile(){let t=this.config?.profile||process.env.AWS_PROFILE||"default",e=process.env.AWS_SHARED_CREDENTIALS_FILE||K(B(),".aws","credentials");if(!W(e))return null;try{let r=J(e,"utf-8"),i=this.parseCredentialsFile(r,t);if(i.accessKeyId&&i.secretAccessKey)return i}catch{}return null}parseCredentialsFile(t,e){let r=t.split(`
2
- `),i="",s="",a="",o;for(let c of r){let h=c.trim();if(!h||h.startsWith("#"))continue;let A=h.match(/^\[([^\]]+)\]$/);if(A){i=A[1];continue}if(i===e){let[m,...f]=h.split("="),b=f.join("=").trim();if(m.trim()==="aws_access_key_id")s=b;else if(m.trim()==="aws_secret_access_key")a=b;else if(m.trim()==="aws_session_token")o=b}}return{accessKeyId:s,secretAccessKey:a,sessionToken:o}}ec2CredentialsCache;async getCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY;if(t&&e)return{accessKeyId:t,secretAccessKey:e,sessionToken:process.env.AWS_SESSION_TOKEN};let r=this.loadCredentialsFromFile();if(r)return r;if(this.ec2CredentialsCache){let i=Date.now();if(this.ec2CredentialsCache.expiration>i+300000)return this.ec2CredentialsCache.credentials}try{let s=await(await fetch("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"21600"}})).text(),o=await(await fetch("http://169.254.169.254/latest/meta-data/iam/security-credentials/",{headers:{"X-aws-ec2-metadata-token":s}})).text(),h=await(await fetch(`http://169.254.169.254/latest/meta-data/iam/security-credentials/${o}`,{headers:{"X-aws-ec2-metadata-token":s}})).json(),A={accessKeyId:h.AccessKeyId,secretAccessKey:h.SecretAccessKey,sessionToken:h.Token};return this.ec2CredentialsCache={credentials:A,expiration:new Date(h.Expiration).getTime()},A}catch(i){throw Error("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or run on an EC2 instance with an IAM role.")}}async request(t){if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey){let i=this.getFromCache(t.cacheKey);if(i!==null)return i}let e=t.retries??this.config.maxRetries??3,r=null;for(let i=0;i<=e;i++)try{let s=await this.makeRequest(t);if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey)this.setInCache(t.cacheKey,s,t.cacheTTL??this.config.defaultCacheTTL??60000);return s}catch(s){if(r=s,!this.shouldRetry(s))throw s;if(i===e)throw s;let o=this.calculateRetryDelay(i);await this.sleep(o)}throw r||Error("Request failed after retries")}async makeRequest(t){let e=t.credentials||(this.credentials?.accessKeyId?this.credentials:await this.getCredentials());if(!e||!e.accessKeyId||!e.secretAccessKey)throw Error("AWS credentials not provided");let r=this.buildUrl(t),i=this.signRequest(t,e),s=await fetch(r,{method:t.method,headers:i,body:t.body}),a=await s.text();if(!s.ok)throw this.parseError(a,s.status,s.headers);if(!a||a.trim()===""){if(t.returnHeaders)return{body:null,headers:this.headersToObject(s.headers)};return null}if(t.rawResponse){if(t.returnHeaders)return{body:a,headers:this.headersToObject(s.headers)};return a}let o;if(a.startsWith("<"))o=this.parseXmlResponse(a);else try{o=JSON.parse(a)}catch{o=a}if(t.returnHeaders)return{body:o,headers:this.headersToObject(s.headers)};return o}headersToObject(t){let e={};return t.forEach((r,i)=>{e[i]=r}),e}buildUrl(t){let{service:e,region:r,queryParams:i}=t,{path:s}=t,a,o="https";if(e==="s3"){let h=yr({region:r,path:s,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});o=h.protocol,a=h.host,s=h.path}else if(e==="cloudfront")a="cloudfront.amazonaws.com";else if(e==="iam")a="iam.amazonaws.com";else if(e==="route53")a="route53.amazonaws.com";else if(e==="route53domains")a="route53domains.us-east-1.amazonaws.com";else if(e==="ecr")a=`api.ecr.${r}.amazonaws.com`;else if(e==="ses")a=`email.${r}.amazonaws.com`;else a=`${e}.${r}.amazonaws.com`;let c=`${o}://${a}${s}`;if(i&&Object.keys(i).length>0){let h=Object.keys(i).map((A)=>`${this.uriEncode(A)}=${this.uriEncode(i[A])}`).join("&");c+=`?${h}`}return c}signRequest(t,e){let{service:r,region:i,method:s,queryParams:a,body:o}=t,{path:c}=t,h=new Date,A=this.getAmzDate(h),m=this.getDateStamp(h),f;if(r==="s3"){let S=yr({region:i,path:c,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});f=S.host,c=S.path}else if(r==="cloudfront")f="cloudfront.amazonaws.com";else if(r==="iam")f="iam.amazonaws.com";else if(r==="route53")f="route53.amazonaws.com";else if(r==="route53domains")f="route53domains.us-east-1.amazonaws.com";else if(r==="ecr")f=`api.ecr.${i}.amazonaws.com`;else if(r==="ses")f=`email.${i}.amazonaws.com`;else f=`${r}.${i}.amazonaws.com`;let b={host:f,"x-amz-date":A,...t.headers||{}};if(e.sessionToken)b["x-amz-security-token"]=e.sessionToken;if(o){if(!Object.keys(b).some((O)=>O.toLowerCase()==="content-type"))b["content-type"]="application/x-www-form-urlencoded";b["content-length"]=Buffer.byteLength(o).toString()}let p=this.sha256(o||"");b["x-amz-content-sha256"]=p;let C=c,E=a?Object.keys(a).sort().map((S)=>`${this.uriEncode(S)}=${this.uriEncode(a[S])}`).join("&"):"",d=Object.keys(b).sort((S,O)=>S.toLowerCase().localeCompare(O.toLowerCase())),u=d.map((S)=>`${S.toLowerCase()}:${b[S].trim()}
1
+ import*as T from"node:crypto";import{existsSync as W,readFileSync as J}from"node:fs";import{homedir as B}from"node:os";import{join as K}from"node:path";var z={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"},H={nbsp:" ",copy:"©",reg:"®",trade:"™",euro:"€",pound:"£",yen:"¥",cent:"¢",deg:"°",micro:"µ",middot:"·",bull:"•",hellip:"…",prime:"′",Prime:"″",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",ndash:"–",mdash:"—",iexcl:"¡",iquest:"¿",sect:"§",para:"¶",dagger:"†",Dagger:"‡",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",times:"×",divide:"÷",plusmn:"±",ne:"≠",le:"≤",ge:"≥",infin:"∞",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",equiv:"≡",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜"};class R{customEntities={};useHtmlEntities;constructor(t=!1){this.useHtmlEntities=t}addEntity(t,e){this.customEntities[t]=e}decodeEntities(t){let e=t.indexOf("&");if(e===-1)return t;let r=t.length,i="",s=0;while(e!==-1&&e<r){if(e>s)i+=t.substring(s,e);let a=t.indexOf(";",e+1);if(a===-1||a-e>32){i+="&",s=e+1,e=t.indexOf("&",s);continue}let o=t.substring(e+1,a);if(o.charCodeAt(0)===35){let c=o.length,h=0,A=!1;if(c>2&&(o.charCodeAt(1)===120||o.charCodeAt(1)===88)){A=!0;for(let m=2;m<c;m++){let f=o.charCodeAt(m);if(f>=48&&f<=57)h=h<<4|f-48;else if(f>=65&&f<=70)h=h<<4|f-55;else if(f>=97&&f<=102)h=h<<4|f-87;else{A=!1;break}}}else if(c>1){A=!0;for(let m=1;m<c;m++){let f=o.charCodeAt(m);if(f>=48&&f<=57)h=h*10+(f-48);else{A=!1;break}}}if(A)i+=String.fromCodePoint(h);else i+=t.substring(e,a+1)}else{let c=this.customEntities[o];if(c===void 0){let h=o.length;if(h>=2&&h<=4){let A=o.charCodeAt(0);if(A===108&&h===2&&o.charCodeAt(1)===116)c="<";else if(A===103&&h===2&&o.charCodeAt(1)===116)c=">";else if(A===97&&h===3&&o.charCodeAt(1)===109&&o.charCodeAt(2)===112)c="&";else if(A===113&&h===4)c=o==="quot"?'"':void 0;else if(A===97&&h===4)c=o==="apos"?"'":void 0}if(c===void 0)c=z[o]??(this.useHtmlEntities?H[o]:void 0)}if(c!==void 0)i+=c;else i+=t.substring(e,a+1)}s=a+1,e=t.indexOf("&",s)}if(s<r)i+=t.substring(s);return i}}var P=[];P[38]="&amp;";P[60]="&lt;";P[62]="&gt;";P[34]="&quot;";P[39]="&apos;";var L={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,alwaysCreateTextNode:!1,trimValues:!0,parseTagValue:!0,parseAttributeValue:!1,processEntities:!0,htmlEntities:!1,commentPropName:!1,cdataPropName:!1,piPropName:!1,preserveOrder:!1,stopNodes:[],unpairedTags:[],isArray:void 0,tagValueProcessor:void 0,attributeValueProcessor:void 0,updateTag:void 0,numberParseOptions:{hex:!0,leadingZeros:!0,scientific:!0},ignorePiTags:!1,transformAttributeName:void 0,transformTagName:void 0,ignoreDeclaration:!1};function _(t){return t===32||t===9||t===10||t===13}function x(t){return t>=65&&t<=90||t>=97&&t<=122||t===95||t===58||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533}function V(t){return x(t)||t===45||t===46||t>=48&&t<=57||t===183||t>=768&&t<=879||t>=8255&&t<=8256}var X=/^0x[\da-fA-F]+$/,M=/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/,G=/^[+-]?(\d+\.?\d*|\.\d+)$/;function D(t,e){return t.charCodeAt(e)===91&&t.charCodeAt(e+1)===67&&t.charCodeAt(e+2)===68&&t.charCodeAt(e+3)===65&&t.charCodeAt(e+4)===84&&t.charCodeAt(e+5)===65&&t.charCodeAt(e+6)===91}function k(t,e){let r=t.charCodeAt(e),i=t.charCodeAt(e+1),s=t.charCodeAt(e+2),a=t.charCodeAt(e+3),o=t.charCodeAt(e+4),c=t.charCodeAt(e+5),h=t.charCodeAt(e+6);return(r===68||r===100)&&(i===79||i===111)&&(s===67||s===99)&&(a===84||a===116)&&(o===89||o===121)&&(c===80||c===112)&&(h===69||h===101)}function Y(t,e,r){if(e>=r||!x(t.charCodeAt(e)))return e;e++;while(e<r&&V(t.charCodeAt(e)))e++;return e}class v{options;entityDecoder;unpairedSet;exactStopNodes;wildcardStopSuffixes;needsJPath;_ignoreAttributes=!0;_textNodeName="#text";_commentPropName=!1;_cdataPropName=!1;_piPropName=!1;_alwaysCreateTextNode=!1;_trimValues=!0;_processEntities=!0;_parseTagValue=!0;_parseAttributeValue=!1;_removeNSPrefix=!1;_attrPrefix="@_";_attrsGroupName=!1;_ignorePiTags=!1;_ignoreDeclaration=!1;constructor(t){this.options={...L,...t},this.entityDecoder=new R(this.options.htmlEntities),this.unpairedSet=new Set(this.options.unpairedTags),this.exactStopNodes=new Set,this.wildcardStopSuffixes=[];for(let e of this.options.stopNodes)if(e.startsWith("*."))this.wildcardStopSuffixes.push(e.substring(2));else this.exactStopNodes.add(e);this._ignoreAttributes=this.options.ignoreAttributes,this._textNodeName=this.options.textNodeName,this._commentPropName=this.options.commentPropName,this._cdataPropName=this.options.cdataPropName,this._piPropName=this.options.piPropName,this._alwaysCreateTextNode=this.options.alwaysCreateTextNode,this._trimValues=this.options.trimValues,this._processEntities=this.options.processEntities,this._parseTagValue=this.options.parseTagValue,this._parseAttributeValue=this.options.parseAttributeValue,this._removeNSPrefix=this.options.removeNSPrefix,this._attrPrefix=this.options.attributeNamePrefix,this._attrsGroupName=this.options.attributesGroupName,this._ignorePiTags=this.options.ignorePiTags,this._ignoreDeclaration=this.options.ignoreDeclaration,this.needsJPath=this.options.stopNodes.length>0||this.options.isArray!==void 0||this.options.updateTag!==void 0||this.options.tagValueProcessor!==void 0||this.options.attributeValueProcessor!==void 0}addEntity(t,e){this.entityDecoder.addEntity(t,e)}parse(t){if(t instanceof Uint8Array)t=new TextDecoder().decode(t);let e=t;if(this.options.preserveOrder)return this.parseOrdered(e);return this.parseUnordered(e)}parseUnordered(t){let e={},r=t.length,i=0;if(r>0&&t.charCodeAt(0)===65279)i=1;return i=this.parseChildren(t,i,r,e,"",[]),e}parseOrdered(t){let e=t.length,r=0;if(e>0&&t.charCodeAt(0)===65279)r=1;let i=[];return this.parseChildrenOrdered(t,r,e,i,""),i}readTagName(t,e,r){return Y(t,e,r)}extractTagName(t,e,r){let i=t.substring(e,r);if(this._removeNSPrefix){let s=i.indexOf(":");if(s!==-1)i=i.substring(s+1)}if(this.options.transformTagName)i=this.options.transformTagName(i);return i}parseAttributes(t,e,r,i,s){let a=0,o=this._removeNSPrefix,c=this.options.transformAttributeName,h=this._trimValues,A=this._processEntities,m=this.options.attributeValueProcessor;while(e<r){let f=t.charCodeAt(e);while(f===32||f===9||f===10||f===13){if(e++,e>=r)break;f=t.charCodeAt(e)}if(e>=r)break;if(f===62||f===47)break;let b=e;if(!x(f))break;e++;while(e<r&&V(t.charCodeAt(e)))e++;let p=t.substring(b,e);if(o){let C=p.indexOf(":");if(C!==-1)p=p.substring(C+1)}if(c)p=c(p);while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===61){e++;while(e<r&&_(t.charCodeAt(e)))e++;if(e>=r)break;let C=t.charCodeAt(e);if(C===34||C===39){e++;let E=e;while(e<r&&t.charCodeAt(e)!==C)e++;let d=t.substring(E,e);if(h&&d.length>0){let u=d.charCodeAt(0),g=d.charCodeAt(d.length-1);if(u<=32||g<=32)d=d.trim()}if(A)d=this.entityDecoder.decodeEntities(d);if(m)d=m(p,d,i)??d;if(s[p]=d,a++,e<r)e++}}else s[p]="true",a++}return a>0?-e-1:e}processTagValue(t,e,r,i,s){if(this._trimValues){let a=t.length;if(a>0){let o=t.charCodeAt(0),c=t.charCodeAt(a-1);if(o<=32||c<=32)t=t.trim()}}if(this._processEntities)t=this.entityDecoder.decodeEntities(t);if(this.options.tagValueProcessor){let a=this.options.tagValueProcessor(e,t,r,i,s);if(a!==void 0)t=a}if(!t)return t;if(this._parseTagValue)return this.parseValue(t);return t}parseValue(t){if(t==="true")return!0;if(t==="false")return!1;if(!t)return t;let e=t.charCodeAt(0);if(!(e>=48&&e<=57||e===43||e===45||e===46))return t;let i=this.options.numberParseOptions;if(i.skipLike?.test(t))return t;if(i.hex&&e===48&&X.test(t))return Number.parseInt(t,16);if(t.length>1&&e===48&&t.charCodeAt(1)!==46){if(i.leadingZeros)return t}if(i.scientific&&M.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}if(G.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}return t}parseAttributeValue(t){if(!this._parseAttributeValue)return t;return this.parseValue(t)}isStopNode(t){if(this.exactStopNodes.has(t))return!0;for(let e of this.wildcardStopSuffixes)if(t.endsWith(`.${e}`)||t===e)return!0;return!1}readStopNodeContent(t,e,r,i){let s=`</${i}`,a=t.indexOf(s,e);if(a===-1)return{content:t.substring(e),pos:r};let o=t.substring(e,a),c=a+s.length;while(c<r&&t.charCodeAt(c)!==62)c++;if(c<r)c++;return{content:o,pos:c}}addToObj(t,e,r,i,s,a){let o=t[e];if(o!==void 0)if(!Array.isArray(o))t[e]=[o,r];else o.push(r);else if(this.options.isArray?.(e,i,s,a))t[e]=[r];else t[e]=r}flushText(t,e,r,i){if(!t&&!e)return;let s=this._textNodeName;if(e){let a=t;if(a&&this._processEntities)a=this.entityDecoder.decodeEntities(a);let o=e+a;if(this._trimValues&&o.length>0){let c=o.charCodeAt(0),h=o.charCodeAt(o.length-1);if(c<=32||h<=32)o=o.trim()}if(this.options.tagValueProcessor){let c=this.options.tagValueProcessor(s,o,r,!1,!0);if(c!==void 0)o=c}if(o){let c=this._parseTagValue?this.parseValue(o):o;if(c!==void 0&&c!=="")this.addToObj(i,s,c,r,!0,!1)}}else{let a=this.processTagValue(t,s,r,!1,!0);if(a!==void 0&&a!=="")this.addToObj(i,s,a,r,!0,!1)}}parseChildren(t,e,r,i,s,a){let o="",c="",h=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let u=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!o)o=t.substring(u,e);else o+=t.substring(u,e);continue}if(e+1>=r)break;let m=t.charCodeAt(e+1);if(m===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(o||c)this.flushText(o,c,s,i),o="",c="";e+=4;let u=t.indexOf("-->",e);if(u===-1){e=r;break}if(this._commentPropName){let g=t.substring(e,u);this.addToObj(i,this._commentPropName,g,s,!0,!1)}e=u+3;continue}if(m===33&&e+8<r&&D(t,e+2)){e+=9;let u=t.indexOf("]]>",e);if(u===-1){e=r;break}let g=t.substring(e,u);if(this._cdataPropName)this.flushText(o,c,s,i),o="",c="",this.addToObj(i,this._cdataPropName,g,s,!0,!1);else{if(o){let y=o;if(this._processEntities)y=this.entityDecoder.decodeEntities(y);c+=y,o=""}c+=g}e=u+3;continue}if(m===33&&e+9<r&&k(t,e+2)){e+=9;let u=1;while(e<r&&u>0){let g=t.charCodeAt(e);if(g===60)u++;else if(g===62)u--;e++}continue}if(m===63){e+=2;let u=e;while(e<r&&!_(t.charCodeAt(e))&&t.charCodeAt(e)!==63)e++;let g=t.substring(u,e),y=t.indexOf("?>",e);if(y===-1){e=r;break}let N=t.substring(e,y).trim();if(g==="xml"){if(!this._ignoreDeclaration&&this._piPropName){let w=this.parsePiAttributes(N);this.addToObj(i,this._piPropName,{[g]:w},s,!0,!1)}}else if(!this._ignorePiTags&&this._piPropName)this.addToObj(i,this._piPropName,{[g]:N},s,!0,!1);e=y+2;continue}if(m===47){if(o||c)this.flushText(o,c,s,i),o="",c="";e+=2;let u=e,g=this.readTagName(t,e,r),y=this.extractTagName(t,u,g);e=g;while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;if(a.length>0&&a[a.length-1]===y){a.pop();continue}return e}if(o||c)this.flushText(o,c,s,i),o="",c="";e++;let f=e,b=this.readTagName(t,e,r),p=this.extractTagName(t,f,b);if(!p){e=b+1;continue}e=b;let C=h?s?`${s}.${p}`:p:"",E={},d=!1;if(!this._ignoreAttributes){let u=this.parseAttributes(t,e,r,C,E);if(u<0)e=-u-1,d=!0;else e=u}else while(e<r){let u=t.charCodeAt(e);if(u===62||u===47)break;if(u===34||u===39){e++;while(e<r&&t.charCodeAt(e)!==u)e++}e++}if(this.options.updateTag){if(this.options.updateTag(p,C,E)===!1){while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47)e+=2;else if(e<r&&t.charCodeAt(e)===62){e++;let g=`</${p}>`,y=t.indexOf(g,e);if(y!==-1)e=y+g.length}continue}}while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47){if(e+=2,d||this._alwaysCreateTextNode){let u={};if(d)this.applyAttributes(u,E,C);if(this._alwaysCreateTextNode)u[this._textNodeName]="";this.addToObj(i,p,u,C,!0,!1)}else this.addToObj(i,p,"",C,!0,!1);continue}if(e<r&&t.charCodeAt(e)===62){if(e++,this.unpairedSet.has(p)){if(d){let N={};this.applyAttributes(N,E,C),this.addToObj(i,p,N,C,!0,!1)}else this.addToObj(i,p,"",C,!0,!1);a.push(p);continue}if(this.exactStopNodes.size>0||this.wildcardStopSuffixes.length>0){if(this.isStopNode(C)){let N=this.readStopNodeContent(t,e,r,p),w={};if(d)this.applyAttributes(w,E,C);if(N.content)w[this._textNodeName]=N.content;this.addToObj(i,p,w,C,!0,!1),e=N.pos;continue}}let u={};if(d)this.applyAttributes(u,E,C);e=this.parseChildren(t,e,r,u,C,a);let g=this._textNodeName,y=u[g];if(!d&&!this._alwaysCreateTextNode){let N=!0;for(let w in u)if(w!==g){N=!1;break}if(N){this.addToObj(i,p,y!==void 0?y:"",C,!0,!1);continue}}this.addToObj(i,p,u,C,!1,!1)}}if(o||c)this.flushText(o,c,s,i);return e}parseChildrenOrdered(t,e,r,i,s){let a="",o=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let d=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!a)a=t.substring(d,e);else a+=t.substring(d,e);continue}if(e+1>=r)break;let h=t.charCodeAt(e+1);if(h===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(a){let u=this.processTagValue(a,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});a=""}e+=4;let d=t.indexOf("-->",e);if(d===-1){e=r;break}if(this._commentPropName)i.push({[this._commentPropName]:[{[this._textNodeName]:t.substring(e,d)}]});e=d+3;continue}if(h===33&&e+8<r&&D(t,e+2)){e+=9;let d=t.indexOf("]]>",e);if(d===-1){e=r;break}let u=t.substring(e,d);if(this._cdataPropName){if(a){let g=this.processTagValue(a,this._textNodeName,s,!1,!0);if(g!==void 0&&g!=="")i.push({[this._textNodeName]:g});a=""}i.push({[this._cdataPropName]:[{[this._textNodeName]:u}]})}else a+=u;e=d+3;continue}if(h===33&&e+9<r&&k(t,e+2)){e+=9;let d=1;while(e<r&&d>0){let u=t.charCodeAt(e);if(u===60)d++;else if(u===62)d--;e++}continue}if(h===63){e+=2;let d=t.indexOf("?>",e);if(d===-1){e=r;break}e=d+2;continue}if(h===47){if(a){let u=this.processTagValue(a,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});a=""}e+=2,e=this.readTagName(t,e,r);while(e<r&&_(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;return e}if(a){let d=this.processTagValue(a,this._textNodeName,s,!1,!0);if(d!==void 0&&d!=="")i.push({[this._textNodeName]:d});a=""}e++;let A=e,m=this.readTagName(t,e,r),f=this.extractTagName(t,A,m);if(!f){e=m+1;continue}e=m;let b=o?s?`${s}.${f}`:f:"",p={},C=!1;if(!this._ignoreAttributes){let d=this.parseAttributes(t,e,r,b,p);if(d<0)e=-d-1,C=!0;else e=d}else while(e<r){let d=t.charCodeAt(e);if(d===62||d===47)break;if(d===34||d===39){e++;while(e<r&&t.charCodeAt(e)!==d)e++}e++}while(e<r&&_(t.charCodeAt(e)))e++;let E={[f]:[]};if(C){E[":@"]={};for(let u in p)E[":@"][this._attrPrefix+u]=this.parseAttributeValue(p[u])}if(e<r&&t.charCodeAt(e)===47){e+=2,i.push(E);continue}if(e<r&&t.charCodeAt(e)===62)e++,e=this.parseChildrenOrdered(t,e,r,E[f],b),i.push(E)}if(a){let c=this.processTagValue(a,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c})}return e}applyAttributes(t,e,r){let i=this._attrPrefix;if(this._attrsGroupName){let s={};for(let a in e)s[i+a]=this.parseAttributeValue(e[a]);t[this._attrsGroupName]=s}else for(let s in e)t[i+s]=this.parseAttributeValue(e[s])}parsePiAttributes(t){let e={},r=0,i=t.length;while(r<i){while(r<i&&_(t.charCodeAt(r)))r++;if(r>=i)break;let s=r;while(r<i&&!_(t.charCodeAt(r))&&t.charCodeAt(r)!==61)r++;let a=t.substring(s,r);if(!a)break;while(r<i&&_(t.charCodeAt(r)))r++;if(r<i&&t.charCodeAt(r)===61){r++;while(r<i&&_(t.charCodeAt(r)))r++;if(r<i){let o=t.charCodeAt(r);if(o===34||o===39){r++;let c=r;while(r<i&&t.charCodeAt(r)!==o)r++;if(e[a]=t.substring(c,r),r<i)r++}}}}return e}}function br(t){let e=t.endpoint||`s3.${t.region}.amazonaws.com`,r=new URL(/^https?:\/\//i.test(e)?e:`https://${e}`);if(r.protocol!=="http:"&&r.protocol!=="https:"||r.pathname!=="/"&&r.pathname!==""||r.search||r.hash||r.username||r.password)throw Error("S3 endpoint must be an HTTP(S) origin without a path");let i=r.protocol.slice(0,-1),s=r.host;if(!t.bucket)return{protocol:i,host:s,path:t.path};if(t.forcePathStyle){let a=t.path==="/"?`/${t.bucket}`:`/${t.bucket}${t.path}`;return{protocol:i,host:s,path:a}}return{protocol:i,host:`${t.bucket}.${s}`,path:t.path}}class n{credentials;config;cache;xmlParser;constructor(t,e){this.config={maxRetries:3,retryDelay:1000,cacheEnabled:!0,defaultCacheTTL:60000,...e},this.credentials=t||this.loadCredentials(),this.cache=new Map,this.xmlParser=new v({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseAttributeValue:!0,trimValues:!0})}loadCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=process.env.AWS_SESSION_TOKEN;if(t&&e)return{accessKeyId:t,secretAccessKey:e,sessionToken:r};let i=this.loadCredentialsFromFile();if(i)return i;return{accessKeyId:"",secretAccessKey:""}}loadCredentialsFromFile(){let t=this.config?.profile||process.env.AWS_PROFILE||"default",e=process.env.AWS_SHARED_CREDENTIALS_FILE||K(B(),".aws","credentials");if(!W(e))return null;try{let r=J(e,"utf-8"),i=this.parseCredentialsFile(r,t);if(i.accessKeyId&&i.secretAccessKey)return i}catch{}return null}parseCredentialsFile(t,e){let r=t.split(`
2
+ `),i="",s="",a="",o;for(let c of r){let h=c.trim();if(!h||h.startsWith("#"))continue;let A=h.match(/^\[([^\]]+)\]$/);if(A){i=A[1];continue}if(i===e){let[m,...f]=h.split("="),b=f.join("=").trim();if(m.trim()==="aws_access_key_id")s=b;else if(m.trim()==="aws_secret_access_key")a=b;else if(m.trim()==="aws_session_token")o=b}}return{accessKeyId:s,secretAccessKey:a,sessionToken:o}}ec2CredentialsCache;async getCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY;if(t&&e)return{accessKeyId:t,secretAccessKey:e,sessionToken:process.env.AWS_SESSION_TOKEN};let r=this.loadCredentialsFromFile();if(r)return r;if(this.ec2CredentialsCache){let i=Date.now();if(this.ec2CredentialsCache.expiration>i+300000)return this.ec2CredentialsCache.credentials}try{let s=await(await fetch("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"21600"}})).text(),o=await(await fetch("http://169.254.169.254/latest/meta-data/iam/security-credentials/",{headers:{"X-aws-ec2-metadata-token":s}})).text(),h=await(await fetch(`http://169.254.169.254/latest/meta-data/iam/security-credentials/${o}`,{headers:{"X-aws-ec2-metadata-token":s}})).json(),A={accessKeyId:h.AccessKeyId,secretAccessKey:h.SecretAccessKey,sessionToken:h.Token};return this.ec2CredentialsCache={credentials:A,expiration:new Date(h.Expiration).getTime()},A}catch(i){throw Error("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or run on an EC2 instance with an IAM role.")}}async request(t){if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey){let i=this.getFromCache(t.cacheKey);if(i!==null)return i}let e=t.retries??this.config.maxRetries??3,r=null;for(let i=0;i<=e;i++)try{let s=await this.makeRequest(t);if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey)this.setInCache(t.cacheKey,s,t.cacheTTL??this.config.defaultCacheTTL??60000);return s}catch(s){if(r=s,!this.shouldRetry(s))throw s;if(i===e)throw s;let o=this.calculateRetryDelay(i);await this.sleep(o)}throw r||Error("Request failed after retries")}async makeRequest(t){let e=t.credentials||(this.credentials?.accessKeyId?this.credentials:await this.getCredentials());if(!e||!e.accessKeyId||!e.secretAccessKey)throw Error("AWS credentials not provided");let r=this.buildUrl(t),i=this.signRequest(t,e),s=await fetch(r,{method:t.method,headers:i,body:t.body}),a=await s.text();if(!s.ok)throw this.parseError(a,s.status,s.headers);if(!a||a.trim()===""){if(t.returnHeaders)return{body:null,headers:this.headersToObject(s.headers)};return null}if(t.rawResponse){if(t.returnHeaders)return{body:a,headers:this.headersToObject(s.headers)};return a}let o;if(a.startsWith("<"))o=this.parseXmlResponse(a);else try{o=JSON.parse(a)}catch{o=a}if(t.returnHeaders)return{body:o,headers:this.headersToObject(s.headers)};return o}headersToObject(t){let e={};return t.forEach((r,i)=>{e[i]=r}),e}buildUrl(t){let{service:e,region:r,queryParams:i}=t,{path:s}=t,a,o="https";if(e==="s3"){let h=br({region:r,path:s,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});o=h.protocol,a=h.host,s=h.path}else if(e==="cloudfront")a="cloudfront.amazonaws.com";else if(e==="iam")a="iam.amazonaws.com";else if(e==="route53")a="route53.amazonaws.com";else if(e==="route53domains")a="route53domains.us-east-1.amazonaws.com";else if(e==="ecr")a=`api.ecr.${r}.amazonaws.com`;else if(e==="ses")a=`email.${r}.amazonaws.com`;else a=`${e}.${r}.amazonaws.com`;let c=`${o}://${a}${s}`;if(i&&Object.keys(i).length>0){let h=Object.keys(i).map((A)=>`${this.uriEncode(A)}=${this.uriEncode(i[A])}`).join("&");c+=`?${h}`}return c}signRequest(t,e){let{service:r,region:i,method:s,queryParams:a,body:o}=t,{path:c}=t,h=new Date,A=this.getAmzDate(h),m=this.getDateStamp(h),f;if(r==="s3"){let S=br({region:i,path:c,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});f=S.host,c=S.path}else if(r==="cloudfront")f="cloudfront.amazonaws.com";else if(r==="iam")f="iam.amazonaws.com";else if(r==="route53")f="route53.amazonaws.com";else if(r==="route53domains")f="route53domains.us-east-1.amazonaws.com";else if(r==="ecr")f=`api.ecr.${i}.amazonaws.com`;else if(r==="ses")f=`email.${i}.amazonaws.com`;else f=`${r}.${i}.amazonaws.com`;let b={host:f,"x-amz-date":A,...t.headers||{}};if(e.sessionToken)b["x-amz-security-token"]=e.sessionToken;if(o){if(!Object.keys(b).some((O)=>O.toLowerCase()==="content-type"))b["content-type"]="application/x-www-form-urlencoded";b["content-length"]=Buffer.byteLength(o).toString()}let p=this.sha256(o||"");b["x-amz-content-sha256"]=p;let C=c,E=a?Object.keys(a).sort().map((S)=>`${this.uriEncode(S)}=${this.uriEncode(a[S])}`).join("&"):"",d=Object.keys(b).sort((S,O)=>S.toLowerCase().localeCompare(O.toLowerCase())),u=d.map((S)=>`${S.toLowerCase()}:${b[S].trim()}
3
3
  `).join(""),g=d.map((S)=>S.toLowerCase()).join(";"),y=[s,C,E,u,g,p].join(`
4
4
  `),N="AWS4-HMAC-SHA256",w=r;if(r==="email")w="ses";let I=`${m}/${i}/${w}/aws4_request`,F=[N,A,I,this.sha256(y)].join(`
5
- `),q=this.getSignatureKey(e.secretAccessKey,m,i,w),U=this.hmac(q,F),j=`${N} Credential=${e.accessKeyId}/${I}, SignedHeaders=${g}, Signature=${U}`;return{...b,Authorization:j}}getAmzDate(t){return t.toISOString().replace(/[:-]|\.\d{3}/g,"")}getDateStamp(t){return t.toISOString().slice(0,10).replace(/-/g,"")}uriEncode(t){return encodeURIComponent(t).replace(/[!'()*]/g,(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}sha256(t){return T.createHash("sha256").update(t,"utf8").digest("hex")}hmac(t,e){return T.createHmac("sha256",t).update(e,"utf8").digest("hex")}getSignatureKey(t,e,r,i){let s=T.createHmac("sha256",`AWS4${t}`).update(e).digest(),a=T.createHmac("sha256",s).update(r).digest(),o=T.createHmac("sha256",a).update(i).digest();return T.createHmac("sha256",o).update("aws4_request").digest()}parseXmlResponse(t){try{let e=this.xmlParser.parse(t);if(e.ErrorResponse)throw this.createErrorFromXml(e.ErrorResponse.Error);let r=Object.keys(e);if(r.length===1)return e[r[0]];return e}catch(e){if(e.code||e.statusCode)throw e;return{}}}parseError(t,e,r){let i=Error();if(i.statusCode=e,i.requestId=r.get("x-amzn-requestid")||r.get("x-amz-request-id")||void 0,t.startsWith("<"))try{let s=this.xmlParser.parse(t);if(s.ErrorResponse?.Error){let a=s.ErrorResponse.Error;return i.code=a.Code,i.message=`AWS Error [${a.Code}]: ${a.Message||"Unknown error"}`,i.type=a.Type,i}if(s.Error)return i.code=s.Error.Code,i.message=`AWS Error [${s.Error.Code}]: ${s.Error.Message||"Unknown error"}`,i}catch{}try{let s=JSON.parse(t);if(s.__type||s.code)return i.code=s.__type||s.code,i.message=`AWS Error [${i.code}]: ${s.message||s.Message||"Unknown error"}`,i}catch{}return i.message=`AWS API Error (${e}): ${t}`,i}createErrorFromXml(t){let e=Error();return e.code=t.Code,e.message=`AWS Error [${t.Code}]: ${t.Message||"Unknown error"}`,e.type=t.Type,e}isRetryableError(t){return["RequestTimeout","RequestTimeoutException","PriorRequestNotComplete","ConnectionError","ThrottlingException","Throttling","TooManyRequestsException","ProvisionedThroughputExceededException","RequestLimitExceeded","BandwidthLimitExceeded","SlowDown","ServiceUnavailable","ServiceUnavailableException","InternalError","InternalFailure","InternalServerError","InternalServiceException","TransientError","TransientFailure","IDPCommunicationErrorException","NetworkError","ConnectionRefusedException","EC2ThrottledException","503 Slow Down","500 InternalError"].includes(t)}isRetryableStatusCode(t){return t>=500||t===429}shouldRetry(t){if(t.name==="FetchError"||t.name==="TypeError"||t.code==="ECONNRESET")return!0;if(t.code&&this.isRetryableError(t.code))return!0;if(t.statusCode&&this.isRetryableStatusCode(t.statusCode))return!0;if(t.statusCode&&t.statusCode>=400&&t.statusCode<500&&t.statusCode!==429)return!1;if(t.statusCode)return!1;return!0}calculateRetryDelay(t){let e=this.config.retryDelay??1000,r=30000,i=Math.min(e*2**t,30000),s=Math.random()*0.3*i;return i+s}sleep(t){return new Promise((e)=>setTimeout(e,t))}getFromCache(t){let e=this.cache.get(t);if(!e)return null;if(Date.now()>e.expires)return this.cache.delete(t),null;return e.data}setInCache(t,e,r){this.cache.set(t,{data:e,expires:Date.now()+r})}clearCache(){this.cache.clear()}clearExpiredCache(){let t=Date.now();for(let[e,r]of this.cache.entries())if(t>r.expires)this.cache.delete(e)}}function l(t){let e={};for(let[r,i]of Object.entries(t)){if(i===void 0||i===null)continue;if(Array.isArray(i))i.forEach((s,a)=>{e[`${r}.${a+1}`]=String(s)});else if(typeof i==="object")for(let[s,a]of Object.entries(i))e[`${r}.${s}`]=String(a);else e[r]=String(i)}return e}function Sh(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=t==="",i=e==="";if(t&&e)return{source:"env",emptyEnvKey:r,emptyEnvSecret:i,description:"environment variables (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)"};let s=process.env.AWS_PROFILE||"default",a=process.env.AWS_SHARED_CREDENTIALS_FILE||K(B(),".aws","credentials");if(W(a))return{source:"file",profile:s,emptyEnvKey:r,emptyEnvSecret:i,description:`~/.aws/credentials (profile: ${s})`};return{source:"ec2",emptyEnvKey:r,emptyEnvSecret:i,description:"EC2 instance metadata service (IMDSv2)"}}
6
- export{yr,n,l,Sh};
5
+ `),q=this.getSignatureKey(e.secretAccessKey,m,i,w),U=this.hmac(q,F),j=`${N} Credential=${e.accessKeyId}/${I}, SignedHeaders=${g}, Signature=${U}`;return{...b,Authorization:j}}getAmzDate(t){return t.toISOString().replace(/[:-]|\.\d{3}/g,"")}getDateStamp(t){return t.toISOString().slice(0,10).replace(/-/g,"")}uriEncode(t){return encodeURIComponent(t).replace(/[!'()*]/g,(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}sha256(t){return T.createHash("sha256").update(t,"utf8").digest("hex")}hmac(t,e){return T.createHmac("sha256",t).update(e,"utf8").digest("hex")}getSignatureKey(t,e,r,i){let s=T.createHmac("sha256",`AWS4${t}`).update(e).digest(),a=T.createHmac("sha256",s).update(r).digest(),o=T.createHmac("sha256",a).update(i).digest();return T.createHmac("sha256",o).update("aws4_request").digest()}parseXmlResponse(t){try{let e=this.xmlParser.parse(t);if(e.ErrorResponse)throw this.createErrorFromXml(e.ErrorResponse.Error);let r=Object.keys(e);if(r.length===1)return e[r[0]];return e}catch(e){if(e.code||e.statusCode)throw e;return{}}}parseError(t,e,r){let i=Error();if(i.statusCode=e,i.requestId=r.get("x-amzn-requestid")||r.get("x-amz-request-id")||void 0,t.startsWith("<"))try{let s=this.xmlParser.parse(t);if(s.ErrorResponse?.Error){let a=s.ErrorResponse.Error;return i.code=a.Code,i.message=`AWS Error [${a.Code}]: ${a.Message||"Unknown error"}`,i.type=a.Type,i}if(s.Error)return i.code=s.Error.Code,i.message=`AWS Error [${s.Error.Code}]: ${s.Error.Message||"Unknown error"}`,i}catch{}try{let s=JSON.parse(t);if(s.__type||s.code)return i.code=s.__type||s.code,i.message=`AWS Error [${i.code}]: ${s.message||s.Message||"Unknown error"}`,i}catch{}return i.message=`AWS API Error (${e}): ${t}`,i}createErrorFromXml(t){let e=Error();return e.code=t.Code,e.message=`AWS Error [${t.Code}]: ${t.Message||"Unknown error"}`,e.type=t.Type,e}isRetryableError(t){return["RequestTimeout","RequestTimeoutException","PriorRequestNotComplete","ConnectionError","ThrottlingException","Throttling","TooManyRequestsException","ProvisionedThroughputExceededException","RequestLimitExceeded","BandwidthLimitExceeded","SlowDown","ServiceUnavailable","ServiceUnavailableException","InternalError","InternalFailure","InternalServerError","InternalServiceException","TransientError","TransientFailure","IDPCommunicationErrorException","NetworkError","ConnectionRefusedException","EC2ThrottledException","503 Slow Down","500 InternalError"].includes(t)}isRetryableStatusCode(t){return t>=500||t===429}shouldRetry(t){if(t.name==="FetchError"||t.name==="TypeError"||t.code==="ECONNRESET")return!0;if(t.code&&this.isRetryableError(t.code))return!0;if(t.statusCode&&this.isRetryableStatusCode(t.statusCode))return!0;if(t.statusCode&&t.statusCode>=400&&t.statusCode<500&&t.statusCode!==429)return!1;if(t.statusCode)return!1;return!0}calculateRetryDelay(t){let e=this.config.retryDelay??1000,r=30000,i=Math.min(e*2**t,30000),s=Math.random()*0.3*i;return i+s}sleep(t){return new Promise((e)=>setTimeout(e,t))}getFromCache(t){let e=this.cache.get(t);if(!e)return null;if(Date.now()>e.expires)return this.cache.delete(t),null;return e.data}setInCache(t,e,r){this.cache.set(t,{data:e,expires:Date.now()+r})}clearCache(){this.cache.clear()}clearExpiredCache(){let t=Date.now();for(let[e,r]of this.cache.entries())if(t>r.expires)this.cache.delete(e)}}function l(t){let e={};for(let[r,i]of Object.entries(t)){if(i===void 0||i===null)continue;if(Array.isArray(i))i.forEach((s,a)=>{e[`${r}.${a+1}`]=String(s)});else if(typeof i==="object")for(let[s,a]of Object.entries(i))e[`${r}.${s}`]=String(a);else e[r]=String(i)}return e}function Wh(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=t==="",i=e==="";if(t&&e)return{source:"env",emptyEnvKey:r,emptyEnvSecret:i,description:"environment variables (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)"};let s=process.env.AWS_PROFILE||"default",a=process.env.AWS_SHARED_CREDENTIALS_FILE||K(B(),".aws","credentials");if(W(a))return{source:"file",profile:s,emptyEnvKey:r,emptyEnvSecret:i,description:`~/.aws/credentials (profile: ${s})`};return{source:"ec2",emptyEnvKey:r,emptyEnvSecret:i,description:"EC2 instance metadata service (IMDSv2)"}}
6
+ export{br,n,l,Wh};
@@ -9,6 +9,7 @@ export * from './server-dns';
9
9
  export * from './dashboard-control-plane';
10
10
  export * from './dashboard-route-manifest';
11
11
  export * from './static-site';
12
+ export * from './storage-failover';
12
13
  export * from './static-site-external-dns';
13
14
  export * from './static-site-helper';
14
15
  export * from './static-api-origin';
@@ -1 +1 @@
1
- import{Xr,Yr,Ol,Qi,Ll,$l,Ml,ca,Fl,Ul,Mm,Ql,S,Hl,Hi,Pe,Gl,ql,HA,Vl,Fm,GA,qA,VA,Um,Qm,jA,zA,Hm,Gm,KA,Gi,Wt,da,Zr,en,Jt,Je,It,qi,qm,tn,jl,zl,la,ji,nn,zi,va}from"../chunk-wdrqt329.js";import{Ta,sn,on,Ki,Wi,Ji,Xi,wa,Ra}from"../chunk-whwg2nzb.js";import{Da}from"../chunk-0bbrbzf9.js";import"../chunk-a6aw2jtz.js";import"../chunk-a21phhyj.js";import"../chunk-yxn6tpbg.js";import"../chunk-4xta1s4z.js";import"../chunk-6eq5xfcx.js";import"../chunk-v9t92ak2.js";import"../chunk-emx1j2yt.js";import{lu,qa,ye,Va,Sn,uu,ja,hc,bs,fc,Nt,Wn,vs}from"../chunk-acpxtkfy.js";import"../chunk-fz70vxrk.js";import"../chunk-g0yyw5k8.js";import"../chunk-z87dekhm.js";import"../chunk-ss4q8kge.js";import{ot,Vh,Ec,ei,ti,ri,pp}from"../chunk-rgw06xbk.js";import{B,Ir,Sr,bc,Rs,u,jh,gp,mp,Ty,wy}from"../chunk-gstz8w2d.js";import"../chunk-rmn71xjb.js";import"../chunk-jncbm332.js";export{Vh as DEFAULT_SITE_PORT_RANGE,ot as HOST_SITES_DIR,Va as IPV6_EXCLUDED_HOST_LABELS,hc as MANAGEMENT_DASHBOARD_SITE,Xr as addSiteToCloudConfig,pp as allocateSitePorts,KA as buildAndPushContainerImage,Da as buildAndPushServerlessImage,Wt as buildFunctionEnv,ti as buildHostSitePortsScript,vs as buildManagementDashboardArtifact,It as buildServerTopology,qi as buildServerlessTopology,qm as buildTopology,la as collectEgressMetrics,lu as collectServerDnsDomains,Gm as createContainerImageDependencies,Um as createExistingStaticFullStackDependencies,Fm as createStaticApiOriginDependencies,nn as dashboardActions,bs as dashboardCredentialsFile,Gl as dashboardPageRoutes,wa as deleteStaticSite,jA as deployExistingStaticFullStack,da as deployServerlessApp,wy as deployShipsFiles,Vl as deploySite,GA as deployStaticApiOrigin,Wi as deployStaticSite,Ra as deployStaticSiteFull,sn as deployStaticSiteWithExternalDns,on as deployStaticSiteWithExternalDnsFull,jl as egressReportMetrics,S as ensureDashboardActor,Wn as ensureManagementDashboard,zA as estimateExistingStaticFullStackMonthlyCost,VA as estimateStaticApiOriginMonthlyCost,zl as fetchEgressReport,Qm as generateExistingStaticFullStackTemplate,Ta as generateExternalDnsStaticSiteTemplate,Ki as generateStaticSiteTemplate,jh as hasComputeConfigured,bc as hasProxyUpstream,Hm as hashContainerContext,Sn as hostAcceptsIpv6,Gi as infraEnvFromOutputs,Hl as initializeDashboardControlPlane,Xi as invalidateCache,Ir as isPhpSite,ca as isValidHostname,ye as normalizePublicIpv6,ei as occupiedHostPorts,ri as parseHostSiteFragments,Ec as parseUpstreamPort,uu as reconcileAddressRecords,Zr as redeployServerlessApp,Yr as removeSiteFromCloudConfig,qa as removeStaleServerAddressRecords,Fl as renderAliasesValue,Ml as renderEnvValue,Ul as renderRedirectsValue,Mm as renderSiteSnippet,Ll as renderSslValue,$l as renderStringValue,zi as resolveDashboardAction,fc as resolveDashboardAuth,tn as resolveDashboardData,ql as resolveLegacyDashboardRoute,Sr as resolveProxyUpstreams,Rs as resolveSiteDeployTarget,u as resolveSiteKind,Nt as resolveUiSource,en as rollbackServerlessApp,HA as routesForDashboard,Je as runRemoteCommand,ji as sanitizeCloudConfig,Ql as setAttachToInCloudConfig,Jt as setMaintenance,Qi as setSitePropertyInCloudConfig,mp as shipsARelease,Ty as shipsToBucket,B as siteInstallBase,va as startLocalDashboardServer,Hi as synchronizeDashboardUsers,Pe as trackDashboardOperation,Ol as updateSiteInCloudConfig,Ji as uploadStaticFiles,gp as validateDeploymentConfig,ja as verifyAddressRecord,qA as verifyStaticApiOrigin};
1
+ import{rn,nn,Vl,ji,jl,zl,Kl,ha,Wl,Jl,ch,Xl,S,Yl,zi,Ne,Zl,eu,Ay,tu,ru,nu,iu,su,dh,yy,Iy,Sy,lh,uh,Cy,Ey,ph,gh,by,Ki,Yt,fa,sn,on,Zt,Xe,St,Wi,mh,an,ou,au,Aa,Xi,dn,Yi,ka}from"../chunk-2p71e3x7.js";import{Ba,ln,un,Zi,es,ts,rs,_a,Oa}from"../chunk-9syc8s7r.js";import{xa}from"../chunk-7xnwa0s8.js";import"../chunk-60nr1ehk.js";import"../chunk-c3f89ryr.js";import"../chunk-31tvc877.js";import"../chunk-5far81q7.js";import"../chunk-k53agv2m.js";import"../chunk-e8e1h2h9.js";import"../chunk-9wmer0zx.js";import{vu,Xa,ye,Ya,Tn,Tu,Za,Ec,Ps,bc,kt,ti,Ns}from"../chunk-s2ve9zxn.js";import"../chunk-qcaqc5b8.js";import"../chunk-ptq9v346.js";import"../chunk-yd40pg8g.js";import"../chunk-zx8ecz8b.js";import{at,Cf,Pc,oi,ai,ci,Pp}from"../chunk-w9jhyy09.js";import{B,vr,Tr,Nc,_s,u,Ef,Np,kp,eI,tI}from"../chunk-3m9ghthh.js";import"../chunk-kczzc599.js";import"../chunk-v2p7c7s4.js";export{Cf as DEFAULT_SITE_PORT_RANGE,at as HOST_SITES_DIR,Ya as IPV6_EXCLUDED_HOST_LABELS,Ec as MANAGEMENT_DASHBOARD_SITE,rn as addSiteToCloudConfig,Pp as allocateSitePorts,by as buildAndPushContainerImage,xa as buildAndPushServerlessImage,Yt as buildFunctionEnv,ai as buildHostSitePortsScript,Ns as buildManagementDashboardArtifact,St as buildServerTopology,Wi as buildServerlessTopology,mh as buildTopology,Aa as collectEgressMetrics,vu as collectServerDnsDomains,gh as createContainerImageDependencies,lh as createExistingStaticFullStackDependencies,dh as createStaticApiOriginDependencies,dn as dashboardActions,Ps as dashboardCredentialsFile,Zl as dashboardPageRoutes,iu as deleteFailoverReplicaBuckets,_a as deleteStaticSite,Cy as deployExistingStaticFullStack,fa as deployServerlessApp,tI as deployShipsFiles,su as deploySite,yy as deployStaticApiOrigin,es as deployStaticSite,Oa as deployStaticSiteFull,ln as deployStaticSiteWithExternalDns,un as deployStaticSiteWithExternalDnsFull,ou as egressReportMetrics,S as ensureDashboardActor,tu as ensureFailoverReplicaBuckets,ti as ensureManagementDashboard,Ey as estimateExistingStaticFullStackMonthlyCost,Sy as estimateStaticApiOriginMonthlyCost,au as fetchEgressReport,uh as generateExistingStaticFullStackTemplate,Ba as generateExternalDnsStaticSiteTemplate,Zi as generateStaticSiteTemplate,ru as grantFailoverReplicaAccess,Ef as hasComputeConfigured,Nc as hasProxyUpstream,ph as hashContainerContext,Tn as hostAcceptsIpv6,Ki as infraEnvFromOutputs,Yl as initializeDashboardControlPlane,rs as invalidateCache,vr as isPhpSite,ha as isValidHostname,ye as normalizePublicIpv6,oi as occupiedHostPorts,ci as parseHostSiteFragments,Pc as parseUpstreamPort,Tu as reconcileAddressRecords,sn as redeployServerlessApp,nn as removeSiteFromCloudConfig,Xa as removeStaleServerAddressRecords,Wl as renderAliasesValue,Kl as renderEnvValue,Jl as renderRedirectsValue,ch as renderSiteSnippet,jl as renderSslValue,zl as renderStringValue,Yi as resolveDashboardAction,bc as resolveDashboardAuth,an as resolveDashboardData,eu as resolveLegacyDashboardRoute,Tr as resolveProxyUpstreams,_s as resolveSiteDeployTarget,u as resolveSiteKind,kt as resolveUiSource,on as rollbackServerlessApp,Ay as routesForDashboard,Xe as runRemoteCommand,Xi as sanitizeCloudConfig,nu as seedFailoverReplicas,Xl as setAttachToInCloudConfig,Zt as setMaintenance,ji as setSitePropertyInCloudConfig,kp as shipsARelease,eI as shipsToBucket,B as siteInstallBase,ka as startLocalDashboardServer,zi as synchronizeDashboardUsers,Ne as trackDashboardOperation,Vl as updateSiteInCloudConfig,ts as uploadStaticFiles,Np as validateDeploymentConfig,Za as verifyAddressRecord,Iy as verifyStaticApiOrigin};
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Deploy-time half of cross-region bucket failover (stacksjs/stacks#1159).
3
+ *
4
+ * The generated stack replicates a website bucket into a replica in another
5
+ * region and puts both behind one CloudFront origin group, but it cannot
6
+ * create the replica: a CloudFormation stack only makes buckets in its own
7
+ * region. The template lists the replicas it needs under
8
+ * `Metadata['TsCloud::StorageFailover']` (read it with
9
+ * `storageFailoverReplicasFromTemplate`), and a deployer runs:
10
+ *
11
+ * 1. {@link ensureFailoverReplicaBuckets} before creating or updating the
12
+ * stack, because S3 rejects a replication rule whose destination bucket is
13
+ * missing or unversioned;
14
+ * 2. {@link grantFailoverReplicaAccess} after the stack, once the
15
+ * distribution exists, so origin access control can read the replica;
16
+ * 3. {@link seedFailoverReplicas} after uploading content, to copy across
17
+ * objects written before replication was turned on (S3 replication only
18
+ * copies new writes).
19
+ *
20
+ * {@link deleteFailoverReplicaBuckets} removes them again; nothing calls it
21
+ * automatically, since the replica is the copy that survives losing the stack.
22
+ */
23
+ import type { StorageFailoverReplica } from '@ts-cloud/core';
24
+ export type FailoverLogger = (message: string) => void;
25
+ /**
26
+ * Create each replica bucket if it is missing, and make sure it is private,
27
+ * encrypted, and (when the primary replicates into it) versioned. Idempotent.
28
+ *
29
+ * @throws when the bucket name is taken in another region or by another account.
30
+ */
31
+ export declare function ensureFailoverReplicaBuckets(replicas: readonly StorageFailoverReplica[], log?: FailoverLogger): Promise<void>;
32
+ /**
33
+ * Let each stack's distribution read its replica through origin access
34
+ * control, by adding (or replacing) one statement in the replica's bucket
35
+ * policy. Other statements in that policy are kept.
36
+ *
37
+ * @param outputs The stack outputs; each replica names the output holding its distribution ARN.
38
+ * @throws when an output is missing, which means the stack did not deploy the distribution.
39
+ */
40
+ export declare function grantFailoverReplicaAccess(replicas: readonly StorageFailoverReplica[], outputs: Record<string, string>, log?: FailoverLogger): Promise<void>;
41
+ /**
42
+ * Copy objects the replica is missing (or holds at a different size) from the
43
+ * primary. S3 replication only copies writes made after it was configured, so
44
+ * a site that turns failover on later would otherwise fail over to an empty
45
+ * bucket. Objects are copied server side.
46
+ *
47
+ * @returns how many objects were copied per replica.
48
+ */
49
+ export declare function seedFailoverReplicas(replicas: readonly StorageFailoverReplica[], log?: FailoverLogger): Promise<Record<string, number>>;
50
+ /**
51
+ * Empty (every version and delete marker) and delete each replica bucket.
52
+ * Never called by a deploy: use it to tear down a site you are removing.
53
+ */
54
+ export declare function deleteFailoverReplicaBuckets(replicas: readonly StorageFailoverReplica[], log?: FailoverLogger): Promise<void>;
package/dist/dns/index.js CHANGED
@@ -1 +1 @@
1
- import{tt,se,_e,Ae,Tt,An,ss,os,nr,ir,yn,sr,as,cs,ds,ls,z,us,ps,gs,ms,oe,hs,fs,As,T,Ha,In,Ga}from"../chunk-v9t92ak2.js";import"../chunk-emx1j2yt.js";import"../chunk-ss4q8kge.js";export{Ae as CloudflareProvider,In as DnsProviderFactory,_e as GoDaddyProvider,tt as PROXIABLE_RECORD_TYPES,se as PorkbunProvider,z as Route53Provider,oe as UnifiedDnsValidator,ds as applyDeclaredZoneSettings,gs as applyZoneMigration,T as createDnsProvider,fs as createGoDaddyValidator,hs as createPorkbunValidator,As as createRoute53Validator,sr as delegateZone,as as delegateZoneFromConfig,cs as describeDelegation,ls as describeZoneSettings,Ha as detectDnsProvider,Ga as dnsProviders,us as exportRoute53Zone,nr as isNameserverRegistrar,ir as isZoneHost,ps as planZoneMigration,Tt as policyTag,An as qualifyName,os as reconcileDeclaredRecords,ss as resolveDeclaredRecords,yn as sameNameservers,ms as verifyZoneParity};
1
+ import{rt,se,Oe,Ae,wt,En,ls,us,or,ar,bn,cr,ps,gs,ms,hs,z,fs,As,ys,Is,oe,Ss,Cs,Es,T,Wa,vn,Ja}from"../chunk-e8e1h2h9.js";import"../chunk-9wmer0zx.js";import"../chunk-zx8ecz8b.js";export{Ae as CloudflareProvider,vn as DnsProviderFactory,Oe as GoDaddyProvider,rt as PROXIABLE_RECORD_TYPES,se as PorkbunProvider,z as Route53Provider,oe as UnifiedDnsValidator,ms as applyDeclaredZoneSettings,ys as applyZoneMigration,T as createDnsProvider,Cs as createGoDaddyValidator,Ss as createPorkbunValidator,Es as createRoute53Validator,cr as delegateZone,ps as delegateZoneFromConfig,gs as describeDelegation,hs as describeZoneSettings,Wa as detectDnsProvider,Ja as dnsProviders,fs as exportRoute53Zone,or as isNameserverRegistrar,ar as isZoneHost,As as planZoneMigration,wt as policyTag,En as qualifyName,us as reconcileDeclaredRecords,ls as resolveDeclaredRecords,bn as sameNameservers,Is as verifyZoneParity};
@@ -34,6 +34,8 @@ export { buildSshArgs, REMOTE_SCRIPT_RUNNER, remoteScriptRunner, scpUpload, sshE
34
34
  export type { RemoteExecOptions, RemoteExecResult, WaitOptions } from './shared/remote-exec';
35
35
  export { AwsBoxProvisioner, buildBoxUserData, createBoxProvisioner, HetznerBoxProvisioner, UBUNTU_2404_AMI_PARAM, } from './shared/box-provision';
36
36
  export type { AwsBoxProvisionerOptions, BoxPort, BoxProviderName, BoxProvisioner, BoxSpec, CreateBoxProvisionerOptions, ProvisionedBox, } from './shared/box-provision';
37
+ export { buildHostCleanupDeployScript, buildHostCleanupExecutable, buildHostCleanupInstallScript, DEFAULT_HOST_CLEANUP_ESCALATED, DEFAULT_HOST_CLEANUP_HIGH_WATER_PERCENT, DEFAULT_HOST_CLEANUP_LOW_WATER_PERCENT, DEFAULT_HOST_CLEANUP_RETENTION, DEFAULT_HOST_CLEANUP_SCHEDULE, HOST_ARTIFACT_CACHE_DIR, HOST_CLEANUP_SCRIPT_PATH, HOST_CLEANUP_UNIT, resolveHostCleanupConfig, } from './shared/host-cleanup';
38
+ export type { ResolvedHostCleanupConfig, ResolvedHostCleanupRetention } from './shared/host-cleanup';
37
39
  export { buildAwsArtifactFetch, buildHostCleanupScript, buildLocalArtifactFetch, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, resolveExecStart, } from './shared/deploy-script';
38
40
  export { deployAllComputeSites, deploySiteRelease, reloadRpxGateway, renewRpxCertificates, } from './shared/compute-deploy';
39
41
  export { isLocalDatabase } from './shared/db-provision';
@@ -1 +1 @@
1
- import{Cn,wt,ar,Rt,En,bn,vn,Tn,hu,za,K,lr,oh,wn,Ka,Ie,Se,xe,N,ur,Rn,pr,ce,Wa,Dn,Ja,Pn,Xa,gr,Za,Oe,W,ec,rt,Le,$e,nt,Ce,Ss,tc,fu,Au,rc,yu,it,Nn,nc,Iu,Su,ic,mr,Ee,sc,Cu,Eu,Cs,kn,st,bu,vu,Tu,wu,Ru,Du,Pu,Nu,ku,Bn,_n,xn,On,Ln,$n,Mn,Bu,_u,hr,k,Es,xu,Ou,Lu,oc,$u,Mu,ah,ac,ch,dh,Fu,Uu,lh,uh,ph,cc,Qu,gh,mh,hh,Un,Qn,Hn,Gn,dc,lc,uc,pc,fh,qn,Vn,jn,zn,gc,mc,Kn,Ts,Ac,Jn,yc,Gu,qu,Vu,Ah}from"../chunk-acpxtkfy.js";import"../chunk-fz70vxrk.js";import"../chunk-g0yyw5k8.js";import"../chunk-z87dekhm.js";import"../chunk-ss4q8kge.js";import"../chunk-gstz8w2d.js";import"../chunk-jncbm332.js";export{pc as AwsBoxProvisioner,ur as AwsDriver,Lu as BOOT_PARTITION_LABEL,Es as CloudDriverFactory,bn as DEFAULT_RPX_CERTS_DIR,Ou as FIRST_BOOT_SCRIPT_PATH,uc as HetznerBoxProvisioner,gr as HetznerClient,Ce as HetznerDriver,ec as LEGACY_DRIVER_STATE_DIR,Ss as LocalBoxDriver,qu as MANAGED_CACHE_POLICY_DISABLED,Gu as MANAGED_CACHE_POLICY_OPTIMIZED,Vu as MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,Eu as RASPBERRY_PI_DEFAULT_SWAP_GB,Xa as REMOTE_SCRIPT_RUNNER,wn as RPX_DIR,Ka as RPX_LAUNCHER_PATH,Ie as RPX_SERVICE_NAME,sc as SSH_BOOTSTRAP_MARKER_DIR,Ee as SSH_BOOTSTRAP_VERSION,st as SSH_DEFAULTS,Mn as SSH_DEPLOY_STORAGE_PATH,fu as SSH_INSECURE_HOST_KEY_OPTS,Au as SSH_KEEPALIVE_OPTS,_n as SSH_PREFLIGHT_SCRIPT,Bu as SSH_SKIP_BOOTSTRAP_ENV,hr as SshDriver,mr as SystemSshTransport,dc as UBUNTU_2404_AMI_PARAM,hh as acquireResizeLock,lh as applyHetznerHostOptimization,Cs as assertArchSupported,_u as assertSshComputeConfig,gc as buildAwsArtifactFetch,lc as buildBoxUserData,Ah as buildCloudFrontOriginConfig,oc as buildCloudInitFirstBoot,Uu as buildHetznerHostOptimizationScript,Kn as buildHostCleanupScript,mc as buildLocalArtifactFetch,K as buildRpxConfig,xe as buildRpxFragmentRefreshScript,lr as buildRpxLbConfig,Se as buildRpxProvisionScript,yu as buildScpArgsFor,Vn as buildSiteDeployScript,Rn as buildSshArgs,rc as buildSshArgsFor,kn as buildSshBootstrapScript,jn as buildStaticSiteDeployScript,xu as cloudDrivers,uh as collectHetznerHostOptimizationReport,ac as collectHetznerResizeManifest,fh as createBoxProvisioner,k as createCloudDriver,Ac as deployAllComputeSites,Ts as deploySiteRelease,za as deriveRouteId,Cn as describeScriptSyntaxError,rt as driverStateDir,Le as driverStatePath,Qn as ensureFirewall,Hn as ensureServer,Un as ensureSshKey,On as evaluatePreflight,ah as executeHetznerServerResize,Su as findKnownHostKey,$n as formatPreflightFindings,wt as formatSshFailure,Tn as gatewayHostnames,N as generateUbuntuAppCloudInit,vn as hasAutoWwwVariant,tc as isBoxMode,Mu as isHetznerCapacityError,En as isLocalDatabase,Iu as knownHostsLine,nc as knownHostsToken,hu as normalizeRoutePath,Oe as normalizeSshPublicKey,xn as parsePreflightFacts,$u as planHetznerServerResize,Ln as preflightFailed,ch as prepareHetznerResize,$e as readDriverState,gh as readResizeCheckpoint,zn as releaseTarballTmpPath,Jn as reloadRpxGateway,Pn as remoteScriptRunner,oh as renderRpxLauncher,yc as renewRpxCertificates,cc as resizeCheckpointPath,Qu as resizeLockPath,qn as resolveExecStart,Za as resolveHetznerApiToken,Fu as resolveHetznerHostOptimizationPlan,Ru as resolveSshHostKeyPolicy,bu as resolveSshHosts,ku as resolveSshLan,Tu as resolveSshPort,wu as resolveSshPrivateKeyPath,Pu as resolveSshProfile,Nu as resolveSshPublicIp,Bn as resolveSshSettings,Du as resolveSshSudo,vu as resolveSshUser,Nn as scanHostKey,Wa as scpUpload,Gn as serverPublicIpv4,Cu as sshBootstrapMarkerPath,pr as sshExec,ce as sshExecOrThrow,it as sshHostKeyFingerprint,ic as sshKnownHostsPath,Rt as summarizeRemoteFailures,ar as surfaceRemoteNotices,ph as verifyHetznerHostOptimization,dh as verifyHetznerResize,Ja as waitForCloudInit,Dn as waitForSsh,W as wrapCloudInitUserData,nt as writeDriverState,mh as writeResizeCheckpoint};
1
+ import{wn,Rt,lr,Dt,Rn,Dn,Pn,Nn,Pu,ec,K,gr,Nh,kn,tc,Ie,Se,xe,N,mr,Bn,hr,ce,rc,_n,nc,On,ic,fr,kh,Bh,ku,Bu,_h,Oh,xh,Ar,xn,_u,Ts,Ln,$n,Mn,Un,Qn,sc,oc,yr,cc,Le,W,dc,nt,$e,Me,it,Ce,ws,lc,Ou,xu,uc,Lu,st,Hn,pc,$u,Mu,gc,Ir,Ee,mc,Fu,Uu,Rs,Gn,ot,Qu,Hu,Gu,qu,Vu,ju,zu,Ku,Wu,qn,Vn,jn,zn,Kn,Wn,Jn,Ju,Xu,Sr,k,Ds,Yu,Zu,ep,hc,tp,rp,Lh,fc,$h,Mh,np,ip,Fh,Uh,Qh,Ac,sp,Hh,Gh,qh,Xn,Yn,Zn,ei,yc,Ic,Sc,Cc,Vh,ks,vc,ri,Tc,op,ap,cp,jh}from"../chunk-s2ve9zxn.js";import"../chunk-qcaqc5b8.js";import"../chunk-ptq9v346.js";import"../chunk-yd40pg8g.js";import"../chunk-zx8ecz8b.js";import"../chunk-3m9ghthh.js";import"../chunk-v2p7c7s4.js";export{Cc as AwsBoxProvisioner,mr as AwsDriver,ep as BOOT_PARTITION_LABEL,Ds as CloudDriverFactory,Bu as DEFAULT_HOST_CLEANUP_ESCALATED,Oh as DEFAULT_HOST_CLEANUP_HIGH_WATER_PERCENT,_h as DEFAULT_HOST_CLEANUP_LOW_WATER_PERCENT,ku as DEFAULT_HOST_CLEANUP_RETENTION,xh as DEFAULT_HOST_CLEANUP_SCHEDULE,Dn as DEFAULT_RPX_CERTS_DIR,Zu as FIRST_BOOT_SCRIPT_PATH,fr as HOST_ARTIFACT_CACHE_DIR,kh as HOST_CLEANUP_SCRIPT_PATH,Bh as HOST_CLEANUP_UNIT,Sc as HetznerBoxProvisioner,yr as HetznerClient,Ce as HetznerDriver,dc as LEGACY_DRIVER_STATE_DIR,ws as LocalBoxDriver,ap as MANAGED_CACHE_POLICY_DISABLED,op as MANAGED_CACHE_POLICY_OPTIMIZED,cp as MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,Uu as RASPBERRY_PI_DEFAULT_SWAP_GB,ic as REMOTE_SCRIPT_RUNNER,kn as RPX_DIR,tc as RPX_LAUNCHER_PATH,Ie as RPX_SERVICE_NAME,mc as SSH_BOOTSTRAP_MARKER_DIR,Ee as SSH_BOOTSTRAP_VERSION,ot as SSH_DEFAULTS,Jn as SSH_DEPLOY_STORAGE_PATH,Ou as SSH_INSECURE_HOST_KEY_OPTS,xu as SSH_KEEPALIVE_OPTS,Vn as SSH_PREFLIGHT_SCRIPT,Ju as SSH_SKIP_BOOTSTRAP_ENV,Sr as SshDriver,Ir as SystemSshTransport,yc as UBUNTU_2404_AMI_PARAM,qh as acquireResizeLock,Fh as applyHetznerHostOptimization,Rs as assertArchSupported,Xu as assertSshComputeConfig,sc as buildAwsArtifactFetch,Ic as buildBoxUserData,jh as buildCloudFrontOriginConfig,hc as buildCloudInitFirstBoot,ip as buildHetznerHostOptimizationScript,Ln as buildHostCleanupDeployScript,_u as buildHostCleanupExecutable,Ts as buildHostCleanupInstallScript,xn as buildHostCleanupScript,oc as buildLocalArtifactFetch,K as buildRpxConfig,xe as buildRpxFragmentRefreshScript,gr as buildRpxLbConfig,Se as buildRpxProvisionScript,Lu as buildScpArgsFor,Mn as buildSiteDeployScript,Bn as buildSshArgs,uc as buildSshArgsFor,Gn as buildSshBootstrapScript,Un as buildStaticSiteDeployScript,Yu as cloudDrivers,Uh as collectHetznerHostOptimizationReport,fc as collectHetznerResizeManifest,Vh as createBoxProvisioner,k as createCloudDriver,vc as deployAllComputeSites,ks as deploySiteRelease,ec as deriveRouteId,wn as describeScriptSyntaxError,nt as driverStateDir,$e as driverStatePath,Yn as ensureFirewall,Zn as ensureServer,Xn as ensureSshKey,zn as evaluatePreflight,Lh as executeHetznerServerResize,Mu as findKnownHostKey,Wn as formatPreflightFindings,Rt as formatSshFailure,Nn as gatewayHostnames,N as generateUbuntuAppCloudInit,Pn as hasAutoWwwVariant,lc as isBoxMode,rp as isHetznerCapacityError,Rn as isLocalDatabase,$u as knownHostsLine,pc as knownHostsToken,Pu as normalizeRoutePath,Le as normalizeSshPublicKey,jn as parsePreflightFacts,tp as planHetznerServerResize,Kn as preflightFailed,$h as prepareHetznerResize,Me as readDriverState,Hh as readResizeCheckpoint,Qn as releaseTarballTmpPath,ri as reloadRpxGateway,On as remoteScriptRunner,Nh as renderRpxLauncher,Tc as renewRpxCertificates,Ac as resizeCheckpointPath,sp as resizeLockPath,$n as resolveExecStart,cc as resolveHetznerApiToken,np as resolveHetznerHostOptimizationPlan,Ar as resolveHostCleanupConfig,Vu as resolveSshHostKeyPolicy,Qu as resolveSshHosts,Wu as resolveSshLan,Gu as resolveSshPort,qu as resolveSshPrivateKeyPath,zu as resolveSshProfile,Ku as resolveSshPublicIp,qn as resolveSshSettings,ju as resolveSshSudo,Hu as resolveSshUser,Hn as scanHostKey,rc as scpUpload,ei as serverPublicIpv4,Fu as sshBootstrapMarkerPath,hr as sshExec,ce as sshExecOrThrow,st as sshHostKeyFingerprint,gc as sshKnownHostsPath,Dt as summarizeRemoteFailures,lr as surfaceRemoteNotices,Qh as verifyHetznerHostOptimization,Mh as verifyHetznerResize,nc as waitForCloudInit,_n as waitForSsh,W as wrapCloudInitUserData,it as writeDriverState,Gh as writeResizeCheckpoint};
@@ -37,15 +37,22 @@ export interface BuildCloudFrontOriginOptions {
37
37
  * receives the same origin secret header, so lock it down the same way.
38
38
  * The default cache behavior targets the origin group; path behaviors stay
39
39
  * on the primary.
40
- * @experimental Built against the AWS documentation; not yet exercised against a live distribution.
41
40
  */
42
41
  failoverOriginDomain?: string;
43
42
  /**
44
43
  * Primary-origin status codes that trigger failover. Allowed: 400, 403, 404,
45
44
  * 416, 429, 500, 502, 503, 504. @default [500, 502, 503, 504]
46
- * @experimental
47
45
  */
48
46
  failoverStatusCodes?: number[];
47
+ /**
48
+ * Times CloudFront tries to connect to {@link originDomain}, 1-3. @default 3
49
+ *
50
+ * With {@link connectionTimeout} this bounds how long an unreachable primary
51
+ * holds a request before CloudFront fails over (3 x 10 seconds by default).
52
+ */
53
+ connectionAttempts?: number;
54
+ /** Seconds CloudFront waits to connect to {@link originDomain}, 1-10. @default 10 */
55
+ connectionTimeout?: number;
49
56
  }
50
57
  /**
51
58
  * Build a complete CloudFront `DistributionConfig` for a self-hosted origin.
@@ -360,9 +360,11 @@ export declare function releaseTarballTmpPath(slug: string | undefined, siteName
360
360
  export declare function buildAwsArtifactFetch(bucket: string, key: string, region: string, destPath: string): string[];
361
361
  export declare function buildLocalArtifactFetch(localPath: string, destPath: string): string[];
362
362
  /**
363
- * Bounded, multi-tenant-safe host maintenance run after a successful deploy.
364
- * Current and rollback releases are deliberately out of scope: their retention
365
- * is managed by buildPruneReleases. This only removes abandoned staging/temp
366
- * archives, aged package caches, unused container images, and old journals.
363
+ * Publish a completed upload into the artifact cache, then stage this deploy's
364
+ * copy. The `chmod` precedes the rename, so a cached artifact is never
365
+ * world-readable and never visible half-written.
367
366
  */
368
- export declare function buildHostCleanupScript(): string[];
367
+ export declare function buildPublishUploadScript(uploadPath: string, cachedPath: string, stagingPath: string): string;
368
+ /** Remove a failed upload's temp file. Never fails: it runs on an error path. */
369
+ export declare function buildDiscardUploadScript(uploadPath: string): string;
370
+ export { buildHostCleanupScript, HOST_ARTIFACT_CACHE_DIR } from './host-cleanup';
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Bounded, multi-tenant-safe disk retention for box hosts.
3
+ *
4
+ * One rule set, three triggers: the tail of every deploy, the failure path of a
5
+ * deploy (a run that died partway is the one most likely to have left
6
+ * something behind), and a systemd timer, so a box that stops deploying still
7
+ * cleans. The rules are time-bounded, so none of them assumes a deploy just
8
+ * finished.
9
+ *
10
+ * Current and rollback releases are out of scope: `buildPruneReleases` and
11
+ * `keepReleases` own those. This only removes abandoned staging and temp
12
+ * archives, the aged release artifact cache, aged package caches, unused
13
+ * container images, old journals and operator-registered paths.
14
+ */
15
+ import type { ComputeHostCleanupConfig, HostCleanupPathRule, HostCleanupRetention } from '@ts-cloud/core';
16
+ /**
17
+ * Content-addressed release cache on a box host (Hetzner and ssh drivers).
18
+ *
19
+ * `uploadRelease` keeps one immutable `<sha256>.tar.gz` per distinct tarball so
20
+ * the second and later sites of one deploy copy it locally instead of
21
+ * re-uploading. Uploads land as `.<sha256>-<nonce>.tmp` and are renamed into
22
+ * place once complete. Retention for both lives here, not in the upload path.
23
+ */
24
+ export declare const HOST_ARTIFACT_CACHE_DIR = "/var/ts-cloud/artifacts";
25
+ /** Where the cleanup is installed on the host, shared by the timer and deploys. */
26
+ export declare const HOST_CLEANUP_SCRIPT_PATH = "/usr/local/bin/ts-cloud-host-cleanup.sh";
27
+ export declare const HOST_CLEANUP_UNIT = "ts-cloud-host-cleanup";
28
+ /** Fully resolved retention windows. */
29
+ export type ResolvedHostCleanupRetention = Required<HostCleanupRetention>;
30
+ export declare const DEFAULT_HOST_CLEANUP_RETENTION: Readonly<ResolvedHostCleanupRetention>;
31
+ /**
32
+ * Windows at or above the high-water mark. The in-flight bounds (staging and
33
+ * `.tmp` uploads) are deliberately not shortened: they protect a concurrent
34
+ * deploy, and deleting its upload mid-transfer would turn disk pressure into a
35
+ * failed release.
36
+ */
37
+ export declare const DEFAULT_HOST_CLEANUP_ESCALATED: Readonly<HostCleanupRetention>;
38
+ export declare const DEFAULT_HOST_CLEANUP_LOW_WATER_PERCENT = 50;
39
+ export declare const DEFAULT_HOST_CLEANUP_HIGH_WATER_PERCENT = 85;
40
+ export declare const DEFAULT_HOST_CLEANUP_SCHEDULE = "daily";
41
+ export interface ResolvedHostCleanupConfig {
42
+ enabled: boolean;
43
+ timer: boolean;
44
+ schedule: string;
45
+ retention: ResolvedHostCleanupRetention;
46
+ /** `null` when pressure awareness is off: every rule runs with `retention`. */
47
+ pressure: null | {
48
+ lowWaterPercent: number;
49
+ highWaterPercent: number;
50
+ escalated: ResolvedHostCleanupRetention;
51
+ };
52
+ paths: HostCleanupPathRule[];
53
+ }
54
+ /**
55
+ * Resolve `compute.hostCleanup` to concrete values, filling defaults and
56
+ * rejecting values that would make the generated shell unsafe. Throws on an
57
+ * invalid config, which surfaces before anything reaches a host.
58
+ */
59
+ export declare function resolveHostCleanupConfig(config?: boolean | ComputeHostCleanupConfig): ResolvedHostCleanupConfig;
60
+ /**
61
+ * The cleanup itself, as shell lines safe to splice into a `set -euo pipefail`
62
+ * script: every command tolerates failure and every variable is assigned
63
+ * before it is read. Contains no here-documents.
64
+ *
65
+ * With pressure awareness on (the default) it reads root-filesystem usage
66
+ * first and picks a tier: `light` below the low-water mark (cheap rules only),
67
+ * `pressure` at or above the high-water mark (every rule, escalated windows,
68
+ * a warning), and `normal` in between or when usage cannot be read. Every run
69
+ * ends with one machine-readable `[ts-cloud] host-cleanup {...}` line.
70
+ */
71
+ export declare function buildHostCleanupScript(config?: boolean | ComputeHostCleanupConfig): string[];
72
+ /**
73
+ * The standalone script the timer and every deploy run. It takes a lock so a
74
+ * timer run and a deploy (or two deploys on a shared box) never prune at once;
75
+ * the loser skips rather than waits, since the winner is doing the same work.
76
+ */
77
+ export declare function buildHostCleanupExecutable(config?: boolean | ComputeHostCleanupConfig): string[];
78
+ /**
79
+ * Install (or update, or remove) the cleanup script and its systemd timer.
80
+ * Idempotent: an unchanged deploy rewrites nothing and reloads nothing. Every
81
+ * line tolerates failure, so it can run inside a deploy that already
82
+ * succeeded, in cloud-init, or on a host without systemd.
83
+ */
84
+ export declare function buildHostCleanupInstallScript(config?: boolean | ComputeHostCleanupConfig): string[];
85
+ /**
86
+ * What a deploy runs: install or refresh the cleanup and its timer, then run it
87
+ * once now. Empty when `hostCleanup: false`, except for removing a timer an
88
+ * earlier deploy installed.
89
+ */
90
+ export declare function buildHostCleanupDeployScript(config?: boolean | ComputeHostCleanupConfig): string[];
@@ -2,7 +2,7 @@
2
2
  * Infrastructure Generator
3
3
  * Generates CloudFormation templates from cloud.config.ts using all Phase 2 modules
4
4
  */
5
- import type { CloudConfig } from '@ts-cloud/core';
5
+ import type { CloudConfig, StorageFailoverReplica } from '@ts-cloud/core';
6
6
  import { TemplateBuilder } from '@ts-cloud/core';
7
7
  export interface GenerationOptions {
8
8
  config: CloudConfig;
@@ -15,6 +15,8 @@ export declare class InfrastructureGenerator {
15
15
  private environment;
16
16
  private mergedConfig;
17
17
  private serverEipLogicalIds;
18
+ /** Failover replicas the generated stack depends on, recorded in the template metadata. */
19
+ private storageFailoverReplicas;
18
20
  constructor(options: GenerationOptions);
19
21
  /**
20
22
  * Merge base config with environment-specific overrides
@@ -60,6 +62,12 @@ export declare class InfrastructureGenerator {
60
62
  * Auto-detects what to generate based on configuration
61
63
  */
62
64
  generate(): this;
65
+ /**
66
+ * Failover replicas of the last {@link generate}, empty when no bucket sets
67
+ * failover. The template metadata holds the same list under the
68
+ * TsCloud::StorageFailover key.
69
+ */
70
+ getStorageFailoverReplicas(): StorageFailoverReplica[];
63
71
  /**
64
72
  * Apply global tags to all resources
65
73
  */
package/dist/index.d.ts CHANGED
@@ -34,12 +34,12 @@ export type { ObjectStorageConfig, ObjectStorageCredentials, ObjectStorageProvid
34
34
  export { keyMatchesFilters, migrateObjectStorage, remapKey } from './object-storage/migrate';
35
35
  export type { MigrateEndpoint, MigrateError, MigrateOptions, MigratePlanItem, MigrateProgress, MigrateResult, MigrateVerification, } from './object-storage/migrate';
36
36
  export * from './ssl';
37
- export { deployStaticSite, deployStaticSiteFull, uploadStaticFiles, invalidateCache, deleteStaticSite, generateStaticSiteTemplate, deployStaticSiteWithExternalDns, deployStaticSiteWithExternalDnsFull, generateExternalDnsStaticSiteTemplate, deploySite, hasProxyUpstream, resolveProxyUpstreams, resolveSiteDeployTarget, resolveSiteKind, shipsARelease, siteInstallBase, validateDeploymentConfig, addSiteToCloudConfig, allocateSitePorts, buildHostSitePortsScript, HOST_SITES_DIR, occupiedHostPorts, parseHostSiteFragments, parseUpstreamPort, removeSiteFromCloudConfig, setAttachToInCloudConfig, setSitePropertyInCloudConfig, updateSiteInCloudConfig, buildAndPushServerlessImage, buildFunctionEnv, deployServerlessApp, infraEnvFromOutputs, redeployServerlessApp, rollbackServerlessApp, runRemoteCommand, setMaintenance, buildManagementDashboardArtifact, dashboardCredentialsFile, ensureManagementDashboard, MANAGEMENT_DASHBOARD_SITE, resolveDashboardAuth, resolveUiSource, } from './deploy';
37
+ export { deployStaticSite, deployStaticSiteFull, uploadStaticFiles, invalidateCache, deleteStaticSite, generateStaticSiteTemplate, deleteFailoverReplicaBuckets, ensureFailoverReplicaBuckets, grantFailoverReplicaAccess, seedFailoverReplicas, deployStaticSiteWithExternalDns, deployStaticSiteWithExternalDnsFull, generateExternalDnsStaticSiteTemplate, deploySite, hasProxyUpstream, resolveProxyUpstreams, resolveSiteDeployTarget, resolveSiteKind, shipsARelease, siteInstallBase, validateDeploymentConfig, addSiteToCloudConfig, allocateSitePorts, buildHostSitePortsScript, HOST_SITES_DIR, occupiedHostPorts, parseHostSiteFragments, parseUpstreamPort, removeSiteFromCloudConfig, setAttachToInCloudConfig, setSitePropertyInCloudConfig, updateSiteInCloudConfig, buildAndPushServerlessImage, buildFunctionEnv, deployServerlessApp, infraEnvFromOutputs, redeployServerlessApp, rollbackServerlessApp, runRemoteCommand, setMaintenance, buildManagementDashboardArtifact, dashboardCredentialsFile, ensureManagementDashboard, MANAGEMENT_DASHBOARD_SITE, resolveDashboardAuth, resolveUiSource, } from './deploy';
38
38
  export { collectServerDnsDomains, hostAcceptsIpv6, IPV6_EXCLUDED_HOST_LABELS, normalizePublicIpv6, reconcileAddressRecords, removeStaleServerAddressRecords, verifyAddressRecord, } from './deploy/server-dns';
39
39
  export type { AddressRecordReport } from './deploy/server-dns';
40
40
  export * from './cdn';
41
41
  export type { EnsureDashboardLogger, ResolvedDashboardAuth, StaticSiteConfig, DeployResult, UploadOptions, ExternalDnsStaticSiteConfig, ExternalDnsDeployResult, DeploySiteConfig, DeploySiteResult, StaticSiteDnsProvider, SiteDeployKind, DeploymentValidationResult, BuildImageOptions, BuiltImage, CodeSource, DeployServerlessOptions, ResolvedContext, } from './deploy';
42
- export { createCloudDriver, CloudDriverFactory, cloudDrivers, AwsDriver, HetznerDriver, SshDriver, SystemSshTransport, resolveSshSettings, buildSshBootstrapScript, SSH_BOOTSTRAP_VERSION, evaluatePreflight, formatPreflightFindings, parsePreflightFacts, preflightFailed, SSH_PREFLIGHT_SCRIPT, buildCloudInitFirstBoot, driverStatePath, readDriverState, writeDriverState, HetznerClient, resolveHetznerApiToken, normalizeSshPublicKey, ensureFirewall, ensureServer, ensureSshKey, serverPublicIpv4, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, buildSshArgs, generateUbuntuAppCloudInit, wrapCloudInitUserData, buildHostCleanupScript, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, deployAllComputeSites, deploySiteRelease, isLocalDatabase, reloadRpxGateway, renewRpxCertificates, gatewayHostnames, hasAutoWwwVariant, DEFAULT_RPX_CERTS_DIR, buildRpxConfig, buildRpxFragmentRefreshScript, } from './drivers';
42
+ export { createCloudDriver, CloudDriverFactory, cloudDrivers, AwsDriver, HetznerDriver, SshDriver, SystemSshTransport, resolveSshSettings, buildSshBootstrapScript, SSH_BOOTSTRAP_VERSION, evaluatePreflight, formatPreflightFindings, parsePreflightFacts, preflightFailed, SSH_PREFLIGHT_SCRIPT, buildCloudInitFirstBoot, driverStatePath, readDriverState, writeDriverState, HetznerClient, resolveHetznerApiToken, normalizeSshPublicKey, ensureFirewall, ensureServer, ensureSshKey, serverPublicIpv4, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, buildSshArgs, generateUbuntuAppCloudInit, wrapCloudInitUserData, buildHostCleanupScript, buildHostCleanupDeployScript, buildHostCleanupInstallScript, resolveHostCleanupConfig, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, deployAllComputeSites, deploySiteRelease, isLocalDatabase, reloadRpxGateway, renewRpxCertificates, gatewayHostnames, hasAutoWwwVariant, DEFAULT_RPX_CERTS_DIR, buildRpxConfig, buildRpxFragmentRefreshScript, } from './drivers';
43
43
  export type { CreateCloudDriverOptions } from './drivers/factory';
44
44
  export type { DriverState, FirstBootBundle, FirstBootIdentity, FirstBootOs, ResolvedSshSettings, SshDriverOptions, SshDriverState, SshPreflightFacts, SshTransport, SshTransportOptions, } from './drivers';
45
45
  export { dashboardActions, resolveDashboardAction, sanitizeCloudConfig, startLocalDashboardServer, } from './deploy/local-dashboard-server';