@integration-app/membrane-cli
Version:
CLI tool for importing and exporting Integration.app workspace data
2 lines (1 loc) • 6.78 kB
JavaScript
var S=Object.defineProperty;var i=(e,t)=>S(e,"name",{value:t,configurable:!0});import"os";import"path";import{C as l,s as a,j as I,h as m}from"./index-DSLX1GoQ.js";import"crypto";import{p as P}from"./parseKnownFiles-D61N1iV6.js";import"fs";import"url";import"chalk";import"commander";import"inquirer";import"node:fs";import"node:path";import"js-yaml";import"@integration-app/sdk";import"zod";import"jsonwebtoken";import"events";import"constants";import"stream";import"util";import"assert";import"buffer";import"node:url";import"node:fs/promises";import"node:events";import"node:stream";import"node:string_decoder";import"zlib";import"form-data";import"async_hooks";import"http";import"https";import"http2";import"process";import"js-convert-case";import"@anthropic-ai/sdk";const R=i((e,t,r)=>{const o={EcsContainer:i(async s=>{const{fromHttp:n}=await import("./index-CYKsKfSc.js"),{fromContainerMetadata:d}=await import("./index-DExxoWNr.js");return r?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>I(n(s??{}),d(s))().then(u)},"EcsContainer"),Ec2InstanceMetadata:i(async s=>{r?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");const{fromInstanceMetadata:n}=await import("./index-DExxoWNr.js");return async()=>n(s)().then(u)},"Ec2InstanceMetadata"),Environment:i(async s=>{r?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");const{fromEnv:n}=await import("./index-iMyvpA-Y.js");return async()=>n(s)().then(u)},"Environment")};if(e in o)return o[e];throw new l(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:r})},"resolveCredentialSource"),u=i(e=>a(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p"),"setNamedProvider"),v=i((e,{profile:t="default",logger:r}={})=>!!e&&typeof e=="object"&&typeof e.role_arn=="string"&&["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&&(A(e,{profile:t,logger:r})||O(e,{profile:t,logger:r})),"isAssumeRoleProfile"),A=i((e,{profile:t,logger:r})=>{const o=typeof e.source_profile=="string"&&typeof e.credential_source>"u";return o&&r?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`),o},"isAssumeRoleWithSourceProfile"),O=i((e,{profile:t,logger:r})=>{const o=typeof e.credential_source=="string"&&typeof e.source_profile>"u";return o&&r?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`),o},"isCredentialSourceProfile"),b=i(async(e,t,r,o={})=>{r.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const s=t[e],{source_profile:n,region:d}=s;if(!r.roleAssumer){const{getDefaultRoleAssumer:c}=await import("./index-DZUZpEcT.js");r.roleAssumer=c({...r.clientConfig,credentialProviderLogger:r.logger,parentClientConfig:{...r?.parentClientConfig,region:d??r?.parentClientConfig?.region}},r.clientPlugins)}if(n&&n in o)throw new l(`Detected a cycle attempting to resolve credentials for profile ${m(r)}. Profiles visited: `+Object.keys(o).join(", "),{logger:r.logger});r.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${n?`source_profile=[${n}]`:`profile=[${e}]`}`);const _=n?y(n,t,r,{...o,[n]:!0},p(t[n]??{})):(await R(s.credential_source,e,r.logger)(r))();if(p(s))return _.then(c=>a(c,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));{const c={RoleArn:s.role_arn,RoleSessionName:s.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:s.external_id,DurationSeconds:parseInt(s.duration_seconds||"3600",10)},{mfa_serial:f}=s;if(f){if(!r.mfaCodeProvider)throw new l(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:r.logger,tryNextLink:!1});c.SerialNumber=f,c.TokenCode=await r.mfaCodeProvider(f)}const w=await _;return r.roleAssumer(w,c).then(E=>a(E,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},"resolveAssumeRoleCredentials"),p=i(e=>!e.role_arn&&!!e.credential_source,"isCredentialSourceWithoutRoleArn"),h=i(e=>!!e&&typeof e=="object"&&typeof e.credential_process=="string","isProcessProfile"),k=i(async(e,t)=>import("./index-LWz-d9jO.js").then(({fromProcess:r})=>r({...e,profile:t})().then(o=>a(o,"CREDENTIALS_PROFILE_PROCESS","v"))),"resolveProcessCredentials"),L=i(async(e,t,r={})=>{const{fromSSO:o}=await import("./index-DxF51eio.js");return o({profile:e,logger:r.logger,parentClientConfig:r.parentClientConfig,clientConfig:r.clientConfig})().then(s=>t.sso_session?a(s,"CREDENTIALS_PROFILE_SSO","r"):a(s,"CREDENTIALS_PROFILE_SSO_LEGACY","t"))},"resolveSsoCredentials"),D=i(e=>e&&(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=="string"),"isSsoProfile"),C=i(e=>!!e&&typeof e=="object"&&typeof e.aws_access_key_id=="string"&&typeof e.aws_secret_access_key=="string"&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,"isStaticCredsProfile"),g=i(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 a(r,"CREDENTIALS_PROFILE","n")},"resolveStaticCredentials"),F=i(e=>!!e&&typeof e=="object"&&typeof e.web_identity_token_file=="string"&&typeof e.role_arn=="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1,"isWebIdentityProfile"),T=i(async(e,t)=>import("./index-1kXuCDve.js").then(({fromTokenFile:r})=>r({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:t.roleAssumerWithWebIdentity,logger:t.logger,parentClientConfig:t.parentClientConfig})().then(o=>a(o,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q"))),"resolveWebIdentityCredentials"),y=i(async(e,t,r,o={},s=!1)=>{const n=t[e];if(Object.keys(o).length>0&&C(n))return g(n,r);if(s||v(n,{profile:e,logger:r.logger}))return b(e,t,r,o);if(C(n))return g(n,r);if(F(n))return T(n,r);if(h(n))return k(r,e);if(D(n))return await L(e,n,r);throw new l(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:r.logger})},"resolveProfileData"),$=i((e={})=>async({callerClientConfig:t}={})=>{const r={...e,parentClientConfig:{...t,...e.parentClientConfig}};r.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const o=await P(r);return y(m({profile:e.profile??t?.profile}),o,r)},"fromIni");export{$ as fromIni};