@stacksjs/ts-cloud 0.12.12 → 0.12.13
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.
- package/dist/aws/index.js +1 -1
- package/dist/bin/chunk-0vsxpmfj.js +3 -0
- package/dist/bin/chunk-12e9v1dw.js +3 -0
- package/dist/bin/chunk-13dhcjjb.js +60 -0
- package/dist/bin/chunk-1fj5gk6r.js +725 -0
- package/dist/bin/chunk-1j2sja1j.js +1 -0
- package/dist/bin/chunk-1s4dny8d.js +1 -0
- package/dist/bin/chunk-2hpnd4g4.js +1 -0
- package/dist/bin/chunk-49sthm4q.js +2 -0
- package/dist/bin/chunk-4yntpqbe.js +1 -0
- package/dist/bin/chunk-4zbnwt9b.js +2 -0
- package/dist/bin/chunk-55kmbzr5.js +1 -0
- package/dist/{chunk-2ybcnrte.js → bin/chunk-57w9nsjk.js} +3 -3
- package/dist/bin/chunk-5gehfky4.js +2 -0
- package/dist/bin/chunk-6xw0r4gn.js +7364 -0
- package/dist/bin/chunk-6zk2n3wk.js +511 -0
- package/dist/bin/{chunk-wcem4cqb.js → chunk-7a7n6p2m.js} +2 -2
- package/dist/bin/chunk-7h6h8yxm.js +6 -0
- package/dist/bin/chunk-7x0hrna6.js +1 -0
- package/dist/bin/{chunk-e2dnxp8d.js → chunk-80zkjpfz.js} +29 -29
- package/dist/bin/chunk-84tvv3x1.js +1 -0
- package/dist/bin/chunk-94cfdvrn.js +2 -0
- package/dist/bin/chunk-96xtj5j6.js +1 -0
- package/dist/bin/chunk-9jfjzycs.js +111 -0
- package/dist/{chunk-ac87ds1k.js → bin/chunk-bckm6fre.js} +6 -6
- package/dist/bin/chunk-bnv8yd9w.js +6 -0
- package/dist/bin/chunk-c51xp8f7.js +1 -0
- package/dist/bin/chunk-d5qhwtkg.js +9 -0
- package/dist/bin/chunk-d7r6mhyv.js +34 -0
- package/dist/bin/chunk-de88yqwy.js +1 -0
- package/dist/bin/chunk-dh2qmxw9.js +1 -0
- package/dist/bin/chunk-dhxwmkhz.js +2 -0
- package/dist/bin/chunk-f35pte64.js +44 -0
- package/dist/bin/{chunk-jxd3j00s.js → chunk-gj5jkhfr.js} +13 -13
- package/dist/bin/chunk-jcyrm5q0.js +2 -0
- package/dist/bin/chunk-jh1593zx.js +1 -0
- package/dist/bin/chunk-nnkhrm4n.js +8 -0
- package/dist/bin/chunk-p36ns96s.js +1 -0
- package/dist/bin/{chunk-t5ngva49.js → chunk-p9hd27k4.js} +8 -8
- package/dist/bin/chunk-qz3za76g.js +1 -0
- package/dist/bin/chunk-r6cvc2pr.js +1 -0
- package/dist/bin/chunk-rh2sqtew.js +1 -0
- package/dist/bin/chunk-rxwecjgc.js +1 -0
- package/dist/bin/chunk-tkzpbb7n.js +1 -0
- package/dist/bin/chunk-vx649y7t.js +1 -0
- package/dist/bin/chunk-vymg9ywg.js +2 -0
- package/dist/bin/chunk-w7k5rvmw.js +1 -0
- package/dist/bin/chunk-wge61ccr.js +2 -0
- package/dist/bin/chunk-wvhqjr80.js +2 -0
- package/dist/bin/chunk-x5x9dzk7.js +3 -0
- package/dist/bin/chunk-xaafj6kf.js +1 -0
- package/dist/bin/chunk-xgepx8yx.js +1 -0
- package/dist/bin/{chunk-t7rcfwqc.js → chunk-yhxpmk29.js} +32 -32
- package/dist/bin/chunk-ymbwekjm.js +1 -0
- package/dist/bin/chunk-yn34zgr2.js +1 -0
- package/dist/bin/chunk-ynr22ma8.js +2 -0
- package/dist/bin/chunk-yt8rgkqt.js +2 -0
- package/dist/bin/chunk-z2ez8wn9.js +37 -0
- package/dist/bin/cli.js +428 -428
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/chunk-13d54txj.js +44 -0
- package/dist/chunk-1kp3y2s7.js +1 -0
- package/dist/chunk-1n3ckctd.js +7355 -0
- package/dist/chunk-30h9rgfn.js +6 -0
- package/dist/chunk-3kapcdpn.js +92 -0
- package/dist/chunk-3qp10j0j.js +5 -0
- package/dist/chunk-6g81m01r.js +141 -0
- package/dist/{chunk-6cxb8d6y.js → chunk-6nvn041c.js} +3 -3
- package/dist/chunk-7by4rm7y.js +1 -0
- package/dist/chunk-7ww65b66.js +709 -0
- package/dist/chunk-9c29rnk3.js +22 -0
- package/dist/chunk-9w32efae.js +1 -0
- package/dist/chunk-e0919h5g.js +2 -0
- package/dist/{chunk-dndxwssj.js → chunk-e7ds04wb.js} +2 -2
- package/dist/chunk-edqhhcg9.js +4 -0
- package/dist/chunk-ej4sm2tw.js +60 -0
- package/dist/chunk-emg3shmb.js +2 -0
- package/dist/chunk-fdexq9e1.js +1 -0
- package/dist/chunk-g8fpsdyq.js +37 -0
- package/dist/chunk-jb8em9ba.js +2 -0
- package/dist/chunk-n688m5fp.js +1 -0
- package/dist/chunk-r5emv4x8.js +2 -0
- package/dist/{chunk-q9a1z53k.js → chunk-sct6mdgc.js} +51 -51
- package/dist/chunk-thpce63q.js +34 -0
- package/dist/chunk-tnjae324.js +585 -0
- package/dist/{bin/chunk-m9r5jype.js → chunk-wjgnfg6q.js} +6 -6
- package/dist/chunk-wpqj98h8.js +2 -0
- package/dist/chunk-wrnhbb13.js +1 -0
- package/dist/chunk-zftpjxkr.js +2 -0
- package/dist/chunk-zmyv76f0.js +114 -0
- package/dist/deploy/index.js +1 -1
- package/dist/dns/index.js +1 -1
- package/dist/drivers/index.d.ts +1 -0
- package/dist/drivers/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +91 -91
- package/dist/operations/index.js +1 -1
- package/dist/protection/index.js +1 -1
- package/dist/push/index.js +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/accept-invitation.html +1 -1
- package/dist/ui/access-denied.html +1 -1
- package/dist/ui/account/automation.html +5 -5
- package/dist/ui/account/security.html +1 -1
- package/dist/ui/applications/compose.html +6 -6
- package/dist/ui/applications/new.html +1 -1
- package/dist/ui/data/backups.html +6 -6
- package/dist/ui/data/services.html +7 -7
- package/dist/ui/data/volumes.html +5 -5
- package/dist/ui/index.html +6 -6
- package/dist/ui/infrastructure/topology.html +9 -9
- package/dist/ui/integrations.html +2 -2
- package/dist/ui/operations/alerts.html +6 -6
- package/dist/ui/operations/configuration.html +5 -5
- package/dist/ui/operations/jobs.html +6 -6
- package/dist/ui/operations/maintenance.html +5 -5
- package/dist/ui/operations/observability.html +6 -6
- package/dist/ui/operations/previews.html +6 -6
- package/dist/ui/operations/queue.html +6 -6
- package/dist/ui/operations/regions.html +5 -5
- package/dist/ui/operations/releases.html +6 -6
- package/dist/ui/operations/spend.html +6 -6
- package/dist/ui/operations/workloads.html +10 -10
- package/dist/ui/security.html +2 -2
- package/dist/ui/server/actions.html +6 -6
- package/dist/ui/server/activity.html +2 -2
- package/dist/ui/server/capacity.html +6 -6
- package/dist/ui/server/database.html +6 -6
- package/dist/ui/server/deployments.html +5 -5
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +6 -6
- package/dist/ui/server/fleet.html +6 -6
- package/dist/ui/server/logs.html +5 -5
- package/dist/ui/server/metrics.html +5 -5
- package/dist/ui/server/security.html +2 -2
- package/dist/ui/server/services.html +2 -2
- package/dist/ui/server/sites.html +17 -17
- package/dist/ui/server/ssh-keys.html +5 -5
- package/dist/ui/server/team.html +5 -5
- package/dist/ui/server/terminal.html +2 -2
- package/dist/ui/serverless/alarms.html +6 -6
- package/dist/ui/serverless/assets.html +2 -2
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +6 -6
- package/dist/ui/serverless/deployments.html +2 -2
- package/dist/ui/serverless/firewall.html +2 -2
- package/dist/ui/serverless/functions.html +6 -6
- package/dist/ui/serverless/logs.html +6 -6
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +6 -6
- package/dist/ui/serverless/secrets.html +6 -6
- package/dist/ui/serverless/traces.html +6 -6
- package/dist/ui/serverless.html +6 -6
- package/dist/ui-src/src/charts.ts +1141 -1294
- package/dist/ui-src/src/topology.ts +3 -3
- package/package.json +3 -3
- package/dist/bin/chunk-0b49jjgr.js +0 -2
- package/dist/bin/chunk-0xnnkeb1.js +0 -1
- package/dist/bin/chunk-227jmf2b.js +0 -2
- package/dist/bin/chunk-2nyyg44g.js +0 -1
- package/dist/bin/chunk-2ztr119n.js +0 -3
- package/dist/bin/chunk-43xj5cny.js +0 -1
- package/dist/bin/chunk-5w6y9pmz.js +0 -1
- package/dist/bin/chunk-5x4rdx8k.js +0 -37
- package/dist/bin/chunk-6zc6a6t3.js +0 -725
- package/dist/bin/chunk-7aagqqr9.js +0 -1
- package/dist/bin/chunk-85qrgshq.js +0 -44
- package/dist/bin/chunk-8zk8msx0.js +0 -2
- package/dist/bin/chunk-9j83q0r4.js +0 -1
- package/dist/bin/chunk-9nhqbes6.js +0 -60
- package/dist/bin/chunk-a4js49mx.js +0 -1
- package/dist/bin/chunk-a9e0hvwe.js +0 -6
- package/dist/bin/chunk-a9tgxf2h.js +0 -1
- package/dist/bin/chunk-aahrv359.js +0 -1
- package/dist/bin/chunk-bfx23be3.js +0 -1
- package/dist/bin/chunk-bpps61am.js +0 -111
- package/dist/bin/chunk-bzth6d1s.js +0 -6
- package/dist/bin/chunk-ca3taw2m.js +0 -1
- package/dist/bin/chunk-cgzp0328.js +0 -1
- package/dist/bin/chunk-d2aaef9v.js +0 -1
- package/dist/bin/chunk-e0z2t4mf.js +0 -6
- package/dist/bin/chunk-empfsmdk.js +0 -2
- package/dist/bin/chunk-er3mww4m.js +0 -1
- package/dist/bin/chunk-fmp5bv0j.js +0 -3
- package/dist/bin/chunk-g3kp5ddx.js +0 -1
- package/dist/bin/chunk-grepda40.js +0 -1
- package/dist/bin/chunk-h6xqtypj.js +0 -2
- package/dist/bin/chunk-hwk9ahms.js +0 -2
- package/dist/bin/chunk-k1xw3zbm.js +0 -34
- package/dist/bin/chunk-m07s5esk.js +0 -2
- package/dist/bin/chunk-n20kbxwb.js +0 -7364
- package/dist/bin/chunk-n2fnav53.js +0 -3
- package/dist/bin/chunk-nv211m42.js +0 -8
- package/dist/bin/chunk-psgjy3z4.js +0 -1
- package/dist/bin/chunk-qmnr82da.js +0 -1
- package/dist/bin/chunk-qqpb82ty.js +0 -2
- package/dist/bin/chunk-rqc8btkj.js +0 -2
- package/dist/bin/chunk-rs85xvt7.js +0 -1
- package/dist/bin/chunk-sj5csg49.js +0 -2
- package/dist/bin/chunk-tjgy10zm.js +0 -9
- package/dist/bin/chunk-v0beqdna.js +0 -1
- package/dist/bin/chunk-vf2s3tba.js +0 -1
- package/dist/bin/chunk-vzkfjrx2.js +0 -511
- package/dist/bin/chunk-wsh5ervz.js +0 -1
- package/dist/bin/chunk-xenhbdmr.js +0 -1
- package/dist/bin/chunk-xrdpxwbf.js +0 -1
- package/dist/bin/chunk-y68m9bx7.js +0 -2
- package/dist/chunk-4884der5.js +0 -1
- package/dist/chunk-4wdxsnn2.js +0 -44
- package/dist/chunk-5hhyyhjt.js +0 -1
- package/dist/chunk-5zkacdw1.js +0 -1
- package/dist/chunk-6f68caq0.js +0 -1
- package/dist/chunk-7z50g5xz.js +0 -4
- package/dist/chunk-8fh4m5ge.js +0 -1
- package/dist/chunk-97pb7wb1.js +0 -1
- package/dist/chunk-ea7tn8nn.js +0 -709
- package/dist/chunk-ess6vxfj.js +0 -2
- package/dist/chunk-j06r5rwv.js +0 -2
- package/dist/chunk-j1g67djb.js +0 -92
- package/dist/chunk-k8x8mrkr.js +0 -2
- package/dist/chunk-mnmz8t7q.js +0 -34
- package/dist/chunk-n1fyryha.js +0 -141
- package/dist/chunk-n1hg0jxs.js +0 -2
- package/dist/chunk-n5xmh0ma.js +0 -37
- package/dist/chunk-q22qfwsc.js +0 -22
- package/dist/chunk-r8t25tbm.js +0 -7355
- package/dist/chunk-t8hzekmk.js +0 -585
- package/dist/chunk-whyttetx.js +0 -5
- package/dist/chunk-yf8stygs.js +0 -114
- package/dist/chunk-ze5x2bpm.js +0 -2
- package/dist/chunk-zh0apedk.js +0 -60
- package/dist/chunk-zjyz926j.js +0 -2
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import*as _ from"node:crypto";import{existsSync as V,readFileSync as Y}from"node:fs";import{homedir as W}from"node:os";import{join as B}from"node:path";var j={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"},z={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 D{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 n=t.indexOf(";",e+1);if(n===-1||n-e>32){i+="&",s=e+1,e=t.indexOf("&",s);continue}let a=t.substring(e+1,n);if(a.charCodeAt(0)===35){let o=a.length,d=0,p=!1;if(o>2&&(a.charCodeAt(1)===120||a.charCodeAt(1)===88)){p=!0;for(let g=2;g<o;g++){let h=a.charCodeAt(g);if(h>=48&&h<=57)d=d<<4|h-48;else if(h>=65&&h<=70)d=d<<4|h-55;else if(h>=97&&h<=102)d=d<<4|h-87;else{p=!1;break}}}else if(o>1){p=!0;for(let g=1;g<o;g++){let h=a.charCodeAt(g);if(h>=48&&h<=57)d=d*10+(h-48);else{p=!1;break}}}if(p)i+=String.fromCodePoint(d);else i+=t.substring(e,n+1)}else{let o=this.customEntities[a];if(o===void 0){let d=a.length;if(d>=2&&d<=4){let p=a.charCodeAt(0);if(p===108&&d===2&&a.charCodeAt(1)===116)o="<";else if(p===103&&d===2&&a.charCodeAt(1)===116)o=">";else if(p===97&&d===3&&a.charCodeAt(1)===109&&a.charCodeAt(2)===112)o="&";else if(p===113&&d===4)o=a==="quot"?'"':void 0;else if(p===97&&d===4)o=a==="apos"?"'":void 0}if(o===void 0)o=j[a]??(this.useHtmlEntities?z[a]:void 0)}if(o!==void 0)i+=o;else i+=t.substring(e,n+1)}s=n+1,e=t.indexOf("&",s)}if(s<r)i+=t.substring(s);return i}}var w=[];w[38]="&";w[60]="<";w[62]=">";w[34]=""";w[39]="'";var H={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 N(t){return t===32||t===9||t===10||t===13}function P(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 k(t){return P(t)||t===45||t===46||t>=48&&t<=57||t===183||t>=768&&t<=879||t>=8255&&t<=8256}var L=/^0x[\da-fA-F]+$/,X=/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/,M=/^[+-]?(\d+\.?\d*|\.\d+)$/;function v(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 I(t,e){let r=t.charCodeAt(e),i=t.charCodeAt(e+1),s=t.charCodeAt(e+2),n=t.charCodeAt(e+3),a=t.charCodeAt(e+4),o=t.charCodeAt(e+5),d=t.charCodeAt(e+6);return(r===68||r===100)&&(i===79||i===111)&&(s===67||s===99)&&(n===84||n===116)&&(a===89||a===121)&&(o===80||o===112)&&(d===69||d===101)}function G(t,e,r){if(e>=r||!P(t.charCodeAt(e)))return e;e++;while(e<r&&k(t.charCodeAt(e)))e++;return e}class O{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={...H,...t},this.entityDecoder=new D(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 G(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 n=0,a=this._removeNSPrefix,o=this.options.transformAttributeName,d=this._trimValues,p=this._processEntities,g=this.options.attributeValueProcessor;while(e<r){let h=t.charCodeAt(e);while(h===32||h===9||h===10||h===13){if(e++,e>=r)break;h=t.charCodeAt(e)}if(e>=r)break;if(h===62||h===47)break;let m=e;if(!P(h))break;e++;while(e<r&&k(t.charCodeAt(e)))e++;let f=t.substring(m,e);if(a){let A=f.indexOf(":");if(A!==-1)f=f.substring(A+1)}if(o)f=o(f);while(e<r&&N(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===61){e++;while(e<r&&N(t.charCodeAt(e)))e++;if(e>=r)break;let A=t.charCodeAt(e);if(A===34||A===39){e++;let b=e;while(e<r&&t.charCodeAt(e)!==A)e++;let u=t.substring(b,e);if(d&&u.length>0){let c=u.charCodeAt(0),l=u.charCodeAt(u.length-1);if(c<=32||l<=32)u=u.trim()}if(p)u=this.entityDecoder.decodeEntities(u);if(g)u=g(f,u,i)??u;if(s[f]=u,n++,e<r)e++}}else s[f]="true",n++}return n>0?-e-1:e}processTagValue(t,e,r,i,s){if(this._trimValues){let n=t.length;if(n>0){let a=t.charCodeAt(0),o=t.charCodeAt(n-1);if(a<=32||o<=32)t=t.trim()}}if(this._processEntities)t=this.entityDecoder.decodeEntities(t);if(this.options.tagValueProcessor){let n=this.options.tagValueProcessor(e,t,r,i,s);if(n!==void 0)t=n}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&&L.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&&X.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}if(M.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}`,n=t.indexOf(s,e);if(n===-1)return{content:t.substring(e),pos:r};let a=t.substring(e,n),o=n+s.length;while(o<r&&t.charCodeAt(o)!==62)o++;if(o<r)o++;return{content:a,pos:o}}addToObj(t,e,r,i,s,n){let a=t[e];if(a!==void 0)if(!Array.isArray(a))t[e]=[a,r];else a.push(r);else if(this.options.isArray?.(e,i,s,n))t[e]=[r];else t[e]=r}flushText(t,e,r,i){if(!t&&!e)return;let s=this._textNodeName;if(e){let n=t;if(n&&this._processEntities)n=this.entityDecoder.decodeEntities(n);let a=e+n;if(this._trimValues&&a.length>0){let o=a.charCodeAt(0),d=a.charCodeAt(a.length-1);if(o<=32||d<=32)a=a.trim()}if(this.options.tagValueProcessor){let o=this.options.tagValueProcessor(s,a,r,!1,!0);if(o!==void 0)a=o}if(a){let o=this._parseTagValue?this.parseValue(a):a;if(o!==void 0&&o!=="")this.addToObj(i,s,o,r,!0,!1)}}else{let n=this.processTagValue(t,s,r,!1,!0);if(n!==void 0&&n!=="")this.addToObj(i,s,n,r,!0,!1)}}parseChildren(t,e,r,i,s,n){let a="",o="",d=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let c=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!a)a=t.substring(c,e);else a+=t.substring(c,e);continue}if(e+1>=r)break;let g=t.charCodeAt(e+1);if(g===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(a||o)this.flushText(a,o,s,i),a="",o="";e+=4;let c=t.indexOf("-->",e);if(c===-1){e=r;break}if(this._commentPropName){let l=t.substring(e,c);this.addToObj(i,this._commentPropName,l,s,!0,!1)}e=c+3;continue}if(g===33&&e+8<r&&v(t,e+2)){e+=9;let c=t.indexOf("]]>",e);if(c===-1){e=r;break}let l=t.substring(e,c);if(this._cdataPropName)this.flushText(a,o,s,i),a="",o="",this.addToObj(i,this._cdataPropName,l,s,!0,!1);else{if(a){let C=a;if(this._processEntities)C=this.entityDecoder.decodeEntities(C);o+=C,a=""}o+=l}e=c+3;continue}if(g===33&&e+9<r&&I(t,e+2)){e+=9;let c=1;while(e<r&&c>0){let l=t.charCodeAt(e);if(l===60)c++;else if(l===62)c--;e++}continue}if(g===63){e+=2;let c=e;while(e<r&&!N(t.charCodeAt(e))&&t.charCodeAt(e)!==63)e++;let l=t.substring(c,e),C=t.indexOf("?>",e);if(C===-1){e=r;break}let y=t.substring(e,C).trim();if(l==="xml"){if(!this._ignoreDeclaration&&this._piPropName){let S=this.parsePiAttributes(y);this.addToObj(i,this._piPropName,{[l]:S},s,!0,!1)}}else if(!this._ignorePiTags&&this._piPropName)this.addToObj(i,this._piPropName,{[l]:y},s,!0,!1);e=C+2;continue}if(g===47){if(a||o)this.flushText(a,o,s,i),a="",o="";e+=2;let c=e,l=this.readTagName(t,e,r),C=this.extractTagName(t,c,l);e=l;while(e<r&&N(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;if(n.length>0&&n[n.length-1]===C){n.pop();continue}return e}if(a||o)this.flushText(a,o,s,i),a="",o="";e++;let h=e,m=this.readTagName(t,e,r),f=this.extractTagName(t,h,m);if(!f){e=m+1;continue}e=m;let A=d?s?`${s}.${f}`:f:"",b={},u=!1;if(!this._ignoreAttributes){let c=this.parseAttributes(t,e,r,A,b);if(c<0)e=-c-1,u=!0;else e=c}else while(e<r){let c=t.charCodeAt(e);if(c===62||c===47)break;if(c===34||c===39){e++;while(e<r&&t.charCodeAt(e)!==c)e++}e++}if(this.options.updateTag){if(this.options.updateTag(f,A,b)===!1){while(e<r&&N(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47)e+=2;else if(e<r&&t.charCodeAt(e)===62){e++;let l=`</${f}>`,C=t.indexOf(l,e);if(C!==-1)e=C+l.length}continue}}while(e<r&&N(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47){if(e+=2,u||this._alwaysCreateTextNode){let c={};if(u)this.applyAttributes(c,b,A);if(this._alwaysCreateTextNode)c[this._textNodeName]="";this.addToObj(i,f,c,A,!0,!1)}else this.addToObj(i,f,"",A,!0,!1);continue}if(e<r&&t.charCodeAt(e)===62){if(e++,this.unpairedSet.has(f)){if(u){let y={};this.applyAttributes(y,b,A),this.addToObj(i,f,y,A,!0,!1)}else this.addToObj(i,f,"",A,!0,!1);n.push(f);continue}if(this.exactStopNodes.size>0||this.wildcardStopSuffixes.length>0){if(this.isStopNode(A)){let y=this.readStopNodeContent(t,e,r,f),S={};if(u)this.applyAttributes(S,b,A);if(y.content)S[this._textNodeName]=y.content;this.addToObj(i,f,S,A,!0,!1),e=y.pos;continue}}let c={};if(u)this.applyAttributes(c,b,A);e=this.parseChildren(t,e,r,c,A,n);let l=this._textNodeName,C=c[l];if(!u&&!this._alwaysCreateTextNode){let y=!0;for(let S in c)if(S!==l){y=!1;break}if(y){this.addToObj(i,f,C!==void 0?C:"",A,!0,!1);continue}}this.addToObj(i,f,c,A,!1,!1)}}if(a||o)this.flushText(a,o,s,i);return e}parseChildrenOrdered(t,e,r,i,s){let n="",a=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let u=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!n)n=t.substring(u,e);else n+=t.substring(u,e);continue}if(e+1>=r)break;let d=t.charCodeAt(e+1);if(d===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(n){let c=this.processTagValue(n,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c});n=""}e+=4;let u=t.indexOf("-->",e);if(u===-1){e=r;break}if(this._commentPropName)i.push({[this._commentPropName]:[{[this._textNodeName]:t.substring(e,u)}]});e=u+3;continue}if(d===33&&e+8<r&&v(t,e+2)){e+=9;let u=t.indexOf("]]>",e);if(u===-1){e=r;break}let c=t.substring(e,u);if(this._cdataPropName){if(n){let l=this.processTagValue(n,this._textNodeName,s,!1,!0);if(l!==void 0&&l!=="")i.push({[this._textNodeName]:l});n=""}i.push({[this._cdataPropName]:[{[this._textNodeName]:c}]})}else n+=c;e=u+3;continue}if(d===33&&e+9<r&&I(t,e+2)){e+=9;let u=1;while(e<r&&u>0){let c=t.charCodeAt(e);if(c===60)u++;else if(c===62)u--;e++}continue}if(d===63){e+=2;let u=t.indexOf("?>",e);if(u===-1){e=r;break}e=u+2;continue}if(d===47){if(n){let c=this.processTagValue(n,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c});n=""}e+=2,e=this.readTagName(t,e,r);while(e<r&&N(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;return e}if(n){let u=this.processTagValue(n,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});n=""}e++;let p=e,g=this.readTagName(t,e,r),h=this.extractTagName(t,p,g);if(!h){e=g+1;continue}e=g;let m=a?s?`${s}.${h}`:h:"",f={},A=!1;if(!this._ignoreAttributes){let u=this.parseAttributes(t,e,r,m,f);if(u<0)e=-u-1,A=!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++}while(e<r&&N(t.charCodeAt(e)))e++;let b={[h]:[]};if(A){b[":@"]={};for(let c in f)b[":@"][this._attrPrefix+c]=this.parseAttributeValue(f[c])}if(e<r&&t.charCodeAt(e)===47){e+=2,i.push(b);continue}if(e<r&&t.charCodeAt(e)===62)e++,e=this.parseChildrenOrdered(t,e,r,b[h],m),i.push(b)}if(n){let o=this.processTagValue(n,this._textNodeName,s,!1,!0);if(o!==void 0&&o!=="")i.push({[this._textNodeName]:o})}return e}applyAttributes(t,e,r){let i=this._attrPrefix;if(this._attrsGroupName){let s={};for(let n in e)s[i+n]=this.parseAttributeValue(e[n]);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&&N(t.charCodeAt(r)))r++;if(r>=i)break;let s=r;while(r<i&&!N(t.charCodeAt(r))&&t.charCodeAt(r)!==61)r++;let n=t.substring(s,r);if(!n)break;while(r<i&&N(t.charCodeAt(r)))r++;if(r<i&&t.charCodeAt(r)===61){r++;while(r<i&&N(t.charCodeAt(r)))r++;if(r<i){let a=t.charCodeAt(r);if(a===34||a===39){r++;let o=r;while(r<i&&t.charCodeAt(r)!==a)r++;if(e[n]=t.substring(o,r),r<i)r++}}}}return e}}function R(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 n=t.path==="/"?`/${t.bucket}`:`/${t.bucket}${t.path}`;return{protocol:i,host:s,path:n}}return{protocol:i,host:`${t.bucket}.${s}`,path:t.path}}class J{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 O({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||B(W(),".aws","credentials");if(!V(e))return null;try{let r=Y(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="",n="",a;for(let o of r){let d=o.trim();if(!d||d.startsWith("#"))continue;let p=d.match(/^\[([^\]]+)\]$/);if(p){i=p[1];continue}if(i===e){let[g,...h]=d.split("="),m=h.join("=").trim();if(g.trim()==="aws_access_key_id")s=m;else if(g.trim()==="aws_secret_access_key")n=m;else if(g.trim()==="aws_session_token")a=m}}return{accessKeyId:s,secretAccessKey:n,sessionToken:a}}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(),a=await(await fetch("http://169.254.169.254/latest/meta-data/iam/security-credentials/",{headers:{"X-aws-ec2-metadata-token":s}})).text(),d=await(await fetch(`http://169.254.169.254/latest/meta-data/iam/security-credentials/${a}`,{headers:{"X-aws-ec2-metadata-token":s}})).json(),p={accessKeyId:d.AccessKeyId,secretAccessKey:d.SecretAccessKey,sessionToken:d.Token};return this.ec2CredentialsCache={credentials:p,expiration:new Date(d.Expiration).getTime()},p}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 a=this.calculateRetryDelay(i);await this.sleep(a)}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}),n=await s.text();if(!s.ok)throw this.parseError(n,s.status,s.headers);if(!n||n.trim()===""){if(t.returnHeaders)return{body:null,headers:this.headersToObject(s.headers)};return null}if(t.rawResponse){if(t.returnHeaders)return{body:n,headers:this.headersToObject(s.headers)};return n}let a;if(n.startsWith("<"))a=this.parseXmlResponse(n);else try{a=JSON.parse(n)}catch{a=n}if(t.returnHeaders)return{body:a,headers:this.headersToObject(s.headers)};return a}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,n,a="https";if(e==="s3"){let d=R({region:r,path:s,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});a=d.protocol,n=d.host,s=d.path}else if(e==="cloudfront")n="cloudfront.amazonaws.com";else if(e==="iam")n="iam.amazonaws.com";else if(e==="route53")n="route53.amazonaws.com";else if(e==="route53domains")n="route53domains.us-east-1.amazonaws.com";else if(e==="ecr")n=`api.ecr.${r}.amazonaws.com`;else if(e==="ses")n=`email.${r}.amazonaws.com`;else n=`${e}.${r}.amazonaws.com`;let o=`${a}://${n}${s}`;if(i&&Object.keys(i).length>0){let d=Object.keys(i).map((p)=>`${this.uriEncode(p)}=${this.uriEncode(i[p])}`).join("&");o+=`?${d}`}return o}signRequest(t,e){let{service:r,region:i,method:s,queryParams:n,body:a}=t,{path:o}=t,d=new Date,p=this.getAmzDate(d),g=this.getDateStamp(d),h;if(r==="s3"){let E=R({region:i,path:o,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});h=E.host,o=E.path}else if(r==="cloudfront")h="cloudfront.amazonaws.com";else if(r==="iam")h="iam.amazonaws.com";else if(r==="route53")h="route53.amazonaws.com";else if(r==="route53domains")h="route53domains.us-east-1.amazonaws.com";else if(r==="ecr")h=`api.ecr.${i}.amazonaws.com`;else if(r==="ses")h=`email.${i}.amazonaws.com`;else h=`${r}.${i}.amazonaws.com`;let m={host:h,"x-amz-date":p,...t.headers||{}};if(e.sessionToken)m["x-amz-security-token"]=e.sessionToken;if(a){if(!Object.keys(m).some((T)=>T.toLowerCase()==="content-type"))m["content-type"]="application/x-www-form-urlencoded";m["content-length"]=Buffer.byteLength(a).toString()}let f=this.sha256(a||"");m["x-amz-content-sha256"]=f;let A=o,b=n?Object.keys(n).sort().map((E)=>`${this.uriEncode(E)}=${this.uriEncode(n[E])}`).join("&"):"",u=Object.keys(m).sort((E,T)=>E.toLowerCase().localeCompare(T.toLowerCase())),c=u.map((E)=>`${E.toLowerCase()}:${m[E].trim()}
|
|
3
|
-
`).join(""),l=u.map((E)=>E.toLowerCase()).join(";"),C=[s,A,b,c,l,f].join(`
|
|
4
|
-
`),y="AWS4-HMAC-SHA256",S=r;if(r==="email")S="ses";let x=`${g}/${i}/${S}/aws4_request`,K=[y,p,x,this.sha256(C)].join(`
|
|
5
|
-
`),F=this.getSignatureKey(e.secretAccessKey,g,i,S),q=this.hmac(F,K),U=`${y} Credential=${e.accessKeyId}/${x}, SignedHeaders=${l}, Signature=${q}`;return{...m,Authorization:U}}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 _.createHash("sha256").update(t,"utf8").digest("hex")}hmac(t,e){return _.createHmac("sha256",t).update(e,"utf8").digest("hex")}getSignatureKey(t,e,r,i){let s=_.createHmac("sha256",`AWS4${t}`).update(e).digest(),n=_.createHmac("sha256",s).update(r).digest(),a=_.createHmac("sha256",n).update(i).digest();return _.createHmac("sha256",a).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 n=s.ErrorResponse.Error;return i.code=n.Code,i.message=`AWS Error [${n.Code}]: ${n.Message||"Unknown error"}`,i.type=n.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 ie(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,n)=>{e[`${r}.${n+1}`]=String(s)});else if(typeof i==="object")for(let[s,n]of Object.entries(i))e[`${r}.${s}`]=String(n);else e[r]=String(i)}return e}function se(){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",n=process.env.AWS_SHARED_CREDENTIALS_FILE||B(W(),".aws","credentials");if(V(n))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{R as oh,J as ph,ie as qh,se as rh};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Jd as a,Kd as b,Ld as c,Md as d,Nd as e,Od as f,Pd as g,Qd as h,Rd as i,Sd as j,Td as k,Ud as l,Vd as m,Wd as n,Xd as o,Yd as p,Zd as q}from"./chunk-n2fnav53.js";import"./chunk-8zk8msx0.js";import"./chunk-h6xqtypj.js";import"./chunk-e2dnxp8d.js";import"./chunk-a9e0hvwe.js";import"./chunk-bzth6d1s.js";import"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{e as assertEnvWithinLimit,d as buildFunctionEnv,f as deployServerlessApp,m as getCommandRecord,c as infraEnvFromOutputs,l as listCommandHistory,g as redeployServerlessApp,b as resolveSecrets,a as resolveServerlessFunctions,q as restoreServerlessDatabase,h as rollbackServerlessApp,k as runAndRecordCommand,n as runDbQuery,j as runRemoteCommand,p as scaleServerlessDatabase,o as serverlessInfo,i as setMaintenance};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$h as J,$i as Ka,$j as Kb,$k as Kc,$l as Kd,$m as Ke,$n as Lf,$o as Lg,Ah as i,Ai as ja,Aj as jb,Ak as jc,Al as jd,Am as je,An as kf,Ao as kg,Bh as j,Bi as ka,Bj as kb,Bk as kc,Bl as kd,Bm as ke,Bn as lf,Bo as lg,Ch as k,Ci as la,Cj as lb,Ck as lc,Cl as ld,Cm as le,Cn as mf,Co as mg,Dh as l,Di as ma,Dj as mb,Dk as mc,Dl as md,Dm as me,Dn as nf,Do as ng,Eh as m,Ei as na,Ej as nb,Ek as nc,El as nd,Em as ne,En as of,Eo as og,Fh as n,Fi as oa,Fj as ob,Fk as oc,Fl as od,Fm as oe,Fn as pf,Fo as pg,Gh as o,Gi as pa,Gj as pb,Gk as pc,Gl as pd,Gm as pe,Gn as qf,Go as qg,Hh as p,Hi as qa,Hj as qb,Hk as qc,Hl as qd,Hm as qe,Hn as rf,Ho as rg,Ih as q,Ii as ra,Ij as rb,Ik as rc,Il as rd,Im as re,In as sf,Io as sg,Jh as r,Ji as sa,Jj as sb,Jk as sc,Jl as sd,Jm as se,Jn as tf,Jo as tg,Kh as s,Ki as ta,Kj as tb,Kk as tc,Kl as td,Km as te,Kn as uf,Ko as ug,Lh as t,Li as ua,Lj as ub,Lk as uc,Ll as ud,Lm as ue,Ln as vf,Lo as vg,Mh as u,Mi as va,Mj as vb,Mk as vc,Ml as vd,Mm as ve,Mn as wf,Mo as wg,Nh as v,Ni as wa,Nj as wb,Nk as wc,Nl as wd,Nm as we,Nn as xf,No as xg,Oh as w,Oi as xa,Oj as xb,Ok as xc,Ol as xd,Om as xe,On as yf,Oo as yg,Ph as x,Pi as ya,Pj as yb,Pk as yc,Pl as yd,Pm as ye,Pn as zf,Po as zg,Qh as y,Qi as za,Qj as zb,Qk as zc,Ql as zd,Qm as ze,Qn as Af,Qo as Ag,Rh as z,Ri as Aa,Rj as Ab,Rk as Ac,Rl as Ad,Rm as Ae,Rn as Bf,Ro as Bg,Sh as A,Si as Ba,Sj as Bb,Sk as Bc,Sl as Bd,Sm as Be,Sn as Cf,So as Cg,Th as B,Ti as Ca,Tj as Cb,Tk as Cc,Tl as Cd,Tm as Ce,Tn as Df,To as Dg,Uh as C,Ui as Da,Uj as Db,Uk as Dc,Ul as Dd,Um as De,Un as Ef,Uo as Eg,Vh as D,Vi as Ea,Vj as Eb,Vk as Ec,Vl as Ed,Vm as Ee,Vn as Ff,Vo as Fg,Wh as E,Wi as Fa,Wj as Fb,Wk as Fc,Wl as Fd,Wm as Fe,Wn as Gf,Wo as Gg,Xh as F,Xi as Ga,Xj as Gb,Xk as Gc,Xl as Gd,Xm as Ge,Xn as Hf,Xo as Hg,Yh as G,Yi as Ha,Yj as Hb,Yk as Hc,Yl as Hd,Ym as He,Yn as If,Yo as Ig,Zh as H,Zi as Ia,Zj as Ib,Zk as Ic,Zl as Id,Zm as Ie,Zn as Jf,Zo as Jg,_h as I,_i as Ja,_j as Jb,_k as Jc,_l as Jd,_m as Je,_n as Kf,_o as Kg,ai as K,aj as La,ak as Lb,al as Lc,am as Ld,an as Le,ao as Mf,ap as Mg,bi as L,bj as Ma,bk as Mb,bl as Mc,bm as Md,bn as Me,bo as Nf,bp as Ng,ci as M,cj as Na,ck as Nb,cl as Nc,cm as Nd,cn as Ne,co as Of,cp as Og,di as N,dj as Oa,dk as Ob,dl as Oc,dm as Od,dn as Oe,do as Pf,dp as Pg,ei as O,ej as Pa,ek as Pb,el as Pc,em as Pd,en as Pe,eo as Qf,ep as Qg,fi as P,fj as Qa,fk as Qb,fl as Qc,fm as Qd,fn as Qe,fo as Rf,fp as Rg,gi as Q,gj as Ra,gk as Rb,gl as Rc,gm as Rd,gn as Re,go as Sf,gp as Sg,hi as R,hj as Sa,hk as Sb,hl as Sc,hm as Sd,hn as Se,ho as Tf,hp as Tg,ii as S,ij as Ta,ik as Tb,il as Tc,im as Td,in as Te,io as Uf,ip as Ug,ji as T,jj as Ua,jk as Ub,jl as Uc,jm as Ud,jn as Ue,jo as Vf,jp as Vg,ki as U,kj as Va,kk as Vb,kl as Vc,km as Vd,kn as Ve,ko as Wf,kp as Wg,li as V,lj as Wa,lk as Wb,ll as Wc,lm as Wd,ln as We,lo as Xf,lp as Xg,mi as W,mj as Xa,mk as Xb,ml as Xc,mm as Xd,mn as Xe,mo as Yf,mp as Yg,ni as X,nj as Ya,nk as Yb,nl as Yc,nm as Yd,nn as Ye,no as Zf,np as Zg,oi as Y,oj as Za,ok as Zb,ol as Zc,om as Zd,on as Ze,oo as _f,op as _g,pi as Z,pj as _a,pk as _b,pl as _c,pm as _d,pn as _e,po as $f,pp as $g,qi as _,qj as $a,qk as $b,ql as $c,qm as $d,qn as $e,qo as ag,qp as ah,ri as aa,rj as ab,rk as ac,rl as ad,rm as ae,rn as af,ro as bg,rp as bh,sh as a,si as ba,sj as bb,sk as bc,sl as bd,sm as be,sn as bf,so as cg,sp as ch,th as b,ti as ca,tj as cb,tk as cc,tl as cd,tm as ce,tn as cf,to as dg,tp as dh,uh as c,ui as da,uj as db,uk as dc,ul as dd,um as de,un as df,uo as eg,up as eh,vh as d,vi as ea,vj as eb,vk as ec,vl as ed,vm as ee,vn as ef,vo as fg,vp as fh,wh as e,wi as fa,wj as fb,wk as fc,wl as fd,wm as fe,wn as ff,wo as gg,wp as gh,xh as f,xi as ga,xj as gb,xk as gc,xl as gd,xm as ge,xn as gf,xo as hg,xp as hh,yh as g,yi as ha,yj as hb,yk as hc,yl as hd,ym as he,yn as hf,yo as ig,yp as ih,zh as h,zi as ia,zj as ib,zk as ic,zl as id,zm as ie,zn as jf,zo as jg,zp as jh}from"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{Je as ABTestManager,sa as AI,Tb as AWSAPIError,xe as AWSConfigManager,Ka as AWS_PSEUDO_PARAMETERS,Id as AWS_REGIONS,wa as ApiGateway,Ja as Arn,Ca as AssetHasher,Aa as Auth,te as BackupManager,_f as BatchProcessingManager,Fe as BlueGreenManager,Kf as BounceComplaintHandler,mf as BuildOptimizationManager,da as CDN,wg as CHAIN_HEADER,$d as COMMON_CROSS_ACCOUNT_ROLES,ua as Cache,He as CanaryManager,ff as CertificateManager,Ob as CloudError,La as CloudFormationBuilder,Jb as CloudFormationClient,Nb as CloudFrontClient,ze as CloudTrailManager,vd as CommandHistory,Ha as Communication,ga as Compute,Pb as ConfigurationError,of as ContainerRegistryManager,Qb as CredentialError,Ad as CrossRegionReferenceManager,db as DASHBOARD_ENTRY,eb as DASHBOARD_PORT_BASE,fb as DASHBOARD_PORT_SPAN,cb as DASHBOARD_STATE_DIR,zg as DEFAULT_RECURSION_LIMITS,cc as DEFAULT_SERVICE_LIMITS,q as DEFAULT_STATE_DIR,vg as DEPTH_HEADER,Yf as DLQMonitoringManager,ea as DNS,Gf as DNSSECManager,ta as Database,$e as DatabaseUserManager,Xb as DebugLogger,Z as DependencyGraph,Ba as Deployment,Rb as DeploymentError,ve as DisasterRecoveryManager,ja as Email,Sf as EmailAdvanced,Mf as EmailAnalyticsManager,Tf as EmailHandlers,Qf as EmailTemplateManager,Ub as ErrorCodes,Wf as FIFOQueueManager,gc as FileCache,ia as FileSystem,Ia as Fn,Bd as GlobalResourceManager,Be as GuardDutyManager,qc as HashCache,eh as HealthCheckManager,kf as ImageScanningManager,na as JobLoader,Wg as LARAVEL_SERVERLESS_BUILD_STEPS,wf as LambdaConcurrencyManager,Cf as LambdaDLQManager,yf as LambdaDestinationsManager,sf as LambdaLayersManager,Af as LambdaVPCManager,uf as LambdaVersionsManager,Re as LogsManager,ig as MANAGED_NODE_VERSIONS,kb as MANAGEMENT_DASHBOARD_SITE_PREFIX,xa as Messaging,Pe as MetricsManager,Ve as MigrationManager,Oc as MockCloudFormation,Qc as MockDynamoDB,Pc as MockS3,za as Monitoring,Vd as MultiAccountManager,yd as MultiRegionManager,fd as MultiStepProgress,ha as Network,gh as NetworkSecurityManager,Wd as OrganizationManager,Yg as PHP_DEFAULT_EXCLUDES,ng as PHP_LAYER_EXTENSIONS,Ea as ParameterStore,Ze as PerformanceManager,va as Permissions,la as Phone,Uf as PhoneAdvanced,ka as PhoneHandlers,Sc as PreviewEnvironmentManager,Xc as PreviewNotificationService,ed as ProgressBar,Le as ProgressiveDeploymentManager,L as Pseudo,ma as Queue,ag as QueueManagementManager,o as QueuePresets,Zd as RECOMMENDED_ACCOUNT_STRUCTURES,_d as RECOMMENDED_SCPS,sd as REPL,ud as REPLCommandBuilder,td as REPLContext,xc as RateLimiter,p as RealtimePresets,Cg as RecursionGuard,Ga as Redirects,Cd as RegionPairManager,ca as Registry,Xe as ReplicaManager,ih as ResourceManagementManager,If as Route53ResolverManager,Ef as Route53RoutingManager,Kb as S3Client,Lb as S3Error,qa as SMS,r as STATE_DIR_ENV_VAR,Fa as Search,Da as Secrets,df as SecretsManager,bf as SecretsRotationManager,fa as Security,De as SecurityHubManager,hf as SecurityScanningManager,Of as SenderReputationManager,qf as ServiceMeshManager,ra as Sftp,Vf as SmsAdvanced,pa as SmsHandlers,gd as Spinner,Dd as StackDependencyManager,oa as StacksIntegration,ah as StaticSiteManager,ba as Storage,ch as StorageAdvancedManager,Te as SyntheticsManager,xg as TRACE_HEADER,hd as TaskList,H as TemplateBuilder,hc as TemplateCache,Sb as ValidationError,ya as Workflow,Ne as XRayManager,Ke as abTestManager,_ as analyzeStackDiff,gg as artifactKey,nd as autocomplete,ye as awsConfigManager,ue as backupManager,sc as batch,$f as batchProcessingManager,Ge as blueGreenManager,Lf as bounceComplaintHandler,ug as buildBunRuntimeLayerZip,Ma as buildCloudFormationTemplate,F as buildMailEnv,tg as buildNodeRuntimeLayerZip,nf as buildOptimizationManager,Xg as buildPhpRuntimeLayerZip,Ie as canaryManager,Dc as categorizeChanges,gf as certificateManager,$b as checkIAMPermissions,Kg as checkInvocation,dc as checkServiceQuotas,yc as chunk,k as clearSigningKeyCache,Gc as cloudConfigSchema,Ae as cloudTrailManager,_g as collectPhpAppEntries,qb as composePresets,mg as composeServerlessAppTemplate,pf as containerRegistryManager,Ta as createApiBackendPreset,Rg as createCliHandler,Fb as createCredentialProvider,bb as createDashboardSite,Ya as createDataPipelinePreset,Wb as createError,Ra as createExistingStaticFullStackPreset,Sa as createFullStackAppPreset,Sg as createHandlers,Pg as createHttpHandler,Va as createJamstackPreset,$a as createLaravelPreset,Za as createMLApiPreset,Wa as createMicroservicesPreset,Rc as createMockAWS,Oa as createNodeJsServerPreset,Pa as createNodeJsServerlessPreset,rb as createPreset,d as createPresignedUrl,e as createPresignedUrlAsync,Qg as createQueueHandler,Xa as createRealtimeAppPreset,Mb as createS3Client,ab as createServerlessLaravelPreset,Qa as createServerlessNodePreset,Na as createStaticSitePreset,_a as createTraditionalWebAppPreset,Ua as createWordPressPreset,cg as createZip,Ed as crossRegionReferenceManager,af as databaseUserManager,Ic as defaultLocalConfig,A as deploymentCoexistenceError,gb as deriveManagementDashboardPort,y as detectDeploymentTargets,Zb as detectMisconfigurations,a as detectServiceRegion,Ac as diffTemplates,Zf as dlqMonitoringManager,Hf as dnssecManager,we as drManager,Nf as emailAnalyticsManager,Rf as emailTemplateManager,Ng as eventToRequest,pb as extendPreset,Xf as fifoQueueManager,pc as findChangedFiles,de as formatAccountStructure,ad as formatBytes,aa as formatDiff,bd as formatDuration,pd as formatFlagSuggestions,wd as formatHistory,xd as formatHistoryStats,dd as formatKeyValue,cd as formatList,$c as formatProgressBar,Sd as formatRegion,Td as formatRegionList,jd as formatSuggestion,Zc as formatTable,_c as formatTree,Bb as fromEC2Metadata,Cb as fromECSMetadata,zb as fromEnvironment,Ab as fromSharedCredentials,Db as fromWebIdentity,yg as functionFingerprint,rg as generateAppImageDockerfile,re as generateApprovalConfig,dg as generateBootstrap,Vc as generateCleanupWorkflow,Wc as generateCostReportWorkflow,be as generateCrossAccountRoleCF,oe as generateDeploymentConfig,je as generateDeploymentPipeline,ee as generateDeploymentWorkflow,N as generateLogicalId,ne as generateManualPipeline,ie as generateMatrixWorkflow,pe as generateMultiEnvConfig,ke as generateMultiEnvPipeline,fe as generateMultiEnvWorkflow,ge as generatePRPreviewWorkflow,se as generateParallelConfig,Tg as generatePhpFpmConfig,qg as generatePhpLayerDockerfile,le as generatePreviewPipeline,Uc as generatePreviewWorkflow,M as generateResourceName,qe as generateScheduledConfig,me as generateScheduledPipeline,he as generateScheduledWorkflow,Ib as getAccountId,Kd as getAllRegions,Pd as getClosestRegion,qd as getCommandUsage,ld as getContextualHelp,Eb as getCredentials,Ec as getDeploymentStrategy,Fc as getDiffStats,Bc as getDiffSummary,Vb as getErrorDetails,Jc as getLocalConfig,Mc as getLocalCredentials,Lc as getLocalEndpoint,Nc as getLocalEnvVars,ec as getQuotaUsageSummary,ae as getRecommendedStructure,Jd as getRegion,Ud as getRegionStats,Md as getRegionsByCompliance,Ld as getRegionsByLocation,Nd as getRegionsByPricingTier,ac as getRequiredPermissions,l as getSigningKeyCacheSize,O as getTimestamp,Fd as globalResourceManager,Ce as guardDutyManager,jb as hasManagementDashboardSite,lc as hashBuffer,mc as hashDirectory,jc as hashFile,nc as hashManifest,kc as hashString,fh as healthCheckManager,lf as imageScanningManager,Bg as inspectInvocation,Hg as installRecursionFetch,Fg as invocationContext,kd as isLikelyTypo,Kc as isLocalDevelopment,mb as isManagementDashboardSiteName,m as isNodeCryptoAvailable,t as isStateDirConfigured,x as isStatePath,Od as isValidRegion,n as isWebCryptoAvailable,xf as lambdaConcurrencyManager,Df as lambdaDLQManager,zf as lambdaDestinationsManager,tf as lambdaLayersManager,Bf as lambdaVPCManager,vf as lambdaVersionsManager,Vg as laravelServerlessEnvDefaults,Se as logsManager,C as mailEnabled,E as mailFirewallPorts,f as makeAWSRequest,h as makeAWSRequestAsync,g as makeAWSRequestOnce,lb as managementDashboardSiteName,sb as mergeInfrastructure,Qe as metricsManager,We as migrationManager,Xd as multiAccountManager,zd as multiRegionManager,hh as networkSecurityManager,Yd as organizationManager,$g as packagePhpApp,hg as packageServerlessApp,rc as parallel,tc as parallelMap,uc as parallelWithRetry,Ag as parseChain,j as parseJSONResponse,i as parseXMLResponse,_e as performanceManager,pg as phpLayerBuildStage,og as phpLayerPackages,Ug as phpRuntimeLayerAssets,Tc as previewManager,Yc as previewNotifications,zc as processInChunks,Me as progressiveDeploymentManager,Dg as propagationHeaders,bg as queueManagementManager,oc as quickHash,Eg as recursionBlockedResponse,Gd as regionPairManager,Ye as replicaManager,Cc as requiresReplacement,Jg as resetRecursionRuntime,Mg as resolveApp,B as resolveAppDatabase,G as resolveCloudProvider,Gb as resolveCredentials,hb as resolveDashboardDomain,ib as resolveDashboardDomains,V as resolveDeployBucketName,z as resolveDeploymentMode,D as resolveMailService,ob as resolveManagementDashboardSite,nb as resolveManagementDashboardSites,Q as resolveProjectStackName,lg as resolveQueueNames,kg as resolveQueues,Gg as resolveRecursionConfig,Hb as resolveRegion,W as resolveServerlessAppStackName,X as resolveServerlessArtifactBucketName,Y as resolveServerlessAssetBucketName,jg as resolveServerlessRuntime,T as resolveSiteBucketName,S as resolveSiteResourceName,R as resolveSiteStackName,w as resolveStatePath,U as resolveStorageBucketName,jh as resourceManagementManager,Og as responseToResult,Jf as route53ResolverManager,Ff as route53RoutingManager,eg as runBuildHooks,Zg as runPhpBuildHooks,P as sanitizeName,md as searchCommands,ef as secretsManager,cf as secretsRotationManager,Ee as securityHubManager,jf as securityScanningManager,Pf as senderReputationManager,vc as sequence,rf as serviceMeshManager,s as setStateDir,fg as sha256,Ig as sharedRecursionGuard,sg as sharedRuntimeLoop,b as signRequest,c as signRequestAsync,Hd as stackDependencyManager,u as stateDir,v as statePath,bh as staticSiteManager,dh as storageAdvancedManager,id as suggestCommand,od as suggestFlags,bc as suggestIAMPolicy,fc as suggestQuotaIncrease,Rd as suggestRegionPairs,Qd as suggestRegions,Ue as syntheticsManager,ic as templateCache,ce as validateAccountStructure,Hc as validateAgainstSchema,rd as validateCommand,Yb as validateConfiguration,_b as validateCredentials,K as validateResourceLimits,I as validateTemplate,J as validateTemplateSize,xb as withCDN,wb as withCache,vb as withDatabase,Lg as withInvocation,tb as withMonitoring,yb as withQueue,ub as withSecurity,wc as withTimeout,Oe as xrayManager};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{pf as w}from"./chunk-85qrgshq.js";var L="\x00";function k(t,i){if(t==="*"||t==="**")return!0;let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*");return new RegExp(`^${e}$`).test(i)}function y(t,i){if(t.startsWith("*.")){let e=t.slice(1);return i.endsWith(e)&&i.length>e.length}return t===i}function d(t,i){if(t.enabled===!1)return!1;if(t.methods?.length&&!t.methods.some((e)=>e.toUpperCase()===i.method.toUpperCase()))return!1;if(t.path&&!k(t.path,i.path))return!1;if(t.host&&!y(t.host,i.host??""))return!1;return!0}function m(t,i){let e=t.key??{source:"ip"},o=e.fallbackToIp!==!1,r;if(e.source==="ip")r=i.ip;else if(e.source==="global")r="global";else if(e.source==="host")r=i.host??"";else if(e.source==="path")r=i.path;else if(e.source==="header")r=e.name?i.headers?.[e.name.toLowerCase()]:void 0;else if(e.source==="cookie")r=e.name?i.cookies?.[e.name]:void 0;if(!r&&e.source!=="global")r=o?i.ip:"__missing__";return`${t.id}\x00${r}`}class A{clock;maxTrackedKeys;buckets=new Map;windows=new Map;rules;constructor(t,i=()=>Date.now(),e=1e5){this.clock=i;this.maxTrackedKeys=e;this.rules=[...t].sort((o,r)=>(o.priority??0)-(r.priority??0))}check(t){let i=this.clock(),e=this.rules.filter((n)=>d(n,t)),o;for(let n of e){let s=this.test(n,t,i);if(s.allowed)continue;if(!o||p(s.action)>p(o.action))o=s}if(o)return o;let r={action:"allow",allowed:!0};for(let n of e){let s=this.consume(n,t,i);if(s.remaining!=null&&(r.remaining??1/0)>s.remaining)r=s}return r}test(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let n=t.burst??t.limit,s=this.buckets.get(o),a=s?Math.min(n,s.tokens+this.refill(t,e-s.updatedAt)):n;if(a>=1)return{action:"allow",allowed:!0};return this.blocked(t,o,0,this.msPerToken(t)*(1-a),e)}let r=(this.windows.get(o)?.hits??[]).filter((n)=>n>e-t.windowMs);if(r.length<t.limit)return{action:"allow",allowed:!0};return this.blocked(t,o,0,r[0]+t.windowMs-e,e)}peek(t){let i=this.clock();for(let e of this.rules){if(!d(e,t))continue;let o=this.test(e,t,i);if(!o.allowed)return o}return{action:"allow",allowed:!0}}msPerToken(t){return t.windowMs/Math.max(1,t.limit)}refill(t,i){return Math.max(0,i)/this.msPerToken(t)}blocked(t,i,e,o,r){let n=t.action??"deny";return{action:n,allowed:n==="allow"||n==="log",ruleId:t.id,limit:t.limit,remaining:e,retryAfterMs:Math.max(0,Math.ceil(o)),resetAt:r+Math.max(0,o),key:i}}consume(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let l=t.burst??t.limit,u=this.buckets.get(o)??{tokens:l,updatedAt:e},c=Math.min(l,u.tokens+this.refill(t,e-u.updatedAt));if(c<1)return this.buckets.set(o,{tokens:c,updatedAt:e}),this.blocked(t,o,0,this.msPerToken(t)*(1-c),e);return this.evictIfNeeded(this.buckets),this.buckets.set(o,{tokens:c-1,updatedAt:e}),{action:"allow",allowed:!0,ruleId:t.id,limit:l,remaining:Math.floor(c-1),resetAt:e+this.msPerToken(t)*(l-(c-1)),key:o}}let n=this.windows.get(o)??{hits:[]},s=e-t.windowMs,a=n.hits.filter((l)=>l>s);if(a.length>=t.limit)return this.windows.set(o,{hits:a}),this.blocked(t,o,0,a[0]+t.windowMs-e,e);return a.push(e),this.evictIfNeeded(this.windows),this.windows.set(o,{hits:a}),{action:"allow",allowed:!0,ruleId:t.id,limit:t.limit,remaining:t.limit-a.length,resetAt:a[0]+t.windowMs,key:o}}evictIfNeeded(t){if(t.size<this.maxTrackedKeys)return;let i=t.size-this.maxTrackedKeys+1,e=0;for(let o of t.keys())if(t.delete(o),++e>=i)break}sweep(){let t=this.clock(),i=0;for(let[e,o]of this.windows){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n){this.windows.delete(e),i++;continue}if(o.hits.every((s)=>s<=t-n.windowMs))this.windows.delete(e),i++}for(let[e,o]of this.buckets){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n||t-o.updatedAt>n.windowMs*2)this.buckets.delete(e),i++}return i}get trackedKeys(){return this.buckets.size+this.windows.size}}function p(t){return{allow:0,log:1,throttle:2,challenge:3,deny:4}[t]}function I(t){let i={};if(t.limit!=null)i["ratelimit-limit"]=String(t.limit);if(t.remaining!=null)i["ratelimit-remaining"]=String(t.remaining);if(t.resetAt!=null)i["ratelimit-reset"]=String(Math.max(0,Math.ceil((t.resetAt-Date.now())/1000)));if(!t.allowed&&t.retryAfterMs!=null)i["retry-after"]=String(Math.max(1,Math.ceil(t.retryAfterMs/1000)));return i}function C(){return[{id:"global-ip",limit:600,windowMs:60000,burst:100,key:{source:"ip"},action:"deny",priority:100},{id:"api-ip",limit:120,windowMs:60000,burst:30,path:"/api/**",key:{source:"ip"},action:"deny",priority:50},{id:"auth-ip",limit:10,windowMs:60000,algorithm:"sliding_window",path:"/auth/**",methods:["POST"],key:{source:"ip"},action:"challenge",priority:10}]}var h="protection.controls",b=24,x=4,M={ipRules:{allow:[],block:[]}};function f(t,i){if(!t?.enabled)return;return new Date(t.expiresAt).getTime()>i.getTime()?t:void 0}function g(t,i){let e=Number.isFinite(t)?Number(t):i;return Math.min(b,Math.max(0.25,e))}var R=500;class P{controlPlane;options;constructor(t,i={}){this.controlPlane=t;this.options=i}now(){return this.options.now?.()??new Date}read(){let t=this.controlPlane.getSetting(h);if(!t||typeof t!=="object"||Array.isArray(t))return{...M,ipRules:{allow:[],block:[]}};let i=t;return{attackMode:i.attackMode,mitigationPause:i.mitigationPause,ipRules:{allow:Array.isArray(i.ipRules?.allow)?i.ipRules.allow:[],block:Array.isArray(i.ipRules?.block)?i.ipRules.block:[]},updatedAt:i.updatedAt}}write(t){let i={...t,updatedAt:this.now().toISOString()};return this.controlPlane.setSetting(h,i),i}raw(){return this.read()}current(){let t=this.now(),i=this.read();return{attackMode:f(i.attackMode,t),mitigationPause:f(i.mitigationPause,t),ipRules:i.ipRules}}enableAttackMode(t){let i=this.now(),e={enabled:!0,startedAt:i.toISOString(),expiresAt:new Date(i.getTime()+g(t.hours,x)*3600000).toISOString(),reason:t.reason.trim()||"Attack mode enabled by an operator.",actorId:t.actorId};return this.write({...this.read(),attackMode:e}),e}disableAttackMode(){let t=this.read();if(!t.attackMode?.enabled)return!1;return this.write({...t,attackMode:{...t.attackMode,enabled:!1}}),!0}pauseMitigations(t){let i=t.reason.trim();if(!i)throw Error("Pausing mitigations requires a reason: you are liable for the traffic it admits.");let e=this.now(),o={enabled:!0,startedAt:e.toISOString(),expiresAt:new Date(e.getTime()+g(t.hours,b)*3600000).toISOString(),reason:i,actorId:t.actorId};return this.write({...this.read(),mitigationPause:o}),o}resumeMitigations(){let t=this.read();if(!t.mitigationPause?.enabled)return!1;return this.write({...t,mitigationPause:{...t.mitigationPause,enabled:!1}}),!0}addIpRule(t,i){let e=i.trim();if(!w(e))throw Error(`Not a valid IP or CIDR: ${i}`);let o=this.read(),r={...o.ipRules,[t]:[...new Set([...o.ipRules[t],e])]};if(r[t].length>R)throw Error(`At most ${R} ${t} rules are supported.`);let n=t==="allow"?"block":"allow";return r[n]=r[n].filter((s)=>s!==e),this.write({...o,ipRules:r}),r}removeIpRule(t,i){let e=this.read(),o={...e.ipRules,[t]:e.ipRules[t].filter((r)=>r!==i.trim())};return this.write({...e,ipRules:o}),o}}function D(t){if(t.mitigationPause)return{attackMode:!!t.attackMode,mitigationPaused:!0,summary:`Automatic mitigation is paused until ${t.mitigationPause.expiresAt}. All traffic is being served and billed.`,expiresAt:t.mitigationPause.expiresAt};if(t.attackMode)return{attackMode:!0,mitigationPaused:!1,summary:`Attack mode is on until ${t.attackMode.expiresAt}. Every visitor is being challenged.`,expiresAt:t.attackMode.expiresAt};return{attackMode:!1,mitigationPaused:!1,summary:"Protection is in its normal posture."}}function E(t,i){if(i.mitigationPause)return t.map((e)=>({...e,enabled:!1}));if(!i.attackMode)return[...t];return t.map((e)=>({...e,action:e.action==="deny"?"deny":"challenge",burst:Math.max(1,Math.min(e.burst??e.limit,5))}))}function T(t,i){let e=[...new Set([...t.allowlist??[],...i.ipRules.allow])],o=[...new Set([...t.blocklist??[],...i.ipRules.block])];if(i.mitigationPause)return{...t,allowlist:e,blocklist:o,monitorOnly:!0};if(!i.attackMode)return{...t,allowlist:e,blocklist:o};let r=t.thresholds??{};return{...t,allowlist:e,blocklist:o,thresholds:{...r,newConnectionsPerSecond:Math.max(1,Math.floor((r.newConnectionsPerSecond??50)/5)),concurrentPerSource:Math.max(1,Math.floor((r.concurrentPerSource??100)/5))}}}function v(t,i){let e=t?.infrastructure?.compute;if(!e||e.ddos===!1)return t;let o=typeof e.ddos==="object"&&e.ddos!==null?e.ddos:{};return{...t,infrastructure:{...t.infrastructure,compute:{...e,ddos:T(o,i)}}}}export{L as a,k as b,d as c,m as d,A as e,I as f,C as g,h,b as i,x as j,P as k,D as l,E as m,T as n,v as o};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{Aj as C,Dj as I,Ej as m,Nh as S,Oh as _}from"./chunk-n20kbxwb.js";import{execSync as O}from"node:child_process";import{randomBytes as P}from"node:crypto";import{chmodSync as B,copyFileSync as F,existsSync as u,mkdirSync as L,readFileSync as T,statSync as J,writeFileSync as b}from"node:fs";import{tmpdir as z}from"node:os";import{basename as V,dirname as y,isAbsolute as k,join as a,resolve as W}from"node:path";import{fileURLToPath as A}from"node:url";function h(e){if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.keys(e).map((r)=>[r,""]))}function E(e){let r=JSON.parse(JSON.stringify(e??{}));if(r.hetzner)delete r.hetzner.apiToken;delete r.aws,delete r.stateDir;for(let t of Object.values(r.sites??{})){if(t?.env)t.env=h(t.env);if(t?.environment)t.environment=h(t.environment)}for(let t of Object.values(r.environments??{}))if(t?.variables)t.variables=h(t.variables);for(let t of Object.values(r.infrastructure?.databases??{}))if(t?.password)t.password="";if(r.infrastructure?.appDatabase?.password)r.infrastructure.appDatabase.password="";if(r.infrastructure?.compute?.database?.password)r.infrastructure.compute.database.password="";if(r.infrastructure?.compute?.managedServices?.vitess?.password)r.infrastructure.compute.managedServices.vitess.password="";return r}function U(e){let r=E(e);return["// Generated by ts-cloud for the management dashboard — do not edit.","//","// This is the project's resolved cloud config, inlined so it needs no","// imports on the box. Credentials are deliberately absent.",`export default ${JSON.stringify(r,null,2)}`,""].join(`
|
|
2
|
-
`)}var G="dashboard";function M(){return S("dashboard-credentials.json")}function H(){return P(24).toString("base64url")}function q(e,r,t){let s=process.env.TS_CLOUD_UI_PASSWORD?.trim();if(s)return{password:s,source:"env"};if(v(process.env.TS_CLOUD_UI_PUBLIC))return{password:void 0,source:"public"};let n=M(),i=_(e,"dashboard-credentials.json");try{if(u(i)){let o=JSON.parse(T(i,"utf8"));if(o?.password)return{password:o.password,source:"generated"}}}catch{}let d=H();try{L(y(i),{recursive:!0}),b(i,`${JSON.stringify({username:r,password:d,generatedAt:new Date().toISOString()},null,2)}
|
|
3
|
-
`),B(i,384),t.info(`Management dashboard: generated a password for '${r}' and saved it to ${n} (read it there — it is not printed). Set TS_CLOUD_UI_PASSWORD to pin your own, or TS_CLOUD_UI_PUBLIC=1 to serve without auth.`)}catch(o){t.warn(`Management dashboard: could not persist the generated password (${o?.message??o}). Using it for this deploy only — pass: ${d}
|
|
4
|
-
This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${n} is writable.`)}return{password:d,source:"generated"}}var R={info:()=>{},warn:()=>{}};function v(e){return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function K(){return S("dashboard-release")}function j(){let e=y(A(import.meta.url));for(let r of[a(e,"..","..","package.json"),a(e,"..","package.json")])try{let t=JSON.parse(T(r,"utf8"));if(t.name==="@stacksjs/ts-cloud"&&t.version)return`^${t.version}`}catch{}return"latest"}function Q(){return process.env.TS_CLOUD_UI_VERSION?.trim()||j()}function X(e,r,t){if(!e?.project?.slug)return t.warn("Management dashboard: the cloud config has no project slug — skipping the live dashboard."),null;let s=_(r,"dashboard-release");try{L(s,{recursive:!0}),b(a(s,"cloud.config.ts"),U(e));let n=Q();if(n.startsWith("file:")){let d=n.slice(5),o=k(d)?d:W(r,d);if(!u(o)||!J(o).isFile())n=j(),t.warn(`Management dashboard: TS_CLOUD_UI_VERSION points to a missing package file (${o}); using the deploying ts-cloud version ${n} instead.`);else{let c=V(o),l=a(s,c);if(o!==l)F(o,l);n=`file:./${c}`}}let i={name:"ts-cloud-dashboard",private:!0,type:"module",dependencies:{"@stacksjs/ts-cloud":n}};return b(a(s,"package.json"),`${JSON.stringify(i,null,2)}
|
|
5
|
-
`),K()}catch(n){return t.warn(`Management dashboard: could not stage the live release (${n?.message??n}) — skipping.`),null}}function Y(e){if(u(a(e,"packages","ui","pages"))||u(a(e,"packages","ui","package.json")))return{uiRoot:"packages/ui/dist",build:"cd packages/ui && bun install && bun run build"};let r=y(A(import.meta.url)),t=[a(r,"ui"),a(r,"..","ui"),a(r,"..","..","ui"),a(r,"..","dist","ui")];for(let s of t)if(u(a(s,"index.html"))||u(a(s,"serverless.html")))return{uiRoot:s,build:!1};return null}function de(e,r={}){let t=r.logger??R,s=r.cwd??process.cwd();if(v(process.env.TS_CLOUD_UI_DISABLE))return t.info("Management dashboard: skipped (TS_CLOUD_UI_DISABLE set)."),e;if(e.cloud?.attachTo)return t.info(`Management dashboard: ${e.project.slug} is attached to ${e.cloud.attachTo}; the server owner's dashboard monitors every attached project.`),e;if(C(e))return e;let n=e.environments&&Object.keys(e.environments)[0],i=process.env.TS_CLOUD_UI_DOMAIN?.trim()||void 0,d=Number(process.env.TS_CLOUD_UI_PORT)||void 0,o={...e.sites??{}};if(!v(process.env.TS_CLOUD_UI_STATIC)){let g=X(e,s,t);if(!g)return e;let p=m(e,n??"production",{uiRoot:g,build:!1,domain:i,port:d,live:!0});if(p.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;for(let{name:N,site:w}of p)o[N]=w,t.info(`Management dashboard → https://${w.domain} (sign in with your ts-cloud account; the first deploy prints an admin password once)`);return e.sites=o,e}let c=Y(s);if(!c)return t.info("Management dashboard: UI not found (no local ui/ or packaged dist/ui) — skipping auto-deploy."),e;let l=process.env.TS_CLOUD_UI_USERNAME?.trim()||"admin",f=q(s,l,t),D=m(e,n??"production",{uiRoot:c.uiRoot,build:c.build,domain:i,username:l,password:f.password,realm:process.env.TS_CLOUD_UI_REALM?.trim()||void 0,live:!1,port:d});if(D.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;let x=f.source==="public"?"NO AUTH — TS_CLOUD_UI_PUBLIC is set (dashboard is publicly reachable)":f.source==="env"?"htpasswd-protected (TS_CLOUD_UI_PASSWORD)":`htpasswd-protected (auto-generated — see ${M()})`;t.warn("Management dashboard: static mode — one shared password, and no per-site collaborators. Unset TS_CLOUD_UI_STATIC for the live dashboard.");for(let{name:g,site:p}of D)o[g]=p,t.info(`Management dashboard → https://${p.domain} (${x})`);return e.sites=o,e}function ue(e){return Object.keys(e.sites??{}).filter(I)}function ce(e,r){if(!e?.root)return null;let t=r.cwd??process.cwd(),s=r.logger??R;try{if(typeof e.build==="string"&&e.build.trim())s.info(`Management dashboard: building UI (${e.build})`),O(e.build,{cwd:t,stdio:"inherit"});let n=k(e.root)?e.root:a(t,e.root);if(!u(n))return s.warn(`Management dashboard: build output not found at ${n} — skipping dashboard artifact.`),null;let i=a(z(),`${r.slug}-${r.siteName??G}-${r.sha}.tar.gz`);return O(`tar czf "${i}" -C "${n}" .`,{stdio:"inherit"}),i}catch(n){return s.warn(`Management dashboard: failed to build artifact — ${n?.message??n}. Skipping dashboard deploy.`),null}}
|
|
6
|
-
export{G as wf,M as xf,q as yf,K as zf,Q as Af,X as Bf,Y as Cf,de as Df,ue as Ef,ce as Ff};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ph as n}from"./chunk-bzth6d1s.js";class s{client;region;constructor(t="us-east-1",e){this.region=t,this.client=new n(void 0,{profile:e})}async getCallerIdentity(){let t=await this.client.request({service:"sts",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetCallerIdentity&Version=2011-06-15"});if(typeof t==="string"){let r=t.match(/<Account>(\d+)<\/Account>/),i=t.match(/<UserId>([^<]+)<\/UserId>/),c=t.match(/<Arn>([^<]+)<\/Arn>/);return{Account:r?.[1],UserId:i?.[1],Arn:c?.[1]}}let e=t?.GetCallerIdentityResponse?.GetCallerIdentityResult||t?.GetCallerIdentityResult;if(e)return{Account:String(e.Account),UserId:e.UserId,Arn:e.Arn};if(t?.Account)return{Account:String(t.Account),UserId:t.UserId,Arn:t.Arn};return{Account:void 0,UserId:void 0,Arn:void 0}}}
|
|
2
|
-
export{s as fd};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fd as a}from"./chunk-empfsmdk.js";import"./chunk-bzth6d1s.js";import"./chunk-m07s5esk.js";export{a as STSClient};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{Gf as m,Pf as l,bg as g,eg as f,fg as d,pg as C}from"./chunk-tjgy10zm.js";function R(e){return`'${e.split("'").join("'\\''")}'`}function p(e){let r=e.user||"root",s=e.script.join(`
|
|
2
|
-
`),t=r==="root"?'bash -l "$TS_CLOUD_RECIPE"':`runuser -l ${R(r)} -c "bash $TS_CLOUD_RECIPE"`;return["set -uo pipefail",`echo "__TS_CLOUD_RECIPE_BEGIN__ ${e.name} (user=${r})"`,"TS_CLOUD_RECIPE=$(mktemp)",`cat > "$TS_CLOUD_RECIPE" <<'TS_CLOUD_RECIPE_EOF'`,s,"TS_CLOUD_RECIPE_EOF",'chmod +r "$TS_CLOUD_RECIPE"',t,"TS_CLOUD_RC=$?",'rm -f "$TS_CLOUD_RECIPE"',`echo "__TS_CLOUD_RECIPE_END__ ${e.name} exit=$TS_CLOUD_RC"`,"exit $TS_CLOUD_RC"]}var c={info:()=>{},warn:()=>{},error:()=>{},step:()=>{},success:()=>{}};async function i(e){return await e.driver.findComputeTargets({slug:e.slug,environment:e.environment,role:e.role||"app"})}async function y(e,r){let s=e.logger||c,t=await i(e);if(t.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};let n=m(e.slug,r.siteName),u=d(n,r.to||"unused"),o=["set -uo pipefail",...C(u,{...r.to?{to:r.to}:{},unitBase:`${e.slug}-${r.siteName}`}),`(cd ${l} && pantry restart php-fpm) 2>/dev/null || true`,`(cd ${u.current} && eval "$(cd ${l} && pantry env 2>/dev/null)" && php artisan queue:restart) 2>/dev/null || true`];s.step(`Rolling back ${r.siteName}${r.to?` to ${r.to}`:" to the previous release"} on ${t.length} server(s)...`);let a=await e.driver.runRemoteDeploy({targets:t,commands:o,comment:`ts-cloud rollback ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!a.success)s.error(`Rollback failed: ${a.error||"unknown error"}`);else s.success(`Rolled back ${r.siteName}.`);return{success:a.success,error:a.error,perInstance:a.perInstance}}async function h(e,r){let s=await i(e);if(s.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};let t=f(m(e.slug,r.siteName)),n=Math.max(1,r.limit??20),u=[`[ -f ${t} ] && tail -n ${n} ${t} || echo "no deploy history for ${r.siteName}"`],o=await e.driver.runRemoteDeploy({targets:s,commands:u,comment:`ts-cloud deploy:history ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});return{success:o.success,error:o.error,perInstance:o.perInstance}}async function I(e,r){let s=e.logger||c,t=await i(e);if(t.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};s.step(`Running recipe '${r.name}' as ${r.user||"root"} on ${t.length} server(s)...`);let n=await e.driver.runRemoteDeploy({targets:t,commands:p({name:r.name,script:r.script,user:r.user}),comment:`ts-cloud recipe ${r.name}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!n.success)s.error(`Recipe '${r.name}' failed: ${n.error||"unknown error"}`);else s.success(`Recipe '${r.name}' completed.`);return{success:n.success,error:n.error,perInstance:n.perInstance}}async function P(e,r){let s=e.logger||c;if(!r.database?.name)return{success:!1,error:"No appDatabase configured to restore."};let t=await i(e);if(t.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};s.step(`Restoring database '${r.database.name}'${r.from?` from ${r.from}`:" from the latest backup"} on ${t.length} server(s)...`);let n=await e.driver.runRemoteDeploy({targets:t,commands:g(r.database,{from:r.from}),comment:`ts-cloud db:restore ${e.slug}/${r.database.name}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!n.success)s.error(`Restore failed: ${n.error||"unknown error"}`);else s.success(`Restored ${r.database.name}.`);return{success:n.success,error:n.error,perInstance:n.perInstance}}
|
|
3
|
-
export{y as xd,h as yd,I as zd,P as Ad};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y,b as z,c as A,d as B,e as C,f as D,g as E,h as F,i as G,j as H,k as I,l as J,m as K,n as L,o as M}from"./chunk-d2aaef9v.js";import{if as s,jf as t,kf as u,lf as v,mf as w,nf as x}from"./chunk-5x4rdx8k.js";import{of as k,pf as l,qf as m,rf as n,sf as o,tf as p,uf as q,vf as r}from"./chunk-85qrgshq.js";import{Lo as a,Mo as b,No as c,Oo as d,Po as e,Qo as f,Ro as g,So as h,To as i,Uo as j}from"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{b as CHAIN_HEADER,H as DEFAULT_ATTACK_MODE_HOURS,k as DEFAULT_DDOS_THRESHOLDS,e as DEFAULT_RECURSION_LIMITS,a as DEPTH_HEADER,G as MAX_CONTROL_HOURS,F as PROTECTION_SETTING,I as ProtectionControlStore,y as RATE_LIMIT_KEY_SEPARATOR,C as RateLimiter,h as RecursionGuard,c as TRACE_HEADER,L as applyControlsToDdos,K as applyControlsToRateLimits,r as applyMitigationFactor,E as defaultRateLimitRules,J as describePosture,s as escapeSecLang,d as functionFingerprint,z as globMatches,u as globToRegex,g as inspectInvocation,t as isSafePattern,l as isValidCidr,M as mergeControlsIntoConfig,f as parseChain,q as planMitigation,i as propagationHeaders,D as rateLimitHeaders,B as rateLimitKey,j as recursionBlockedResponse,p as renderDdosInstallScript,o as renderNftablesRuleset,n as renderSysctlFile,v as renderWafConfig,w as renderWafInstallScript,A as ruleMatches,m as sysctlHardening,x as wafEventTelemetry};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$b as z,$c as Aa,Ac as _,Bc as aa,Cb as a,Cc as ba,Db as b,Dc as ca,Eb as c,Ec as da,Fb as d,Fc as ea,Gb as e,Gc as fa,Hb as f,Hc as ga,Ib as g,Ic as ha,Jb as h,Jc as ia,Kb as i,Kc as ja,Lb as j,Lc as ka,Mb as k,Mc as la,Nb as l,Nc as ma,Ob as m,Oc as na,Pb as n,Pc as oa,Qb as o,Qc as pa,Rb as p,Rc as qa,Sb as q,Sc as ra,Tb as r,Tc as sa,Ub as s,Uc as ta,Vb as t,Vc as ua,Wb as u,Wc as va,Xb as v,Xc as wa,Yb as w,Yc as xa,Zb as x,Zc as ya,_b as y,_c as za,ac as A,ad as Ba,bc as B,cc as C,dc as D,dd as Ca,ec as E,ed as Da,fc as F,gc as G,hc as H,ic as I,jc as J,kc as K,lc as L,mc as M,nc as N,oc as O,pc as P,qc as Q,rc as R,sc as S,tc as T,uc as U,vc as V,wc as W,xc as X,yc as Y,zc as Z}from"./chunk-bpps61am.js";import"./chunk-85qrgshq.js";import"./chunk-jxd3j00s.js";import"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{Z as AnomalyConfigStore,za as AwsSpendTransport,Aa as ComputeSpendTransport,x as CounterTracker,u as DEFAULT_METER_MAPPINGS,l as DEFAULT_PRICE_BOOK,B as DEFAULT_THRESHOLDS,_ as DETECTABLE_SIGNALS,c as ENFORCEMENT_ACTIONS,K as ENFORCEMENT_DESCRIPTIONS,d as ENFORCEMENT_SEVERITY,ea as FOCUS_VERSION,b as METERS,a as METER_KEYS,e as MICRO_CENTS,G as MIN_PROJECTION_CONFIDENCE,pa as RecordingSpendTransport,X as SENSITIVITY_THRESHOLDS,xa as SPEND_CYCLE_SECONDS,ka as SPEND_GATE_SETTING,ua as SPEND_LEASE_SETTING,ba as SignalSource,ma as SpendCapError,la as SpendGate,va as SpendLoopLease,ta as SpendNotificationRouter,wa as SpendRunner,ia as SpendService,C as SpendStore,qa as URGENT_SPEND_EVENTS,L as USER_VISIBLE_ACTIONS,z as aggregateDeltas,W as anomalyOptionsForSignal,na as assertSpendAllows,q as budgetWindow,Ba as compositeSpendTransport,oa as createEnforcementHandlers,U as detectAnomalies,V as detectLatestAnomaly,I as evaluateBudget,T as ewma,v as findMapping,g as findPriceEntry,ra as formatCents,F as formatTimeToExhaustion,H as governingLimitCents,Ca as handleSpendRequest,s as hourBucket,t as hourBucketsBetween,P as isOperationAllowed,m as isValidTimeZone,da as lookbackHoursForSignal,Q as median,R as medianAbsoluteDeviation,J as mergeDecisions,k as mergePriceBooks,y as meterTelemetry,ca as optionsForSignal,E as percentOfLimit,M as planEnforcement,r as previousBudgetWindow,h as priceUsage,i as priceUsageLines,D as projectSpend,S as robustZScore,j as roundCents,Y as routeMatches,N as runEnforcement,A as scopeKey,aa as signalDefinition,sa as spendNotificationText,Da as spendOpenApiPaths,ya as startSpendLoop,ha as streamFocusJsonl,O as strongestActiveAction,f as tieredMicroCents,ga as toFocusJsonl,fa as toFocusRecords,w as usageDeltaKey,p as utcInstantOfLocal,ja as zeroFill,o as zoneOffsetMs,n as zonedParts};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ph as g}from"./chunk-bzth6d1s.js";class p{client;region;constructor(e="us-east-1",t){this.region=e,this.client=new g(void 0,{profile:t})}async createStack(e){let t={Action:"CreateStack",StackName:e.stackName,Version:"2010-05-15"};if(e.templateBody)t.TemplateBody=e.templateBody;else if(e.templateUrl)t.TemplateURL=e.templateUrl;else throw Error("Either templateBody or templateUrl must be provided");if(e.parameters)e.parameters.forEach((a,r)=>{t[`Parameters.member.${r+1}.ParameterKey`]=a.ParameterKey,t[`Parameters.member.${r+1}.ParameterValue`]=a.ParameterValue});if(e.capabilities)e.capabilities.forEach((a,r)=>{t[`Capabilities.member.${r+1}`]=a});if(e.roleArn)t.RoleARN=e.roleArn;if(e.tags)e.tags.forEach((a,r)=>{t[`Tags.member.${r+1}.Key`]=a.Key,t[`Tags.member.${r+1}.Value`]=a.Value});if(e.timeoutInMinutes)t.TimeoutInMinutes=e.timeoutInMinutes;if(e.onFailure)t.OnFailure=e.onFailure;let s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{StackId:s.StackId||s.CreateStackResult?.StackId}}async updateStack(e){let t={Action:"UpdateStack",StackName:e.stackName,Version:"2010-05-15"};if(e.templateBody)t.TemplateBody=e.templateBody;else if(e.templateUrl)t.TemplateURL=e.templateUrl;if(e.parameters)e.parameters.forEach((a,r)=>{if(t[`Parameters.member.${r+1}.ParameterKey`]=a.ParameterKey,a.UsePreviousValue)t[`Parameters.member.${r+1}.UsePreviousValue`]="true";else t[`Parameters.member.${r+1}.ParameterValue`]=a.ParameterValue});if(e.capabilities)e.capabilities.forEach((a,r)=>{t[`Capabilities.member.${r+1}`]=a});if(e.roleArn)t.RoleARN=e.roleArn;if(e.tags)e.tags.forEach((a,r)=>{t[`Tags.member.${r+1}.Key`]=a.Key,t[`Tags.member.${r+1}.Value`]=a.Value});let s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{StackId:s.StackId||s.UpdateStackResult?.StackId}}async deleteStack(e,t,s){let a={Action:"DeleteStack",StackName:e,Version:"2010-05-15"};if(t)a.RoleARN=t;if(s&&s.length>0)s.forEach((r,m)=>{a[`RetainResources.member.${m+1}`]=r});await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(a).toString()})}async describeStacks(e={}){let t={Action:"DescribeStacks",Version:"2010-05-15"};if(e.stackName)t.StackName=e.stackName;let s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{Stacks:this.parseStacksResponse(s)}}async describeStackEvents(e){let t={Action:"DescribeStackEvents",StackName:e,Version:"2010-05-15"},s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{StackEvents:this.parseStackEvents(s)}}async listStackResources(e){let t={Action:"ListStackResources",StackName:e,Version:"2010-05-15"},a=(await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()}))?.ListStackResourcesResult?.StackResourceSummaries?.member,r=[];if(a)r=Array.isArray(a)?a:[a];return{StackResourceSummaries:r}}async waitForStack(e,t){let s={"stack-create-complete":["CREATE_COMPLETE"],"stack-update-complete":["UPDATE_COMPLETE"],"stack-delete-complete":["DELETE_COMPLETE"]},a=["CREATE_FAILED","ROLLBACK_FAILED","ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE"],r=s[t],m=360,i=0;while(i<360)try{let c=await this.describeStacks({stackName:e});if(c.Stacks.length===0){if(t==="stack-delete-complete")return;if(i%10===0)console.log(`[waitForStack] Attempt ${i}: Stack not visible yet`);await new Promise((o)=>setTimeout(o,2000)),i++;continue}let n=c.Stacks[0];if(i%10===0)console.log(`[waitForStack] Attempt ${i}: Status = ${n.StackStatus}${n.StackStatusReason?` (${n.StackStatusReason})`:""}`);if(r.includes(n.StackStatus))return;if((t==="stack-create-complete"||t==="stack-update-complete")&&(n.StackStatus==="DELETE_IN_PROGRESS"||n.StackStatus==="DELETE_COMPLETE")){console.log("[waitForStack] Stack is being deleted (creation/update failed)");let o="";try{let u=await this.describeStackEvents(e);console.log("[waitForStack] Stack events (most recent first):");for(let l of u.StackEvents.slice(0,15))if(l.ResourceStatus.includes("FAILED")||l.ResourceStatusReason){if(console.log(` ${l.LogicalResourceId}: ${l.ResourceStatus} - ${l.ResourceStatusReason||"No reason provided"}`),l.ResourceStatus.includes("FAILED")&&l.ResourceStatusReason&&!o)o=l.ResourceStatusReason}}catch{}let S=o||n.StackStatusReason||"Check CloudFormation console for details.";throw Error(`Stack creation/update failed - stack is being deleted. Reason: ${S}`)}if(n.StackStatus==="DELETE_FAILED"&&t==="stack-delete-complete"){let o=Error("Stack deletion failed - may have resources that need to be retained");throw o.code="DELETE_FAILED",o.stackStatus=n.StackStatus,o.statusReason=n.StackStatusReason,o}if(a.includes(n.StackStatus))throw Error(`Stack reached failure status: ${n.StackStatus}`);await new Promise((o)=>setTimeout(o,5000)),i++}catch(c){if(t==="stack-delete-complete"&&c.message?.includes("does not exist"))return;if(t==="stack-create-complete"&&c.message?.includes("does not exist")){if(i%10===0)console.log(`[waitForStack] Attempt ${i}: Stack does not exist (error), retrying...`);await new Promise((n)=>setTimeout(n,2000)),i++;continue}throw console.log(`[waitForStack] Unexpected error: ${c.message}`),c}throw console.log(`[waitForStack] Timeout after ${i} attempts`),Error(`Timeout waiting for stack to reach ${t}`)}async validateTemplate(e){let t={Action:"ValidateTemplate",TemplateBody:e,Version:"2010-05-15"};return await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()})}async listStacks(e){let t={Action:"ListStacks",Version:"2010-05-15"};if(e)e.forEach((c,n)=>{t[`StackStatusFilter.member.${n+1}`]=c});let s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()}),a=s.ListStacksResponse||s,r=a.ListStacksResult||a,m=r.StackSummaries?.member||r.StackSummaries||[];return{StackSummaries:(Array.isArray(m)?m:m?[m]:[]).map((c)=>({StackId:c.StackId||"",StackName:c.StackName||"",TemplateDescription:c.TemplateDescription,CreationTime:c.CreationTime||"",LastUpdatedTime:c.LastUpdatedTime,DeletionTime:c.DeletionTime,StackStatus:c.StackStatus||""}))}}async createChangeSet(e){let t={Action:"CreateChangeSet",StackName:e.stackName,ChangeSetName:e.changeSetName,Version:"2010-05-15"};if(e.templateBody)t.TemplateBody=e.templateBody;else if(e.templateUrl)t.TemplateURL=e.templateUrl;if(e.parameters)e.parameters.forEach((a,r)=>{t[`Parameters.member.${r+1}.ParameterKey`]=a.ParameterKey,t[`Parameters.member.${r+1}.ParameterValue`]=a.ParameterValue});if(e.capabilities)e.capabilities.forEach((a,r)=>{t[`Capabilities.member.${r+1}`]=a});if(e.changeSetType)t.ChangeSetType=e.changeSetType;let s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{Id:s.Id,StackId:s.StackId}}async describeChangeSet(e,t){let s={Action:"DescribeChangeSet",StackName:e,ChangeSetName:t,Version:"2010-05-15"};return await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(s).toString()})}async executeChangeSet(e,t){let s={Action:"ExecuteChangeSet",StackName:e,ChangeSetName:t,Version:"2010-05-15"};await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(s).toString()})}async deleteChangeSet(e,t){let s={Action:"DeleteChangeSet",StackName:e,ChangeSetName:t,Version:"2010-05-15"};await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(s).toString()})}async getStackOutputs(e){let t=await this.describeStacks({stackName:e});if(!t.Stacks||t.Stacks.length===0)throw Error(`Stack ${e} not found`);let s=t.Stacks[0],a={};if(s.Outputs)for(let r of s.Outputs)a[r.OutputKey]=r.OutputValue;return a}async getTemplate(e){let t={Action:"GetTemplate",StackName:e,Version:"2010-05-15"},s=await this.client.request({service:"cloudformation",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{TemplateBody:s?.GetTemplateResult?.TemplateBody||s?.TemplateBody||""}}parseStacksResponse(e){let t=[],s=e?.DescribeStacksResult?.Stacks?.member||e?.Stacks?.member||e?.Stacks||e;if(s&&!Array.isArray(s))s=[s];if(Array.isArray(s)){for(let a of s)if(a.StackId||a.StackName){let r;if(a.Outputs?.member)r=(Array.isArray(a.Outputs.member)?a.Outputs.member:[a.Outputs.member]).map((i)=>({OutputKey:i.OutputKey,OutputValue:i.OutputValue,Description:i.Description,ExportName:i.ExportName}));t.push({StackId:a.StackId,StackName:a.StackName,StackStatus:a.StackStatus,CreationTime:a.CreationTime,LastUpdatedTime:a.LastUpdatedTime,StackStatusReason:a.StackStatusReason,Outputs:r})}}else if(e.StackId)t.push({StackId:e.StackId,StackName:e.StackName,StackStatus:e.StackStatus,CreationTime:e.CreationTime,LastUpdatedTime:e.LastUpdatedTime});return t}parseStackEvents(e){let t=[],s=e?.DescribeStackEventsResult?.StackEvents?.member||e?.StackEvents?.member||e?.StackEvents||[];if(s&&!Array.isArray(s))s=[s];for(let a of s)if(a.LogicalResourceId)t.push({Timestamp:a.Timestamp,ResourceType:a.ResourceType,LogicalResourceId:a.LogicalResourceId,ResourceStatus:a.ResourceStatus,ResourceStatusReason:a.ResourceStatusReason});return t}async waitForStackWithProgress(e,t,s){let a={"stack-create-complete":["CREATE_COMPLETE"],"stack-update-complete":["UPDATE_COMPLETE"],"stack-delete-complete":["DELETE_COMPLETE"]},r=["CREATE_FAILED","ROLLBACK_FAILED","ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE"],m=a[t],i=360,c=0,n=new Set;while(c<360)try{if(s)try{let l=[...(await this.describeStackEvents(e)).StackEvents||[]].reverse();for(let k of l){let d=`${k.LogicalResourceId}-${k.ResourceStatus}-${k.Timestamp}`;if(!n.has(d))n.add(d),s({resourceId:k.LogicalResourceId,resourceType:k.ResourceType,status:k.ResourceStatus,reason:k.ResourceStatusReason,timestamp:k.Timestamp})}}catch{}let o=await this.describeStacks({stackName:e});if(o.Stacks.length===0){if(t==="stack-delete-complete")return;await new Promise((u)=>setTimeout(u,2000)),c++;continue}let S=o.Stacks[0];if(m.includes(S.StackStatus))return;if(S.StackStatus==="DELETE_FAILED"&&t==="stack-delete-complete"){let u=Error("Stack deletion failed - may have resources that need to be retained");throw u.code="DELETE_FAILED",u.stackStatus=S.StackStatus,u.statusReason=S.StackStatusReason,u}if(r.includes(S.StackStatus))throw Error(`Stack reached failure status: ${S.StackStatus}`);await new Promise((u)=>setTimeout(u,3000)),c++}catch(o){if(t==="stack-delete-complete"&&o.message?.includes("does not exist"))return;if(t==="stack-create-complete"&&o.message?.includes("does not exist")){await new Promise((S)=>setTimeout(S,2000)),c++;continue}throw o}throw Error(`Timeout waiting for stack to reach ${t}`)}async waitForStackComplete(e,t=120,s=5000){let a=["CREATE_COMPLETE","UPDATE_COMPLETE","DELETE_COMPLETE"],r=["CREATE_FAILED","UPDATE_FAILED","DELETE_FAILED","ROLLBACK_COMPLETE","ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED"];for(let m=0;m<t;m++)try{let i=await this.describeStacks({stackName:e});if(i.Stacks.length===0)return{success:!0,status:"DELETE_COMPLETE"};let c=i.Stacks[0],n=c.StackStatus;if(a.includes(n))return{success:!0,status:n};if(r.includes(n))return{success:!1,status:n,reason:c.StackStatusReason};await new Promise((o)=>setTimeout(o,s))}catch(i){if(i.message?.includes("does not exist"))return{success:!0,status:"DELETE_COMPLETE"};throw i}return{success:!1,status:"TIMEOUT",reason:"Timeout waiting for stack operation"}}}
|
|
2
|
-
export{p as vg};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ph as l,qh as a}from"./chunk-bzth6d1s.js";class g{client;region;constructor(e="us-east-1"){this.region=e,this.client=new l}async describeDBInstances(e){let r={Action:"DescribeDBInstances",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((o,c)=>{r[`Filters.Filter.${c+1}.Name`]=o.Name,o.Values.forEach((u,d)=>{r[`Filters.Filter.${c+1}.Values.Value.${d+1}`]=u})});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBInstancesResult||n,s=i.DBInstances?.DBInstance||[];if(!Array.isArray(s))s=s?[s]:[];return{DBInstances:s,Marker:i.Marker}}async describeDBInstance(e){return(await this.describeDBInstances({DBInstanceIdentifier:e})).DBInstances?.[0]}async describeDBClusters(e){let r={Action:"DescribeDBClusters",Version:"2014-10-31"};if(e?.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;if(e?.Filters)e.Filters.forEach((o,c)=>{r[`Filters.Filter.${c+1}.Name`]=o.Name,o.Values.forEach((u,d)=>{r[`Filters.Filter.${c+1}.Values.Value.${d+1}`]=u})});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBClustersResult||n,s=i.DBClusters?.DBCluster||[];if(!Array.isArray(s))s=s?[s]:[];return{DBClusters:s,Marker:i.Marker}}async describeDBSnapshots(e){let r={Action:"DescribeDBSnapshots",Version:"2014-10-31"};if(e?.DBInstanceIdentifier)r.DBInstanceIdentifier=e.DBInstanceIdentifier;if(e?.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;if(e?.SnapshotType)r.SnapshotType=e.SnapshotType;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBSnapshotsResult||n,s=i.DBSnapshots?.DBSnapshot||[];if(!Array.isArray(s))s=s?[s]:[];return{DBSnapshots:s,Marker:i.Marker}}async describeDBSubnetGroups(e){let r={Action:"DescribeDBSubnetGroups",Version:"2014-10-31"};if(e?.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e?.MaxRecords)r.MaxRecords=e.MaxRecords;if(e?.Marker)r.Marker=e.Marker;let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}),i=n.DescribeDBSubnetGroupsResult||n,s=i.DBSubnetGroups?.DBSubnetGroup||[];if(!Array.isArray(s))s=s?[s]:[];return{DBSubnetGroups:s,Marker:i.Marker}}async createDBInstance(e){let r={Action:"CreateDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBInstanceClass:e.DBInstanceClass,Engine:e.Engine};if(e.DBClusterIdentifier)r.DBClusterIdentifier=e.DBClusterIdentifier;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DBName)r.DBName=e.DBName;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.LicenseModel)r.LicenseModel=e.LicenseModel;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.StorageType)r.StorageType=e.StorageType;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=s});if(e.Tags)e.Tags.forEach((s,o)=>{r[`Tags.Tag.${o+1}.Key`]=s.Key,r[`Tags.Tag.${o+1}.Value`]=s.Value});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.CreateDBInstanceResult||n).DBInstance}}async createDBCluster(e){let r={Action:"CreateDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUsername)r.MasterUsername=e.MasterUsername;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DatabaseName)r.DatabaseName=e.DatabaseName;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.StorageEncrypted!==void 0)r.StorageEncrypted=e.StorageEncrypted;if(e.KmsKeyId)r.KmsKeyId=e.KmsKeyId;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;e.VpcSecurityGroupIds?.forEach((i,s)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${s+1}`]=i});let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a(r)).toString()});return{DBCluster:(t.CreateDBClusterResult||t).DBCluster}}async deleteDBInstance(e){let r={Action:"DeleteDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.SkipFinalSnapshot!==void 0)r.SkipFinalSnapshot=e.SkipFinalSnapshot;if(e.FinalDBSnapshotIdentifier)r.FinalDBSnapshotIdentifier=e.FinalDBSnapshotIdentifier;if(e.DeleteAutomatedBackups!==void 0)r.DeleteAutomatedBackups=e.DeleteAutomatedBackups;let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.DeleteDBInstanceResult||n).DBInstance}}async modifyDBInstance(e){let r={Action:"ModifyDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.AllocatedStorage)r.AllocatedStorage=e.AllocatedStorage;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.PreferredBackupWindow)r.PreferredBackupWindow=e.PreferredBackupWindow;if(e.PreferredMaintenanceWindow)r.PreferredMaintenanceWindow=e.PreferredMaintenanceWindow;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=s});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.ModifyDBInstanceResult||n).DBInstance}}async modifyDBCluster(e){let r={Action:"ModifyDBCluster",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier};if(e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;if(e.BackupRetentionPeriod!==void 0)r.BackupRetentionPeriod=e.BackupRetentionPeriod;if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.MasterUserPassword)r.MasterUserPassword=e.MasterUserPassword;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.ApplyImmediately!==void 0)r.ApplyImmediately=e.ApplyImmediately;let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBCluster:(n.ModifyDBClusterResult||n).DBCluster}}async rebootDBCluster(e){let r={Action:"FailoverDBCluster",Version:"2014-10-31",DBClusterIdentifier:e},t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a(r)).toString()});return{DBCluster:(t.FailoverDBClusterResult||t).DBCluster}}async createDBClusterSnapshot(e,r){let t={Action:"CreateDBClusterSnapshot",Version:"2014-10-31",DBClusterIdentifier:e,DBClusterSnapshotIdentifier:r};return this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a(t)).toString()})}async describeDBClusterSnapshots(e={}){let r={Action:"DescribeDBClusterSnapshots",Version:"2014-10-31",...e},t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a(r)).toString()}),n=t.DescribeDBClusterSnapshotsResult||t,i=n.DBClusterSnapshots?.DBClusterSnapshot??n.DBClusterSnapshots??[];return{DBClusterSnapshots:Array.isArray(i)?i:[i]}}async deleteDBClusterSnapshot(e){await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a({Action:"DeleteDBClusterSnapshot",Version:"2014-10-31",DBClusterSnapshotIdentifier:e})).toString()})}async deleteDBCluster(e,r){let t={Action:"DeleteDBCluster",Version:"2014-10-31",DBClusterIdentifier:e,SkipFinalSnapshot:!r};if(r)t.FinalDBSnapshotIdentifier=r;let n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a(t)).toString()});return{DBCluster:(n.DeleteDBClusterResult||n).DBCluster}}async restoreDBClusterToPointInTime(e){let r={Action:"RestoreDBClusterToPointInTime",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SourceDBClusterIdentifier:e.SourceDBClusterIdentifier};if(e.RestoreToTime)r.RestoreToTime=e.RestoreToTime.toISOString();if(e.UseLatestRestorableTime)r.UseLatestRestorableTime=!0;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=s});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBCluster:(n.RestoreDBClusterToPointInTimeResult||n).DBCluster}}async restoreDBClusterFromSnapshot(e){let r={Action:"RestoreDBClusterFromSnapshot",Version:"2014-10-31",DBClusterIdentifier:e.DBClusterIdentifier,SnapshotIdentifier:e.SnapshotIdentifier,Engine:e.Engine};if(e.EngineVersion)r.EngineVersion=e.EngineVersion;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds?.forEach((i,s)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${s+1}`]=i}),e.ServerlessV2ScalingConfiguration)r["ServerlessV2ScalingConfiguration.MinCapacity"]=e.ServerlessV2ScalingConfiguration.MinCapacity,r["ServerlessV2ScalingConfiguration.MaxCapacity"]=e.ServerlessV2ScalingConfiguration.MaxCapacity;let t=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(a(r)).toString()});return{DBCluster:(t.RestoreDBClusterFromSnapshotResult||t).DBCluster}}async startDBInstance(e){let t=new URLSearchParams(a({Action:"StartDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e})).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.StartDBInstanceResult||n).DBInstance}}async stopDBInstance(e){let r={Action:"StopDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.DBSnapshotIdentifier)r.DBSnapshotIdentifier=e.DBSnapshotIdentifier;let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.StopDBInstanceResult||n).DBInstance}}async rebootDBInstance(e){let r={Action:"RebootDBInstance",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier};if(e.ForceFailover!==void 0)r.ForceFailover=e.ForceFailover;let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.RebootDBInstanceResult||n).DBInstance}}async createDBSnapshot(e){let r={Action:"CreateDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.Tags)e.Tags.forEach((s,o)=>{r[`Tags.Tag.${o+1}.Key`]=s.Key,r[`Tags.Tag.${o+1}.Value`]=s.Value});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBSnapshot:(n.CreateDBSnapshotResult||n).DBSnapshot}}async deleteDBSnapshot(e){let t=new URLSearchParams(a({Action:"DeleteDBSnapshot",Version:"2014-10-31",DBSnapshotIdentifier:e})).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBSnapshot:(n.DeleteDBSnapshotResult||n).DBSnapshot}}async restoreDBInstanceFromDBSnapshot(e){let r={Action:"RestoreDBInstanceFromDBSnapshot",Version:"2014-10-31",DBInstanceIdentifier:e.DBInstanceIdentifier,DBSnapshotIdentifier:e.DBSnapshotIdentifier};if(e.DBInstanceClass)r.DBInstanceClass=e.DBInstanceClass;if(e.Port)r.Port=e.Port;if(e.AvailabilityZone)r.AvailabilityZone=e.AvailabilityZone;if(e.DBSubnetGroupName)r.DBSubnetGroupName=e.DBSubnetGroupName;if(e.MultiAZ!==void 0)r.MultiAZ=e.MultiAZ;if(e.PubliclyAccessible!==void 0)r.PubliclyAccessible=e.PubliclyAccessible;if(e.AutoMinorVersionUpgrade!==void 0)r.AutoMinorVersionUpgrade=e.AutoMinorVersionUpgrade;if(e.StorageType)r.StorageType=e.StorageType;if(e.DeletionProtection!==void 0)r.DeletionProtection=e.DeletionProtection;if(e.VpcSecurityGroupIds)e.VpcSecurityGroupIds.forEach((s,o)=>{r[`VpcSecurityGroupIds.VpcSecurityGroupId.${o+1}`]=s});if(e.Tags)e.Tags.forEach((s,o)=>{r[`Tags.Tag.${o+1}.Key`]=s.Key,r[`Tags.Tag.${o+1}.Value`]=s.Value});let t=new URLSearchParams(a(r)).toString(),n=await this.client.request({service:"rds",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});return{DBInstance:(n.RestoreDBInstanceFromDBSnapshotResult||n).DBInstance}}async waitForDBInstanceAvailable(e,r=60,t=30000){for(let n=0;n<r;n++){let i=await this.describeDBInstance(e);if(i?.DBInstanceStatus==="available")return i;if(["deleted","failed","incompatible-restore","incompatible-parameters"].includes(i?.DBInstanceStatus||""))throw Error(`DB instance ${e} is in terminal state: ${i?.DBInstanceStatus}`);await new Promise((s)=>setTimeout(s,t))}throw Error(`Timeout waiting for DB instance ${e} to become available`)}async waitForDBInstanceDeleted(e,r=60,t=30000){for(let n=0;n<r;n++)try{let i=await this.describeDBInstance(e);if(i?.DBInstanceStatus==="deleting"){await new Promise((s)=>setTimeout(s,t));continue}throw Error(`DB instance ${e} is in state: ${i?.DBInstanceStatus}`)}catch(i){if(i.code==="DBInstanceNotFound"||i.code==="DBInstanceNotFoundFault")return;throw i}throw Error(`Timeout waiting for DB instance ${e} to be deleted`)}}
|
|
2
|
-
export{g as gd};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{Ag as P}from"./chunk-m9r5jype.js";import{Cg as A}from"./chunk-e2dnxp8d.js";import{ph as d}from"./chunk-bzth6d1s.js";import{Bp as y}from"./chunk-m07s5esk.js";function I(e,t){let s=[`Action=${e}`,"Version=2010-05-08"];for(let[a,i]of Object.entries(t)){if(i===void 0||i===null)continue;if(Array.isArray(i))i.forEach((n,c)=>{if(typeof n==="object"&&n!==null)for(let[u,l]of Object.entries(n))s.push(`${a}.member.${c+1}.${u}=${encodeURIComponent(String(l))}`);else s.push(`${a}.member.${c+1}=${encodeURIComponent(String(n))}`)});else if(typeof i==="object"){for(let[n,c]of Object.entries(i))if(c!==void 0&&c!==null)s.push(`${a}.${n}=${encodeURIComponent(String(c))}`)}else s.push(`${a}=${encodeURIComponent(String(i))}`)}return s.join("&")}function r(e,t){let s=new RegExp(`<${t}>([^<]*)</${t}>`),a=e.match(s);return a?a[1]:void 0}function o(e,t,s){let a=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`),i=e.match(a);if(!i)return[];let n=[],c=new RegExp(`<${s}>([\\s\\S]*?)</${s}>`,"g"),u;while((u=c.exec(i[1]))!==null)n.push(u[1]);return n}class g{client;region;constructor(e="us-east-1",t){this.client=new d(void 0,{profile:t}),this.region=e}async request(e,t={}){let s=I(e,t);return await this.client.request({service:"iam",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s})}async createUser(e){let t=await this.request("CreateUser",e);return this.parseUser(t)}async getUser(e={}){let t=await this.request("GetUser",e);return this.parseUser(t)}async listUsers(e={}){let t=await this.request("ListUsers",e),s=this.parseUsers(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Users:s,IsTruncated:a,Marker:i}}async updateUser(e){await this.request("UpdateUser",e)}async deleteUser(e){await this.request("DeleteUser",e)}parseUser(e){return{UserName:r(e,"UserName")||"",UserId:r(e,"UserId")||"",Arn:r(e,"Arn")||"",Path:r(e,"Path"),CreateDate:r(e,"CreateDate"),PasswordLastUsed:r(e,"PasswordLastUsed")}}parseUsers(e){return o(e,"Users","member").map((s)=>({UserName:r(s,"UserName")||"",UserId:r(s,"UserId")||"",Arn:r(s,"Arn")||"",Path:r(s,"Path"),CreateDate:r(s,"CreateDate"),PasswordLastUsed:r(s,"PasswordLastUsed")}))}async createGroup(e){let t=await this.request("CreateGroup",e);return this.parseGroup(t)}async getGroup(e){let t=await this.request("GetGroup",e),s=this.parseGroup(t),a=this.parseUsers(t),i=r(t,"IsTruncated")==="true",n=r(t,"Marker");return{Group:s,Users:a,IsTruncated:i,Marker:n}}async listGroups(e={}){let t=await this.request("ListGroups",e),s=this.parseGroups(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Groups:s,IsTruncated:a,Marker:i}}async updateGroup(e){await this.request("UpdateGroup",e)}async deleteGroup(e){await this.request("DeleteGroup",e)}async addUserToGroup(e){await this.request("AddUserToGroup",e)}async removeUserFromGroup(e){await this.request("RemoveUserFromGroup",e)}async listGroupsForUser(e){let t=await this.request("ListGroupsForUser",e),s=this.parseGroups(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Groups:s,IsTruncated:a,Marker:i}}parseGroup(e){return{GroupName:r(e,"GroupName")||"",GroupId:r(e,"GroupId")||"",Arn:r(e,"Arn")||"",Path:r(e,"Path"),CreateDate:r(e,"CreateDate")}}parseGroups(e){return o(e,"Groups","member").map((s)=>({GroupName:r(s,"GroupName")||"",GroupId:r(s,"GroupId")||"",Arn:r(s,"Arn")||"",Path:r(s,"Path"),CreateDate:r(s,"CreateDate")}))}async createRole(e){let t=await this.request("CreateRole",e);return this.parseRole(t)}async getRole(e){let t=await this.request("GetRole",e);return this.parseRole(t)}async listRoles(e={}){let t=await this.request("ListRoles",e),s=this.parseRoles(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Roles:s,IsTruncated:a,Marker:i}}async updateRole(e){await this.request("UpdateRole",e)}async updateRoleDescription(e){let t=await this.request("UpdateRoleDescription",e);return this.parseRole(t)}async updateAssumeRolePolicy(e){await this.request("UpdateAssumeRolePolicy",e)}async deleteRole(e){await this.request("DeleteRole",e)}async tagRole(e){await this.request("TagRole",e)}async untagRole(e){await this.request("UntagRole",e)}async listRoleTags(e){let t=await this.request("ListRoleTags",e),s=this.parseTags(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Tags:s,IsTruncated:a,Marker:i}}parseRole(e){return{RoleName:r(e,"RoleName")||"",RoleId:r(e,"RoleId")||"",Arn:r(e,"Arn")||"",Path:r(e,"Path"),CreateDate:r(e,"CreateDate"),AssumeRolePolicyDocument:r(e,"AssumeRolePolicyDocument"),Description:r(e,"Description"),MaxSessionDuration:r(e,"MaxSessionDuration")?Number.parseInt(r(e,"MaxSessionDuration"),10):void 0}}parseRoles(e){return o(e,"Roles","member").map((s)=>({RoleName:r(s,"RoleName")||"",RoleId:r(s,"RoleId")||"",Arn:r(s,"Arn")||"",Path:r(s,"Path"),CreateDate:r(s,"CreateDate"),AssumeRolePolicyDocument:r(s,"AssumeRolePolicyDocument"),Description:r(s,"Description"),MaxSessionDuration:r(s,"MaxSessionDuration")?Number.parseInt(r(s,"MaxSessionDuration"),10):void 0}))}parseTags(e){return o(e,"Tags","member").map((s)=>({Key:r(s,"Key")||"",Value:r(s,"Value")||""}))}async createPolicy(e){let t=await this.request("CreatePolicy",e);return this.parsePolicy(t)}async getPolicy(e){let t=await this.request("GetPolicy",e);return this.parsePolicy(t)}async getPolicyVersion(e){let t=await this.request("GetPolicyVersion",e);return{VersionId:r(t,"VersionId")||"",IsDefaultVersion:r(t,"IsDefaultVersion")==="true",CreateDate:r(t,"CreateDate"),Document:r(t,"Document")}}async listPolicies(e={}){let t=await this.request("ListPolicies",e),s=this.parsePolicies(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Policies:s,IsTruncated:a,Marker:i}}async listPolicyVersions(e){let t=await this.request("ListPolicyVersions",e),s=this.parsePolicyVersions(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{Versions:s,IsTruncated:a,Marker:i}}async createPolicyVersion(e){let t=await this.request("CreatePolicyVersion",e);return{VersionId:r(t,"VersionId")||"",IsDefaultVersion:r(t,"IsDefaultVersion")==="true",CreateDate:r(t,"CreateDate")}}async deletePolicyVersion(e){await this.request("DeletePolicyVersion",e)}async setDefaultPolicyVersion(e){await this.request("SetDefaultPolicyVersion",e)}async deletePolicy(e){await this.request("DeletePolicy",e)}async attachUserPolicy(e){await this.request("AttachUserPolicy",e)}async detachUserPolicy(e){await this.request("DetachUserPolicy",e)}async attachGroupPolicy(e){await this.request("AttachGroupPolicy",e)}async detachGroupPolicy(e){await this.request("DetachGroupPolicy",e)}async attachRolePolicy(e){await this.request("AttachRolePolicy",e)}async detachRolePolicy(e){await this.request("DetachRolePolicy",e)}async listAttachedUserPolicies(e){let t=await this.request("ListAttachedUserPolicies",e),s=this.parseAttachedPolicies(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{AttachedPolicies:s,IsTruncated:a,Marker:i}}async listAttachedGroupPolicies(e){let t=await this.request("ListAttachedGroupPolicies",e),s=this.parseAttachedPolicies(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{AttachedPolicies:s,IsTruncated:a,Marker:i}}async listAttachedRolePolicies(e){let t=await this.request("ListAttachedRolePolicies",e),s=this.parseAttachedPolicies(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{AttachedPolicies:s,IsTruncated:a,Marker:i}}parsePolicy(e){return{PolicyName:r(e,"PolicyName")||"",PolicyId:r(e,"PolicyId")||"",Arn:r(e,"Arn")||"",Path:r(e,"Path"),DefaultVersionId:r(e,"DefaultVersionId"),AttachmentCount:r(e,"AttachmentCount")?Number.parseInt(r(e,"AttachmentCount"),10):void 0,PermissionsBoundaryUsageCount:r(e,"PermissionsBoundaryUsageCount")?Number.parseInt(r(e,"PermissionsBoundaryUsageCount"),10):void 0,IsAttachable:r(e,"IsAttachable")==="true",Description:r(e,"Description"),CreateDate:r(e,"CreateDate"),UpdateDate:r(e,"UpdateDate")}}parsePolicies(e){return o(e,"Policies","member").map((s)=>({PolicyName:r(s,"PolicyName")||"",PolicyId:r(s,"PolicyId")||"",Arn:r(s,"Arn")||"",Path:r(s,"Path"),DefaultVersionId:r(s,"DefaultVersionId"),AttachmentCount:r(s,"AttachmentCount")?Number.parseInt(r(s,"AttachmentCount"),10):void 0,PermissionsBoundaryUsageCount:r(s,"PermissionsBoundaryUsageCount")?Number.parseInt(r(s,"PermissionsBoundaryUsageCount"),10):void 0,IsAttachable:r(s,"IsAttachable")==="true",Description:r(s,"Description"),CreateDate:r(s,"CreateDate"),UpdateDate:r(s,"UpdateDate")}))}parsePolicyVersions(e){return o(e,"Versions","member").map((s)=>({VersionId:r(s,"VersionId")||"",IsDefaultVersion:r(s,"IsDefaultVersion")==="true",CreateDate:r(s,"CreateDate")}))}parseAttachedPolicies(e){return o(e,"AttachedPolicies","member").map((s)=>({PolicyName:r(s,"PolicyName")||"",PolicyArn:r(s,"PolicyArn")||""}))}async putUserPolicy(e){await this.request("PutUserPolicy",e)}async getUserPolicy(e){let t=await this.request("GetUserPolicy",e);return{UserName:r(t,"UserName")||"",PolicyName:r(t,"PolicyName")||"",PolicyDocument:decodeURIComponent(r(t,"PolicyDocument")||"")}}async deleteUserPolicy(e){await this.request("DeleteUserPolicy",e)}async listUserPolicies(e){let t=await this.request("ListUserPolicies",e),s=o(t,"PolicyNames","member"),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{PolicyNames:s,IsTruncated:a,Marker:i}}async putGroupPolicy(e){await this.request("PutGroupPolicy",e)}async getGroupPolicy(e){let t=await this.request("GetGroupPolicy",e);return{GroupName:r(t,"GroupName")||"",PolicyName:r(t,"PolicyName")||"",PolicyDocument:decodeURIComponent(r(t,"PolicyDocument")||"")}}async deleteGroupPolicy(e){await this.request("DeleteGroupPolicy",e)}async listGroupPolicies(e){let t=await this.request("ListGroupPolicies",e),s=o(t,"PolicyNames","member"),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{PolicyNames:s,IsTruncated:a,Marker:i}}async putRolePolicy(e){await this.request("PutRolePolicy",e)}async getRolePolicy(e){let t=await this.request("GetRolePolicy",e);return{RoleName:r(t,"RoleName")||"",PolicyName:r(t,"PolicyName")||"",PolicyDocument:decodeURIComponent(r(t,"PolicyDocument")||"")}}async deleteRolePolicy(e){await this.request("DeleteRolePolicy",e)}async listRolePolicies(e){let t=await this.request("ListRolePolicies",e),s=o(t,"PolicyNames","member"),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{PolicyNames:s,IsTruncated:a,Marker:i}}async createAccessKey(e={}){let t=await this.request("CreateAccessKey",e);if(typeof t==="object"){let s=t?.CreateAccessKeyResult?.AccessKey||t?.AccessKey;if(s)return{AccessKey:{UserName:s.UserName||"",AccessKeyId:s.AccessKeyId||"",Status:s.Status||"Active",SecretAccessKey:s.SecretAccessKey||"",CreateDate:s.CreateDate}}}return{AccessKey:{UserName:r(t,"UserName")||"",AccessKeyId:r(t,"AccessKeyId")||"",Status:r(t,"Status")||"Active",SecretAccessKey:r(t,"SecretAccessKey")||"",CreateDate:r(t,"CreateDate")}}}async listAccessKeys(e={}){let t=await this.request("ListAccessKeys",e),s=this.parseAccessKeys(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{AccessKeyMetadata:s,IsTruncated:a,Marker:i}}async updateAccessKey(e){await this.request("UpdateAccessKey",e)}async deleteAccessKey(e){await this.request("DeleteAccessKey",e)}async getAccessKeyLastUsed(e){let t=await this.request("GetAccessKeyLastUsed",e);return{UserName:r(t,"UserName")||"",AccessKeyLastUsed:{LastUsedDate:r(t,"LastUsedDate"),ServiceName:r(t,"ServiceName"),Region:r(t,"Region")}}}parseAccessKeys(e){return o(e,"AccessKeyMetadata","member").map((s)=>({UserName:r(s,"UserName"),AccessKeyId:r(s,"AccessKeyId")||"",Status:r(s,"Status")||"Active",CreateDate:r(s,"CreateDate")}))}async createInstanceProfile(e){let t=await this.request("CreateInstanceProfile",e);return this.parseInstanceProfile(t)}async getInstanceProfile(e){let t=await this.request("GetInstanceProfile",e);return this.parseInstanceProfile(t)}async listInstanceProfiles(e={}){let t=await this.request("ListInstanceProfiles",e),s=this.parseInstanceProfiles(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{InstanceProfiles:s,IsTruncated:a,Marker:i}}async listInstanceProfilesForRole(e){let t=await this.request("ListInstanceProfilesForRole",e),s=this.parseInstanceProfiles(t),a=r(t,"IsTruncated")==="true",i=r(t,"Marker");return{InstanceProfiles:s,IsTruncated:a,Marker:i}}async addRoleToInstanceProfile(e){await this.request("AddRoleToInstanceProfile",e)}async removeRoleFromInstanceProfile(e){await this.request("RemoveRoleFromInstanceProfile",e)}async deleteInstanceProfile(e){await this.request("DeleteInstanceProfile",e)}parseInstanceProfile(e){return{InstanceProfileName:r(e,"InstanceProfileName")||"",InstanceProfileId:r(e,"InstanceProfileId")||"",Arn:r(e,"Arn")||"",Path:r(e,"Path"),CreateDate:r(e,"CreateDate")}}parseInstanceProfiles(e){return o(e,"InstanceProfiles","member").map((s)=>({InstanceProfileName:r(s,"InstanceProfileName")||"",InstanceProfileId:r(s,"InstanceProfileId")||"",Arn:r(s,"Arn")||"",Path:r(s,"Path"),CreateDate:r(s,"CreateDate")}))}async getAccountPasswordPolicy(){let e=await this.request("GetAccountPasswordPolicy");return{MinimumPasswordLength:r(e,"MinimumPasswordLength")?Number.parseInt(r(e,"MinimumPasswordLength"),10):void 0,RequireSymbols:r(e,"RequireSymbols")==="true",RequireNumbers:r(e,"RequireNumbers")==="true",RequireUppercaseCharacters:r(e,"RequireUppercaseCharacters")==="true",RequireLowercaseCharacters:r(e,"RequireLowercaseCharacters")==="true",AllowUsersToChangePassword:r(e,"AllowUsersToChangePassword")==="true",ExpirePasswords:r(e,"ExpirePasswords")==="true",MaxPasswordAge:r(e,"MaxPasswordAge")?Number.parseInt(r(e,"MaxPasswordAge"),10):void 0,PasswordReusePrevention:r(e,"PasswordReusePrevention")?Number.parseInt(r(e,"PasswordReusePrevention"),10):void 0,HardExpiry:r(e,"HardExpiry")==="true"}}async updateAccountPasswordPolicy(e){await this.request("UpdateAccountPasswordPolicy",e)}async deleteAccountPasswordPolicy(){await this.request("DeleteAccountPasswordPolicy")}async getAccountSummary(){let e=await this.request("GetAccountSummary"),t={},s=o(e,"SummaryMap","entry");for(let a of s){let i=r(a,"key"),n=r(a,"value");if(i&&n)t[i]=Number.parseInt(n,10)}return t}async listAccountAliases(){let e=await this.request("ListAccountAliases"),t=o(e,"AccountAliases","member"),s=r(e,"IsTruncated")==="true",a=r(e,"Marker");return{AccountAliases:t,IsTruncated:s,Marker:a}}async createAccountAlias(e){await this.request("CreateAccountAlias",e)}async deleteAccountAlias(e){await this.request("DeleteAccountAlias",e)}async simulatePrincipalPolicy(e){let t=await this.request("SimulatePrincipalPolicy",e);return this.parseSimulationResults(t)}parseSimulationResults(e){let s=o(e,"EvaluationResults","member").map((n)=>{let u=o(n,"MatchedStatements","member").map((l)=>({SourcePolicyId:r(l,"SourcePolicyId"),SourcePolicyType:r(l,"SourcePolicyType")}));return{EvalActionName:r(n,"EvalActionName")||"",EvalResourceName:r(n,"EvalResourceName"),EvalDecision:r(n,"EvalDecision")||"",MatchedStatements:u.length>0?u:void 0}}),a=r(e,"IsTruncated")==="true",i=r(e,"Marker");return{EvaluationResults:s,IsTruncated:a,Marker:i}}}class p{client;region;constructor(e="us-east-1",t){this.region=e,this.client=new d(t)}async createEmailIdentity(e){return await this.client.request({service:"email",region:this.region,method:"POST",path:"/v2/email/identities",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async getEmailIdentity(e){let t=await this.client.request({service:"email",region:this.region,method:"GET",path:`/v2/email/identities/${encodeURIComponent(e)}`,headers:{"Content-Type":"application/json"}});return{IdentityType:t.IdentityType,IdentityName:e,SendingEnabled:t.VerifiedForSendingStatus,VerificationStatus:t.VerificationStatus,DkimAttributes:t.DkimAttributes,MailFromAttributes:t.MailFromAttributes}}async putEmailIdentityMailFromAttributes(e,t){await this.client.request({service:"email",region:this.region,method:"PUT",path:`/v2/email/identities/${encodeURIComponent(e)}/mail-from`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async listEmailIdentities(e){let t="/v2/email/identities",s=[];if(e?.PageSize)s.push(`PageSize=${e.PageSize}`);if(e?.NextToken)s.push(`NextToken=${encodeURIComponent(e.NextToken)}`);if(s.length>0)t+=`?${s.join("&")}`;let a=await this.client.request({service:"email",region:this.region,method:"GET",path:t,headers:{"Content-Type":"application/json"}});return{EmailIdentities:a.EmailIdentities,NextToken:a.NextToken}}async deleteEmailIdentity(e){await this.client.request({service:"email",region:this.region,method:"DELETE",path:`/v2/email/identities/${encodeURIComponent(e)}`,headers:{"Content-Type":"application/json"}})}async putEmailIdentityDkimAttributes(e){await this.client.request({service:"email",region:this.region,method:"PUT",path:`/v2/email/identities/${encodeURIComponent(e.EmailIdentity)}/dkim`,headers:{"Content-Type":"application/json"},body:JSON.stringify({SigningEnabled:e.SigningEnabled})})}async sendEmail(e){return{MessageId:(await this.client.request({service:"email",region:this.region,method:"POST",path:"/v2/email/outbound-emails",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).MessageId}}async sendBulkEmail(e){return{BulkEmailEntryResults:(await this.client.request({service:"email",region:this.region,method:"POST",path:"/v2/email/outbound-bulk-emails",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).BulkEmailEntryResults}}async createEmailTemplate(e){await this.client.request({service:"email",region:this.region,method:"POST",path:"/v2/email/templates",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async getEmailTemplate(e){return await this.client.request({service:"email",region:this.region,method:"GET",path:`/v2/email/templates/${encodeURIComponent(e)}`,headers:{"Content-Type":"application/json"}})}async deleteEmailTemplate(e){await this.client.request({service:"email",region:this.region,method:"DELETE",path:`/v2/email/templates/${encodeURIComponent(e)}`,headers:{"Content-Type":"application/json"}})}async listEmailTemplates(e){let t="/v2/email/templates",s=[];if(e?.PageSize)s.push(`PageSize=${e.PageSize}`);if(e?.NextToken)s.push(`NextToken=${encodeURIComponent(e.NextToken)}`);if(s.length>0)t+=`?${s.join("&")}`;return await this.client.request({service:"email",region:this.region,method:"GET",path:t,headers:{"Content-Type":"application/json"}})}async getSendStatistics(){return{SendDataPoints:(await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetSendStatistics&Version=2010-12-01"})).GetSendStatisticsResponse?.GetSendStatisticsResult?.SendDataPoints?.member}}async getSendQuota(){let t=(await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetSendQuota&Version=2010-12-01"})).GetSendQuotaResponse?.GetSendQuotaResult;return{Max24HourSend:t?.Max24HourSend?Number(t.Max24HourSend):void 0,MaxSendRate:t?.MaxSendRate?Number(t.MaxSendRate):void 0,SentLast24Hours:t?.SentLast24Hours?Number(t.SentLast24Hours):void 0}}async verifyDomain(e){let t=await this.createEmailIdentity({EmailIdentity:e});return{dkimTokens:t.DkimAttributes?.Tokens,verificationStatus:t.DkimAttributes?.Status}}async sendSimpleEmail(e){let t=Array.isArray(e.to)?e.to:[e.to],s=e.replyTo?Array.isArray(e.replyTo)?e.replyTo:[e.replyTo]:void 0,a={};if(e.text)a.Text={Data:e.text};if(e.html)a.Html={Data:e.html};return this.sendEmail({FromEmailAddress:e.from,Destination:{ToAddresses:t},Content:{Simple:{Subject:{Data:e.subject},Body:a}},ReplyToAddresses:s})}async sendTemplatedEmail(e){let t=Array.isArray(e.to)?e.to:[e.to],s=e.replyTo?Array.isArray(e.replyTo)?e.replyTo:[e.replyTo]:void 0;return this.sendEmail({FromEmailAddress:e.from,Destination:{ToAddresses:t},Content:{Template:{TemplateName:e.templateName,TemplateData:JSON.stringify(e.templateData)}},ReplyToAddresses:s})}async getDkimRecords(e){let t=await this.getEmailIdentity(e);if(!t.DkimAttributes?.Tokens)return[];return t.DkimAttributes.Tokens.map((s)=>({name:`${s}._domainkey.${e}`,type:"CNAME",value:`${s}.dkim.amazonses.com`}))}async isDomainVerified(e){try{let t=await this.getEmailIdentity(e);return t.VerificationStatus==="SUCCESS"&&t.SendingEnabled===!0}catch{return!1}}async waitForDomainVerification(e,t=60,s=30000){for(let a=0;a<t;a++){if(await this.isDomainVerified(e))return!0;await new Promise((n)=>setTimeout(n,s))}return!1}buildFormBody(e){return Object.entries(e).filter(([,s])=>s!==void 0).map(([s,a])=>`${encodeURIComponent(s)}=${encodeURIComponent(a)}`).join("&")}async createReceiptRuleSet(e){await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody({Action:"CreateReceiptRuleSet",Version:"2010-12-01",RuleSetName:e})})}async deleteReceiptRuleSet(e){await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody({Action:"DeleteReceiptRuleSet",Version:"2010-12-01",RuleSetName:e})})}async setActiveReceiptRuleSet(e){await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody({Action:"SetActiveReceiptRuleSet",Version:"2010-12-01",RuleSetName:e})})}async listReceiptRuleSets(e){let t={Action:"ListReceiptRuleSets",Version:"2010-12-01"};if(e)t.NextToken=e;let s=await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody(t)}),a=s?.ListReceiptRuleSetsResponse?.ListReceiptRuleSetsResult||s?.ListReceiptRuleSetsResult,i=a?.RuleSets?.member;return{RuleSets:Array.isArray(i)?i:i?[i]:[],NextToken:a?.NextToken}}async describeReceiptRuleSet(e){let t=await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody({Action:"DescribeReceiptRuleSet",Version:"2010-12-01",RuleSetName:e})}),s=t?.DescribeReceiptRuleSetResponse?.DescribeReceiptRuleSetResult||t?.DescribeReceiptRuleSetResult,a=s?.Rules?.member;return{Metadata:s?.Metadata,Rules:Array.isArray(a)?a:a?[a]:[]}}async createReceiptRule(e){let t={Action:"CreateReceiptRule",Version:"2010-12-01",RuleSetName:e.RuleSetName,"Rule.Name":e.Rule.Name,"Rule.Enabled":e.Rule.Enabled!==!1?"true":"false"};if(e.Rule.TlsPolicy)t["Rule.TlsPolicy"]=e.Rule.TlsPolicy;if(e.Rule.ScanEnabled!==void 0)t["Rule.ScanEnabled"]=e.Rule.ScanEnabled?"true":"false";if(e.After)t.After=e.After;if(e.Rule.Recipients)e.Rule.Recipients.forEach((s,a)=>{t[`Rule.Recipients.member.${a+1}`]=s});e.Rule.Actions.forEach((s,a)=>{let i=a+1;if(s.S3Action){if(t[`Rule.Actions.member.${i}.S3Action.BucketName`]=s.S3Action.BucketName,s.S3Action.ObjectKeyPrefix)t[`Rule.Actions.member.${i}.S3Action.ObjectKeyPrefix`]=s.S3Action.ObjectKeyPrefix;if(s.S3Action.KmsKeyArn)t[`Rule.Actions.member.${i}.S3Action.KmsKeyArn`]=s.S3Action.KmsKeyArn}if(s.LambdaAction)t[`Rule.Actions.member.${i}.LambdaAction.FunctionArn`]=s.LambdaAction.FunctionArn,t[`Rule.Actions.member.${i}.LambdaAction.InvocationType`]=s.LambdaAction.InvocationType||"Event";if(s.SNSAction){if(t[`Rule.Actions.member.${i}.SNSAction.TopicArn`]=s.SNSAction.TopicArn,s.SNSAction.Encoding)t[`Rule.Actions.member.${i}.SNSAction.Encoding`]=s.SNSAction.Encoding}if(s.StopAction){if(t[`Rule.Actions.member.${i}.StopAction.Scope`]=s.StopAction.Scope,s.StopAction.TopicArn)t[`Rule.Actions.member.${i}.StopAction.TopicArn`]=s.StopAction.TopicArn}}),await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody(t)})}async deleteReceiptRule(e,t){await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody({Action:"DeleteReceiptRule",Version:"2010-12-01",RuleSetName:e,RuleName:t})})}async receiptRuleSetExists(e){try{return await this.describeReceiptRuleSet(e),!0}catch(t){if(t.code==="RuleSetDoesNotExist"||t.statusCode===400)return!1;throw t}}async getActiveReceiptRuleSet(){let e=await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody({Action:"DescribeActiveReceiptRuleSet",Version:"2010-12-01"})}),t=e?.DescribeActiveReceiptRuleSetResponse?.DescribeActiveReceiptRuleSetResult||e?.DescribeActiveReceiptRuleSetResult;if(!t?.Metadata)return null;let s=t?.Rules?.member;return{Metadata:t?.Metadata,Rules:Array.isArray(s)?s:s?[s]:[]}}async updateReceiptRule(e){let t={Action:"UpdateReceiptRule",Version:"2010-12-01",RuleSetName:e.RuleSetName,"Rule.Name":e.Rule.Name};if(e.Rule.Enabled!==void 0)t["Rule.Enabled"]=e.Rule.Enabled?"true":"false";if(e.Rule.TlsPolicy)t["Rule.TlsPolicy"]=e.Rule.TlsPolicy;if(e.Rule.ScanEnabled!==void 0)t["Rule.ScanEnabled"]=e.Rule.ScanEnabled?"true":"false";if(e.Rule.Recipients)e.Rule.Recipients.forEach((s,a)=>{t[`Rule.Recipients.member.${a+1}`]=s});e.Rule.Actions.forEach((s,a)=>{let i=a+1;if(s.S3Action){if(t[`Rule.Actions.member.${i}.S3Action.BucketName`]=s.S3Action.BucketName,s.S3Action.ObjectKeyPrefix)t[`Rule.Actions.member.${i}.S3Action.ObjectKeyPrefix`]=s.S3Action.ObjectKeyPrefix;if(s.S3Action.KmsKeyArn)t[`Rule.Actions.member.${i}.S3Action.KmsKeyArn`]=s.S3Action.KmsKeyArn}if(s.LambdaAction)t[`Rule.Actions.member.${i}.LambdaAction.FunctionArn`]=s.LambdaAction.FunctionArn,t[`Rule.Actions.member.${i}.LambdaAction.InvocationType`]=s.LambdaAction.InvocationType||"Event";if(s.SNSAction){if(t[`Rule.Actions.member.${i}.SNSAction.TopicArn`]=s.SNSAction.TopicArn,s.SNSAction.Encoding)t[`Rule.Actions.member.${i}.SNSAction.Encoding`]=s.SNSAction.Encoding}if(s.StopAction){if(t[`Rule.Actions.member.${i}.StopAction.Scope`]=s.StopAction.Scope,s.StopAction.TopicArn)t[`Rule.Actions.member.${i}.StopAction.TopicArn`]=s.StopAction.TopicArn}}),await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody(t)})}async sendRawEmail(e){let t=Buffer.from(e.rawMessage).toString("base64"),s={Action:"SendRawEmail",Version:"2010-12-01",Source:e.source,"RawMessage.Data":t};e.destinations.forEach((n,c)=>{s[`Destinations.member.${c+1}`]=n});let a=await this.client.request({service:"ses",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:this.buildFormBody(s)});return{MessageId:(a?.SendRawEmailResponse?.SendRawEmailResult||a?.SendRawEmailResult)?.MessageId}}async getSuppressedDestination(e){try{return(await this.client.request({service:"ses",region:this.region,method:"GET",path:`/v2/email/suppression/addresses/${encodeURIComponent(e)}`}))?.SuppressedDestination||null}catch(t){if(t.message?.includes("404")||t.message?.includes("NotFoundException"))return null;throw t}}async deleteSuppressedDestination(e){await this.client.request({service:"ses",region:this.region,method:"DELETE",path:`/v2/email/suppression/addresses/${encodeURIComponent(e)}`})}}class h{ses;s3;iam;route53;region;domain;defaultFrom;constructor(e={}){this.region=e.region||"us-east-1",this.domain=e.domain,this.defaultFrom=e.defaultFrom,this.ses=new p(this.region),this.s3=new A(this.region),this.iam=new g(this.region),this.route53=new P(this.region)}async send(e){let t=e.from||this.defaultFrom;if(!t)throw Error("From address is required. Set defaultFrom in constructor or provide from in options.");let s=e.fromName?`${e.fromName} <${t}>`:t,a=Array.isArray(e.to)?e.to:[e.to];if(!e.attachments||e.attachments.length===0)return{messageId:(await this.ses.sendSimpleEmail({from:s,to:a,subject:e.subject,text:e.text,html:e.html,replyTo:e.replyTo})).MessageId||""};let i=this.buildRawEmail(e,s,a);return{messageId:(await this.ses.sendEmail({FromEmailAddress:s,Destination:{ToAddresses:a,CcAddresses:e.cc?Array.isArray(e.cc)?e.cc:[e.cc]:void 0,BccAddresses:e.bcc?Array.isArray(e.bcc)?e.bcc:[e.bcc]:void 0},Content:{Raw:{Data:Buffer.from(i).toString("base64")}}})).MessageId||""}}async sendTemplate(e){let t=e.from||this.defaultFrom;if(!t)throw Error("From address is required");let s=e.fromName?`${e.fromName} <${t}>`:t;return{messageId:(await this.ses.sendTemplatedEmail({from:s,to:e.to,templateName:e.templateName,templateData:e.templateData,replyTo:e.replyTo})).MessageId||""}}async sendBulk(e){let t=e.from||this.defaultFrom;if(!t)throw Error("From address is required");let s=e.recipients.map((i)=>({Destination:{ToAddresses:Array.isArray(i.to)?i.to:[i.to]},ReplacementEmailContent:i.templateData?{ReplacementTemplate:{ReplacementTemplateData:JSON.stringify(i.templateData)}}:void 0}));return{results:(await this.ses.sendBulkEmail({FromEmailAddress:t,BulkEmailEntries:s,DefaultContent:{Template:{TemplateName:e.templateName,TemplateData:JSON.stringify(e.defaultTemplateData)}}})).BulkEmailEntryResults?.map((i)=>({status:i.Status||"UNKNOWN",messageId:i.MessageId,error:i.Error}))||[]}}async setupDomain(e){let t;try{t=await this.ses.getEmailIdentity(e)}catch{let a=await this.ses.createEmailIdentity({EmailIdentity:e});t={VerificationStatus:a.DkimAttributes?.Status,DkimAttributes:a.DkimAttributes,SendingEnabled:a.VerifiedForSendingStatus}}try{await this.ses.putEmailIdentityDkimAttributes({EmailIdentity:e,SigningEnabled:!0})}catch{}try{await this.ses.putEmailIdentityMailFromAttributes(e,{MailFromDomain:`mail.${e}`,BehaviorOnMxFailure:"USE_DEFAULT_VALUE"})}catch{}let s=await this.ses.getDkimRecords(e);return{domainVerified:t.SendingEnabled===!0,dkimStatus:t.DkimAttributes?.Status||"UNKNOWN",dkimTokens:t.DkimAttributes?.Tokens,mailFromStatus:t.MailFromAttributes?.MailFromDomainStatus}}async getDnsRecords(e){let t=[],s=await this.ses.getDkimRecords(e);for(let a of s)t.push({type:a.type,name:a.name,value:a.value,ttl:1800});return t.push({type:"MX",name:e,value:`inbound-smtp.${this.region}.amazonaws.com`,priority:10,ttl:3600}),t.push({type:"MX",name:`mail.${e}`,value:`feedback-smtp.${this.region}.amazonses.com`,priority:10,ttl:3600}),t.push({type:"TXT",name:`mail.${e}`,value:"v=spf1 include:amazonses.com ~all",ttl:3600}),t.push({type:"TXT",name:`_dmarc.${e}`,value:`v=DMARC1;p=quarantine;pct=25;rua=mailto:dmarcreports@${e}`,ttl:3600}),t}async isDomainReady(e){try{let t=await this.ses.getEmailIdentity(e);return t.SendingEnabled===!0&&t.DkimAttributes?.Status==="SUCCESS"}catch{return!1}}async setupReceiving(e){let t={Version:"2012-10-17",Statement:[{Sid:"AllowSESPuts",Effect:"Allow",Principal:{Service:"ses.amazonaws.com"},Action:"s3:PutObject",Resource:`arn:aws:s3:::${e.bucketName}/*`,Condition:{StringEquals:{"AWS:SourceAccount":e.accountId}}}]};await this.s3.putBucketPolicy(e.bucketName,t);try{await this.ses.createReceiptRuleSet(e.ruleSetName)}catch(a){if(!a.message?.includes("already exists")&&a.code!=="AlreadyExists")throw a}let s=[{S3Action:{BucketName:e.bucketName,ObjectKeyPrefix:e.prefix||"inbox/"}}];if(e.lambdaArn)s.push({LambdaAction:{FunctionArn:e.lambdaArn,InvocationType:"Event"}});try{await this.ses.createReceiptRule({RuleSetName:e.ruleSetName,Rule:{Name:e.ruleName,Enabled:!0,TlsPolicy:"Optional",Recipients:e.recipients||[e.domain],ScanEnabled:e.scanEnabled!==!1,Actions:s}})}catch(a){if(a.message?.includes("already exists"))await this.ses.deleteReceiptRule(e.ruleSetName,e.ruleName),await this.ses.createReceiptRule({RuleSetName:e.ruleSetName,Rule:{Name:e.ruleName,Enabled:!0,TlsPolicy:"Optional",Recipients:e.recipients||[e.domain],ScanEnabled:e.scanEnabled!==!1,Actions:s}});else throw a}await this.ses.setActiveReceiptRuleSet(e.ruleSetName)}async getIncomingEmails(e){return(await this.s3.list({bucket:e.bucket,prefix:e.prefix||"incoming/",maxKeys:e.maxResults||100})).map((s)=>({key:s.Key||"",lastModified:s.LastModified||"",size:s.Size||0}))}async readEmail(e){return await this.s3.getObject(e.bucket,e.key)}async createSmtpCredentials(e){let t=`ses-smtp-${e.username.replace(/[^a-zA-Z0-9]/g,"-")}`,{AWSClient:s}=await import("./chunk-7aagqqr9.js"),a=new s,i=(m,S)=>{let f={Action:m,Version:"2010-05-08",...S};return Object.entries(f).map(([b,T])=>`${encodeURIComponent(b)}=${encodeURIComponent(T)}`).join("&")};try{await a.request({service:"iam",region:"us-east-1",method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i("CreateUser",{UserName:t})})}catch(m){if(!m.message?.includes("EntityAlreadyExists"))throw m}let n={Version:"2012-10-17",Statement:[{Effect:"Allow",Action:"ses:SendRawEmail",Resource:"*",Condition:{StringLike:{"ses:FromAddress":`*@${e.domain}`}}}]},c=`ses-smtp-policy-${e.domain.replace(/\./g,"-")}`;try{await a.request({service:"iam",region:"us-east-1",method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i("PutUserPolicy",{UserName:t,PolicyName:c,PolicyDocument:JSON.stringify(n)})})}catch{}let l=(await a.request({service:"iam",region:"us-east-1",method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i("CreateAccessKey",{UserName:t})}))?.CreateAccessKeyResult?.AccessKey;if(!l?.AccessKeyId||!l?.SecretAccessKey)throw Error("Failed to create access key");let R=this.deriveSmtpPassword(l.SecretAccessKey);return{username:l.AccessKeyId,password:R,server:`email-smtp.${this.region}.amazonaws.com`,port:587}}deriveSmtpPassword(e){let t=y("node:crypto"),s="SendRawEmail",a=Buffer.from([4]),i=t.createHmac("sha256",`AWS4${e}`).update("11111111").digest();return i=t.createHmac("sha256",i).update(this.region).digest(),i=t.createHmac("sha256",i).update("ses").digest(),i=t.createHmac("sha256",i).update("aws4_request").digest(),i=t.createHmac("sha256",i).update("SendRawEmail").digest(),Buffer.concat([a,i]).toString("base64")}async createTemplate(e){await this.ses.createEmailTemplate({TemplateName:e.name,TemplateContent:{Subject:e.subject,Text:e.text,Html:e.html}})}async getTemplate(e){try{let t=await this.ses.getEmailTemplate(e);return{name:t.TemplateName||e,subject:t.TemplateContent?.Subject,text:t.TemplateContent?.Text,html:t.TemplateContent?.Html}}catch{return null}}async deleteTemplate(e){await this.ses.deleteEmailTemplate(e)}async listTemplates(){return(await this.ses.listEmailTemplates()).TemplatesMetadata?.map((t)=>({name:t.TemplateName||"",createdAt:t.CreatedTimestamp}))||[]}async deploy(e){let t=`${e.appName}-${e.environment}-email-rules`,s=`${e.appName}-inbound-email`,a=e.storage?.bucketName||`${e.appName}-${e.environment}-email`,i=await this.setupDomain(e.domain);if(!(await this.s3.listBuckets()).Buckets?.some((l)=>l.Name===a))await this.s3.createBucket(a);await this.setupReceiving({domain:e.domain,ruleSetName:t,ruleName:s,bucketName:a,prefix:e.storage?.prefix||"inbox/",accountId:e.accountId,recipients:e.catchAll?[e.domain]:e.mailboxes,scanEnabled:!0});let u=await this.getDnsRecords(e.domain);return{success:!0,domainVerified:i.domainVerified,dkimStatus:i.dkimStatus,receiptRuleSet:t,storageBucket:a,dnsRecords:u}}async undeploy(e){let t=`${e.appName}-${e.environment}-email-rules`,s=`${e.appName}-inbound-email`,a=`${e.appName}-${e.environment}-email`;try{await this.ses.deleteReceiptRule(t,s)}catch{}try{await this.ses.deleteReceiptRuleSet(t)}catch{}if(e.deleteBucket)try{await this.s3.emptyAndDeleteBucket(a)}catch{}}async getSendingStats(){let e=await this.ses.getSendQuota();return{sentLast24Hours:e.SentLast24Hours||0,maxSendRate:e.MaxSendRate||0,max24HourSend:e.Max24HourSend||0}}buildRawEmail(e,t,s){let a=`----=_Part_${Date.now()}_${Math.random().toString(36).substring(2)}`,i="";if(i+=`From: ${t}\r
|
|
2
|
-
`,i+=`To: ${s.join(", ")}\r
|
|
3
|
-
`,e.cc){let n=Array.isArray(e.cc)?e.cc:[e.cc];i+=`Cc: ${n.join(", ")}\r
|
|
4
|
-
`}if(i+=`Subject: ${e.subject}\r
|
|
5
|
-
`,i+=`MIME-Version: 1.0\r
|
|
6
|
-
`,i+=`Content-Type: multipart/mixed; boundary="${a}"\r
|
|
7
|
-
`,i+=`\r
|
|
8
|
-
`,e.text||e.html)if(i+=`--${a}\r
|
|
9
|
-
`,e.html&&e.text){let n=`----=_Alt_${Date.now()}`;i+=`Content-Type: multipart/alternative; boundary="${n}"\r
|
|
10
|
-
`,i+=`\r
|
|
11
|
-
`,i+=`--${n}\r
|
|
12
|
-
`,i+=`Content-Type: text/plain; charset="UTF-8"\r
|
|
13
|
-
`,i+=`\r
|
|
14
|
-
`,i+=`${e.text}\r
|
|
15
|
-
`,i+=`--${n}\r
|
|
16
|
-
`,i+=`Content-Type: text/html; charset="UTF-8"\r
|
|
17
|
-
`,i+=`\r
|
|
18
|
-
`,i+=`${e.html}\r
|
|
19
|
-
`,i+=`--${n}--\r
|
|
20
|
-
`}else if(e.html)i+=`Content-Type: text/html; charset="UTF-8"\r
|
|
21
|
-
`,i+=`\r
|
|
22
|
-
`,i+=`${e.html}\r
|
|
23
|
-
`;else i+=`Content-Type: text/plain; charset="UTF-8"\r
|
|
24
|
-
`,i+=`\r
|
|
25
|
-
`,i+=`${e.text}\r
|
|
26
|
-
`;if(e.attachments)for(let n of e.attachments)i+=`--${a}\r
|
|
27
|
-
`,i+=`Content-Type: ${n.contentType||"application/octet-stream"}; name="${n.filename}"\r
|
|
28
|
-
`,i+=`Content-Transfer-Encoding: base64\r
|
|
29
|
-
`,i+=`Content-Disposition: attachment; filename="${n.filename}"\r
|
|
30
|
-
`,i+=`\r
|
|
31
|
-
`,i+=`${n.content}\r
|
|
32
|
-
`;return i+=`--${a}--\r
|
|
33
|
-
`,i}}var M=new h;
|
|
34
|
-
export{g as wg,p as xg,h as yg,M as zg};
|