UNPKG

@ew-did-registry/did-s3-store

Version:

S3-based implementation of IDidStore

1 lines 19.9 kB
"use strict";exports.id=547,exports.ids=[547],exports.modules={4547:(e,t,n)=>{n.d(t,{getDefaultRoleAssumer:()=>pn,getDefaultRoleAssumerWithWebIdentity:()=>hn});var s=n(1758),o=n(6170),r=n(6692),i=n(2258),a=n(7801),c=n(8866),l=n(1320),d=n(4546),u=n(2165),p=n(8313),h=n(784),m=n(2952);const g=async(e,t,n)=>({operation:(0,m.u)(t).operation,region:await(0,m.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),f=e=>{const t=[];return"AssumeRoleWithWebIdentity"===e.operation?t.push({schemeId:"smithy.api#noAuth"}):t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e)),t},y={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var S=n(9474),P=n(8227),w=n(1065),E=n(7727),b=n(5133),I=n(5708),v=n(5854),A=n(5834),x=n(8226),C=n(4134),R=n(2640),k=n(563),T=n(7670),D=n(6775),$=n(5332);const K="required",O="type",j="fn",W="argv",z="ref",M=!1,U=!0,q="booleanEquals",F="stringEquals",H="sigv4",_="us-east-1",L="endpoint",N="https://sts.{Region}.{PartitionResult#dnsSuffix}",V="tree",G="error",B="getAttr",Z={[K]:!1,[O]:"String"},J={[K]:!0,default:!1,[O]:"Boolean"},Y={[z]:"Endpoint"},Q={[j]:"isSet",[W]:[{[z]:"Region"}]},X={[z]:"Region"},ee={[j]:"aws.partition",[W]:[X],assign:"PartitionResult"},te={[z]:"UseFIPS"},ne={[z]:"UseDualStack"},se={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:H,signingName:"sts",signingRegion:_}]},headers:{}},oe={},re={conditions:[{[j]:F,[W]:[X,"aws-global"]}],[L]:se,[O]:L},ie={[j]:q,[W]:[te,!0]},ae={[j]:q,[W]:[ne,!0]},ce={[j]:B,[W]:[{[z]:"PartitionResult"},"supportsFIPS"]},le={[z]:"PartitionResult"},de={[j]:q,[W]:[!0,{[j]:B,[W]:[le,"supportsDualStack"]}]},ue=[{[j]:"isSet",[W]:[Y]}],pe=[ie],he=[ae],me={version:"1.0",parameters:{Region:Z,UseDualStack:J,UseFIPS:J,Endpoint:Z,UseGlobalEndpoint:J},rules:[{conditions:[{[j]:q,[W]:[{[z]:"UseGlobalEndpoint"},U]},{[j]:"not",[W]:ue},Q,ee,{[j]:q,[W]:[te,M]},{[j]:q,[W]:[ne,M]}],rules:[{conditions:[{[j]:F,[W]:[X,"ap-northeast-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"ap-south-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"ap-southeast-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"ap-southeast-2"]}],endpoint:se,[O]:L},re,{conditions:[{[j]:F,[W]:[X,"ca-central-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"eu-central-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"eu-north-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"eu-west-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"eu-west-2"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"eu-west-3"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"sa-east-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,_]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"us-east-2"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"us-west-1"]}],endpoint:se,[O]:L},{conditions:[{[j]:F,[W]:[X,"us-west-2"]}],endpoint:se,[O]:L},{endpoint:{url:N,properties:{authSchemes:[{name:H,signingName:"sts",signingRegion:"{Region}"}]},headers:oe},[O]:L}],[O]:V},{conditions:ue,rules:[{conditions:pe,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[O]:G},{conditions:he,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[O]:G},{endpoint:{url:Y,properties:oe,headers:oe},[O]:L}],[O]:V},{conditions:[Q],rules:[{conditions:[ee],rules:[{conditions:[ie,ae],rules:[{conditions:[{[j]:q,[W]:[U,ce]},de],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:oe,headers:oe},[O]:L}],[O]:V},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[O]:G}],[O]:V},{conditions:pe,rules:[{conditions:[{[j]:q,[W]:[ce,U]}],rules:[{conditions:[{[j]:F,[W]:[{[j]:B,[W]:[le,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:oe,headers:oe},[O]:L},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:oe,headers:oe},[O]:L}],[O]:V},{error:"FIPS is enabled but this partition does not support FIPS",[O]:G}],[O]:V},{conditions:he,rules:[{conditions:[de],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:oe,headers:oe},[O]:L}],[O]:V},{error:"DualStack is enabled but this partition does not support DualStack",[O]:G}],[O]:V},re,{endpoint:{url:N,properties:oe,headers:oe},[O]:L}],[O]:V}],[O]:V},{error:"Invalid Configuration: Missing Region",[O]:G}]},ge=new $.kS({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),fe=(e,t={})=>ge.get(e,(()=>(0,$.sO)(me,{endpointParams:e,logger:t.logger})));$.mw.aws=D.UF;var ye=n(9308);var Se=n(3119),Pe=n(130);class we extends p.Kj{config;constructor(...[e]){const t=(e=>{(0,p.I9)(process.version);const t=(0,ye.I)(e),n=()=>t().then(p.lT),s=(e=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??k.E,base64Encoder:e?.base64Encoder??k.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??fe,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??f,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new E.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new c.mR}],logger:e?.logger??new p.N4,serviceId:e?.serviceId??"STS",urlParser:e?.urlParser??R.D,utf8Decoder:e?.utf8Decoder??T.ar,utf8Encoder:e?.utf8Encoder??T.Pq}))(e);(0,P.I)(process.version);const o={profile:e?.profile,logger:s.logger};return{...s,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,v.Z)(w.$,o),bodyLengthChecker:e?.bodyLengthChecker??x.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,b.pf)({serviceId:s.serviceId,clientVersion:S.rE}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4")||(async t=>await e.credentialDefaultProvider(t?.__config||{})()),signer:new E.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new c.mR}],maxAttempts:e?.maxAttempts??(0,v.Z)(u.qs,e),region:e?.region??(0,v.Z)(a.GG,{...a.zH,...o}),requestHandler:A.$c.create(e?.requestHandler??n),retryMode:e?.retryMode??(0,v.Z)({...u.kN,default:async()=>(await n()).retryMode||C.L0},e),sha256:e?.sha256??I.V.bind(null,"sha256"),streamCollector:e?.streamCollector??A.kv,useDualstackEndpoint:e?.useDualstackEndpoint??(0,v.Z)(a.e$,o),useFipsEndpoint:e?.useFipsEndpoint??(0,v.Z)(a.Ko,o),userAgentAppId:e?.userAgentAppId??(0,v.Z)(b.hV,o)}})(e||{});super(t),this.initConfig=t;const n=(y=t,Object.assign(y,{useDualstackEndpoint:y.useDualstackEndpoint??!1,useFipsEndpoint:y.useFipsEndpoint??!1,useGlobalEndpoint:y.useGlobalEndpoint??!1,defaultSigningName:"sts"}));var y;const D=(0,i.Dc)(n),$=(0,u.$z)(D),K=(0,a.TD)($),O=(0,s.OV)(K),j=((e,t)=>{const n=Object.assign((0,Se.Rq)(e),(0,p.xA)(e),(0,Pe.eS)(e),(e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){s=e},credentials:()=>s}})(e));return t.forEach((e=>e.configure(n))),Object.assign(e,(0,Se.$3)(n),(0,p.uv)(n),(0,Pe.jt)(n),{httpAuthSchemes:(s=n).httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()});var s})((e=>{const t=(n=e,Object.assign(n,{stsClientCtor:we}));var n;const s=(0,h.h)(t);return Object.assign(s,{authSchemePreference:(0,m.t)(e.authSchemePreference??[])})})((0,d.Co)(O)),e?.extensions||[]);this.config=j,this.middlewareStack.use((0,i.sM)(this.config)),this.middlewareStack.use((0,u.ey)(this.config)),this.middlewareStack.use((0,l.vK)(this.config)),this.middlewareStack.use((0,s.TC)(this.config)),this.middlewareStack.use((0,o.Y7)(this.config)),this.middlewareStack.use((0,r.n4)(this.config)),this.middlewareStack.use((0,c.wB)(this.config,{httpAuthSchemeParametersProvider:g,identityProviderConfigProvider:async e=>new c.h$({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,c.lW)(this.config))}destroy(){super.destroy()}}var Ee=n(8029);class be extends p.TJ{constructor(e){super(e),Object.setPrototypeOf(this,be.prototype)}}const Ie=e=>({...e,...e.SecretAccessKey&&{SecretAccessKey:p.$H}}),ve=e=>({...e,...e.Credentials&&{Credentials:Ie(e.Credentials)}});class Ae extends be{name="ExpiredTokenException";$fault="client";constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,Ae.prototype)}}class xe extends be{name="MalformedPolicyDocumentException";$fault="client";constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),Object.setPrototypeOf(this,xe.prototype)}}class Ce extends be{name="PackedPolicyTooLargeException";$fault="client";constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),Object.setPrototypeOf(this,Ce.prototype)}}class Re extends be{name="RegionDisabledException";$fault="client";constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),Object.setPrototypeOf(this,Re.prototype)}}class ke extends be{name="IDPRejectedClaimException";$fault="client";constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),Object.setPrototypeOf(this,ke.prototype)}}class Te extends be{name="InvalidIdentityTokenException";$fault="client";constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,Te.prototype)}}const De=e=>({...e,...e.WebIdentityToken&&{WebIdentityToken:p.$H}}),$e=e=>({...e,...e.Credentials&&{Credentials:Ie(e.Credentials)}});class Ke extends be{name="IDPCommunicationErrorException";$fault="client";constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),Object.setPrototypeOf(this,Ke.prototype)}}var Oe=n(9596);const je=async(e,t)=>{const n=ft;let s;return s=en({...Ge(e,t),[St]:wt,[Zt]:yt}),gt(t,n,"/",void 0,s)},We=async(e,t)=>{const n=ft;let s;return s=en({...Be(e,t),[St]:It,[Zt]:yt}),gt(t,n,"/",void 0,s)},ze=async(e,t)=>{if(e.statusCode>=300)return Ue(e,t);const n=await(0,Oe.t_)(e.body,t);let s={};return s=st(n.AssumeRoleResult,t),{$metadata:ht(e),...s}},Me=async(e,t)=>{if(e.statusCode>=300)return Ue(e,t);const n=await(0,Oe.t_)(e.body,t);let s={};return s=ot(n.AssumeRoleWithWebIdentityResult,t),{$metadata:ht(e),...s}},Ue=async(e,t)=>{const n={...e,body:await(0,Oe.FI)(e.body,t)},s=tn(e,n.body);switch(s){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await qe(n,t);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await Le(n,t);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await Ne(n,t);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await Ve(n,t);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await Fe(n,t);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await He(n,t);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await _e(n,t);default:const o=n.body;return mt({output:e,parsedBody:o.Error,errorCode:s})}},qe=async(e,t)=>{const n=e.body,s=it(n.Error,t),o=new Ae({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},Fe=async(e,t)=>{const n=e.body,s=at(n.Error,t),o=new Ke({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},He=async(e,t)=>{const n=e.body,s=ct(n.Error,t),o=new ke({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},_e=async(e,t)=>{const n=e.body,s=lt(n.Error,t),o=new Te({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},Le=async(e,t)=>{const n=e.body,s=dt(n.Error,t),o=new xe({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},Ne=async(e,t)=>{const n=e.body,s=ut(n.Error,t),o=new Ce({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},Ve=async(e,t)=>{const n=e.body,s=pt(n.Error,t),o=new Re({$metadata:ht(e),...s});return(0,p.Mw)(o,n)},Ge=(e,t)=>{const n={};if(null!=e[Ut]&&(n[Ut]=e[Ut]),null!=e[qt]&&(n[qt]=e[qt]),null!=e[Kt]){const s=Ze(e[Kt],t);0===e[Kt]?.length&&(n.PolicyArns=[]),Object.entries(s).forEach((([e,t])=>{n[`PolicyArns.${e}`]=t}))}if(null!=e[$t]&&(n[$t]=e[$t]),null!=e[Rt]&&(n[Rt]=e[Rt]),null!=e[Vt]){const s=tt(e[Vt],t);0===e[Vt]?.length&&(n.Tags=[]),Object.entries(s).forEach((([e,t])=>{n[`Tags.${e}`]=t}))}if(null!=e[Bt]){const s=et(e[Bt],t);0===e[Bt]?.length&&(n.TransitiveTagKeys=[]),Object.entries(s).forEach((([e,t])=>{n[`TransitiveTagKeys.${e}`]=t}))}if(null!=e[Tt]&&(n[Tt]=e[Tt]),null!=e[Lt]&&(n[Lt]=e[Lt]),null!=e[Gt]&&(n[Gt]=e[Gt]),null!=e[_t]&&(n[_t]=e[_t]),null!=e[jt]){const s=Qe(e[jt],t);0===e[jt]?.length&&(n.ProvidedContexts=[]),Object.entries(s).forEach((([e,t])=>{n[`ProvidedContexts.${e}`]=t}))}return n},Be=(e,t)=>{const n={};if(null!=e[Ut]&&(n[Ut]=e[Ut]),null!=e[qt]&&(n[qt]=e[qt]),null!=e[Yt]&&(n[Yt]=e[Yt]),null!=e[Wt]&&(n[Wt]=e[Wt]),null!=e[Kt]){const s=Ze(e[Kt],t);0===e[Kt]?.length&&(n.PolicyArns=[]),Object.entries(s).forEach((([e,t])=>{n[`PolicyArns.${e}`]=t}))}return null!=e[$t]&&(n[$t]=e[$t]),null!=e[Rt]&&(n[Rt]=e[Rt]),n},Ze=(e,t)=>{const n={};let s=1;for(const o of e){if(null===o)continue;const e=Je(o,t);Object.entries(e).forEach((([e,t])=>{n[`member.${s}.${e}`]=t})),s++}return n},Je=(e,t)=>{const n={};return null!=e[Qt]&&(n[Qt]=e[Qt]),n},Ye=(e,t)=>{const n={};return null!=e[Ot]&&(n[Ot]=e[Ot]),null!=e[Ct]&&(n[Ct]=e[Ct]),n},Qe=(e,t)=>{const n={};let s=1;for(const t of e){if(null===t)continue;const e=Ye(t);Object.entries(e).forEach((([e,t])=>{n[`member.${s}.${e}`]=t})),s++}return n},Xe=(e,t)=>{const n={};return null!=e[Dt]&&(n[Dt]=e[Dt]),null!=e[Jt]&&(n[Jt]=e[Jt]),n},et=(e,t)=>{const n={};let s=1;for(const t of e)null!==t&&(n[`member.${s}`]=t,s++);return n},tt=(e,t)=>{const n={};let s=1;for(const t of e){if(null===t)continue;const e=Xe(t);Object.entries(e).forEach((([e,t])=>{n[`member.${s}.${e}`]=t})),s++}return n},nt=(e,t)=>{const n={};return null!=e[Et]&&(n[Et]=(0,p.lK)(e[Et])),null!=e[vt]&&(n[vt]=(0,p.lK)(e[vt])),n},st=(e,t)=>{const n={};return null!=e[xt]&&(n[xt]=rt(e[xt],t)),null!=e[bt]&&(n[bt]=nt(e[bt])),null!=e[zt]&&(n[zt]=(0,p.xW)(e[zt])),null!=e[_t]&&(n[_t]=(0,p.lK)(e[_t])),n},ot=(e,t)=>{const n={};return null!=e[xt]&&(n[xt]=rt(e[xt],t)),null!=e[Ht]&&(n[Ht]=(0,p.lK)(e[Ht])),null!=e[bt]&&(n[bt]=nt(e[bt])),null!=e[zt]&&(n[zt]=(0,p.xW)(e[zt])),null!=e[Mt]&&(n[Mt]=(0,p.lK)(e[Mt])),null!=e[At]&&(n[At]=(0,p.lK)(e[At])),null!=e[_t]&&(n[_t]=(0,p.lK)(e[_t])),n},rt=(e,t)=>{const n={};return null!=e[Pt]&&(n[Pt]=(0,p.lK)(e[Pt])),null!=e[Ft]&&(n[Ft]=(0,p.lK)(e[Ft])),null!=e[Nt]&&(n[Nt]=(0,p.lK)(e[Nt])),null!=e[kt]&&(n[kt]=(0,p.Y0)((0,p.t_)(e[kt]))),n},it=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},at=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},ct=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},lt=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},dt=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},ut=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},pt=(e,t)=>{const n={};return null!=e[Xt]&&(n[Xt]=(0,p.lK)(e[Xt])),n},ht=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),mt=(0,p.jr)(be),gt=async(e,t,n,s,o)=>{const{hostname:r,protocol:i="https",port:a,path:c}=await e.endpoint(),l={protocol:i,hostname:r,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==s&&(l.hostname=s),void 0!==o&&(l.body=o),new Pe.Kd(l)},ft={"content-type":"application/x-www-form-urlencoded"},yt="2011-06-15",St="Action",Pt="AccessKeyId",wt="AssumeRole",Et="AssumedRoleId",bt="AssumedRoleUser",It="AssumeRoleWithWebIdentity",vt="Arn",At="Audience",xt="Credentials",Ct="ContextAssertion",Rt="DurationSeconds",kt="Expiration",Tt="ExternalId",Dt="Key",$t="Policy",Kt="PolicyArns",Ot="ProviderArn",jt="ProvidedContexts",Wt="ProviderId",zt="PackedPolicySize",Mt="Provider",Ut="RoleArn",qt="RoleSessionName",Ft="SecretAccessKey",Ht="SubjectFromWebIdentityToken",_t="SourceIdentity",Lt="SerialNumber",Nt="SessionToken",Vt="Tags",Gt="TokenCode",Bt="TransitiveTagKeys",Zt="Version",Jt="Value",Yt="WebIdentityToken",Qt="arn",Xt="message",en=e=>Object.entries(e).map((([e,t])=>(0,p.$6)(e)+"="+(0,p.$6)(t))).join("&"),tn=(e,t)=>void 0!==t.Error?.Code?t.Error.Code:404==e.statusCode?"NotFound":void 0;class nn extends(p.uB.classBuilder().ep(y).m((function(e,t,n,s){return[(0,Ee.TM)(n,this.serialize,this.deserialize),(0,d.rD)(n,e.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,ve).ser(je).de(ze).build()){}class sn extends(p.uB.classBuilder().ep(y).m((function(e,t,n,s){return[(0,Ee.TM)(n,this.serialize,this.deserialize),(0,d.rD)(n,e.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(De,$e).ser(We).de(Me).build()){}const on={AssumeRoleCommand:nn,AssumeRoleWithWebIdentityCommand:sn};(0,p.J1)(on,class extends we{});var rn=n(8455);const an="us-east-1",cn=e=>{if("string"==typeof e?.Arn){const t=e.Arn.split(":");if(t.length>4&&""!==t[4])return t[4]}},ln=async(e,t,n)=>{const s="function"==typeof e?await e():e,o="function"==typeof t?await t():t;return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${s} (provider)`,`${o} (parent client)`,`${an} (STS default)`),s??o??an},dn=e=>"h2"===e?.metadata?.handlerProtocol,un=(e,t)=>t?class extends e{constructor(e){super(e);for(const e of t)this.middlewareStack.use(e)}}:e,pn=(e={},t)=>((e,t)=>{let n,s;return async(o,r)=>{if(s=o,!n){const{logger:o=e?.parentClientConfig?.logger,region:r,requestHandler:i=e?.parentClientConfig?.requestHandler,credentialProviderLogger:a}=e,c=await ln(r,e?.parentClientConfig?.region,a),l=!dn(i);n=new t({profile:e?.parentClientConfig?.profile,credentialDefaultProvider:()=>async()=>s,region:c,requestHandler:l?i:void 0,logger:o})}const{Credentials:i,AssumedRoleUser:a}=await n.send(new nn(r));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`);const c=cn(a),l={accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,...i.CredentialScope&&{credentialScope:i.CredentialScope},...c&&{accountId:c}};return(0,rn.g)(l,"CREDENTIALS_STS_ASSUME_ROLE","i"),l}})(e,un(we,t)),hn=(e={},t)=>((e,t)=>{let n;return async s=>{if(!n){const{logger:s=e?.parentClientConfig?.logger,region:o,requestHandler:r=e?.parentClientConfig?.requestHandler,credentialProviderLogger:i}=e,a=await ln(o,e?.parentClientConfig?.region,i),c=!dn(r);n=new t({profile:e?.parentClientConfig?.profile,region:a,requestHandler:c?r:void 0,logger:s})}const{Credentials:o,AssumedRoleUser:r}=await n.send(new sn(s));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${s.RoleArn}`);const i=cn(r),a={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...i&&{accountId:i}};return i&&(0,rn.g)(a,"RESOLVED_ACCOUNT_ID","T"),(0,rn.g)(a,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),a}})(e,un(we,t))},9474:e=>{e.exports={rE:"3.826.0"}}};