diff --git a/src/transforms/v2-to-v3/apis/replaceAwsCredentials.ts b/src/transforms/v2-to-v3/apis/replaceAwsCredentials.ts index 62bfeab82..23ce6af2d 100644 --- a/src/transforms/v2-to-v3/apis/replaceAwsCredentials.ts +++ b/src/transforms/v2-to-v3/apis/replaceAwsCredentials.ts @@ -1,11 +1,17 @@ import { Collection, JSCodeshift } from "jscodeshift"; import { AWS_CREDENTIALS_MAP } from "../config"; +import { ImportType } from "../modules"; import { getAwsCredentialsNewExpressions } from "./getAwsCredentialsNewExpressions"; +export interface ReplaceAwsCredentialsOptions { + v2GlobalName?: string; + importType: ImportType; +} + export const replaceAwsCredentials = ( j: JSCodeshift, source: Collection, - v2GlobalName?: string + { v2GlobalName }: ReplaceAwsCredentialsOptions ) => { if (!v2GlobalName) return; @@ -17,8 +23,8 @@ export const replaceAwsCredentials = ( const credsNewExpressionCount = credsNewExpressions.size(); if (credsNewExpressionCount > 0) { - // addClientNamedModule(j, source, { - // ...options, + // ToDo: Call importType agnostic addNamedModule + // addNamedModule(j, source, { // importedName: v3ProviderName, // v3ClientPackageName: "@aws-sdk/credential-provider", // }); diff --git a/src/transforms/v2-to-v3/transformer.ts b/src/transforms/v2-to-v3/transformer.ts index 02f2dacfd..1e387b474 100644 --- a/src/transforms/v2-to-v3/transformer.ts +++ b/src/transforms/v2-to-v3/transformer.ts @@ -92,7 +92,7 @@ const transformer = async (file: FileInfo, api: API) => { replaceClientCreation(j, source, { ...v2Options, v3ClientName }); replaceDocClientCreation(j, source, v2Options); } - replaceAwsCredentials(j, source, v2GlobalName); + replaceAwsCredentials(j, source, { v2GlobalName, importType }); replaceAwsUtilFunctions(j, source, v2GlobalName); removeGlobalModule(j, source, { v2GlobalName, importType });