@ew-did-registry/did-s3-store
Version:
S3-based implementation of IDidStore
1 lines • 15.1 kB
JavaScript
"use strict";exports.id=240,exports.ids=[240],exports.modules={1830:(e,t,r)=>{r.d(t,{CG:()=>n,Y2:()=>s,cJ:()=>i});var o=r(3127);const s=(e,t)=>(0,o.w)(e,t).then((e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw"SyntaxError"===t?.name&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}return{}})),n=async(e,t)=>{const r=await s(e,t);return r.message=r.message??r.Message,r},i=(e,t)=>{const r=(e,t)=>Object.keys(e).find((e=>e.toLowerCase()===t.toLowerCase())),o=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},s=r(e.headers,"x-amzn-errortype");if(void 0!==s)return o(e.headers[s]);if(t&&"object"==typeof t){const e=r(t,"code");if(e&&void 0!==t[e])return o(t[e]);if(void 0!==t.__type)return o(t.__type)}}},6240:(e,t,r)=>{r.d(t,{CreateTokenCommand:()=>He,SSOOIDCClient:()=>de});var o=r(1758),s=r(6170),n=r(6692),i=r(2258),a=r(7801),c=r(8866),d=r(1320),p=r(4546),u=r(2165),l=r(8313),h=r(784),m=r(2952);const y=async(e,t,r)=>({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"CreateToken"===e.operation?t.push({schemeId:"smithy.api#noAuth"}):t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e)),t},g={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var w=r(9474),x=r(8227),S=r(1065),b=r(5133),E=r(5708),v=r(5854),P=r(5834),I=r(8226),O=r(4134),k=r(7727),_=r(2640),j=r(563),T=r(7670),$=r(6775),C=r(5332);const A="required",D="fn",z="argv",K="ref",R=!0,U="isSet",M="booleanEquals",q="error",F="endpoint",H="tree",G="PartitionResult",V="getAttr",Z={[A]:!1,type:"String"},B={[A]:!0,default:!1,type:"Boolean"},J={[K]:"Endpoint"},L={[D]:M,[z]:[{[K]:"UseFIPS"},!0]},N={[D]:M,[z]:[{[K]:"UseDualStack"},!0]},Y={},W={[D]:V,[z]:[{[K]:G},"supportsFIPS"]},X={[K]:G},Q={[D]:M,[z]:[!0,{[D]:V,[z]:[X,"supportsDualStack"]}]},ee=[L],te=[N],re=[{[K]:"Region"}],oe={version:"1.0",parameters:{Region:Z,UseDualStack:B,UseFIPS:B,Endpoint:Z},rules:[{conditions:[{[D]:U,[z]:[J]}],rules:[{conditions:ee,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:q},{conditions:te,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:q},{endpoint:{url:J,properties:Y,headers:Y},type:F}],type:H},{conditions:[{[D]:U,[z]:re}],rules:[{conditions:[{[D]:"aws.partition",[z]:re,assign:G}],rules:[{conditions:[L,N],rules:[{conditions:[{[D]:M,[z]:[R,W]},Q],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Y,headers:Y},type:F}],type:H},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:q}],type:H},{conditions:ee,rules:[{conditions:[{[D]:M,[z]:[W,R]}],rules:[{conditions:[{[D]:"stringEquals",[z]:[{[D]:V,[z]:[X,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:Y,headers:Y},type:F},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Y,headers:Y},type:F}],type:H},{error:"FIPS is enabled but this partition does not support FIPS",type:q}],type:H},{conditions:te,rules:[{conditions:[Q],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Y,headers:Y},type:F}],type:H},{error:"DualStack is enabled but this partition does not support DualStack",type:q}],type:H},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:Y,headers:Y},type:F}],type:H}],type:H},{error:"Invalid Configuration: Missing Region",type:q}]},se=new C.kS({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),ne=(e,t={})=>se.get(e,(()=>(0,C.sO)(oe,{endpointParams:e,logger:t.logger})));C.mw.aws=$.UF;var ie=r(9308);var ae=r(3119),ce=r(130);class de extends l.Kj{config;constructor(...[e]){const t=(e=>{(0,l.I9)(process.version);const t=(0,ie.I)(e),r=()=>t().then(l.lT),o=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??j.E,base64Encoder:e?.base64Encoder??j.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ne,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??f,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new k.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new c.mR}],logger:e?.logger??new l.N4,serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??_.D,utf8Decoder:e?.utf8Decoder??T.ar,utf8Encoder:e?.utf8Encoder??T.Pq}))(e);(0,x.I)(process.version);const s={profile:e?.profile,logger:o.logger};return{...o,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,v.Z)(S.$,s),bodyLengthChecker:e?.bodyLengthChecker??I.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,b.pf)({serviceId:o.serviceId,clientVersion:w.rE}),maxAttempts:e?.maxAttempts??(0,v.Z)(u.qs,e),region:e?.region??(0,v.Z)(a.GG,{...a.zH,...s}),requestHandler:P.$c.create(e?.requestHandler??r),retryMode:e?.retryMode??(0,v.Z)({...u.kN,default:async()=>(await r()).retryMode||O.L0},e),sha256:e?.sha256??E.V.bind(null,"sha256"),streamCollector:e?.streamCollector??P.kv,useDualstackEndpoint:e?.useDualstackEndpoint??(0,v.Z)(a.e$,s),useFipsEndpoint:e?.useFipsEndpoint??(0,v.Z)(a.Ko,s),userAgentAppId:e?.userAgentAppId??(0,v.Z)(b.hV,s)}})(e||{});super(t),this.initConfig=t;const r=(g=t,Object.assign(g,{useDualstackEndpoint:g.useDualstackEndpoint??!1,useFipsEndpoint:g.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"}));var g;const $=(0,i.Dc)(r),C=(0,u.$z)($),A=(0,a.TD)(C),D=(0,o.OV)(A),z=((e,t)=>{const r=Object.assign((0,ae.Rq)(e),(0,l.xA)(e),(0,ce.eS)(e),(e=>{const t=e.httpAuthSchemes;let r=e.httpAuthSchemeProvider,o=e.credentials;return{setHttpAuthScheme(e){const r=t.findIndex((t=>t.schemeId===e.schemeId));-1===r?t.push(e):t.splice(r,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){r=e},httpAuthSchemeProvider:()=>r,setCredentials(e){o=e},credentials:()=>o}})(e));return t.forEach((e=>e.configure(r))),Object.assign(e,(0,ae.$3)(r),(0,l.uv)(r),(0,ce.jt)(r),{httpAuthSchemes:(o=r).httpAuthSchemes(),httpAuthSchemeProvider:o.httpAuthSchemeProvider(),credentials:o.credentials()});var o})((e=>{const t=(0,h.h)(e);return Object.assign(t,{authSchemePreference:(0,m.t)(e.authSchemePreference??[])})})((0,p.Co)(D)),e?.extensions||[]);this.config=z,this.middlewareStack.use((0,i.sM)(this.config)),this.middlewareStack.use((0,u.ey)(this.config)),this.middlewareStack.use((0,d.vK)(this.config)),this.middlewareStack.use((0,o.TC)(this.config)),this.middlewareStack.use((0,s.Y7)(this.config)),this.middlewareStack.use((0,n.n4)(this.config)),this.middlewareStack.use((0,c.wB)(this.config,{httpAuthSchemeParametersProvider:y,identityProviderConfigProvider:async e=>new c.h$({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,c.lW)(this.config))}destroy(){super.destroy()}}var pe=r(8029);class ue extends l.TJ{constructor(e){super(e),Object.setPrototypeOf(this,ue.prototype)}}class le extends ue{name="AccessDeniedException";$fault="client";error;error_description;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,le.prototype),this.error=e.error,this.error_description=e.error_description}}class he extends ue{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e}),Object.setPrototypeOf(this,he.prototype),this.error=e.error,this.error_description=e.error_description}}const me=e=>({...e,...e.clientSecret&&{clientSecret:l.$H},...e.refreshToken&&{refreshToken:l.$H},...e.codeVerifier&&{codeVerifier:l.$H}}),ye=e=>({...e,...e.accessToken&&{accessToken:l.$H},...e.refreshToken&&{refreshToken:l.$H},...e.idToken&&{idToken:l.$H}});class fe extends ue{name="ExpiredTokenException";$fault="client";error;error_description;constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,fe.prototype),this.error=e.error,this.error_description=e.error_description}}class ge extends ue{name="InternalServerException";$fault="server";error;error_description;constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,ge.prototype),this.error=e.error,this.error_description=e.error_description}}class we extends ue{name="InvalidClientException";$fault="client";error;error_description;constructor(e){super({name:"InvalidClientException",$fault:"client",...e}),Object.setPrototypeOf(this,we.prototype),this.error=e.error,this.error_description=e.error_description}}class xe extends ue{name="InvalidGrantException";$fault="client";error;error_description;constructor(e){super({name:"InvalidGrantException",$fault:"client",...e}),Object.setPrototypeOf(this,xe.prototype),this.error=e.error,this.error_description=e.error_description}}class Se extends ue{name="InvalidRequestException";$fault="client";error;error_description;constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,Se.prototype),this.error=e.error,this.error_description=e.error_description}}class be extends ue{name="InvalidScopeException";$fault="client";error;error_description;constructor(e){super({name:"InvalidScopeException",$fault:"client",...e}),Object.setPrototypeOf(this,be.prototype),this.error=e.error,this.error_description=e.error_description}}class Ee extends ue{name="SlowDownException";$fault="client";error;error_description;constructor(e){super({name:"SlowDownException",$fault:"client",...e}),Object.setPrototypeOf(this,Ee.prototype),this.error=e.error,this.error_description=e.error_description}}class ve extends ue{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),Object.setPrototypeOf(this,ve.prototype),this.error=e.error,this.error_description=e.error_description}}class Pe extends ue{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,Pe.prototype),this.error=e.error,this.error_description=e.error_description}}var Ie=r(1830);const Oe=async(e,t)=>{const r=(0,c.lI)(e,t);let o;return r.bp("/token"),o=JSON.stringify((0,l.s)(e,{clientId:[],clientSecret:[],code:[],codeVerifier:[],deviceCode:[],grantType:[],redirectUri:[],refreshToken:[],scope:e=>(0,l.Ss)(e)})),r.m("POST").h({"content-type":"application/json"}).b(o),r.build()},ke=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return _e(e,t);const r=(0,l.Tj)({$metadata:Fe(e)}),o=(0,l.Y0)((0,l.Xk)(await(0,Ie.Y2)(e.body,t)),"body"),s=(0,l.s)(o,{accessToken:l.lK,expiresIn:l.ET,idToken:l.lK,refreshToken:l.lK,tokenType:l.lK});return Object.assign(r,s),r},_e=async(e,t)=>{const r={...e,body:await(0,Ie.CG)(e.body,t)},o=(0,Ie.cJ)(e,r.body);switch(o){case"AccessDeniedException":case"com.amazonaws.ssooidc#AccessDeniedException":throw await Te(r,t);case"AuthorizationPendingException":case"com.amazonaws.ssooidc#AuthorizationPendingException":throw await $e(r,t);case"ExpiredTokenException":case"com.amazonaws.ssooidc#ExpiredTokenException":throw await Ce(r,t);case"InternalServerException":case"com.amazonaws.ssooidc#InternalServerException":throw await Ae(r,t);case"InvalidClientException":case"com.amazonaws.ssooidc#InvalidClientException":throw await De(r,t);case"InvalidGrantException":case"com.amazonaws.ssooidc#InvalidGrantException":throw await ze(r,t);case"InvalidRequestException":case"com.amazonaws.ssooidc#InvalidRequestException":throw await Ke(r,t);case"InvalidScopeException":case"com.amazonaws.ssooidc#InvalidScopeException":throw await Re(r,t);case"SlowDownException":case"com.amazonaws.ssooidc#SlowDownException":throw await Ue(r,t);case"UnauthorizedClientException":case"com.amazonaws.ssooidc#UnauthorizedClientException":throw await Me(r,t);case"UnsupportedGrantTypeException":case"com.amazonaws.ssooidc#UnsupportedGrantTypeException":throw await qe(r,t);default:const s=r.body;return je({output:e,parsedBody:s,errorCode:o})}},je=(0,l.jr)(ue),Te=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new le({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},$e=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new he({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Ce=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new fe({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Ae=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new ge({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},De=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new we({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},ze=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new xe({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Ke=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new Se({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Re=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new be({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Ue=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new Ee({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Me=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new ve({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},qe=async(e,t)=>{const r=(0,l.Tj)({}),o=e.body,s=(0,l.s)(o,{error:l.lK,error_description:l.lK});Object.assign(r,s);const n=new Pe({$metadata:Fe(e),...r});return(0,l.Mw)(n,e.body)},Fe=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"]});class He extends(l.uB.classBuilder().ep(g).m((function(e,t,r,o){return[(0,pe.TM)(r,this.serialize,this.deserialize),(0,p.rD)(r,e.getEndpointParameterInstructions())]})).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").f(me,ye).ser(Oe).de(ke).build()){}const Ge={CreateTokenCommand:He};(0,l.J1)(Ge,class extends de{})},9474:e=>{e.exports={rE:"3.826.0"}}};