@thunderclient/cli 1.27.12 → 1.27.14

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/733.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=733,exports.ids=[733],exports.modules={843(e,t,r){r.d(t,{fromIni:()=>T});var n=r(840),i=r(57),o=r(56),s=r(87),a=r(53);const c=e=>(0,s.g)(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p"),l=(e,{profile:t,logger:r})=>{const n="string"==typeof e.source_profile&&void 0===e.credential_source;return n&&r?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`),n},f=(e,{profile:t,logger:r})=>{const n="string"==typeof e.credential_source&&void 0===e.source_profile;return n&&r?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`),n},d=async(e,t,n,l,f={},d)=>{n.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const u=t[e],{source_profile:p,region:w}=u;if(!n.roleAssumer){const{getDefaultRoleAssumer:e}=await r.e(248).then(r.bind(r,860));n.roleAssumer=e({...n.clientConfig,credentialProviderLogger:n.logger,parentClientConfig:{...l,...n?.parentClientConfig,region:w??n?.parentClientConfig?.region??l?.region}},n.clientPlugins)}if(p&&p in f)throw new o.C(`Detected a cycle attempting to resolve credentials for profile ${(0,i.Bz)(n)}. Profiles visited: `+Object.keys(f).join(", "),{logger:n.logger});n.logger?.debug("@aws-sdk/credential-provider-ini - finding credential resolver using "+(p?`source_profile=[${p}]`:`profile=[${e}]`));const h=p?d(p,t,n,l,{...f,[p]:!0},g(t[p]??{})):(await((e,t,n)=>{const i={EcsContainer:async e=>{const{fromHttp:t}=await r.e(963).then(r.bind(r,849)),{fromContainerMetadata:i}=await r.e(330).then(r.bind(r,848));return n?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>(0,a.c)(t(e??{}),i(e))().then(c)},Ec2InstanceMetadata:async e=>{n?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");const{fromInstanceMetadata:t}=await r.e(330).then(r.bind(r,848));return async()=>t(e)().then(c)},Environment:async e=>{n?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");const{fromEnv:t}=await r.e(960).then(r.bind(r,861));return async()=>t(e)().then(c)}};if(e in i)return i[e];throw new o.C(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:n})})(u.credential_source,e,n.logger)(n))();if(g(u))return h.then(e=>(0,s.g)(e,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));{const t={RoleArn:u.role_arn,RoleSessionName:u.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:u.external_id,DurationSeconds:parseInt(u.duration_seconds||"3600",10)},{mfa_serial:r}=u;if(r){if(!n.mfaCodeProvider)throw new o.C(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:n.logger,tryNextLink:!1});t.SerialNumber=r,t.TokenCode=await n.mfaCodeProvider(r)}const i=await h;return n.roleAssumer(i,t).then(e=>(0,s.g)(e,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},g=e=>!e.role_arn&&!!e.credential_source;var u=r(65),p=r(33),w=r(20),h=r(106),y=r(17),E=r(59);class I{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=3e5;constructor(e,t,r){this.profileData=e,this.init=t,this.callerClientConfig=r}async loadCredentials(){const e=await this.loadToken();if(!e)throw new o.C(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});const t=e.accessToken,r=Date.now();return new Date(t.expiresAt).getTime()-r<=I.REFRESH_THRESHOLD?this.refresh(e):{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,accountId:t.accountId,expiration:new Date(t.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(e){const{SigninClient:t,CreateOAuth2TokenCommand:n}=await Promise.all([r.e(350),r.e(785)]).then(r.bind(r,862)),{logger:i,userAgentAppId:s}=this.callerClientConfig??{},a=(e=>"h2"===e?.metadata?.handlerProtocol)(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,c=new t({credentials:{accessKeyId:"",secretAccessKey:""},region:this.profileData.region??await(this.callerClientConfig?.region?.())??process.env.AWS_REGION,requestHandler:a,logger:i,userAgentAppId:s,...this.init?.clientConfig});this.createDPoPInterceptor(c.middlewareStack);const l={tokenInput:{clientId:e.clientId,refreshToken:e.refreshToken,grantType:"refresh_token"}};try{const t=await c.send(new n(l)),{accessKeyId:r,secretAccessKey:i,sessionToken:s}=t.tokenOutput?.accessToken??{},{refreshToken:a,expiresIn:f}=t.tokenOutput??{};if(!(r&&i&&s&&a))throw new o.C("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});const d=1e3*(f??900),g=new Date(Date.now()+d),u={...e,accessToken:{...e.accessToken,accessKeyId:r,secretAccessKey:i,sessionToken:s,expiresAt:g.toISOString()},refreshToken:a};await this.saveToken(u);const p=u.accessToken;return{accessKeyId:p.accessKeyId,secretAccessKey:p.secretAccessKey,sessionToken:p.sessionToken,accountId:p.accountId,expiration:g}}catch(e){if("AccessDeniedException"===e.name){let t;switch(e.error){case"TOKEN_EXPIRED":t="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":t="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":t="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:t=`Failed to refresh token: ${String(e)}. Please re-authenticate using \`aws login\``}throw new o.C(t,{logger:this.logger,tryNextLink:!1})}throw new o.C(`Failed to refresh token: ${String(e)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){const e=this.getTokenFilePath();try{let t;try{t=await(0,u.TA)(e,{ignoreCache:this.init?.ignoreCache})}catch{t=await h.promises.readFile(e,"utf8")}const r=JSON.parse(t),n=["accessToken","clientId","refreshToken","dpopKey"].filter(e=>!r[e]);if(r.accessToken?.accountId||n.push("accountId"),n.length>0)throw new o.C(`Token validation failed, missing fields: ${n.join(", ")}`,{logger:this.logger,tryNextLink:!1});return r}catch(t){throw new o.C(`Failed to load token from ${e}: ${String(t)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){const t=this.getTokenFilePath(),r=(0,E.dirname)(t);try{await h.promises.mkdir(r,{recursive:!0})}catch(e){}await h.promises.writeFile(t,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){const e=process.env.AWS_LOGIN_CACHE_DIRECTORY??(0,E.join)((0,y.homedir)(),".aws","login","cache"),t=Buffer.from(this.loginSession,"utf8"),r=(0,w.createHash)("sha256").update(t).digest("hex");return(0,E.join)(e,`${r}.json`)}derToRawSignature(e){let t=2;if(2!==e[t])throw new Error("Invalid DER signature");t++;const r=e[t++];let n=e.subarray(t,t+r);if(t+=r,2!==e[t])throw new Error("Invalid DER signature");t++;const i=e[t++];let o=e.subarray(t,t+i);n=0===n[0]?n.subarray(1):n,o=0===o[0]?o.subarray(1):o;const s=Buffer.concat([Buffer.alloc(32-n.length),n]),a=Buffer.concat([Buffer.alloc(32-o.length),o]);return Buffer.concat([s,a])}createDPoPInterceptor(e){e.add(e=>async t=>{if(p.K.isInstance(t.request)){const e=t.request,r=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}${e.path}`,n=await this.generateDpop(e.method,r);e.headers={...e.headers,DPoP:n}}return e(t)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",t){const r=await this.loadToken();try{const n=(0,w.createPrivateKey)({key:r.dpopKey,format:"pem",type:"sec1"}),i=(0,w.createPublicKey)(n).export({format:"der",type:"spki"});let o=-1;for(let e=0;e<i.length;e++)if(4===i[e]){o=e;break}const s=i.slice(o+1,o+33),a=i.slice(o+33,o+65),c={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:s.toString("base64url"),y:a.toString("base64url")}},l={jti:crypto.randomUUID(),htm:e,htu:t,iat:Math.floor(Date.now()/1e3)},f=Buffer.from(JSON.stringify(c)).toString("base64url"),d=`${f}.${Buffer.from(JSON.stringify(l)).toString("base64url")}`,g=(0,w.sign)("sha256",Buffer.from(d),n),u=this.derToRawSignature(g);return`${d}.${u.toString("base64url")}`}catch(e){throw new o.C(`Failed to generate Dpop proof: ${e instanceof Error?e.message:String(e)}`,{logger:this.logger,tryNextLink:!1})}}}const C=async(e,t,r)=>{const a=await(c={...t,profile:e},async({callerClientConfig:e}={})=>{c?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");const t=await(0,n.Y)(c||{}),r=(0,i.Bz)({profile:c?.profile??e?.profile}),a=t[r];if(!a?.login_session)throw new o.C(`Profile ${r} does not contain login_session.`,{tryNextLink:!0,logger:c?.logger});const l=new I(a,c,e),f=await l.loadCredentials();return(0,s.g)(f,"CREDENTIALS_LOGIN","AD")})({callerClientConfig:r});var c;return(0,s.g)(a,"CREDENTIALS_PROFILE_LOGIN","AC")},k=e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.aws_access_key_id&&"string"==typeof e.aws_secret_access_key&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,S=async(e,t)=>{t?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");const r={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return(0,s.g)(r,"CREDENTIALS_PROFILE","n")},R=async(e,t,n,i,a={},c=!1)=>{const g=t[e];if(Object.keys(a).length>0&&k(g))return S(g,n);if(c||((e,{profile:t="default",logger:r}={})=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.role_arn&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(l(e,{profile:t,logger:r})||f(e,{profile:t,logger:r})))(g,{profile:e,logger:n.logger}))return d(e,t,n,i,a,R);if(k(g))return S(g,n);if(u=g,Boolean(u)&&"object"==typeof u&&"string"==typeof u.web_identity_token_file&&"string"==typeof u.role_arn&&["undefined","string"].indexOf(typeof u.role_session_name)>-1)return(async(e,t,n)=>{const{fromTokenFile:i}=await r.e(522).then(r.bind(r,847)),o=await i({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:t.roleAssumerWithWebIdentity,logger:t.logger,parentClientConfig:t.parentClientConfig})({callerClientConfig:n});return(0,s.g)(o,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")})(g,n,i);var u;if((e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.credential_process)(g))return(async(e,t)=>{const{fromProcess:n}=await r.e(876).then(r.bind(r,844)),i=await n({...e,profile:t})();return(0,s.g)(i,"CREDENTIALS_PROFILE_PROCESS","v")})(n,e);if((e=>e&&("string"==typeof e.sso_start_url||"string"==typeof e.sso_account_id||"string"==typeof e.sso_session||"string"==typeof e.sso_region||"string"==typeof e.sso_role_name))(g))return await(async(e,t,n={},i)=>{const{fromSSO:o}=await r.e(843).then(r.bind(r,839));return o({profile:e,logger:n.logger,parentClientConfig:n.parentClientConfig,clientConfig:n.clientConfig})({callerClientConfig:i}).then(e=>t.sso_session?(0,s.g)(e,"CREDENTIALS_PROFILE_SSO","r"):(0,s.g)(e,"CREDENTIALS_PROFILE_SSO_LEGACY","t"))})(e,g,n,i);if((e=>Boolean(e&&e.login_session))(g))return C(e,n,i);throw new o.C(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:n.logger})},T=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const r=await(0,n.Y)(e);return R((0,i.Bz)({profile:e.profile??t?.profile}),r,e,t)}},840(e,t,r){r.d(t,{Y:()=>i});var n=r(58);const i=async e=>{const t=await(0,n.p)(e);return((...e)=>{const t={};for(const r of e)for(const[e,n]of Object.entries(r))void 0!==t[e]?Object.assign(t[e],n):t[e]=n;return t})(t.configFile,t.credentialsFile)}}};
2
+ "use strict";exports.id=733,exports.ids=[733],exports.modules={844(e,t,r){r.d(t,{fromIni:()=>T});var n=r(841),i=r(57),o=r(56),s=r(87),a=r(53);const c=e=>(0,s.g)(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p"),l=(e,{profile:t,logger:r})=>{const n="string"==typeof e.source_profile&&void 0===e.credential_source;return n&&r?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`),n},f=(e,{profile:t,logger:r})=>{const n="string"==typeof e.credential_source&&void 0===e.source_profile;return n&&r?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`),n},d=async(e,t,n,l,f={},d)=>{n.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const u=t[e],{source_profile:p,region:w}=u;if(!n.roleAssumer){const{getDefaultRoleAssumer:e}=await r.e(248).then(r.bind(r,861));n.roleAssumer=e({...n.clientConfig,credentialProviderLogger:n.logger,parentClientConfig:{...l,...n?.parentClientConfig,region:w??n?.parentClientConfig?.region??l?.region}},n.clientPlugins)}if(p&&p in f)throw new o.C(`Detected a cycle attempting to resolve credentials for profile ${(0,i.Bz)(n)}. Profiles visited: `+Object.keys(f).join(", "),{logger:n.logger});n.logger?.debug("@aws-sdk/credential-provider-ini - finding credential resolver using "+(p?`source_profile=[${p}]`:`profile=[${e}]`));const h=p?d(p,t,n,l,{...f,[p]:!0},g(t[p]??{})):(await((e,t,n)=>{const i={EcsContainer:async e=>{const{fromHttp:t}=await r.e(963).then(r.bind(r,850)),{fromContainerMetadata:i}=await r.e(330).then(r.bind(r,849));return n?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>(0,a.c)(t(e??{}),i(e))().then(c)},Ec2InstanceMetadata:async e=>{n?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");const{fromInstanceMetadata:t}=await r.e(330).then(r.bind(r,849));return async()=>t(e)().then(c)},Environment:async e=>{n?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");const{fromEnv:t}=await r.e(960).then(r.bind(r,862));return async()=>t(e)().then(c)}};if(e in i)return i[e];throw new o.C(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:n})})(u.credential_source,e,n.logger)(n))();if(g(u))return h.then(e=>(0,s.g)(e,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));{const t={RoleArn:u.role_arn,RoleSessionName:u.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:u.external_id,DurationSeconds:parseInt(u.duration_seconds||"3600",10)},{mfa_serial:r}=u;if(r){if(!n.mfaCodeProvider)throw new o.C(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:n.logger,tryNextLink:!1});t.SerialNumber=r,t.TokenCode=await n.mfaCodeProvider(r)}const i=await h;return n.roleAssumer(i,t).then(e=>(0,s.g)(e,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},g=e=>!e.role_arn&&!!e.credential_source;var u=r(65),p=r(33),w=r(20),h=r(106),y=r(17),E=r(59);class I{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=3e5;constructor(e,t,r){this.profileData=e,this.init=t,this.callerClientConfig=r}async loadCredentials(){const e=await this.loadToken();if(!e)throw new o.C(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});const t=e.accessToken,r=Date.now();return new Date(t.expiresAt).getTime()-r<=I.REFRESH_THRESHOLD?this.refresh(e):{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,accountId:t.accountId,expiration:new Date(t.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(e){const{SigninClient:t,CreateOAuth2TokenCommand:n}=await Promise.all([r.e(350),r.e(785)]).then(r.bind(r,863)),{logger:i,userAgentAppId:s}=this.callerClientConfig??{},a=(e=>"h2"===e?.metadata?.handlerProtocol)(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,c=new t({credentials:{accessKeyId:"",secretAccessKey:""},region:this.profileData.region??await(this.callerClientConfig?.region?.())??process.env.AWS_REGION,requestHandler:a,logger:i,userAgentAppId:s,...this.init?.clientConfig});this.createDPoPInterceptor(c.middlewareStack);const l={tokenInput:{clientId:e.clientId,refreshToken:e.refreshToken,grantType:"refresh_token"}};try{const t=await c.send(new n(l)),{accessKeyId:r,secretAccessKey:i,sessionToken:s}=t.tokenOutput?.accessToken??{},{refreshToken:a,expiresIn:f}=t.tokenOutput??{};if(!(r&&i&&s&&a))throw new o.C("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});const d=1e3*(f??900),g=new Date(Date.now()+d),u={...e,accessToken:{...e.accessToken,accessKeyId:r,secretAccessKey:i,sessionToken:s,expiresAt:g.toISOString()},refreshToken:a};await this.saveToken(u);const p=u.accessToken;return{accessKeyId:p.accessKeyId,secretAccessKey:p.secretAccessKey,sessionToken:p.sessionToken,accountId:p.accountId,expiration:g}}catch(e){if("AccessDeniedException"===e.name){let t;switch(e.error){case"TOKEN_EXPIRED":t="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":t="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":t="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:t=`Failed to refresh token: ${String(e)}. Please re-authenticate using \`aws login\``}throw new o.C(t,{logger:this.logger,tryNextLink:!1})}throw new o.C(`Failed to refresh token: ${String(e)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){const e=this.getTokenFilePath();try{let t;try{t=await(0,u.TA)(e,{ignoreCache:this.init?.ignoreCache})}catch{t=await h.promises.readFile(e,"utf8")}const r=JSON.parse(t),n=["accessToken","clientId","refreshToken","dpopKey"].filter(e=>!r[e]);if(r.accessToken?.accountId||n.push("accountId"),n.length>0)throw new o.C(`Token validation failed, missing fields: ${n.join(", ")}`,{logger:this.logger,tryNextLink:!1});return r}catch(t){throw new o.C(`Failed to load token from ${e}: ${String(t)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){const t=this.getTokenFilePath(),r=(0,E.dirname)(t);try{await h.promises.mkdir(r,{recursive:!0})}catch(e){}await h.promises.writeFile(t,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){const e=process.env.AWS_LOGIN_CACHE_DIRECTORY??(0,E.join)((0,y.homedir)(),".aws","login","cache"),t=Buffer.from(this.loginSession,"utf8"),r=(0,w.createHash)("sha256").update(t).digest("hex");return(0,E.join)(e,`${r}.json`)}derToRawSignature(e){let t=2;if(2!==e[t])throw new Error("Invalid DER signature");t++;const r=e[t++];let n=e.subarray(t,t+r);if(t+=r,2!==e[t])throw new Error("Invalid DER signature");t++;const i=e[t++];let o=e.subarray(t,t+i);n=0===n[0]?n.subarray(1):n,o=0===o[0]?o.subarray(1):o;const s=Buffer.concat([Buffer.alloc(32-n.length),n]),a=Buffer.concat([Buffer.alloc(32-o.length),o]);return Buffer.concat([s,a])}createDPoPInterceptor(e){e.add(e=>async t=>{if(p.K.isInstance(t.request)){const e=t.request,r=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}${e.path}`,n=await this.generateDpop(e.method,r);e.headers={...e.headers,DPoP:n}}return e(t)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",t){const r=await this.loadToken();try{const n=(0,w.createPrivateKey)({key:r.dpopKey,format:"pem",type:"sec1"}),i=(0,w.createPublicKey)(n).export({format:"der",type:"spki"});let o=-1;for(let e=0;e<i.length;e++)if(4===i[e]){o=e;break}const s=i.slice(o+1,o+33),a=i.slice(o+33,o+65),c={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:s.toString("base64url"),y:a.toString("base64url")}},l={jti:crypto.randomUUID(),htm:e,htu:t,iat:Math.floor(Date.now()/1e3)},f=Buffer.from(JSON.stringify(c)).toString("base64url"),d=`${f}.${Buffer.from(JSON.stringify(l)).toString("base64url")}`,g=(0,w.sign)("sha256",Buffer.from(d),n),u=this.derToRawSignature(g);return`${d}.${u.toString("base64url")}`}catch(e){throw new o.C(`Failed to generate Dpop proof: ${e instanceof Error?e.message:String(e)}`,{logger:this.logger,tryNextLink:!1})}}}const C=async(e,t,r)=>{const a=await(c={...t,profile:e},async({callerClientConfig:e}={})=>{c?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");const t=await(0,n.Y)(c||{}),r=(0,i.Bz)({profile:c?.profile??e?.profile}),a=t[r];if(!a?.login_session)throw new o.C(`Profile ${r} does not contain login_session.`,{tryNextLink:!0,logger:c?.logger});const l=new I(a,c,e),f=await l.loadCredentials();return(0,s.g)(f,"CREDENTIALS_LOGIN","AD")})({callerClientConfig:r});var c;return(0,s.g)(a,"CREDENTIALS_PROFILE_LOGIN","AC")},k=e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.aws_access_key_id&&"string"==typeof e.aws_secret_access_key&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,S=async(e,t)=>{t?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");const r={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return(0,s.g)(r,"CREDENTIALS_PROFILE","n")},R=async(e,t,n,i,a={},c=!1)=>{const g=t[e];if(Object.keys(a).length>0&&k(g))return S(g,n);if(c||((e,{profile:t="default",logger:r}={})=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.role_arn&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(l(e,{profile:t,logger:r})||f(e,{profile:t,logger:r})))(g,{profile:e,logger:n.logger}))return d(e,t,n,i,a,R);if(k(g))return S(g,n);if(u=g,Boolean(u)&&"object"==typeof u&&"string"==typeof u.web_identity_token_file&&"string"==typeof u.role_arn&&["undefined","string"].indexOf(typeof u.role_session_name)>-1)return(async(e,t,n)=>{const{fromTokenFile:i}=await r.e(522).then(r.bind(r,848)),o=await i({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:t.roleAssumerWithWebIdentity,logger:t.logger,parentClientConfig:t.parentClientConfig})({callerClientConfig:n});return(0,s.g)(o,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")})(g,n,i);var u;if((e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.credential_process)(g))return(async(e,t)=>{const{fromProcess:n}=await r.e(876).then(r.bind(r,845)),i=await n({...e,profile:t})();return(0,s.g)(i,"CREDENTIALS_PROFILE_PROCESS","v")})(n,e);if((e=>e&&("string"==typeof e.sso_start_url||"string"==typeof e.sso_account_id||"string"==typeof e.sso_session||"string"==typeof e.sso_region||"string"==typeof e.sso_role_name))(g))return await(async(e,t,n={},i)=>{const{fromSSO:o}=await r.e(843).then(r.bind(r,840));return o({profile:e,logger:n.logger,parentClientConfig:n.parentClientConfig,clientConfig:n.clientConfig})({callerClientConfig:i}).then(e=>t.sso_session?(0,s.g)(e,"CREDENTIALS_PROFILE_SSO","r"):(0,s.g)(e,"CREDENTIALS_PROFILE_SSO_LEGACY","t"))})(e,g,n,i);if((e=>Boolean(e&&e.login_session))(g))return C(e,n,i);throw new o.C(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:n.logger})},T=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const r=await(0,n.Y)(e);return R((0,i.Bz)({profile:e.profile??t?.profile}),r,e,t)}},841(e,t,r){r.d(t,{Y:()=>i});var n=r(58);const i=async e=>{const t=await(0,n.p)(e);return((...e)=>{const t={};for(const r of e)for(const[e,n]of Object.entries(r))void 0!==t[e]?Object.assign(t[e],n):t[e]=n;return t})(t.configFile,t.credentialsFile)}}};
package/dist/785.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=785,exports.ids=[785],exports.modules={862(e,t,n){n.d(t,{CreateOAuth2TokenCommand:()=>ft,SigninClient:()=>mt});var s=n(36),i=n(32),o=n(38),r=n(34),a=n(35),c=n(43),u=n(42),p=n(46),h=n(47),g=n(49),d=n(51),l=n(70),m=n(84),v=n(71),f=n(85),S=n(86),P=n(44),R=n(69);const w=async(e,t,n)=>({operation:(0,P.u)(t).operation,region:await(0,R.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const k=e=>{const t=[];if("CreateOAuth2Token"===e.operation)t.push({schemeId:"smithy.api#noAuth"});else t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"signin",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e));return t},x={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var I=n(853),A=n(92),y=n(93),E=n(96),b=n(97),C=n(100),T=n(99),O=n(104),D=n(52),z=n(103),F=n(101),j=n(102),q=n(40),U=n(105),$=n(107),M=n(108),V=n(109),H=n(110),N=n(854),B=n(858),K=n(72),L=n(68),G=n(74),J=n(77),Q=n(78),W=n(79),X=n(129),Y=n(132),Z=n(133),_=n(130),ee=n(134);const te="ref",ne=-1,se=!0,ie="isSet",oe="booleanEquals",re="PartitionResult",ae="stringEquals",ce="getAttr",ue="https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}",pe={[te]:"Endpoint"},he={fn:ce,argv:[{[te]:re},"name"]},ge={[te]:re},de={[te]:"Region"},le={authSchemes:[{name:"sigv4",signingName:"signin",signingRegion:"{Region}"}]},me={},ve=[de],fe={conditions:[[ie,ve],[oe,[{fn:"coalesce",argv:[{[te]:"IsControlPlane"},!1]},se]],[ie,[pe]],["aws.partition",ve,re],[oe,[{[te]:"UseFIPS"},se]],[oe,[{[te]:"UseDualStack"},se]],[ae,[he,"aws"]],[ae,[he,"aws-cn"]],[oe,[{fn:ce,argv:[ge,"supportsDualStack"]},se]],[ae,[de,"us-gov-west-1"]],[ae,[he,"aws-us-gov"]],[oe,[{fn:ce,argv:[ge,"supportsFIPS"]},se]],[ae,[he,"aws-iso"]],[ae,[he,"aws-iso-b"]],[ae,[he,"aws-iso-f"]],[ae,[he,"aws-iso-e"]],[ae,[he,"aws-eusc"]]],results:[[ne],["https://signin.{Region}.api.aws",le],["https://signin.{Region}.api.amazonwebservices.com.cn",le],[ue,le],["https://{Region}.signin.aws.amazon.com",me],["https://{Region}.signin.amazonaws.cn",me],["https://{Region}.signin.amazonaws-us-gov.com",me],["https://{Region}.signin.c2shome.ic.gov",me],["https://{Region}.signin.sc2shome.sgov.gov",me],["https://{Region}.signin.csphome.hci.ic.gov",me],["https://{Region}.signin.csphome.adc-e.uk",me],["https://{Region}.signin.amazonaws-eusc.eu",me],["https://signin-fips.amazonaws-us-gov.com",me],["https://{Region}.signin-fips.amazonaws-us-gov.com",me],["https://{Region}.signin.{PartitionResult#dnsSuffix}",me],[ne,"Invalid Configuration: FIPS and custom endpoint are not supported"],[ne,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[pe,me],["https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",me],[ne,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://signin-fips.{Region}.{PartitionResult#dnsSuffix}",me],[ne,"FIPS is enabled but this partition does not support FIPS"],[ue,me],[ne,"DualStack is enabled but this partition does not support DualStack"],["https://signin.{Region}.{PartitionResult#dnsSuffix}",me],[ne,"Invalid Configuration: Missing Region"]]},Se=1e8,Pe=new Int32Array([-1,1,-1,0,4,3,2,30,Se+25,1,24,5,2,30,6,3,7,26,4,18,8,5,17,9,6,Se+4,10,7,Se+5,11,10,Se+6,12,12,Se+7,13,13,Se+8,14,14,Se+9,15,15,Se+10,16,16,Se+11,Se+14,8,Se+22,Se+23,5,22,19,9,Se+12,20,10,Se+13,21,11,Se+20,Se+21,8,23,Se+19,11,Se+18,Se+19,2,29,25,3,32,26,4,27,Se+25,5,Se+25,28,9,Se+12,Se+25,3,32,30,4,Se+15,31,5,Se+16,Se+17,6,Se+1,33,7,Se+2,Se+3]),Re=ee.d.from(Pe,2,fe.conditions,fe.results),we=new Y.k({size:50,params:["Endpoint","IsControlPlane","Region","UseDualStack","UseFIPS"]}),ke=(e,t={})=>we.get(e,()=>(0,Z.c)(Re,{endpointParams:e,logger:t.logger}));_.m.aws=X.U;var xe=n(117),Ie=n(121);class Ae extends Ie.T{constructor(e){super(e),Object.setPrototypeOf(this,Ae.prototype)}}class ye extends Ae{name="AccessDeniedException";$fault="client";error;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,ye.prototype),this.error=e.error}}class Ee extends Ae{name="InternalServerException";$fault="server";error;constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,Ee.prototype),this.error=e.error}}class be extends Ae{name="TooManyRequestsError";$fault="client";error;constructor(e){super({name:"TooManyRequestsError",$fault:"client",...e}),Object.setPrototypeOf(this,be.prototype),this.error=e.error}}class Ce extends Ae{name="ValidationException";$fault="client";error;constructor(e){super({name:"ValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,Ce.prototype),this.error=e.error}}const Te="accessKeyId",Oe="accessToken",De="client",ze="clientId",Fe="codeVerifier",je="error",qe="expiresIn",Ue="grantType",$e="http",Me="httpError",Ve="idToken",He="jsonName",Ne="message",Be="refreshToken",Ke="redirectUri",Le="smithy.ts.sdk.synthetic.com.amazonaws.signin",Ge="secretAccessKey",Je="sessionToken",Qe="tokenType",We="com.amazonaws.signin",Xe=xe.O.for(Le);var Ye=[-3,Le,"SigninServiceException",0,[],[]];Xe.registerError(Ye,Ae);const Ze=xe.O.for(We);var _e=[-3,We,"AccessDeniedException",{[je]:De},[je,Ne],[0,0],2];Ze.registerError(_e,ye);var et=[-3,We,"InternalServerException",{[je]:"server",[Me]:500},[je,Ne],[0,0],2];Ze.registerError(et,Ee);var tt=[-3,We,"TooManyRequestsError",{[je]:De,[Me]:429},[je,Ne],[0,0],2];Ze.registerError(tt,be);var nt=[-3,We,"ValidationException",{[je]:De,[Me]:400},[je,Ne],[0,0],2];Ze.registerError(nt,Ce);const st=[Xe,Ze];var it=[0,We,"RefreshToken",8,0],ot=[3,We,"AccessToken",8,[Te,Ge,Je],[[0,{[He]:Te}],[0,{[He]:Ge}],[0,{[He]:Je}]],3],rt=[3,We,"CreateOAuth2TokenRequest",0,["tokenInput"],[[()=>at,16]],1],at=[3,We,"CreateOAuth2TokenRequestBody",0,[ze,Ue,"code",Ke,Fe,Be],[[0,{[He]:ze}],[0,{[He]:Ue}],0,[0,{[He]:Ke}],[0,{[He]:Fe}],[()=>it,{[He]:Be}]],2],ct=[3,We,"CreateOAuth2TokenResponse",0,["tokenOutput"],[[()=>ut,16]],1],ut=[3,We,"CreateOAuth2TokenResponseBody",0,[Oe,Qe,qe,Be,Ve],[[()=>ot,{[He]:Oe}],[0,{[He]:Qe}],[1,{[He]:qe}],[()=>it,{[He]:Be}],[0,{[He]:Ve}]],4],pt=[9,We,"CreateOAuth2Token",{[$e]:["POST","/v1/token",200]},()=>rt,()=>ct];const ht=e=>{(0,C.I)(process.version);const t=(0,O.I)(e),n=()=>t().then(T.l),s=(e=>({apiVersion:"2023-01-01",base64Decoder:e?.base64Decoder??G.E,base64Encoder:e?.base64Encoder??J.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ke,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??k,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new H.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new B.m}],logger:e?.logger??new K.N,protocol:e?.protocol??N.Y,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.signin",errorTypeRegistries:st,version:"2023-01-01",serviceTarget:"Signin"},serviceId:e?.serviceId??"Signin",urlParser:e?.urlParser??L.D,utf8Decoder:e?.utf8Decoder??Q.a,utf8Encoder:e?.utf8Encoder??W.P}))(e);(0,A.I)(process.version);const i={profile:e?.profile,logger:s.logger};return{...s,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,D.Z)(b.$,i),bodyLengthChecker:e?.bodyLengthChecker??U.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,y.pf)({serviceId:s.serviceId,clientVersion:I.rE}),maxAttempts:e?.maxAttempts??(0,D.Z)(m.qs,e),region:e?.region??(0,D.Z)(z.GG,{...z.zH,...i}),requestHandler:M.$.create(e?.requestHandler??n),retryMode:e?.retryMode??(0,D.Z)({...m.kN,default:async()=>(await n()).retryMode||q.L0},e),sha256:e?.sha256??$.V.bind(null,"sha256"),streamCollector:e?.streamCollector??V.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,D.Z)(F.e$,i),useFipsEndpoint:e?.useFipsEndpoint??(0,D.Z)(j.Ko,i),userAgentAppId:e?.userAgentAppId??(0,D.Z)(E.hV,i)}};var gt=n(135),dt=n(136),lt=n(137);class mt extends h.K{config;constructor(...[e]){const t=ht(e||{});super(t),this.initConfig=t;const n=(h=t,Object.assign(h,{useDualstackEndpoint:h.useDualstackEndpoint??!1,useFipsEndpoint:h.useFipsEndpoint??!1,defaultSigningName:"signin"}));var h;const P=(0,s.D)(n),k=(0,m.$z)(P),x=(0,g.T)(k),I=(0,i.OV)(x),A=((e,t)=>{const n=Object.assign((0,gt.R)(e),(0,dt.xA)(e),(0,lt.e)(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,gt.$)(n),(0,dt.uv)(n),(0,lt.j)(n),{httpAuthSchemes:(s=n).httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()});var s})((e=>{const t=(0,S.h)(e);return Object.assign(t,{authSchemePreference:(0,R.t)(e.authSchemePreference??[])})})((0,d.Co)(I)),e?.extensions||[]);this.config=A,this.middlewareStack.use((0,f.wq)(this.config)),this.middlewareStack.use((0,o.sM)(this.config)),this.middlewareStack.use((0,v.ey)(this.config)),this.middlewareStack.use((0,l.vK)(this.config)),this.middlewareStack.use((0,i.TC)(this.config)),this.middlewareStack.use((0,r.Y7)(this.config)),this.middlewareStack.use((0,a.n)(this.config)),this.middlewareStack.use((0,c.w)(this.config,{httpAuthSchemeParametersProvider:w,identityProviderConfigProvider:async e=>new u.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,p.l)(this.config))}destroy(){super.destroy()}}var vt=n(138);class ft extends(vt.u.classBuilder().ep({...x,IsControlPlane:{type:"staticContextParams",value:!1}}).m(function(e,t,n,s){return[(0,d.rD)(n,e.getEndpointParameterInstructions())]}).s("Signin","CreateOAuth2Token",{}).n("SigninClient","CreateOAuth2TokenCommand").sc(pt).build()){}}};
2
+ "use strict";exports.id=785,exports.ids=[785],exports.modules={863(e,t,n){n.d(t,{CreateOAuth2TokenCommand:()=>ft,SigninClient:()=>mt});var s=n(36),i=n(32),o=n(38),r=n(34),a=n(35),c=n(43),u=n(42),p=n(46),h=n(47),g=n(49),d=n(51),l=n(70),m=n(84),v=n(71),f=n(85),S=n(86),P=n(44),R=n(69);const w=async(e,t,n)=>({operation:(0,P.u)(t).operation,region:await(0,R.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const k=e=>{const t=[];if("CreateOAuth2Token"===e.operation)t.push({schemeId:"smithy.api#noAuth"});else t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"signin",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e));return t},x={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var I=n(854),A=n(92),y=n(93),E=n(96),b=n(97),C=n(100),T=n(99),O=n(104),D=n(52),z=n(103),F=n(101),j=n(102),q=n(40),U=n(105),$=n(107),M=n(108),V=n(109),H=n(110),N=n(855),B=n(859),K=n(72),L=n(68),G=n(74),J=n(77),Q=n(78),W=n(79),X=n(129),Y=n(132),Z=n(133),_=n(130),ee=n(134);const te="ref",ne=-1,se=!0,ie="isSet",oe="booleanEquals",re="PartitionResult",ae="stringEquals",ce="getAttr",ue="https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}",pe={[te]:"Endpoint"},he={fn:ce,argv:[{[te]:re},"name"]},ge={[te]:re},de={[te]:"Region"},le={authSchemes:[{name:"sigv4",signingName:"signin",signingRegion:"{Region}"}]},me={},ve=[de],fe={conditions:[[ie,ve],[oe,[{fn:"coalesce",argv:[{[te]:"IsControlPlane"},!1]},se]],[ie,[pe]],["aws.partition",ve,re],[oe,[{[te]:"UseFIPS"},se]],[oe,[{[te]:"UseDualStack"},se]],[ae,[he,"aws"]],[ae,[he,"aws-cn"]],[oe,[{fn:ce,argv:[ge,"supportsDualStack"]},se]],[ae,[de,"us-gov-west-1"]],[ae,[he,"aws-us-gov"]],[oe,[{fn:ce,argv:[ge,"supportsFIPS"]},se]],[ae,[he,"aws-iso"]],[ae,[he,"aws-iso-b"]],[ae,[he,"aws-iso-f"]],[ae,[he,"aws-iso-e"]],[ae,[he,"aws-eusc"]]],results:[[ne],["https://signin.{Region}.api.aws",le],["https://signin.{Region}.api.amazonwebservices.com.cn",le],[ue,le],["https://{Region}.signin.aws.amazon.com",me],["https://{Region}.signin.amazonaws.cn",me],["https://{Region}.signin.amazonaws-us-gov.com",me],["https://{Region}.signin.c2shome.ic.gov",me],["https://{Region}.signin.sc2shome.sgov.gov",me],["https://{Region}.signin.csphome.hci.ic.gov",me],["https://{Region}.signin.csphome.adc-e.uk",me],["https://{Region}.signin.amazonaws-eusc.eu",me],["https://signin-fips.amazonaws-us-gov.com",me],["https://{Region}.signin-fips.amazonaws-us-gov.com",me],["https://{Region}.signin.{PartitionResult#dnsSuffix}",me],[ne,"Invalid Configuration: FIPS and custom endpoint are not supported"],[ne,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[pe,me],["https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",me],[ne,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://signin-fips.{Region}.{PartitionResult#dnsSuffix}",me],[ne,"FIPS is enabled but this partition does not support FIPS"],[ue,me],[ne,"DualStack is enabled but this partition does not support DualStack"],["https://signin.{Region}.{PartitionResult#dnsSuffix}",me],[ne,"Invalid Configuration: Missing Region"]]},Se=1e8,Pe=new Int32Array([-1,1,-1,0,4,3,2,30,Se+25,1,24,5,2,30,6,3,7,26,4,18,8,5,17,9,6,Se+4,10,7,Se+5,11,10,Se+6,12,12,Se+7,13,13,Se+8,14,14,Se+9,15,15,Se+10,16,16,Se+11,Se+14,8,Se+22,Se+23,5,22,19,9,Se+12,20,10,Se+13,21,11,Se+20,Se+21,8,23,Se+19,11,Se+18,Se+19,2,29,25,3,32,26,4,27,Se+25,5,Se+25,28,9,Se+12,Se+25,3,32,30,4,Se+15,31,5,Se+16,Se+17,6,Se+1,33,7,Se+2,Se+3]),Re=ee.d.from(Pe,2,fe.conditions,fe.results),we=new Y.k({size:50,params:["Endpoint","IsControlPlane","Region","UseDualStack","UseFIPS"]}),ke=(e,t={})=>we.get(e,()=>(0,Z.c)(Re,{endpointParams:e,logger:t.logger}));_.m.aws=X.U;var xe=n(117),Ie=n(121);class Ae extends Ie.T{constructor(e){super(e),Object.setPrototypeOf(this,Ae.prototype)}}class ye extends Ae{name="AccessDeniedException";$fault="client";error;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,ye.prototype),this.error=e.error}}class Ee extends Ae{name="InternalServerException";$fault="server";error;constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,Ee.prototype),this.error=e.error}}class be extends Ae{name="TooManyRequestsError";$fault="client";error;constructor(e){super({name:"TooManyRequestsError",$fault:"client",...e}),Object.setPrototypeOf(this,be.prototype),this.error=e.error}}class Ce extends Ae{name="ValidationException";$fault="client";error;constructor(e){super({name:"ValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,Ce.prototype),this.error=e.error}}const Te="accessKeyId",Oe="accessToken",De="client",ze="clientId",Fe="codeVerifier",je="error",qe="expiresIn",Ue="grantType",$e="http",Me="httpError",Ve="idToken",He="jsonName",Ne="message",Be="refreshToken",Ke="redirectUri",Le="smithy.ts.sdk.synthetic.com.amazonaws.signin",Ge="secretAccessKey",Je="sessionToken",Qe="tokenType",We="com.amazonaws.signin",Xe=xe.O.for(Le);var Ye=[-3,Le,"SigninServiceException",0,[],[]];Xe.registerError(Ye,Ae);const Ze=xe.O.for(We);var _e=[-3,We,"AccessDeniedException",{[je]:De},[je,Ne],[0,0],2];Ze.registerError(_e,ye);var et=[-3,We,"InternalServerException",{[je]:"server",[Me]:500},[je,Ne],[0,0],2];Ze.registerError(et,Ee);var tt=[-3,We,"TooManyRequestsError",{[je]:De,[Me]:429},[je,Ne],[0,0],2];Ze.registerError(tt,be);var nt=[-3,We,"ValidationException",{[je]:De,[Me]:400},[je,Ne],[0,0],2];Ze.registerError(nt,Ce);const st=[Xe,Ze];var it=[0,We,"RefreshToken",8,0],ot=[3,We,"AccessToken",8,[Te,Ge,Je],[[0,{[He]:Te}],[0,{[He]:Ge}],[0,{[He]:Je}]],3],rt=[3,We,"CreateOAuth2TokenRequest",0,["tokenInput"],[[()=>at,16]],1],at=[3,We,"CreateOAuth2TokenRequestBody",0,[ze,Ue,"code",Ke,Fe,Be],[[0,{[He]:ze}],[0,{[He]:Ue}],0,[0,{[He]:Ke}],[0,{[He]:Fe}],[()=>it,{[He]:Be}]],2],ct=[3,We,"CreateOAuth2TokenResponse",0,["tokenOutput"],[[()=>ut,16]],1],ut=[3,We,"CreateOAuth2TokenResponseBody",0,[Oe,Qe,qe,Be,Ve],[[()=>ot,{[He]:Oe}],[0,{[He]:Qe}],[1,{[He]:qe}],[()=>it,{[He]:Be}],[0,{[He]:Ve}]],4],pt=[9,We,"CreateOAuth2Token",{[$e]:["POST","/v1/token",200]},()=>rt,()=>ct];const ht=e=>{(0,C.I)(process.version);const t=(0,O.I)(e),n=()=>t().then(T.l),s=(e=>({apiVersion:"2023-01-01",base64Decoder:e?.base64Decoder??G.E,base64Encoder:e?.base64Encoder??J.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ke,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??k,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new H.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new B.m}],logger:e?.logger??new K.N,protocol:e?.protocol??N.Y,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.signin",errorTypeRegistries:st,version:"2023-01-01",serviceTarget:"Signin"},serviceId:e?.serviceId??"Signin",urlParser:e?.urlParser??L.D,utf8Decoder:e?.utf8Decoder??Q.a,utf8Encoder:e?.utf8Encoder??W.P}))(e);(0,A.I)(process.version);const i={profile:e?.profile,logger:s.logger};return{...s,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,D.Z)(b.$,i),bodyLengthChecker:e?.bodyLengthChecker??U.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,y.pf)({serviceId:s.serviceId,clientVersion:I.rE}),maxAttempts:e?.maxAttempts??(0,D.Z)(m.qs,e),region:e?.region??(0,D.Z)(z.GG,{...z.zH,...i}),requestHandler:M.$.create(e?.requestHandler??n),retryMode:e?.retryMode??(0,D.Z)({...m.kN,default:async()=>(await n()).retryMode||q.L0},e),sha256:e?.sha256??$.V.bind(null,"sha256"),streamCollector:e?.streamCollector??V.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,D.Z)(F.e$,i),useFipsEndpoint:e?.useFipsEndpoint??(0,D.Z)(j.Ko,i),userAgentAppId:e?.userAgentAppId??(0,D.Z)(E.hV,i)}};var gt=n(135),dt=n(136),lt=n(137);class mt extends h.K{config;constructor(...[e]){const t=ht(e||{});super(t),this.initConfig=t;const n=(h=t,Object.assign(h,{useDualstackEndpoint:h.useDualstackEndpoint??!1,useFipsEndpoint:h.useFipsEndpoint??!1,defaultSigningName:"signin"}));var h;const P=(0,s.D)(n),k=(0,m.$z)(P),x=(0,g.T)(k),I=(0,i.OV)(x),A=((e,t)=>{const n=Object.assign((0,gt.R)(e),(0,dt.xA)(e),(0,lt.e)(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,gt.$)(n),(0,dt.uv)(n),(0,lt.j)(n),{httpAuthSchemes:(s=n).httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()});var s})((e=>{const t=(0,S.h)(e);return Object.assign(t,{authSchemePreference:(0,R.t)(e.authSchemePreference??[])})})((0,d.Co)(I)),e?.extensions||[]);this.config=A,this.middlewareStack.use((0,f.wq)(this.config)),this.middlewareStack.use((0,o.sM)(this.config)),this.middlewareStack.use((0,v.ey)(this.config)),this.middlewareStack.use((0,l.vK)(this.config)),this.middlewareStack.use((0,i.TC)(this.config)),this.middlewareStack.use((0,r.Y7)(this.config)),this.middlewareStack.use((0,a.n)(this.config)),this.middlewareStack.use((0,c.w)(this.config,{httpAuthSchemeParametersProvider:w,identityProviderConfigProvider:async e=>new u.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,p.l)(this.config))}destroy(){super.destroy()}}var vt=n(138);class ft extends(vt.u.classBuilder().ep({...x,IsControlPlane:{type:"staticContextParams",value:!1}}).m(function(e,t,n,s){return[(0,d.rD)(n,e.getEndpointParameterInstructions())]}).s("Signin","CreateOAuth2Token",{}).n("SigninClient","CreateOAuth2TokenCommand").sc(pt).build()){}}};
package/dist/843.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=843,exports.ids=[843],exports.modules={839(e,o,s){s.d(o,{fromSSO:()=>$});var t=s(57),n=s(840),r=s(56),i=s(62),a=s(60),c=s(61);const l=e=>Object.entries(e).filter(([e])=>e.startsWith(a.I.SSO_SESSION+c.Q)).reduce((e,[o,s])=>({...e,[o.substring(o.indexOf(c.Q)+1)]:s}),{});var g=s(64),f=s(65);const w=()=>({}),h=async(e={})=>(0,f.TA)(e.configFilepath??(0,i.g)()).then(g.A).then(l).catch(w);var p=s(87),d=s(54);class u extends d.m{name="TokenProviderError";constructor(e,o=!0){super(e,o),Object.setPrototypeOf(this,u.prototype)}}var S=s(841);const C="To refresh this SSO session run 'aws sso login' with the corresponding profile.",y=async(e,o,t={},n)=>{const{CreateTokenCommand:r}=await Promise.all([s.e(350),s.e(485)]).then(s.bind(s,859)),i=await(async(e,o={},t)=>{const{SSOOIDCClient:n}=await Promise.all([s.e(350),s.e(485)]).then(s.bind(s,859)),r=e=>o.clientConfig?.[e]??o.parentClientConfig?.[e]??t?.[e];return new n(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:r("logger"),userAgentAppId:r("userAgentAppId")}))})(o,t,n);return i.send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))},k=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new u(`Token is expired. ${C}`,!1)},m=(e,o,s=!1)=>{if(void 0===o)throw new u(`Value not present for '${e}' in SSO Token${s?". Cannot refresh":""}. ${C}`,!1)};var _=s(842),O=s(106);const{writeFile:x}=O.promises,T=new Date(0),A=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const s=await(0,n.Y)(e),r=(0,t.Bz)({profile:e.profile??o?.profile}),i=s[r];if(!i)throw new u(`Profile '${r}' could not be found in shared credentials file.`,!1);if(!i.sso_session)throw new u(`Profile '${r}' is missing required property 'sso_session'.`);const a=i.sso_session,c=(await h(e))[a];if(!c)throw new u(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!c[e])throw new u(`Sso session '${a}' is missing required property '${e}'.`,!1);c.sso_start_url;const l=c.sso_region;let g;try{g=await(0,S.v)(a)}catch(e){throw new u(`The SSO session token associated with profile=${r} was not found or is invalid. ${C}`,!1)}m("accessToken",g.accessToken),m("expiresAt",g.expiresAt);const{accessToken:f,expiresAt:w}=g,p={token:f,expiration:new Date(w)};if(p.expiration.getTime()-Date.now()>3e5)return p;if(Date.now()-T.getTime()<3e4)return k(p),p;m("clientId",g.clientId,!0),m("clientSecret",g.clientSecret,!0),m("refreshToken",g.refreshToken,!0);try{T.setTime(Date.now());const s=await y(g,l,e,o);m("accessToken",s.accessToken),m("expiresIn",s.expiresIn);const t=new Date(Date.now()+1e3*s.expiresIn);try{await((e,o)=>{const s=(0,_.C)(e),t=JSON.stringify(o,null,2);return x(s,t)})(a,{...g,accessToken:s.accessToken,expiresAt:t.toISOString(),refreshToken:s.refreshToken})}catch(e){}return{token:s.accessToken,expiration:t}}catch(e){return k(p),p}},I=!1,N=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:t,ssoRegion:n,ssoRoleName:i,ssoClient:a,clientConfig:c,parentClientConfig:l,callerClientConfig:g,profile:f,filepath:w,configFilepath:h,ignoreCache:d,logger:u})=>{let C;const y="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{const e=await A({profile:f,filepath:w,configFilepath:h,ignoreCache:d,clientConfig:c,parentClientConfig:l,logger:u})({callerClientConfig:g});C={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new r.C(e.message,{tryNextLink:I,logger:u})}else try{C=await(0,S.v)(e)}catch(e){throw new r.C(`The SSO session associated with this profile is invalid. ${y}`,{tryNextLink:I,logger:u})}if(new Date(C.expiresAt).getTime()-Date.now()<=0)throw new r.C(`The SSO session associated with this profile has expired. ${y}`,{tryNextLink:I,logger:u});const{accessToken:k}=C,{SSOClient:m,GetRoleCredentialsCommand:_}=await Promise.all([s.e(350),s.e(890)]).then(s.bind(s,852)),O=a||new m(Object.assign({},c??{},{logger:c?.logger??g?.logger??l?.logger,region:c?.region??n,userAgentAppId:c?.userAgentAppId??g?.userAgentAppId??l?.userAgentAppId}));let x;try{x=await O.send(new _({accountId:t,roleName:i,accessToken:k}))}catch(e){throw new r.C(e,{tryNextLink:I,logger:u})}const{roleCredentials:{accessKeyId:T,secretAccessKey:N,sessionToken:$,expiration:v,credentialScope:D,accountId:R}={}}=x;if(!(T&&N&&$&&v))throw new r.C("SSO returns an invalid temporary credential.",{tryNextLink:I,logger:u});const L={accessKeyId:T,secretAccessKey:N,sessionToken:$,expiration:new Date(v),...D&&{credentialScope:D},...R&&{accountId:R}};return o?(0,p.g)(L,"CREDENTIALS_SSO","s"):(0,p.g)(L,"CREDENTIALS_SSO_LEGACY","u"),L},$=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:s,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoSession:l}=e,{ssoClient:g}=e,f=(0,t.Bz)({profile:e.profile??o?.profile});if(s||i||a||c||l){if(s&&i&&a&&c)return N({ssoStartUrl:s,ssoSession:l,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoClient:g,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:f,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger});throw new r.C('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const o=(await(0,n.Y)(e))[f];if(!o)throw new r.C(`Profile ${f} was not found.`,{logger:e.logger});if(!(w=o)||"string"!=typeof w.sso_start_url&&"string"!=typeof w.sso_account_id&&"string"!=typeof w.sso_session&&"string"!=typeof w.sso_region&&"string"!=typeof w.sso_role_name)throw new r.C(`Profile ${f} is not configured with SSO credentials.`,{logger:e.logger});if(o?.sso_session){const t=(await h(e))[o.sso_session],n=` configurations in profile ${f} and sso-session ${o.sso_session}`;if(a&&a!==t.sso_region)throw new r.C("Conflicting SSO region"+n,{tryNextLink:!1,logger:e.logger});if(s&&s!==t.sso_start_url)throw new r.C("Conflicting SSO start_url"+n,{tryNextLink:!1,logger:e.logger});o.sso_region=t.sso_region,o.sso_start_url=t.sso_start_url}const{sso_start_url:t,sso_account_id:i,sso_region:c,sso_role_name:l,sso_session:p}=((e,o)=>{const{sso_start_url:s,sso_account_id:t,sso_region:n,sso_role_name:i}=e;if(!(s&&t&&n&&i))throw new r.C(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e})(o,e.logger);return N({ssoStartUrl:t,ssoSession:p,ssoAccountId:i,ssoRegion:c,ssoRoleName:l,ssoClient:g,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:f,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}var w}},842(e,o,s){s.d(o,{C:()=>i});var t=s(20),n=s(59),r=s(63);const i=e=>{const o=(0,t.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,r.R)(),".aws","sso","cache",`${o}.json`)}},841(e,o,s){s.d(o,{a:()=>r,v:()=>i});var t=s(28),n=s(842);const r={},i=async e=>{if(r[e])return r[e];const o=(0,n.C)(e),s=await(0,t.readFile)(o,"utf8");return JSON.parse(s)}}};
2
+ "use strict";exports.id=843,exports.ids=[843],exports.modules={840(e,o,s){s.d(o,{fromSSO:()=>$});var t=s(57),n=s(841),r=s(56),i=s(62),a=s(60),c=s(61);const l=e=>Object.entries(e).filter(([e])=>e.startsWith(a.I.SSO_SESSION+c.Q)).reduce((e,[o,s])=>({...e,[o.substring(o.indexOf(c.Q)+1)]:s}),{});var g=s(64),f=s(65);const w=()=>({}),h=async(e={})=>(0,f.TA)(e.configFilepath??(0,i.g)()).then(g.A).then(l).catch(w);var p=s(87),d=s(54);class u extends d.m{name="TokenProviderError";constructor(e,o=!0){super(e,o),Object.setPrototypeOf(this,u.prototype)}}var S=s(842);const C="To refresh this SSO session run 'aws sso login' with the corresponding profile.",y=async(e,o,t={},n)=>{const{CreateTokenCommand:r}=await Promise.all([s.e(350),s.e(485)]).then(s.bind(s,860)),i=await(async(e,o={},t)=>{const{SSOOIDCClient:n}=await Promise.all([s.e(350),s.e(485)]).then(s.bind(s,860)),r=e=>o.clientConfig?.[e]??o.parentClientConfig?.[e]??t?.[e];return new n(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:r("logger"),userAgentAppId:r("userAgentAppId")}))})(o,t,n);return i.send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))},k=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new u(`Token is expired. ${C}`,!1)},m=(e,o,s=!1)=>{if(void 0===o)throw new u(`Value not present for '${e}' in SSO Token${s?". Cannot refresh":""}. ${C}`,!1)};var _=s(843),O=s(106);const{writeFile:x}=O.promises,T=new Date(0),A=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const s=await(0,n.Y)(e),r=(0,t.Bz)({profile:e.profile??o?.profile}),i=s[r];if(!i)throw new u(`Profile '${r}' could not be found in shared credentials file.`,!1);if(!i.sso_session)throw new u(`Profile '${r}' is missing required property 'sso_session'.`);const a=i.sso_session,c=(await h(e))[a];if(!c)throw new u(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!c[e])throw new u(`Sso session '${a}' is missing required property '${e}'.`,!1);c.sso_start_url;const l=c.sso_region;let g;try{g=await(0,S.v)(a)}catch(e){throw new u(`The SSO session token associated with profile=${r} was not found or is invalid. ${C}`,!1)}m("accessToken",g.accessToken),m("expiresAt",g.expiresAt);const{accessToken:f,expiresAt:w}=g,p={token:f,expiration:new Date(w)};if(p.expiration.getTime()-Date.now()>3e5)return p;if(Date.now()-T.getTime()<3e4)return k(p),p;m("clientId",g.clientId,!0),m("clientSecret",g.clientSecret,!0),m("refreshToken",g.refreshToken,!0);try{T.setTime(Date.now());const s=await y(g,l,e,o);m("accessToken",s.accessToken),m("expiresIn",s.expiresIn);const t=new Date(Date.now()+1e3*s.expiresIn);try{await((e,o)=>{const s=(0,_.C)(e),t=JSON.stringify(o,null,2);return x(s,t)})(a,{...g,accessToken:s.accessToken,expiresAt:t.toISOString(),refreshToken:s.refreshToken})}catch(e){}return{token:s.accessToken,expiration:t}}catch(e){return k(p),p}},I=!1,N=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:t,ssoRegion:n,ssoRoleName:i,ssoClient:a,clientConfig:c,parentClientConfig:l,callerClientConfig:g,profile:f,filepath:w,configFilepath:h,ignoreCache:d,logger:u})=>{let C;const y="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{const e=await A({profile:f,filepath:w,configFilepath:h,ignoreCache:d,clientConfig:c,parentClientConfig:l,logger:u})({callerClientConfig:g});C={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new r.C(e.message,{tryNextLink:I,logger:u})}else try{C=await(0,S.v)(e)}catch(e){throw new r.C(`The SSO session associated with this profile is invalid. ${y}`,{tryNextLink:I,logger:u})}if(new Date(C.expiresAt).getTime()-Date.now()<=0)throw new r.C(`The SSO session associated with this profile has expired. ${y}`,{tryNextLink:I,logger:u});const{accessToken:k}=C,{SSOClient:m,GetRoleCredentialsCommand:_}=await Promise.all([s.e(350),s.e(890)]).then(s.bind(s,853)),O=a||new m(Object.assign({},c??{},{logger:c?.logger??g?.logger??l?.logger,region:c?.region??n,userAgentAppId:c?.userAgentAppId??g?.userAgentAppId??l?.userAgentAppId}));let x;try{x=await O.send(new _({accountId:t,roleName:i,accessToken:k}))}catch(e){throw new r.C(e,{tryNextLink:I,logger:u})}const{roleCredentials:{accessKeyId:T,secretAccessKey:N,sessionToken:$,expiration:v,credentialScope:D,accountId:R}={}}=x;if(!(T&&N&&$&&v))throw new r.C("SSO returns an invalid temporary credential.",{tryNextLink:I,logger:u});const L={accessKeyId:T,secretAccessKey:N,sessionToken:$,expiration:new Date(v),...D&&{credentialScope:D},...R&&{accountId:R}};return o?(0,p.g)(L,"CREDENTIALS_SSO","s"):(0,p.g)(L,"CREDENTIALS_SSO_LEGACY","u"),L},$=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:s,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoSession:l}=e,{ssoClient:g}=e,f=(0,t.Bz)({profile:e.profile??o?.profile});if(s||i||a||c||l){if(s&&i&&a&&c)return N({ssoStartUrl:s,ssoSession:l,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoClient:g,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:f,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger});throw new r.C('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const o=(await(0,n.Y)(e))[f];if(!o)throw new r.C(`Profile ${f} was not found.`,{logger:e.logger});if(!(w=o)||"string"!=typeof w.sso_start_url&&"string"!=typeof w.sso_account_id&&"string"!=typeof w.sso_session&&"string"!=typeof w.sso_region&&"string"!=typeof w.sso_role_name)throw new r.C(`Profile ${f} is not configured with SSO credentials.`,{logger:e.logger});if(o?.sso_session){const t=(await h(e))[o.sso_session],n=` configurations in profile ${f} and sso-session ${o.sso_session}`;if(a&&a!==t.sso_region)throw new r.C("Conflicting SSO region"+n,{tryNextLink:!1,logger:e.logger});if(s&&s!==t.sso_start_url)throw new r.C("Conflicting SSO start_url"+n,{tryNextLink:!1,logger:e.logger});o.sso_region=t.sso_region,o.sso_start_url=t.sso_start_url}const{sso_start_url:t,sso_account_id:i,sso_region:c,sso_role_name:l,sso_session:p}=((e,o)=>{const{sso_start_url:s,sso_account_id:t,sso_region:n,sso_role_name:i}=e;if(!(s&&t&&n&&i))throw new r.C(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e})(o,e.logger);return N({ssoStartUrl:t,ssoSession:p,ssoAccountId:i,ssoRegion:c,ssoRoleName:l,ssoClient:g,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:f,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}var w}},843(e,o,s){s.d(o,{C:()=>i});var t=s(20),n=s(59),r=s(63);const i=e=>{const o=(0,t.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,r.R)(),".aws","sso","cache",`${o}.json`)}},842(e,o,s){s.d(o,{a:()=>r,v:()=>i});var t=s(28),n=s(843);const r={},i=async e=>{if(r[e])return r[e];const o=(0,n.C)(e),s=await(0,t.readFile)(o,"utf8");return JSON.parse(s)}}};
package/dist/876.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=876,exports.ids=[876],exports.modules={844(e,r,t){t.d(r,{fromProcess:()=>f});var o=t(840),n=t(57),s=t(845),c=t(56),i=t(846),a=t(18),d=t(87);const l=async(e,r,t)=>{const o=r[e];if(!r[e])throw new c.C(`Profile ${e} could not be found in shared credentials file.`,{logger:t});{const n=o.credential_process;if(void 0===n)throw new c.C(`Profile ${e} did not contain credential_process.`,{logger:t});{const o=(0,a.promisify)(s.Z?.getTokenRecord?.().exec??i.exec);try{const{stdout:t}=await o(n);let s;try{s=JSON.parse(t.trim())}catch{throw Error(`Profile ${e} credential_process returned invalid JSON.`)}return((e,r,t)=>{if(1!==r.Version)throw Error(`Profile ${e} credential_process did not return Version 1.`);if(void 0===r.AccessKeyId||void 0===r.SecretAccessKey)throw Error(`Profile ${e} credential_process returned invalid credentials.`);if(r.Expiration){const t=new Date;if(new Date(r.Expiration)<t)throw Error(`Profile ${e} credential_process returned expired credentials.`)}let o=r.AccountId;!o&&t?.[e]?.aws_account_id&&(o=t[e].aws_account_id);const n={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,...r.SessionToken&&{sessionToken:r.SessionToken},...r.Expiration&&{expiration:new Date(r.Expiration)},...r.CredentialScope&&{credentialScope:r.CredentialScope},...o&&{accountId:o}};return(0,d.g)(n,"CREDENTIALS_PROCESS","w"),n})(e,s,r)}catch(e){throw new c.C(e.message,{logger:t})}}}},f=(e={})=>async({callerClientConfig:r}={})=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const t=await(0,o.Y)(e);return l((0,n.Bz)({profile:e.profile??r?.profile}),t,e.logger)}},845(e,r,t){t.d(r,{Z:()=>s});var o=t(841),n=t(65);const s={getFileRecord:()=>n.Jj,interceptFile(e,r){n.Jj[e]=Promise.resolve(r)},getTokenRecord:()=>o.a,interceptToken(e,r){o.a[e]=r}}},842(e,r,t){t.d(r,{C:()=>c});var o=t(20),n=t(59),s=t(63);const c=e=>{const r=(0,o.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,s.R)(),".aws","sso","cache",`${r}.json`)}},841(e,r,t){t.d(r,{a:()=>s,v:()=>c});var o=t(28),n=t(842);const s={},c=async e=>{if(s[e])return s[e];const r=(0,n.C)(e),t=await(0,o.readFile)(r,"utf8");return JSON.parse(t)}}};
2
+ "use strict";exports.id=876,exports.ids=[876],exports.modules={845(e,r,t){t.d(r,{fromProcess:()=>f});var o=t(841),n=t(57),s=t(846),c=t(56),i=t(847),a=t(18),d=t(87);const l=async(e,r,t)=>{const o=r[e];if(!r[e])throw new c.C(`Profile ${e} could not be found in shared credentials file.`,{logger:t});{const n=o.credential_process;if(void 0===n)throw new c.C(`Profile ${e} did not contain credential_process.`,{logger:t});{const o=(0,a.promisify)(s.Z?.getTokenRecord?.().exec??i.exec);try{const{stdout:t}=await o(n);let s;try{s=JSON.parse(t.trim())}catch{throw Error(`Profile ${e} credential_process returned invalid JSON.`)}return((e,r,t)=>{if(1!==r.Version)throw Error(`Profile ${e} credential_process did not return Version 1.`);if(void 0===r.AccessKeyId||void 0===r.SecretAccessKey)throw Error(`Profile ${e} credential_process returned invalid credentials.`);if(r.Expiration){const t=new Date;if(new Date(r.Expiration)<t)throw Error(`Profile ${e} credential_process returned expired credentials.`)}let o=r.AccountId;!o&&t?.[e]?.aws_account_id&&(o=t[e].aws_account_id);const n={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,...r.SessionToken&&{sessionToken:r.SessionToken},...r.Expiration&&{expiration:new Date(r.Expiration)},...r.CredentialScope&&{credentialScope:r.CredentialScope},...o&&{accountId:o}};return(0,d.g)(n,"CREDENTIALS_PROCESS","w"),n})(e,s,r)}catch(e){throw new c.C(e.message,{logger:t})}}}},f=(e={})=>async({callerClientConfig:r}={})=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const t=await(0,o.Y)(e);return l((0,n.Bz)({profile:e.profile??r?.profile}),t,e.logger)}},846(e,r,t){t.d(r,{Z:()=>s});var o=t(842),n=t(65);const s={getFileRecord:()=>n.Jj,interceptFile(e,r){n.Jj[e]=Promise.resolve(r)},getTokenRecord:()=>o.a,interceptToken(e,r){o.a[e]=r}}},843(e,r,t){t.d(r,{C:()=>c});var o=t(20),n=t(59),s=t(63);const c=e=>{const r=(0,o.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,s.R)(),".aws","sso","cache",`${r}.json`)}},842(e,r,t){t.d(r,{a:()=>s,v:()=>c});var o=t(28),n=t(843);const s={},c=async e=>{if(s[e])return s[e];const r=(0,n.C)(e),t=await(0,o.readFile)(r,"utf8");return JSON.parse(t)}}};
package/dist/890.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=890,exports.ids=[890],exports.modules={852(e,t,s){s.d(t,{GetRoleCredentialsCommand:()=>z,SSOClient:()=>tt});var n=s(138),o=s(51);const i={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var r=s(117),a=s(121);class c extends a.T{constructor(e){super(e),Object.setPrototypeOf(this,c.prototype)}}class u extends c{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,u.prototype)}}class l extends c{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,l.prototype)}}class p extends c{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,p.prototype)}}class d extends c{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,d.prototype)}}const h="client",m="error",g="http",S="httpError",v="httpHeader",f="httpQuery",P="message",x="smithy.ts.sdk.synthetic.com.amazonaws.sso",R="com.amazonaws.sso",y=r.O.for(x);var E=[-3,x,"SSOServiceException",0,[],[]];y.registerError(E,c);const I=r.O.for(R);var b=[-3,R,"InvalidRequestException",{[m]:h,[S]:400},[P],[0]];I.registerError(b,u);var w=[-3,R,"ResourceNotFoundException",{[m]:h,[S]:404},[P],[0]];I.registerError(w,l);var A=[-3,R,"TooManyRequestsException",{[m]:h,[S]:429},[P],[0]];I.registerError(A,p);var k=[-3,R,"UnauthorizedException",{[m]:h,[S]:401},[P],[0]];I.registerError(k,d);const C=[y,I];var D=[0,R,"AccessTokenType",8,0],F=[0,R,"SecretAccessKeyType",8,0],O=[0,R,"SessionTokenType",8,0],T=[3,R,"GetRoleCredentialsRequest",0,["roleName","accountId","accessToken"],[[0,{[f]:"role_name"}],[0,{[f]:"account_id"}],[()=>D,{[v]:"x-amz-sso_bearer_token"}]],3],q=[3,R,"GetRoleCredentialsResponse",0,["roleCredentials"],[[()=>U,0]]],U=[3,R,"RoleCredentials",0,["accessKeyId","secretAccessKey","sessionToken","expiration"],[0,[()=>F,0],[()=>O,0],1]],j=[9,R,"GetRoleCredentials",{[g]:["GET","/federation/credentials",200]},()=>T,()=>q];class z extends(n.u.classBuilder().ep(i).m(function(e,t,s,n){return[(0,o.rD)(s,e.getEndpointParameterInstructions())]}).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").sc(j).build()){}var G=s(36),$=s(32),M=s(38),N=s(34),H=s(35),_=s(43),K=s(42),B=s(46),V=s(47),W=s(49),L=s(70),Q=s(84),J=s(71),X=s(85),Y=s(86),Z=s(44),ee=s(69);const te=async(e,t,s)=>({operation:(0,Z.u)(t).operation,region:await(0,ee.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const se=e=>{const t=[];if("GetRoleCredentials"===e.operation)t.push({schemeId:"smithy.api#noAuth"});else t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e));return t};var ne=s(853),oe=s(92),ie=s(93),re=s(96),ae=s(97),ce=s(100),ue=s(99),le=s(104),pe=s(52),de=s(103),he=s(101),me=s(102),ge=s(40),Se=s(105),ve=s(107),fe=s(108),Pe=s(109),xe=s(110),Re=s(854),ye=s(858),Ee=s(72),Ie=s(68),be=s(74),we=s(77),Ae=s(78),ke=s(79),Ce=s(129),De=s(132),Fe=s(133),Oe=s(130),Te=s(134);const qe="ref",Ue=-1,je=!0,ze="isSet",Ge="PartitionResult",$e="booleanEquals",Me="getAttr",Ne={[qe]:"Endpoint"},He={[qe]:Ge},_e={},Ke=[{[qe]:"Region"}],Be={conditions:[[ze,[Ne]],[ze,Ke],["aws.partition",Ke,Ge],[$e,[{[qe]:"UseFIPS"},je]],[$e,[{[qe]:"UseDualStack"},je]],[$e,[{fn:Me,argv:[He,"supportsDualStack"]},je]],[$e,[{fn:Me,argv:[He,"supportsFIPS"]},je]],["stringEquals",[{fn:Me,argv:[He,"name"]},"aws-us-gov"]]],results:[[Ue],[Ue,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Ue,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Ne,_e],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",_e],[Ue,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",_e],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",_e],[Ue,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",_e],[Ue,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",_e],[Ue,"Invalid Configuration: Missing Region"]]},Ve=1e8,We=new Int32Array([-1,1,-1,0,13,3,1,4,Ve+12,2,5,Ve+12,3,8,6,4,7,Ve+11,5,Ve+9,Ve+10,4,11,9,6,10,Ve+8,7,Ve+6,Ve+7,5,12,Ve+5,6,Ve+4,Ve+5,3,Ve+1,14,4,Ve+2,Ve+3]),Le=Te.d.from(We,2,Be.conditions,Be.results),Qe=new De.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Je=(e,t={})=>Qe.get(e,()=>(0,Fe.c)(Le,{endpointParams:e,logger:t.logger}));Oe.m.aws=Ce.U;const Xe=e=>{(0,ce.I)(process.version);const t=(0,le.I)(e),s=()=>t().then(ue.l),n=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??be.E,base64Encoder:e?.base64Encoder??we.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Je,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??se,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new xe.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new ye.m}],logger:e?.logger??new Ee.N,protocol:e?.protocol??Re.Y,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:C,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??Ie.D,utf8Decoder:e?.utf8Decoder??Ae.a,utf8Encoder:e?.utf8Encoder??ke.P}))(e);(0,oe.I)(process.version);const o={profile:e?.profile,logger:n.logger};return{...n,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,pe.Z)(ae.$,o),bodyLengthChecker:e?.bodyLengthChecker??Se.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,ie.pf)({serviceId:n.serviceId,clientVersion:ne.rE}),maxAttempts:e?.maxAttempts??(0,pe.Z)(Q.qs,e),region:e?.region??(0,pe.Z)(de.GG,{...de.zH,...o}),requestHandler:fe.$.create(e?.requestHandler??s),retryMode:e?.retryMode??(0,pe.Z)({...Q.kN,default:async()=>(await s()).retryMode||ge.L0},e),sha256:e?.sha256??ve.V.bind(null,"sha256"),streamCollector:e?.streamCollector??Pe.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,pe.Z)(he.e$,o),useFipsEndpoint:e?.useFipsEndpoint??(0,pe.Z)(me.Ko,o),userAgentAppId:e?.userAgentAppId??(0,pe.Z)(re.hV,o)}};var Ye=s(135),Ze=s(136),et=s(137);class tt extends V.K{config;constructor(...[e]){const t=Xe(e||{});super(t),this.initConfig=t;const s=(n=t,Object.assign(n,{useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}));var n;const i=(0,G.D)(s),r=(0,Q.$z)(i),a=(0,W.T)(r),c=(0,$.OV)(a),u=((e,t)=>{const s=Object.assign((0,Ye.R)(e),(0,Ze.xA)(e),(0,et.e)(e),(e=>{const t=e.httpAuthSchemes;let s=e.httpAuthSchemeProvider,n=e.credentials;return{setHttpAuthScheme(e){const s=t.findIndex(t=>t.schemeId===e.schemeId);-1===s?t.push(e):t.splice(s,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){s=e},httpAuthSchemeProvider:()=>s,setCredentials(e){n=e},credentials:()=>n}})(e));return t.forEach(e=>e.configure(s)),Object.assign(e,(0,Ye.$)(s),(0,Ze.uv)(s),(0,et.j)(s),{httpAuthSchemes:(n=s).httpAuthSchemes(),httpAuthSchemeProvider:n.httpAuthSchemeProvider(),credentials:n.credentials()});var n})((e=>{const t=(0,Y.h)(e);return Object.assign(t,{authSchemePreference:(0,ee.t)(e.authSchemePreference??[])})})((0,o.Co)(c)),e?.extensions||[]);this.config=u,this.middlewareStack.use((0,X.wq)(this.config)),this.middlewareStack.use((0,M.sM)(this.config)),this.middlewareStack.use((0,J.ey)(this.config)),this.middlewareStack.use((0,L.vK)(this.config)),this.middlewareStack.use((0,$.TC)(this.config)),this.middlewareStack.use((0,N.Y7)(this.config)),this.middlewareStack.use((0,H.n)(this.config)),this.middlewareStack.use((0,_.w)(this.config,{httpAuthSchemeParametersProvider:te,identityProviderConfigProvider:async e=>new K.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,B.l)(this.config))}destroy(){super.destroy()}}}};
2
+ "use strict";exports.id=890,exports.ids=[890],exports.modules={853(e,t,s){s.d(t,{GetRoleCredentialsCommand:()=>z,SSOClient:()=>tt});var n=s(138),o=s(51);const i={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var r=s(117),a=s(121);class c extends a.T{constructor(e){super(e),Object.setPrototypeOf(this,c.prototype)}}class u extends c{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,u.prototype)}}class l extends c{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,l.prototype)}}class p extends c{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,p.prototype)}}class d extends c{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,d.prototype)}}const h="client",m="error",g="http",S="httpError",v="httpHeader",f="httpQuery",P="message",x="smithy.ts.sdk.synthetic.com.amazonaws.sso",R="com.amazonaws.sso",y=r.O.for(x);var E=[-3,x,"SSOServiceException",0,[],[]];y.registerError(E,c);const I=r.O.for(R);var b=[-3,R,"InvalidRequestException",{[m]:h,[S]:400},[P],[0]];I.registerError(b,u);var w=[-3,R,"ResourceNotFoundException",{[m]:h,[S]:404},[P],[0]];I.registerError(w,l);var A=[-3,R,"TooManyRequestsException",{[m]:h,[S]:429},[P],[0]];I.registerError(A,p);var k=[-3,R,"UnauthorizedException",{[m]:h,[S]:401},[P],[0]];I.registerError(k,d);const C=[y,I];var D=[0,R,"AccessTokenType",8,0],F=[0,R,"SecretAccessKeyType",8,0],O=[0,R,"SessionTokenType",8,0],T=[3,R,"GetRoleCredentialsRequest",0,["roleName","accountId","accessToken"],[[0,{[f]:"role_name"}],[0,{[f]:"account_id"}],[()=>D,{[v]:"x-amz-sso_bearer_token"}]],3],q=[3,R,"GetRoleCredentialsResponse",0,["roleCredentials"],[[()=>U,0]]],U=[3,R,"RoleCredentials",0,["accessKeyId","secretAccessKey","sessionToken","expiration"],[0,[()=>F,0],[()=>O,0],1]],j=[9,R,"GetRoleCredentials",{[g]:["GET","/federation/credentials",200]},()=>T,()=>q];class z extends(n.u.classBuilder().ep(i).m(function(e,t,s,n){return[(0,o.rD)(s,e.getEndpointParameterInstructions())]}).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").sc(j).build()){}var G=s(36),$=s(32),M=s(38),N=s(34),H=s(35),_=s(43),K=s(42),B=s(46),V=s(47),W=s(49),L=s(70),Q=s(84),J=s(71),X=s(85),Y=s(86),Z=s(44),ee=s(69);const te=async(e,t,s)=>({operation:(0,Z.u)(t).operation,region:await(0,ee.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const se=e=>{const t=[];if("GetRoleCredentials"===e.operation)t.push({schemeId:"smithy.api#noAuth"});else t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e));return t};var ne=s(854),oe=s(92),ie=s(93),re=s(96),ae=s(97),ce=s(100),ue=s(99),le=s(104),pe=s(52),de=s(103),he=s(101),me=s(102),ge=s(40),Se=s(105),ve=s(107),fe=s(108),Pe=s(109),xe=s(110),Re=s(855),ye=s(859),Ee=s(72),Ie=s(68),be=s(74),we=s(77),Ae=s(78),ke=s(79),Ce=s(129),De=s(132),Fe=s(133),Oe=s(130),Te=s(134);const qe="ref",Ue=-1,je=!0,ze="isSet",Ge="PartitionResult",$e="booleanEquals",Me="getAttr",Ne={[qe]:"Endpoint"},He={[qe]:Ge},_e={},Ke=[{[qe]:"Region"}],Be={conditions:[[ze,[Ne]],[ze,Ke],["aws.partition",Ke,Ge],[$e,[{[qe]:"UseFIPS"},je]],[$e,[{[qe]:"UseDualStack"},je]],[$e,[{fn:Me,argv:[He,"supportsDualStack"]},je]],[$e,[{fn:Me,argv:[He,"supportsFIPS"]},je]],["stringEquals",[{fn:Me,argv:[He,"name"]},"aws-us-gov"]]],results:[[Ue],[Ue,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Ue,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Ne,_e],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",_e],[Ue,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",_e],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",_e],[Ue,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",_e],[Ue,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",_e],[Ue,"Invalid Configuration: Missing Region"]]},Ve=1e8,We=new Int32Array([-1,1,-1,0,13,3,1,4,Ve+12,2,5,Ve+12,3,8,6,4,7,Ve+11,5,Ve+9,Ve+10,4,11,9,6,10,Ve+8,7,Ve+6,Ve+7,5,12,Ve+5,6,Ve+4,Ve+5,3,Ve+1,14,4,Ve+2,Ve+3]),Le=Te.d.from(We,2,Be.conditions,Be.results),Qe=new De.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Je=(e,t={})=>Qe.get(e,()=>(0,Fe.c)(Le,{endpointParams:e,logger:t.logger}));Oe.m.aws=Ce.U;const Xe=e=>{(0,ce.I)(process.version);const t=(0,le.I)(e),s=()=>t().then(ue.l),n=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??be.E,base64Encoder:e?.base64Encoder??we.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Je,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??se,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new xe.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new ye.m}],logger:e?.logger??new Ee.N,protocol:e?.protocol??Re.Y,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:C,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??Ie.D,utf8Decoder:e?.utf8Decoder??Ae.a,utf8Encoder:e?.utf8Encoder??ke.P}))(e);(0,oe.I)(process.version);const o={profile:e?.profile,logger:n.logger};return{...n,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,pe.Z)(ae.$,o),bodyLengthChecker:e?.bodyLengthChecker??Se.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,ie.pf)({serviceId:n.serviceId,clientVersion:ne.rE}),maxAttempts:e?.maxAttempts??(0,pe.Z)(Q.qs,e),region:e?.region??(0,pe.Z)(de.GG,{...de.zH,...o}),requestHandler:fe.$.create(e?.requestHandler??s),retryMode:e?.retryMode??(0,pe.Z)({...Q.kN,default:async()=>(await s()).retryMode||ge.L0},e),sha256:e?.sha256??ve.V.bind(null,"sha256"),streamCollector:e?.streamCollector??Pe.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,pe.Z)(he.e$,o),useFipsEndpoint:e?.useFipsEndpoint??(0,pe.Z)(me.Ko,o),userAgentAppId:e?.userAgentAppId??(0,pe.Z)(re.hV,o)}};var Ye=s(135),Ze=s(136),et=s(137);class tt extends V.K{config;constructor(...[e]){const t=Xe(e||{});super(t),this.initConfig=t;const s=(n=t,Object.assign(n,{useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}));var n;const i=(0,G.D)(s),r=(0,Q.$z)(i),a=(0,W.T)(r),c=(0,$.OV)(a),u=((e,t)=>{const s=Object.assign((0,Ye.R)(e),(0,Ze.xA)(e),(0,et.e)(e),(e=>{const t=e.httpAuthSchemes;let s=e.httpAuthSchemeProvider,n=e.credentials;return{setHttpAuthScheme(e){const s=t.findIndex(t=>t.schemeId===e.schemeId);-1===s?t.push(e):t.splice(s,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){s=e},httpAuthSchemeProvider:()=>s,setCredentials(e){n=e},credentials:()=>n}})(e));return t.forEach(e=>e.configure(s)),Object.assign(e,(0,Ye.$)(s),(0,Ze.uv)(s),(0,et.j)(s),{httpAuthSchemes:(n=s).httpAuthSchemes(),httpAuthSchemeProvider:n.httpAuthSchemeProvider(),credentials:n.credentials()});var n})((e=>{const t=(0,Y.h)(e);return Object.assign(t,{authSchemePreference:(0,ee.t)(e.authSchemePreference??[])})})((0,o.Co)(c)),e?.extensions||[]);this.config=u,this.middlewareStack.use((0,X.wq)(this.config)),this.middlewareStack.use((0,M.sM)(this.config)),this.middlewareStack.use((0,J.ey)(this.config)),this.middlewareStack.use((0,L.vK)(this.config)),this.middlewareStack.use((0,$.TC)(this.config)),this.middlewareStack.use((0,N.Y7)(this.config)),this.middlewareStack.use((0,H.n)(this.config)),this.middlewareStack.use((0,_.w)(this.config,{httpAuthSchemeParametersProvider:te,identityProviderConfigProvider:async e=>new K.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,B.l)(this.config))}destroy(){super.destroy()}}}};
package/dist/960.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=960,exports.ids=[960],exports.modules={861(r,s,t){t.d(s,{fromEnv:()=>e.sF});var e=t(98)}};
2
+ "use strict";exports.id=960,exports.ids=[960],exports.modules={862(r,s,t){t.d(s,{fromEnv:()=>e.sF});var e=t(98)}};
package/dist/963.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=963,exports.ids=[963],exports.modules={849(e,t,r){r.d(t,{fromHttp:()=>u});var n=r(87),o=r(56),a=r(108),s=r(28),i=r.n(s);var c=r(33),f=r(83),l=r(850);const u=(e={})=>{let t;e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");const r=e.awsContainerCredentialsRelativeUri??process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,s=e.awsContainerCredentialsFullUri??process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI,u=e.awsContainerAuthorizationToken??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN,w=e.awsContainerAuthorizationTokenFile??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE,y="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?.warn?e.logger.warn.bind(e.logger):console.warn;if(r&&s&&(y("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),y("awsContainerCredentialsFullUri will take precedence.")),u&&w&&(y("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),y("awsContainerAuthorizationToken will take precedence.")),s)t=s;else{if(!r)throw new o.C("No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.",{logger:e.logger});t=`http://169.254.170.2${r}`}const d=new URL(t);((e,t)=>{if("https:"!==e.protocol&&"169.254.170.2"!==e.hostname&&"169.254.170.23"!==e.hostname&&"[fd00:ec2::23]"!==e.hostname){if(e.hostname.includes("[")){if("[::1]"===e.hostname||"[0000:0000:0000:0000:0000:0000:0000:0001]"===e.hostname)return}else{if("localhost"===e.hostname)return;const t=e.hostname.split("."),r=e=>{const t=parseInt(e,10);return 0<=t&&t<=255};if("127"===t[0]&&r(t[1])&&r(t[2])&&r(t[3])&&4===t.length)return}throw new o.C("URL not accepted. It must either be HTTPS or match one of the following:\n - loopback CIDR 127.0.0.0/8 or [::1/128]\n - ECS container host 169.254.170.2\n - EKS container host 169.254.170.23 or [fd00:ec2::23]",{logger:t})}})(d,e.logger);const p=a.$.create({connectionTimeout:e.timeout??1e3}),h=e.timeout??1e3,m=(b=async()=>{const t=function(e){return new c.K({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((e,[t,r])=>(e[t]=r,e),{}),fragment:e.hash})}(d);u?t.headers.Authorization=u:w&&(t.headers.Authorization=(await i().readFile(w)).toString());try{return async function(e,t){const r=(0,l.c)(e.body),n=await r.transformToString();if(200===e.statusCode){const e=JSON.parse(n);if("string"!=typeof e.AccessKeyId||"string"!=typeof e.SecretAccessKey||"string"!=typeof e.Token||"string"!=typeof e.Expiration)throw new o.C("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:t});return{accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:(0,f.EI)(e.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let r={};try{r=JSON.parse(n)}catch(e){}throw Object.assign(new o.C(`Server responded with status: ${e.statusCode}`,{logger:t}),{Code:r.Code,Message:r.Message})}throw new o.C(`Server responded with status: ${e.statusCode}`,{logger:t})}((await p.handle(t,{requestTimeout:h})).response).then(e=>(0,n.g)(e,"CREDENTIALS_HTTP","z"))}catch(t){throw new o.C(String(t),{logger:e.logger})}},g=e.maxRetries??3,T=e.timeout??1e3,async()=>{for(let e=0;e<g;++e)try{return await b()}catch(e){await new Promise(e=>setTimeout(e,T))}return await b()});var b,g,T;return async()=>{try{return await m()}finally{p.destroy?.()}}}},850(e,t,r){r.d(t,{c:()=>b});var n=r(16),o=r(75);const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=Object.entries(a).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),i=a.split("");function c(e){let t;t="string"==typeof e?(e=>(new TextEncoder).encode(e))(e):e;const r="object"==typeof t&&"number"==typeof t.length,n="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let e=0;e<t.length;e+=3){let r=0,n=0;for(let o=e,a=Math.min(e+3,t.length);o<a;o++)r|=t[o]<<8*(a-o-1),n+=8;const a=Math.ceil(n/6);r<<=6*a-n;for(let e=1;e<=a;e++){const t=6*(a-e);o+=i[(r&63<<t)>>t]}o+="==".slice(0,4-a)}return o}var f=r(89);const l=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>{if(2!==n.readyState)return r(new Error("Reader aborted too early"));const e=n.result??"",o=e.indexOf(","),a=o>-1?o+1:e.length;t(e.substring(a))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(e)})}(e),r=(e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const r=new ArrayBuffer(t),n=new DataView(r);for(let t=0;t<e.length;t+=4){let r=0,o=0;for(let n=t,a=t+3;n<=a;n++)if("="!==e[n]){if(!(e[n]in s))throw new TypeError(`Invalid character ${e[n]} in base64 string.`);r|=s[e[n]]<<6*(a-n),o+=6}else r>>=6;const a=t/4*3;r>>=o%8;const i=Math.floor(o/8);for(let e=0;e<i;e++){const t=8*(i-e-1);n.setUint8(a+e,(r&255<<t)>>t)}}return new Uint8Array(r)})(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let n=!1,o=0;for(;!n;){const{done:e,value:a}=await r.read();a&&(t.push(a),o+=a.length),n=e}const a=new Uint8Array(o);let s=0;for(const e of t)a.set(e,s),s+=e.length;return a}(e);const u=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),w="The stream has already been transformed.",y=e=>{if(!d(e)&&!u(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(w);return t=!0,await l(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return c(t);if("hex"===e)return(0,f.n)(t);if(void 0===e||"utf8"===e||"utf-8"===e)return(e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)})(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(w);if(t=!0,d(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(u(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},d=e=>"function"==typeof Blob&&e instanceof Blob;class p extends n.Writable{bufferedBytes=[];_write(e,t,r){this.bufferedBytes.push(e),r()}}const h=e=>(e=>"function"==typeof ReadableStream&&e instanceof ReadableStream)(e)?async function(e){const t=[],r=e.getReader();let n=!1,o=0;for(;!n;){const{done:e,value:a}=await r.read();a&&(t.push(a),o+=a.length),n=e}const a=new Uint8Array(o);let s=0;for(const e of t)a.set(e,s),s+=e.length;return a}(e):new Promise((t,r)=>{const n=new p;e.pipe(n),e.on("error",e=>{n.end(),r(e)}),n.on("error",r),n.on("finish",function(){const e=new Uint8Array(Buffer.concat(this.bufferedBytes));t(e)})}),m="The stream has already been transformed.",b=e=>{if(!(e instanceof n.Readable))try{return y(e)}catch(t){throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(m);return t=!0,await h(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if(void 0===e||Buffer.isEncoding(e))return(0,o.Q)(t.buffer,t.byteOffset,t.byteLength).toString(e);return new TextDecoder(e).decode(t)},transformToWebStream:()=>{if(t)throw new Error(m);if(null!==e.readableFlowing)throw new Error("The stream has been consumed by other callbacks.");if("function"!=typeof n.Readable.toWeb)throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return t=!0,n.Readable.toWeb(e)}})}}};
2
+ "use strict";exports.id=963,exports.ids=[963],exports.modules={850(e,t,r){r.d(t,{fromHttp:()=>u});var n=r(87),o=r(56),a=r(108),s=r(28),i=r.n(s);var c=r(33),f=r(83),l=r(851);const u=(e={})=>{let t;e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");const r=e.awsContainerCredentialsRelativeUri??process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,s=e.awsContainerCredentialsFullUri??process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI,u=e.awsContainerAuthorizationToken??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN,w=e.awsContainerAuthorizationTokenFile??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE,y="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?.warn?e.logger.warn.bind(e.logger):console.warn;if(r&&s&&(y("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),y("awsContainerCredentialsFullUri will take precedence.")),u&&w&&(y("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),y("awsContainerAuthorizationToken will take precedence.")),s)t=s;else{if(!r)throw new o.C("No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.",{logger:e.logger});t=`http://169.254.170.2${r}`}const d=new URL(t);((e,t)=>{if("https:"!==e.protocol&&"169.254.170.2"!==e.hostname&&"169.254.170.23"!==e.hostname&&"[fd00:ec2::23]"!==e.hostname){if(e.hostname.includes("[")){if("[::1]"===e.hostname||"[0000:0000:0000:0000:0000:0000:0000:0001]"===e.hostname)return}else{if("localhost"===e.hostname)return;const t=e.hostname.split("."),r=e=>{const t=parseInt(e,10);return 0<=t&&t<=255};if("127"===t[0]&&r(t[1])&&r(t[2])&&r(t[3])&&4===t.length)return}throw new o.C("URL not accepted. It must either be HTTPS or match one of the following:\n - loopback CIDR 127.0.0.0/8 or [::1/128]\n - ECS container host 169.254.170.2\n - EKS container host 169.254.170.23 or [fd00:ec2::23]",{logger:t})}})(d,e.logger);const p=a.$.create({connectionTimeout:e.timeout??1e3}),h=e.timeout??1e3,m=(b=async()=>{const t=function(e){return new c.K({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((e,[t,r])=>(e[t]=r,e),{}),fragment:e.hash})}(d);u?t.headers.Authorization=u:w&&(t.headers.Authorization=(await i().readFile(w)).toString());try{return async function(e,t){const r=(0,l.c)(e.body),n=await r.transformToString();if(200===e.statusCode){const e=JSON.parse(n);if("string"!=typeof e.AccessKeyId||"string"!=typeof e.SecretAccessKey||"string"!=typeof e.Token||"string"!=typeof e.Expiration)throw new o.C("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:t});return{accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:(0,f.EI)(e.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let r={};try{r=JSON.parse(n)}catch(e){}throw Object.assign(new o.C(`Server responded with status: ${e.statusCode}`,{logger:t}),{Code:r.Code,Message:r.Message})}throw new o.C(`Server responded with status: ${e.statusCode}`,{logger:t})}((await p.handle(t,{requestTimeout:h})).response).then(e=>(0,n.g)(e,"CREDENTIALS_HTTP","z"))}catch(t){throw new o.C(String(t),{logger:e.logger})}},g=e.maxRetries??3,T=e.timeout??1e3,async()=>{for(let e=0;e<g;++e)try{return await b()}catch(e){await new Promise(e=>setTimeout(e,T))}return await b()});var b,g,T;return async()=>{try{return await m()}finally{p.destroy?.()}}}},851(e,t,r){r.d(t,{c:()=>b});var n=r(16),o=r(75);const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=Object.entries(a).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),i=a.split("");function c(e){let t;t="string"==typeof e?(e=>(new TextEncoder).encode(e))(e):e;const r="object"==typeof t&&"number"==typeof t.length,n="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let e=0;e<t.length;e+=3){let r=0,n=0;for(let o=e,a=Math.min(e+3,t.length);o<a;o++)r|=t[o]<<8*(a-o-1),n+=8;const a=Math.ceil(n/6);r<<=6*a-n;for(let e=1;e<=a;e++){const t=6*(a-e);o+=i[(r&63<<t)>>t]}o+="==".slice(0,4-a)}return o}var f=r(89);const l=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>{if(2!==n.readyState)return r(new Error("Reader aborted too early"));const e=n.result??"",o=e.indexOf(","),a=o>-1?o+1:e.length;t(e.substring(a))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(e)})}(e),r=(e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const r=new ArrayBuffer(t),n=new DataView(r);for(let t=0;t<e.length;t+=4){let r=0,o=0;for(let n=t,a=t+3;n<=a;n++)if("="!==e[n]){if(!(e[n]in s))throw new TypeError(`Invalid character ${e[n]} in base64 string.`);r|=s[e[n]]<<6*(a-n),o+=6}else r>>=6;const a=t/4*3;r>>=o%8;const i=Math.floor(o/8);for(let e=0;e<i;e++){const t=8*(i-e-1);n.setUint8(a+e,(r&255<<t)>>t)}}return new Uint8Array(r)})(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let n=!1,o=0;for(;!n;){const{done:e,value:a}=await r.read();a&&(t.push(a),o+=a.length),n=e}const a=new Uint8Array(o);let s=0;for(const e of t)a.set(e,s),s+=e.length;return a}(e);const u=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),w="The stream has already been transformed.",y=e=>{if(!d(e)&&!u(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(w);return t=!0,await l(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return c(t);if("hex"===e)return(0,f.n)(t);if(void 0===e||"utf8"===e||"utf-8"===e)return(e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)})(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(w);if(t=!0,d(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(u(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},d=e=>"function"==typeof Blob&&e instanceof Blob;class p extends n.Writable{bufferedBytes=[];_write(e,t,r){this.bufferedBytes.push(e),r()}}const h=e=>(e=>"function"==typeof ReadableStream&&e instanceof ReadableStream)(e)?async function(e){const t=[],r=e.getReader();let n=!1,o=0;for(;!n;){const{done:e,value:a}=await r.read();a&&(t.push(a),o+=a.length),n=e}const a=new Uint8Array(o);let s=0;for(const e of t)a.set(e,s),s+=e.length;return a}(e):new Promise((t,r)=>{const n=new p;e.pipe(n),e.on("error",e=>{n.end(),r(e)}),n.on("error",r),n.on("finish",function(){const e=new Uint8Array(Buffer.concat(this.bufferedBytes));t(e)})}),m="The stream has already been transformed.",b=e=>{if(!(e instanceof n.Readable))try{return y(e)}catch(t){throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(m);return t=!0,await h(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if(void 0===e||Buffer.isEncoding(e))return(0,o.Q)(t.buffer,t.byteOffset,t.byteLength).toString(e);return new TextDecoder(e).decode(t)},transformToWebStream:()=>{if(t)throw new Error(m);if(null!==e.readableFlowing)throw new Error("The stream has been consumed by other callbacks.");if("function"!=typeof n.Readable.toWeb)throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return t=!0,n.Readable.toWeb(e)}})}}};