-
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.
Use only default import while transforming import equals (#608)
- Loading branch information
Showing
40 changed files
with
209 additions
and
334 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": minor | ||
--- | ||
|
||
Use only default import while transforming import equals |
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
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
14 changes: 2 additions & 12 deletions
14
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,13 +1,3 @@ | ||
import { CLIENTS_TO_TEST } from "./config"; | ||
import { getClientNameWithLocalSuffix } from "./getClientNameWithLocalSuffix"; | ||
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode"; | ||
import { getV3PackageImportEqualsCode } from "./getV3PackageImportEqualsCode"; | ||
import { getServiceImportEqualsOutput } from "./getServiceImportEqualsOutput"; | ||
|
||
export const getServiceImportEqualsWithNameOutput = () => { | ||
let content = ``; | ||
|
||
content += getV3PackageImportEqualsCode(CLIENTS_TO_TEST, { useLocalSuffix: true }); | ||
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST.map(getClientNameWithLocalSuffix)); | ||
|
||
return content; | ||
}; | ||
export const getServiceImportEqualsWithNameOutput = getServiceImportEqualsOutput; |
30 changes: 3 additions & 27 deletions
30
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
20 changes: 3 additions & 17 deletions
20
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,32 +1,18 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
import AWS_Lambda = require("@aws-sdk/client-lambda"); | ||
|
||
const { | ||
Lambda | ||
} = AWS_Lambda; | ||
|
||
import AWS_STS = require("@aws-sdk/client-sts"); | ||
|
||
const { | ||
STS | ||
} = AWS_STS; | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const ddbClient = new AWS_DynamoDB.DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const stsClient = new AWS_STS.STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
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 | ||
.invoke(invokeInput); |
20 changes: 3 additions & 17 deletions
20
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,32 +1,18 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
import AWS_Lambda = require("@aws-sdk/client-lambda"); | ||
|
||
const { | ||
Lambda | ||
} = AWS_Lambda; | ||
|
||
import AWS_STS = require("@aws-sdk/client-sts"); | ||
|
||
const { | ||
STS | ||
} = AWS_STS; | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const ddbClient = new AWS_DynamoDB.DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const stsClient = new AWS_STS.STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
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 | ||
.invoke(invokeInput); |
6 changes: 1 addition & 5 deletions
6
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,8 +1,4 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
const client = new DynamoDB(); | ||
const client = new AWS_DynamoDB.DynamoDB(); | ||
const data = await client.listTables(); |
6 changes: 1 addition & 5 deletions
6
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,8 +1,4 @@ | ||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
const client = new DynamoDB(); | ||
const client = new AWS_DynamoDB.DynamoDB(); | ||
const data = await client.listTables(); |
15 changes: 3 additions & 12 deletions
15
...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,20 +1,11 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_lib_dynamodb; | ||
|
||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
const docClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
const docClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_DynamoDBDocumentClient.ScanCommandInput = { | ||
const docClientScanInput: AWS_lib_dynamodb.ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_DynamoDBDocumentClient.ScanCommandOutput = await docClient | ||
const docClientScanOutput: AWS_lib_dynamodb.ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
15 changes: 3 additions & 12 deletions
15
...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,20 +1,11 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_lib_dynamodb; | ||
|
||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB: DynDB | ||
} = AWS_DynamoDB; | ||
|
||
const docClient = DynamoDBDocument.from(new DynDB({ region: "us-west-2" })); | ||
const docClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_DynDBDocumentClient.ScanCommandInput = { | ||
const docClientScanInput: AWS_lib_dynamodb.ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_DynDBDocumentClient.ScanCommandOutput = await docClient | ||
const docClientScanOutput: AWS_lib_dynamodb.ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
11 changes: 1 addition & 10 deletions
11
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,14 +1,5 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_lib_dynamodb; | ||
|
||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
const documentClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
const documentClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const response = await documentClient.scan({ TableName: "TABLE_NAME" }); |
11 changes: 1 addition & 10 deletions
11
...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,14 +1,5 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_lib_dynamodb; | ||
|
||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB: DynamoDBClient | ||
} = AWS_DynamoDB; | ||
|
||
const documentClient = DynamoDBDocument.from(new DynamoDBClient({ region: "us-west-2" })); | ||
const documentClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.DynamoDB({ region: "us-west-2" })); | ||
const response = await documentClient.scan({ TableName: "TABLE_NAME" }); |
11 changes: 1 addition & 10 deletions
11
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,14 +1,5 @@ | ||
import AWS_lib_dynamodb = require("@aws-sdk/lib-dynamodb"); | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_lib_dynamodb; | ||
|
||
import AWS_DynamoDB = require("@aws-sdk/client-dynamodb"); | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
const documentClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
const documentClient = AWS_lib_dynamodb.DynamoDBDocument.from(new AWS_DynamoDB.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
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.