gemi 0.4.42 → 0.4.44
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/chunk-00e9dad0734d9761.js +2 -0
- package/dist/chunk-01052ff9d1c07ef8.js +1 -1
- package/dist/chunk-0130e95410edb036.js +18 -0
- package/dist/chunk-03c8e645c994d40a.js +1 -1
- package/dist/chunk-1900e90c372bb1d6.js +1 -1
- package/dist/chunk-2ecc077efab285b4.js +2 -0
- package/dist/chunk-415d564ff61a8fe6.js +2 -0
- package/dist/chunk-487b7c0cb388d533.js +6 -0
- package/dist/chunk-4cb19a9e82653084.js +1 -1
- package/dist/chunk-5fd67245740e3908.js +9 -0
- package/dist/chunk-67351e678a7ccc10.js +2 -0
- package/dist/chunk-9113f22a5215c639.js +3 -0
- package/dist/chunk-a0003b7feea6fae6.js +2 -0
- package/dist/chunk-ae373c8ae2d526ae.js +18 -0
- package/dist/chunk-b0cc82fa84d5362d.js +2 -0
- package/dist/chunk-bf92f3127474b56a.js +3 -0
- package/dist/chunk-c1813278ccdc04b8.js +2 -0
- package/dist/chunk-c3eaa877d3aab9db.js +18 -0
- package/dist/chunk-c609d06153ed09ce.js +1 -1
- package/dist/chunk-d26ffb7722e6df54.js +1 -0
- package/dist/chunk-d5ddfacbfc84a47d.js +6 -0
- package/dist/chunk-dc7b0cf226ba3afa.js +1 -1
- package/dist/chunk-e1a08bb52ee7ea09.js +2 -0
- package/dist/chunk-f5a4295176f9b1c1.js +2 -0
- package/dist/chunk-f5e313cc7d724fbe.js +2 -0
- package/dist/chunk-f868cdf653dbe87e.js +2 -0
- package/dist/chunk-f9e6a0a946ebb032.js +2 -0
- package/dist/client/Mutation.d.ts +9 -13
- package/dist/client/Mutation.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +16 -4
- package/dist/client/{useRouter.d.ts → useNavigate.d.ts} +2 -2
- package/dist/client/useNavigate.d.ts.map +1 -0
- package/dist/client/useRoute.d.ts +8 -0
- package/dist/client/useRoute.d.ts.map +1 -0
- package/dist/http/ApiRouter.d.ts +4 -5
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/I18nServiceContainer.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/storage/index.js +4 -4
- package/package.json +1 -1
- package/dist/client/useRouter.d.ts.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-c1813278ccdc04b8.js";import{y as b} from"./chunk-7ce930fe69575c87.js";import{A as G0,B as I0,C as T0,E as Wl,F as B0,J as Tl,K as Al,M as Rl,N as Ll,P as _l,Q as bl,W as K,X as Ih,Y as u0,aa as A0,ca as S,ea as u,ha as R0,ja as U0,ka as T,la as L0,ma as fl,na as Cl,oa as H0,pa as S0,qa as ch} from"./chunk-9113f22a5215c639.js";import{Da as yh,Ea as dl,Fa as wl,Ga as q0,Ha as vl,Ia as Ml,Ja as zl,Ka as y0,La as Ol,Ma as gl,Na as xl,Oa as il,Pa as Q0,Qa as X0,Sa as F,Ta as B,Ua as Y0,Va as cl,Xa as el,Ya as Z0,Za as pl,_a as $0,ab as dh,bb as nl,cb as ol,db as ul,eb as tl,fb as m0,gb as J0,wa as E0,xa as k0,ya as K0,za as F0} from"./chunk-ae373c8ae2d526ae.js";import"./chunk-a0003b7feea6fae6.js";import{ib as f,jb as jl} from"./chunk-4cb19a9e82653084.js";import"./chunk-ff086fe014985526.js";import{qb as Qh} from"./chunk-5fd67245740e3908.js";import"./chunk-d26ffb7722e6df54.js";var C=b(yh(),1);var Gl=b(dh(),1);var md=function(h){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:h.region},propertiesExtractor:(d,l)=>({signingProperties:{config:d,context:l}})}},ll=function(h){return{schemeId:"smithy.api#noAuth"}},Il=async(h,d,l)=>{return{operation:dl(d).operation,region:await wl(h.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Hl=(h)=>{const d=[];switch(h.operation){case"AssumeRoleWithSAML":{d.push(ll(h));break}case"AssumeRoleWithWebIdentity":{d.push(ll(h));break}default:d.push(md(h))}return d},Jd=(h)=>({...h,stsClientCtor:A}),Sl=(h)=>{const d=Jd(h);return{...Gl.resolveAwsSdkSigV4Config(d)}};var ml=(h)=>{return{...h,useDualstackEndpoint:h.useDualstackEndpoint??!1,useFipsEndpoint:h.useFipsEndpoint??!1,useGlobalEndpoint:h.useGlobalEndpoint??!1,defaultSigningName:"sts"}},D={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 Jl={name:"@aws-sdk/client-sts",description:"AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",version:"3.629.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-sts","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo sts",test:"yarn test:unit","test:unit":"jest"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.629.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.629.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.620.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.614.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-sts"}};var wh=b(dh(),1);var h0=b(yh(),1);var al=b(dh(),1),rl=b(yh(),1);var Dl={["required"]:!1,["type"]:"String"},qh={["required"]:!0,default:!1,["type"]:"Boolean"},Xl={["ref"]:"Endpoint"},El={["fn"]:"isSet",["argv"]:[{["ref"]:"Region"}]},J={["ref"]:"Region"},kl={["fn"]:"aws.partition",["argv"]:[J],assign:"PartitionResult"},Yl={["ref"]:"UseFIPS"},Zl={["ref"]:"UseDualStack"},E={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:"sigv4",signingName:"sts",signingRegion:"us-east-1"}]},headers:{}},X={},Kl={conditions:[{["fn"]:"stringEquals",["argv"]:[J,"aws-global"]}],["endpoint"]:E,["type"]:"endpoint"},$l={["fn"]:"booleanEquals",["argv"]:[Yl,!0]},Ul={["fn"]:"booleanEquals",["argv"]:[Zl,!0]},Fl={["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsFIPS"]},Vl={["ref"]:"PartitionResult"},Bl={["fn"]:"booleanEquals",["argv"]:[!0,{["fn"]:"getAttr",["argv"]:[Vl,"supportsDualStack"]}]},ql=[{["fn"]:"isSet",["argv"]:[Xl]}],yl=[$l],Ql=[Ul],Ed={version:"1.0",parameters:{Region:Dl,UseDualStack:qh,UseFIPS:qh,Endpoint:Dl,UseGlobalEndpoint:qh},rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},{["fn"]:"not",["argv"]:ql},El,kl,{["fn"]:"booleanEquals",["argv"]:[Yl,!1]},{["fn"]:"booleanEquals",["argv"]:[Zl,!1]}],rules:[{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"ap-northeast-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"ap-south-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"ap-southeast-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"ap-southeast-2"]}],endpoint:E,["type"]:"endpoint"},Kl,{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"ca-central-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"eu-central-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"eu-north-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"eu-west-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"eu-west-2"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"eu-west-3"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"sa-east-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"us-east-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"us-east-2"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"us-west-1"]}],endpoint:E,["type"]:"endpoint"},{conditions:[{["fn"]:"stringEquals",["argv"]:[J,"us-west-2"]}],endpoint:E,["type"]:"endpoint"},{endpoint:{url:"https://sts.{Region}.{PartitionResult#dnsSuffix}",properties:{authSchemes:[{name:"sigv4",signingName:"sts",signingRegion:"{Region}"}]},headers:X},["type"]:"endpoint"}],["type"]:"tree"},{conditions:ql,rules:[{conditions:yl,error:"Invalid Configuration: FIPS and custom endpoint are not supported",["type"]:"error"},{conditions:Ql,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",["type"]:"error"},{endpoint:{url:Xl,properties:X,headers:X},["type"]:"endpoint"}],["type"]:"tree"},{conditions:[El],rules:[{conditions:[kl],rules:[{conditions:[$l,Ul],rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[!0,Fl]},Bl],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:X,headers:X},["type"]:"endpoint"}],["type"]:"tree"},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",["type"]:"error"}],["type"]:"tree"},{conditions:yl,rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[Fl,!0]}],rules:[{conditions:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Vl,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:X,headers:X},["type"]:"endpoint"},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:X,headers:X},["type"]:"endpoint"}],["type"]:"tree"},{error:"FIPS is enabled but this partition does not support FIPS",["type"]:"error"}],["type"]:"tree"},{conditions:Ql,rules:[{conditions:[Bl],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:X,headers:X},["type"]:"endpoint"}],["type"]:"tree"},{error:"DualStack is enabled but this partition does not support DualStack",["type"]:"error"}],["type"]:"tree"},Kl,{endpoint:{url:"https://sts.{Region}.{PartitionResult#dnsSuffix}",properties:X,headers:X},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid Configuration: Missing Region",["type"]:"error"}]},Pl=Ed;var Nl=(h,d={})=>{return Ml(Pl,{endpointParams:h,logger:d.logger})};vl.aws=zl;var sl=(h)=>{return{apiVersion:"2011-06-15",base64Decoder:h?.base64Decoder??Tl,base64Encoder:h?.base64Encoder??Ll,disableHostPrefix:h?.disableHostPrefix??!1,endpointProvider:h?.endpointProvider??Nl,extensions:h?.extensions??[],httpAuthSchemeProvider:h?.httpAuthSchemeProvider??Hl,httpAuthSchemes:h?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(d)=>d.getIdentityProvider("aws.auth#sigv4"),signer:new al.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(d)=>d.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new rl.NoAuthSigner}],logger:h?.logger??new Wl,serviceId:h?.serviceId??"STS",urlParser:h?.urlParser??jl,utf8Decoder:h?.utf8Decoder??Al,utf8Encoder:h?.utf8Encoder??Rl}};var l0=(h)=>{Cl(process.version);const d=tl(h),l=()=>d().then(fl),w=sl(h);return wh.emitWarningIfUnsupportedVersion(process.version),{...w,...h,runtime:"node",defaultsMode:d,bodyLengthChecker:h?.bodyLengthChecker??ul,credentialDefaultProvider:h?.credentialDefaultProvider??Qh,defaultUserAgentProvider:h?.defaultUserAgentProvider??nl({serviceId:w.serviceId,clientVersion:Jl.version}),httpAuthSchemes:h?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(G)=>G.getIdentityProvider("aws.auth#sigv4")||(async(H)=>await Qh(H?.__config||{})()),signer:new wh.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(G)=>G.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new h0.NoAuthSigner}],maxAttempts:h?.maxAttempts??f(el),region:h?.region??f(xl,il),requestHandler:_l.create(h?.requestHandler??l),retryMode:h?.retryMode??f({...pl,default:async()=>(await l()).retryMode||cl}),sha256:h?.sha256??ol.bind(null,"sha256"),streamCollector:h?.streamCollector??bl,useDualstackEndpoint:h?.useDualstackEndpoint??f(Ol),useFipsEndpoint:h?.useFipsEndpoint??f(gl)}};var d0=(h)=>{const d=h.httpAuthSchemes;let{httpAuthSchemeProvider:l,credentials:w}=h;return{setHttpAuthScheme(G){const H=d.findIndex((I)=>I.schemeId===G.schemeId);if(H===-1)d.push(G);else d.splice(H,1,G)},httpAuthSchemes(){return d},setHttpAuthSchemeProvider(G){l=G},httpAuthSchemeProvider(){return l},setCredentials(G){w=G},credentials(){return w}}},w0=(h)=>{return{httpAuthSchemes:h.httpAuthSchemes(),httpAuthSchemeProvider:h.httpAuthSchemeProvider(),credentials:h.credentials()}};var Gh=(h)=>h,D0=(h,d)=>{const l={...Gh(m0(h)),...Gh(H0(h)),...Gh(G0(h)),...Gh(d0(h))};return d.forEach((w)=>w.configure(l)),{...h,...J0(l),...S0(l),...I0(l),...w0(l)}};class A extends B0{constructor(...[h]){const d=l0(h||{}),l=ml(d),w=q0(l),G=Z0(w),H=Q0(G),I=E0(H),Q=Y0(I),v=Sl(Q),M=D0(v,h?.extensions||[]);super(M);this.config=M,this.middlewareStack.use(y0(this.config)),this.middlewareStack.use($0(this.config)),this.middlewareStack.use(X0(this.config)),this.middlewareStack.use(k0(this.config)),this.middlewareStack.use(K0(this.config)),this.middlewareStack.use(F0(this.config)),this.middlewareStack.use(C.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Il,identityProviderConfigProvider:async(n)=>new C.DefaultIdentityProviderConfig({"aws.auth#sigv4":n.credentials})})),this.middlewareStack.use(C.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class Y extends U0{constructor(h){super(h);Object.setPrototypeOf(this,Y.prototype)}}class Hh extends Y{constructor(h){super({name:"ExpiredTokenException",$fault:"client",...h});this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,Hh.prototype)}}class Sh extends Y{constructor(h){super({name:"MalformedPolicyDocumentException",$fault:"client",...h});this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,Sh.prototype)}}class mh extends Y{constructor(h){super({name:"PackedPolicyTooLargeException",$fault:"client",...h});this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,mh.prototype)}}class Jh extends Y{constructor(h){super({name:"RegionDisabledException",$fault:"client",...h});this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,Jh.prototype)}}class Dh extends Y{constructor(h){super({name:"IDPRejectedClaimException",$fault:"client",...h});this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,Dh.prototype)}}class Eh extends Y{constructor(h){super({name:"InvalidIdentityTokenException",$fault:"client",...h});this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,Eh.prototype)}}class kh extends Y{constructor(h){super({name:"IDPCommunicationErrorException",$fault:"client",...h});this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,kh.prototype)}}class Kh extends Y{constructor(h){super({name:"InvalidAuthorizationMessageException",$fault:"client",...h});this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,Kh.prototype)}}var o=(h)=>({...h,...h.SecretAccessKey&&{SecretAccessKey:Ih}}),V0=(h)=>({...h,...h.Credentials&&{Credentials:o(h.Credentials)}}),P0=(h)=>({...h,...h.SAMLAssertion&&{SAMLAssertion:Ih}}),v0=(h)=>({...h,...h.Credentials&&{Credentials:o(h.Credentials)}}),M0=(h)=>({...h,...h.WebIdentityToken&&{WebIdentityToken:Ih}}),z0=(h)=>({...h,...h.Credentials&&{Credentials:o(h.Credentials)}}),N0=(h)=>({...h,...h.Credentials&&{Credentials:o(h.Credentials)}}),W0=(h)=>({...h,...h.Credentials&&{Credentials:o(h.Credentials)}});var P=b(dh(),1);var j0=async(h,d)=>{const l=j;let w;return w=_({...Yd(h,d),[r]:od,[s]:a}),L(d,l,"/",void 0,w)},a0=async(h,d)=>{const l=j;let w;return w=_({...Zd(h,d),[r]:ud,[s]:a}),L(d,l,"/",void 0,w)},r0=async(h,d)=>{const l=j;let w;return w=_({...$d(h,d),[r]:td,[s]:a}),L(d,l,"/",void 0,w)},s0=async(h,d)=>{const l=j;let w;return w=_({...Ud(h,d),[r]:hw,[s]:a}),L(d,l,"/",void 0,w)},_0=async(h,d)=>{const l=j;let w;return w=_({...Vd(h,d),[r]:lw,[s]:a}),L(d,l,"/",void 0,w)},b0=async(h,d)=>{const l=j;let w;return w=_({...Pd(h,d),[r]:dw,[s]:a}),L(d,l,"/",void 0,w)},f0=async(h,d)=>{const l=j;let w;return w=_({...vd(h,d),[r]:ww,[s]:a}),L(d,l,"/",void 0,w)},C0=async(h,d)=>{const l=j;let w;return w=_({...Md(h,d),[r]:Gw,[s]:a}),L(d,l,"/",void 0,w)},O0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=Rd(l.AssumeRoleResult,d),{$metadata:k(h),...w}},g0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=Ld(l.AssumeRoleWithSAMLResult,d),{$metadata:k(h),...w}},x0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=jd(l.AssumeRoleWithWebIdentityResult,d),{$metadata:k(h),...w}},i0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=ad(l.DecodeAuthorizationMessageResult,d),{$metadata:k(h),...w}},c0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=_d(l.GetAccessKeyInfoResult,d),{$metadata:k(h),...w}},e0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=bd(l.GetCallerIdentityResult,d),{$metadata:k(h),...w}},p0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=fd(l.GetFederationTokenResult,d),{$metadata:k(h),...w}},n0=async(h,d)=>{if(h.statusCode>=300)return R(h,d);const l=await P.parseXmlBody(h.body,d);let w={};return w=Cd(l.GetSessionTokenResult,d),{$metadata:k(h),...w}},R=async(h,d)=>{const l={...h,body:await P.parseXmlErrorBody(h.body,d)},w=Iw(h,l.body);switch(w){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await kd(l,d);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await yd(l,d);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await Qd(l,d);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await Xd(l,d);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await Fd(l,d);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await qd(l,d);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await Kd(l,d);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await Bd(l,d);default:const G=l.body;return nd({output:h,parsedBody:G.Error,errorCode:w})}},kd=async(h,d)=>{const l=h.body,w=rd(l.Error,d),G=new Hh({$metadata:k(h),...w});return T(G,l)},Kd=async(h,d)=>{const l=h.body,w=Od(l.Error,d),G=new kh({$metadata:k(h),...w});return T(G,l)},Fd=async(h,d)=>{const l=h.body,w=gd(l.Error,d),G=new Dh({$metadata:k(h),...w});return T(G,l)},Bd=async(h,d)=>{const l=h.body,w=xd(l.Error,d),G=new Kh({$metadata:k(h),...w});return T(G,l)},qd=async(h,d)=>{const l=h.body,w=id(l.Error,d),G=new Eh({$metadata:k(h),...w});return T(G,l)},yd=async(h,d)=>{const l=h.body,w=cd(l.Error,d),G=new Sh({$metadata:k(h),...w});return T(G,l)},Qd=async(h,d)=>{const l=h.body,w=ed(l.Error,d),G=new mh({$metadata:k(h),...w});return T(G,l)},Xd=async(h,d)=>{const l=h.body,w=pd(l.Error,d),G=new Jh({$metadata:k(h),...w});return T(G,l)},Yd=(h,d)=>{const l={};if(h[W]!=null)l[W]=h[W];if(h[i]!=null)l[i]=h[i];if(h[$]!=null){const w=Fh(h[$],d);if(h[$]?.length===0)l.PolicyArns=[];Object.entries(w).forEach(([G,H])=>{const I=`PolicyArns.${G}`;l[I]=H})}if(h[Z]!=null)l[Z]=h[Z];if(h[y]!=null)l[y]=h[y];if(h[e]!=null){const w=o0(h[e],d);if(h[e]?.length===0)l.Tags=[];Object.entries(w).forEach(([G,H])=>{const I=`Tags.${G}`;l[I]=H})}if(h[Ch]!=null){const w=Ad(h[Ch],d);if(h[Ch]?.length===0)l.TransitiveTagKeys=[];Object.entries(w).forEach(([G,H])=>{const I=`TransitiveTagKeys.${G}`;l[I]=H})}if(h[Uh]!=null)l[Uh]=h[Uh];if(h[c]!=null)l[c]=h[c];if(h[p]!=null)l[p]=h[p];if(h[V]!=null)l[V]=h[V];if(h[Rh]!=null){const w=Wd(h[Rh],d);if(h[Rh]?.length===0)l.ProvidedContexts=[];Object.entries(w).forEach(([G,H])=>{const I=`ProvidedContexts.${G}`;l[I]=H})}return l},Zd=(h,d)=>{const l={};if(h[W]!=null)l[W]=h[W];if(h[Th]!=null)l[Th]=h[Th];if(h[sh]!=null)l[sh]=h[sh];if(h[$]!=null){const w=Fh(h[$],d);if(h[$]?.length===0)l.PolicyArns=[];Object.entries(w).forEach(([G,H])=>{const I=`PolicyArns.${G}`;l[I]=H})}if(h[Z]!=null)l[Z]=h[Z];if(h[y]!=null)l[y]=h[y];return l},$d=(h,d)=>{const l={};if(h[W]!=null)l[W]=h[W];if(h[i]!=null)l[i]=h[i];if(h[xh]!=null)l[xh]=h[xh];if(h[Lh]!=null)l[Lh]=h[Lh];if(h[$]!=null){const w=Fh(h[$],d);if(h[$]?.length===0)l.PolicyArns=[];Object.entries(w).forEach(([G,H])=>{const I=`PolicyArns.${G}`;l[I]=H})}if(h[Z]!=null)l[Z]=h[Z];if(h[y]!=null)l[y]=h[y];return l},Ud=(h,d)=>{const l={};if(h[Vh]!=null)l[Vh]=h[Vh];return l},Vd=(h,d)=>{const l={};if(h[O]!=null)l[O]=h[O];return l},Pd=(h,d)=>{return{}},vd=(h,d)=>{const l={};if(h[Nh]!=null)l[Nh]=h[Nh];if(h[Z]!=null)l[Z]=h[Z];if(h[$]!=null){const w=Fh(h[$],d);if(h[$]?.length===0)l.PolicyArns=[];Object.entries(w).forEach(([G,H])=>{const I=`PolicyArns.${G}`;l[I]=H})}if(h[y]!=null)l[y]=h[y];if(h[e]!=null){const w=o0(h[e],d);if(h[e]?.length===0)l.Tags=[];Object.entries(w).forEach(([G,H])=>{const I=`Tags.${G}`;l[I]=H})}return l},Md=(h,d)=>{const l={};if(h[y]!=null)l[y]=h[y];if(h[c]!=null)l[c]=h[c];if(h[p]!=null)l[p]=h[p];return l},Fh=(h,d)=>{const l={};let w=1;for(let G of h){if(G===null)continue;const H=zd(G,d);Object.entries(H).forEach(([I,Q])=>{l[`member.${w}.${I}`]=Q}),w++}return l},zd=(h,d)=>{const l={};if(h[ih]!=null)l[ih]=h[ih];return l},Nd=(h,d)=>{const l={};if(h[Ah]!=null)l[Ah]=h[Ah];if(h[Yh]!=null)l[Yh]=h[Yh];return l},Wd=(h,d)=>{const l={};let w=1;for(let G of h){if(G===null)continue;const H=Nd(G,d);Object.entries(H).forEach(([I,Q])=>{l[`member.${w}.${I}`]=Q}),w++}return l},Td=(h,d)=>{const l={};if(h[zh]!=null)l[zh]=h[zh];if(h[gh]!=null)l[gh]=h[gh];return l},Ad=(h,d)=>{const l={};let w=1;for(let G of h){if(G===null)continue;l[`member.${w}`]=G,w++}return l},o0=(h,d)=>{const l={};let w=1;for(let G of h){if(G===null)continue;const H=Td(G,d);Object.entries(H).forEach(([I,Q])=>{l[`member.${w}.${I}`]=Q}),w++}return l},eh=(h,d)=>{const l={};if(h[Xh]!=null)l[Xh]=S(h[Xh]);if(h[N]!=null)l[N]=S(h[N]);return l},Rd=(h,d)=>{const l={};if(h[q]!=null)l[q]=t(h[q],d);if(h[z]!=null)l[z]=eh(h[z],d);if(h[U]!=null)l[U]=u(h[U]);if(h[V]!=null)l[V]=S(h[V]);return l},Ld=(h,d)=>{const l={};if(h[q]!=null)l[q]=t(h[q],d);if(h[z]!=null)l[z]=eh(h[z],d);if(h[U]!=null)l[U]=u(h[U]);if(h[ah]!=null)l[ah]=S(h[ah]);if(h[bh]!=null)l[bh]=S(h[bh]);if(h[Mh]!=null)l[Mh]=S(h[Mh]);if(h[x]!=null)l[x]=S(h[x]);if(h[Wh]!=null)l[Wh]=S(h[Wh]);if(h[V]!=null)l[V]=S(h[V]);return l},jd=(h,d)=>{const l={};if(h[q]!=null)l[q]=t(h[q],d);if(h[_h]!=null)l[_h]=S(h[_h]);if(h[z]!=null)l[z]=eh(h[z],d);if(h[U]!=null)l[U]=u(h[U]);if(h[jh]!=null)l[jh]=S(h[jh]);if(h[x]!=null)l[x]=S(h[x]);if(h[V]!=null)l[V]=S(h[V]);return l},t=(h,d)=>{const l={};if(h[O]!=null)l[O]=S(h[O]);if(h[rh]!=null)l[rh]=S(h[rh]);if(h[fh]!=null)l[fh]=S(h[fh]);if(h[$h]!=null)l[$h]=A0(R0(h[$h]));return l},ad=(h,d)=>{const l={};if(h[Zh]!=null)l[Zh]=S(h[Zh]);return l},rd=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},sd=(h,d)=>{const l={};if(h[vh]!=null)l[vh]=S(h[vh]);if(h[N]!=null)l[N]=S(h[N]);return l},_d=(h,d)=>{const l={};if(h[g]!=null)l[g]=S(h[g]);return l},bd=(h,d)=>{const l={};if(h[Oh]!=null)l[Oh]=S(h[Oh]);if(h[g]!=null)l[g]=S(h[g]);if(h[N]!=null)l[N]=S(h[N]);return l},fd=(h,d)=>{const l={};if(h[q]!=null)l[q]=t(h[q],d);if(h[Ph]!=null)l[Ph]=sd(h[Ph],d);if(h[U]!=null)l[U]=u(h[U]);return l},Cd=(h,d)=>{const l={};if(h[q]!=null)l[q]=t(h[q],d);return l},Od=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},gd=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},xd=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},id=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},cd=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},ed=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},pd=(h,d)=>{const l={};if(h[m]!=null)l[m]=S(h[m]);return l},k=(h)=>({httpStatusCode:h.statusCode,requestId:h.headers["x-amzn-requestid"]??h.headers["x-amzn-request-id"]??h.headers["x-amz-request-id"],extendedRequestId:h.headers["x-amz-id-2"],cfId:h.headers["x-amz-cf-id"]});var nd=L0(Y),L=async(h,d,l,w,G)=>{const{hostname:H,protocol:I="https",port:Q,path:v}=await h.endpoint(),M={protocol:I,hostname:H,port:Q,method:"POST",path:v.endsWith("/")?v.slice(0,-1)+l:v+l,headers:d};if(w!==void 0)M.hostname=w;if(G!==void 0)M.body=G;return new T0(M)},j={"content-type":"application/x-www-form-urlencoded"},a="2011-06-15",r="Action",O="AccessKeyId",od="AssumeRole",Xh="AssumedRoleId",z="AssumedRoleUser",ud="AssumeRoleWithSAML",td="AssumeRoleWithWebIdentity",g="Account",N="Arn",x="Audience",q="Credentials",Yh="ContextAssertion",hw="DecodeAuthorizationMessage",Zh="DecodedMessage",y="DurationSeconds",$h="Expiration",Uh="ExternalId",Vh="EncodedMessage",Ph="FederatedUser",vh="FederatedUserId",lw="GetAccessKeyInfo",dw="GetCallerIdentity",ww="GetFederationToken",Gw="GetSessionToken",Mh="Issuer",zh="Key",Nh="Name",Wh="NameQualifier",Z="Policy",$="PolicyArns",Th="PrincipalArn",Ah="ProviderArn",Rh="ProvidedContexts",Lh="ProviderId",U="PackedPolicySize",jh="Provider",W="RoleArn",i="RoleSessionName",ah="Subject",rh="SecretAccessKey",sh="SAMLAssertion",_h="SubjectFromWebIdentityToken",V="SourceIdentity",c="SerialNumber",bh="SubjectType",fh="SessionToken",e="Tags",p="TokenCode",Ch="TransitiveTagKeys",Oh="UserId",s="Version",gh="Value",xh="WebIdentityToken",ih="arn",m="message",_=(h)=>Object.entries(h).map(([d,l])=>ch(d)+"="+ch(l)).join("&"),Iw=(h,d)=>{if(d.Error?.Code!==void 0)return d.Error.Code;if(h.statusCode==404)return"NotFound"};class hh extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,V0).ser(j0).de(O0).build(){}class ph extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(P0,v0).ser(a0).de(g0).build(){}class lh extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(M0,z0).ser(r0).de(x0).build(){}class nh extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(s0).de(i0).build(){}class oh extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(_0).de(c0).build(){}class uh extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(b0).de(e0).build(){}class th extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,N0).ser(f0).de(p0).build(){}class hl extends K.classBuilder().ep({...D}).m(function(h,d,l,w){return[F(l,this.serialize,this.deserialize),B(l,h.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,W0).ser(C0).de(n0).build(){}var Hw={AssumeRoleCommand:hh,AssumeRoleWithSAMLCommand:ph,AssumeRoleWithWebIdentityCommand:lh,DecodeAuthorizationMessageCommand:nh,GetAccessKeyInfoCommand:oh,GetCallerIdentityCommand:uh,GetFederationTokenCommand:th,GetSessionTokenCommand:hl};class t0 extends A{}u0(Hw,t0);var hd="us-east-1",ld=(h)=>{if(typeof h?.Arn==="string"){const d=h.Arn.split(":");if(d.length>4&&d[4]!=="")return d[4]}return},dd=async(h,d,l)=>{const w=typeof h==="function"?await h():h,G=typeof d==="function"?await d():d;return l?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${w} (provider)`,`${G} (parent client)`,`${hd} (STS default)`),w??G??hd},wd=(h,d)=>{let l,w;return async(G,H)=>{if(w=G,!l){const{logger:M=h?.parentClientConfig?.logger,region:n,requestHandler:Bh=h?.parentClientConfig?.requestHandler,credentialProviderLogger:Hd}=h,Sd=await dd(n,h?.parentClientConfig?.region,Hd);l=new d({credentialDefaultProvider:()=>async()=>w,region:Sd,requestHandler:Bh,logger:M})}const{Credentials:I,AssumedRoleUser:Q}=await l.send(new hh(H));if(!I||!I.AccessKeyId||!I.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${H.RoleArn}`);const v=ld(Q);return{accessKeyId:I.AccessKeyId,secretAccessKey:I.SecretAccessKey,sessionToken:I.SessionToken,expiration:I.Expiration,...I.CredentialScope&&{credentialScope:I.CredentialScope},...v&&{accountId:v}}}},Gd=(h,d)=>{let l;return async(w)=>{if(!l){const{logger:Q=h?.parentClientConfig?.logger,region:v,requestHandler:M=h?.parentClientConfig?.requestHandler,credentialProviderLogger:n}=h,Bh=await dd(v,h?.parentClientConfig?.region,n);l=new d({region:Bh,requestHandler:M,logger:Q})}const{Credentials:G,AssumedRoleUser:H}=await l.send(new lh(w));if(!G||!G.AccessKeyId||!G.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${w.RoleArn}`);const I=ld(H);return{accessKeyId:G.AccessKeyId,secretAccessKey:G.SecretAccessKey,sessionToken:G.SessionToken,expiration:G.Expiration,...G.CredentialScope&&{credentialScope:G.CredentialScope},...I&&{accountId:I}}}};var Id=(h,d)=>{if(!d)return h;else return class l extends h{constructor(w){super(w);for(let G of d)this.middlewareStack.use(G)}}},Sw=(h={},d)=>wd(h,Id(A,d)),mw=(h={},d)=>Gd(h,Id(A,d)),RG=(h)=>(d)=>h({roleAssumer:Sw(d),roleAssumerWithWebIdentity:mw(d),...d});export{mw as getDefaultRoleAssumerWithWebIdentity,Sw as getDefaultRoleAssumer,RG as decorateDefaultCredentialProvider,B0 as __Client,Y as STSServiceException,A as STSClient,t0 as STS,Jh as RegionDisabledException,mh as PackedPolicyTooLargeException,Sh as MalformedPolicyDocumentException,Eh as InvalidIdentityTokenException,Kh as InvalidAuthorizationMessageException,Dh as IDPRejectedClaimException,kh as IDPCommunicationErrorException,W0 as GetSessionTokenResponseFilterSensitiveLog,hl as GetSessionTokenCommand,N0 as GetFederationTokenResponseFilterSensitiveLog,th as GetFederationTokenCommand,uh as GetCallerIdentityCommand,oh as GetAccessKeyInfoCommand,Hh as ExpiredTokenException,nh as DecodeAuthorizationMessageCommand,o as CredentialsFilterSensitiveLog,z0 as AssumeRoleWithWebIdentityResponseFilterSensitiveLog,M0 as AssumeRoleWithWebIdentityRequestFilterSensitiveLog,lh as AssumeRoleWithWebIdentityCommand,v0 as AssumeRoleWithSAMLResponseFilterSensitiveLog,P0 as AssumeRoleWithSAMLRequestFilterSensitiveLog,ph as AssumeRoleWithSAMLCommand,V0 as AssumeRoleResponseFilterSensitiveLog,hh as AssumeRoleCommand,K as $Command};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-7ce930fe69575c87.js";import"./chunk-a0003b7feea6fae6.js";import{ib as v,jb as B} from"./chunk-4cb19a9e82653084.js";import{kb as z,lb as y} from"./chunk-ff086fe014985526.js";import"./chunk-d26ffb7722e6df54.js";import{parse as p} from"url";import{Buffer as M} from"buffer";import{request as k} from"http";function u(c){return new Promise((I,x)=>{const T=k({method:"GET",...c,hostname:c.hostname?.replace(/^\[(.+)\]$/,"$1")});T.on("error",(N)=>{x(Object.assign(new z("Unable to connect to instance metadata service"),N)),T.destroy()}),T.on("timeout",()=>{x(new z("TimeoutError from instance metadata service")),T.destroy()}),T.on("response",(N)=>{const{statusCode:O=400}=N;if(O<200||300<=O)x(Object.assign(new z("Error response received from instance metadata service"),{statusCode:O})),T.destroy();const E=[];N.on("data",(w)=>{E.push(w)}),N.on("end",()=>{I(M.concat(E)),T.destroy()})}),T.end()})}var K=(c)=>Boolean(c)&&typeof c==="object"&&typeof c.AccessKeyId==="string"&&typeof c.SecretAccessKey==="string"&&typeof c.Token==="string"&&typeof c.Expiration==="string",_=(c)=>({accessKeyId:c.AccessKeyId,secretAccessKey:c.SecretAccessKey,sessionToken:c.Token,expiration:new Date(c.Expiration),...c.AccountId&&{accountId:c.AccountId}});var hc=1000,Yc=0,D=({maxRetries:c=0,timeout:I=1000})=>({maxRetries:c,timeout:I});var m=(c,I)=>{let x=c();for(let T=0;T<I;T++)x=x.catch(c);return x};var Q="AWS_CONTAINER_CREDENTIALS_FULL_URI",X="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",b="AWS_CONTAINER_AUTHORIZATION_TOKEN",mc=(c={})=>{const{timeout:I,maxRetries:x}=D(c);return()=>m(async()=>{const T=await s({logger:c.logger}),N=JSON.parse(await C(I,T));if(!K(N))throw new y("Invalid response received from instance metadata service.",{logger:c.logger});return _(N)},x)},C=async(c,I)=>{if(process.env[b])I.headers={...I.headers,Authorization:process.env[b]};return(await u({...I,timeout:c})).toString()},a="169.254.170.2",n={localhost:!0,"127.0.0.1":!0},o={"http:":!0,"https:":!0},s=async({logger:c})=>{if(process.env[X])return{hostname:a,path:process.env[X]};if(process.env[Q]){const I=p(process.env[Q]);if(!I.hostname||!(I.hostname in n))throw new y(`${I.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:c});if(!I.protocol||!(I.protocol in o))throw new y(`${I.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:c});return{...I,port:I.port?parseInt(I.port,10):void 0}}throw new y("The container metadata credential provider cannot be used unless"+` the ${X} or ${Q} environment`+" variable is set",{tryNextLink:!1,logger:c})};class G extends y{constructor(c,I=!0){super(c,I);this.tryNextLink=I,this.name="InstanceMetadataV1FallbackError",Object.setPrototypeOf(this,G.prototype)}}var A;(function(c){c.IPv4="http://169.254.169.254",c.IPv6="http://[fd00:ec2::254]"})(A||(A={}));var H={environmentVariableSelector:(c)=>c["AWS_EC2_METADATA_SERVICE_ENDPOINT"],configFileSelector:(c)=>c["ec2_metadata_service_endpoint"],default:void 0};var f;(function(c){c.IPv4="IPv4",c.IPv6="IPv6"})(f||(f={}));var g="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",l="ec2_metadata_service_endpoint_mode",q={environmentVariableSelector:(c)=>c[g],configFileSelector:(c)=>c[l],default:f.IPv4};var Z=async()=>B(await r()||await d()),r=async()=>v(H)(),d=async()=>{const c=await v(q)();switch(c){case f.IPv4:return A.IPv4;case f.IPv6:return A.IPv6;default:throw new Error(`Unsupported endpoint mode: ${c}.`+` Select from ${Object.values(f)}`)}};var L=(c,I)=>{const x=300+Math.floor(Math.random()*300),T=new Date(Date.now()+x*1000);I.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these "+`credentials will be attempted after ${new Date(T)}.\nFor more information, please visit: `+"https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html");const N=c.originalExpiration??c.expiration;return{...c,...N?{originalExpiration:N}:{},expiration:T}};var U=(c,I={})=>{const x=I?.logger||console;let T;return async()=>{let N;try{if(N=await c(),N.expiration&&N.expiration.getTime()<Date.now())N=L(N,x)}catch(O){if(T)x.warn("Credential renew failed: ",O),N=L(T,x);else throw O}return T=N,N}};var P="/latest/meta-data/iam/security-credentials/",e="/latest/api/token",W="AWS_EC2_METADATA_V1_DISABLED",t="ec2_metadata_v1_disabled",F="x-aws-ec2-metadata-token",oc=(c={})=>U(i(c),{logger:c.logger}),i=(c={})=>{let I=!1;const{logger:x,profile:T}=c,{timeout:N,maxRetries:O}=D(c),E=async(w,$)=>{if(I||$.headers?.[F]==null){let h=!1,Y=!1;const R=await v({environmentVariableSelector:(S)=>{const j=S[W];if(Y=!!j&&j!=="false",j===void 0)throw new y(`${W} not set in env, checking config file next.`,{logger:c.logger});return Y},configFileSelector:(S)=>{const j=S[t];return h=!!j&&j!=="false",h},default:!1},{profile:T})();if(c.ec2MetadataV1Disabled||R){const S=[];if(c.ec2MetadataV1Disabled)S.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(h)S.push(`config file profile (${t})`);if(Y)S.push(`process environment variable (${W})`);throw new G(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${S.join(", ")}].`)}}const V=(await m(async()=>{let h;try{h=await Ic($)}catch(Y){if(Y.statusCode===401)I=!1;throw Y}return h},w)).trim();return m(async()=>{let h;try{h=await Tc(V,$,c)}catch(Y){if(Y.statusCode===401)I=!1;throw Y}return h},w)};return async()=>{const w=await Z();if(I)return x?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),E(O,{...w,timeout:N});else{let $;try{$=(await cc({...w,timeout:N})).toString()}catch(J){if(J?.statusCode===400)throw Object.assign(J,{message:"EC2 Metadata token request returned error"});else if(J.message==="TimeoutError"||[403,404,405].includes(J.statusCode))I=!0;return x?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),E(O,{...w,timeout:N})}return E(O,{...w,headers:{[F]:$},timeout:N})}}},cc=async(c)=>u({...c,path:e,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),Ic=async(c)=>(await u({...c,path:P})).toString(),Tc=async(c,I,x)=>{const T=JSON.parse((await u({...I,path:P+c})).toString());if(!K(T))throw new y("Invalid response received from instance metadata service.",{logger:x.logger});return _(T)};export{D as providerConfigFromInit,u as httpRequest,Z as getInstanceMetadataEndpoint,oc as fromInstanceMetadata,mc as fromContainerMetadata,A as Endpoint,X as ENV_CMDS_RELATIVE_URI,Q as ENV_CMDS_FULL_URI,b as ENV_CMDS_AUTH_TOKEN,hc as DEFAULT_TIMEOUT,Yc as DEFAULT_MAX_RETRIES};
|