-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add import equals declaration for named imports (#615)
- Loading branch information
Showing
44 changed files
with
307 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"aws-sdk-js-codemod": patch | ||
--- | ||
|
||
Add import equals declaration for named imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 13 additions & 2 deletions
15
scripts/generateNewClientTests/getServiceImportEqualsWithNameOutput.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
import { getServiceImportEqualsOutput } from "./getServiceImportEqualsOutput"; | ||
import { CLIENTS_TO_TEST } from "./config"; | ||
import { getClientNameWithLocalSuffix } from "./getClientNameWithLocalSuffix"; | ||
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode"; | ||
import { getV3PackageImportEqualsCode } from "./getV3PackageImportEqualsCode"; | ||
|
||
export const getServiceImportEqualsWithNameOutput = getServiceImportEqualsOutput; | ||
export const getServiceImportEqualsWithNameOutput = () => { | ||
let content = ``; | ||
|
||
content += getV3PackageImportEqualsCode(CLIENTS_TO_TEST, { useLocalSuffix: true }); | ||
content += "\n"; | ||
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST.map(getClientNameWithLocalSuffix)); | ||
|
||
return content; | ||
}; |
21 changes: 19 additions & 2 deletions
21
scripts/generateNewClientTests/getV3PackageImportEqualsCode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/transforms/v2-to-v3/__fixtures__/api-basic-type/global-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import AWS_S3 = require("@aws-sdk/client-s3"); | ||
import Tag = AWS_S3.Tag; | ||
|
||
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }]; | ||
const testTags: Tag[] = [{ Key: "key", Value: "value" }]; |
3 changes: 2 additions & 1 deletion
3
src/transforms/v2-to-v3/__fixtures__/api-basic-type/service-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import AWS_S3 = require("@aws-sdk/client-s3"); | ||
import Tag = AWS_S3.Tag; | ||
|
||
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }]; | ||
const testTags: Tag[] = [{ Key: "key", Value: "value" }]; |
27 changes: 18 additions & 9 deletions
27
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
import ListTablesCommandOutput = AWS_DynamoDB.ListTablesCommandOutput; | ||
import ListTablesCommandInput = AWS_DynamoDB.ListTablesCommandInput; | ||
import AWS_Lambda = require("@aws-sdk/client-lambda"); | ||
import Lambda = AWS_Lambda.Lambda; | ||
import InvokeCommandOutput = AWS_Lambda.InvokeCommandOutput; | ||
import InvokeCommandInput = AWS_Lambda.InvokeCommandInput; | ||
import AWS_STS = require("@aws-sdk/client-sts"); | ||
import STS = AWS_STS.STS; | ||
import GetCallerIdentityCommandOutput = AWS_STS.GetCallerIdentityCommandOutput; | ||
import GetCallerIdentityCommandInput = AWS_STS.GetCallerIdentityCommandInput; | ||
|
||
const ddbClient = new AWS_DynamoDB.DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new AWS_STS.STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new AWS_Lambda.Lambda({ region: "us-west-2" }); | ||
const invokeInput: AWS_Lambda.InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: AWS_Lambda.InvokeCommandOutput = await lambdaClient | ||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
const invokeInput: InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: InvokeCommandOutput = await lambdaClient | ||
.invoke(invokeInput); |
27 changes: 18 additions & 9 deletions
27
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
import ListTablesCommandOutput = AWS_DynamoDB.ListTablesCommandOutput; | ||
import ListTablesCommandInput = AWS_DynamoDB.ListTablesCommandInput; | ||
import AWS_Lambda = require("@aws-sdk/client-lambda"); | ||
import Lambda = AWS_Lambda.Lambda; | ||
import InvokeCommandOutput = AWS_Lambda.InvokeCommandOutput; | ||
import InvokeCommandInput = AWS_Lambda.InvokeCommandInput; | ||
import AWS_STS = require("@aws-sdk/client-sts"); | ||
import STS = AWS_STS.STS; | ||
import GetCallerIdentityCommandOutput = AWS_STS.GetCallerIdentityCommandOutput; | ||
import GetCallerIdentityCommandInput = AWS_STS.GetCallerIdentityCommandInput; | ||
|
||
const ddbClient = new AWS_DynamoDB.DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new AWS_STS.STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new AWS_Lambda.Lambda({ region: "us-west-2" }); | ||
const invokeInput: AWS_Lambda.InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: AWS_Lambda.InvokeCommandOutput = await lambdaClient | ||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
const invokeInput: InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: InvokeCommandOutput = await lambdaClient | ||
.invoke(invokeInput); |
3 changes: 2 additions & 1 deletion
3
src/transforms/v2-to-v3/__fixtures__/api-promise/global-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
|
||
const client = new AWS_DynamoDB.DynamoDB(); | ||
const client = new DynamoDB(); | ||
const data = await client.listTables(); |
3 changes: 2 additions & 1 deletion
3
src/transforms/v2-to-v3/__fixtures__/api-promise/service-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
|
||
const client = new AWS_DynamoDB.DynamoDB(); | ||
const client = new DynamoDB(); | ||
const data = await client.listTables(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
...rms/v2-to-v3/__fixtures__/ddb-doc-client-input-output-type/global-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
import DynamoDBDocument = AWS_lib_dynamodb.DynamoDBDocument; | ||
import ScanCommandOutput = AWS_lib_dynamodb.ScanCommandOutput; | ||
import ScanCommandInput = AWS_lib_dynamodb.ScanCommandInput; | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
|
||
const docClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const docClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_lib_dynamodb.ScanCommandInput = { | ||
const docClientScanInput: ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_lib_dynamodb.ScanCommandOutput = await docClient | ||
const docClientScanOutput: ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
10 changes: 7 additions & 3 deletions
10
...ms/v2-to-v3/__fixtures__/ddb-doc-client-input-output-type/service-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
import DynamoDBDocument = AWS_lib_dynamodb.DynamoDBDocument; | ||
import ScanCommandOutput = AWS_lib_dynamodb.ScanCommandOutput; | ||
import ScanCommandInput = AWS_lib_dynamodb.ScanCommandInput; | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynDB = AWS_DynamoDB.DynamoDB; | ||
|
||
const docClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const docClient = DynamoDBDocument.from(new DynDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_lib_dynamodb.ScanCommandInput = { | ||
const docClientScanInput: ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_lib_dynamodb.ScanCommandOutput = await docClient | ||
const docClientScanOutput: ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
4 changes: 3 additions & 1 deletion
4
src/transforms/v2-to-v3/__fixtures__/ddb-doc-client/global-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
import DynamoDBDocument = AWS_lib_dynamodb.DynamoDBDocument; | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
|
||
const documentClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const documentClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
const response = await documentClient.scan({ TableName: "TABLE_NAME" }); |
4 changes: 3 additions & 1 deletion
4
...transforms/v2-to-v3/__fixtures__/ddb-doc-client/service-import-equals-with-name.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
import DynamoDBDocument = AWS_lib_dynamodb.DynamoDBDocument; | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDBClient = AWS_DynamoDB.DynamoDB; | ||
|
||
const documentClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const documentClient = DynamoDBDocument.from(new DynamoDBClient({ region: "us-west-2" })); | ||
const response = await documentClient.scan({ TableName: "TABLE_NAME" }); |
4 changes: 3 additions & 1 deletion
4
src/transforms/v2-to-v3/__fixtures__/ddb-doc-client/service-import-equals.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
import DynamoDBDocument = AWS_lib_dynamodb.DynamoDBDocument; | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
import DynamoDB = AWS_DynamoDB.DynamoDB; | ||
|
||
const documentClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const documentClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
const response = await documentClient.scan({ TableName: "TABLE_NAME" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.