-
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 named imports while transforming require/import (#603)
- Loading branch information
Showing
29 changed files
with
229 additions
and
353 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 named imports while transforming require/import |
4 changes: 2 additions & 2 deletions
4
src/transforms/v2-to-v3/__fixtures__/api-basic-type/global-import.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,3 @@ | ||
import * as AWS_S3 from "@aws-sdk/client-s3"; | ||
import { Tag } from "@aws-sdk/client-s3"; | ||
|
||
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }]; | ||
const testTags: Tag[] = [{ Key: "key", Value: "value" }]; |
4 changes: 2 additions & 2 deletions
4
src/transforms/v2-to-v3/__fixtures__/api-basic-type/service-import-deep.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,3 @@ | ||
import * as AWS_S3 from "@aws-sdk/client-s3"; | ||
import { Tag } from "@aws-sdk/client-s3"; | ||
|
||
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }]; | ||
const testTags: Tag[] = [{ Key: "key", Value: "value" }]; |
4 changes: 2 additions & 2 deletions
4
src/transforms/v2-to-v3/__fixtures__/api-basic-type/service-import.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,3 @@ | ||
import * as AWS_S3 from "@aws-sdk/client-s3"; | ||
import { Tag } from "@aws-sdk/client-s3"; | ||
|
||
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }]; | ||
const testTags: Tag[] = [{ Key: "key", Value: "value" }]; |
32 changes: 9 additions & 23 deletions
32
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-import.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 * as AWS_DynamoDB from "@aws-sdk/client-dynamodb"; | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
import * as AWS_Lambda from "@aws-sdk/client-lambda"; | ||
|
||
const { | ||
Lambda | ||
} = AWS_Lambda; | ||
|
||
import * as AWS_STS from "@aws-sdk/client-sts"; | ||
|
||
const { | ||
STS | ||
} = AWS_STS; | ||
import { DynamoDB, ListTablesCommandInput, ListTablesCommandOutput } from "@aws-sdk/client-dynamodb"; | ||
import { InvokeCommandInput, InvokeCommandOutput, Lambda } from "@aws-sdk/client-lambda"; | ||
import { GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts"; | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
const invokeInput: AWS_Lambda.InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: AWS_Lambda.InvokeCommandOutput = await lambdaClient | ||
const invokeInput: InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: InvokeCommandOutput = await lambdaClient | ||
.invoke(invokeInput); |
32 changes: 9 additions & 23 deletions
32
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import-deep.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 * as AWS_DynamoDB from "@aws-sdk/client-dynamodb"; | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
import * as AWS_Lambda from "@aws-sdk/client-lambda"; | ||
|
||
const { | ||
Lambda | ||
} = AWS_Lambda; | ||
|
||
import * as AWS_STS from "@aws-sdk/client-sts"; | ||
|
||
const { | ||
STS | ||
} = AWS_STS; | ||
import { DynamoDB, ListTablesCommandInput, ListTablesCommandOutput } from "@aws-sdk/client-dynamodb"; | ||
import { InvokeCommandInput, InvokeCommandOutput, Lambda } from "@aws-sdk/client-lambda"; | ||
import { GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts"; | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
const invokeInput: AWS_Lambda.InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: AWS_Lambda.InvokeCommandOutput = await lambdaClient | ||
const invokeInput: InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: InvokeCommandOutput = await lambdaClient | ||
.invoke(invokeInput); |
32 changes: 9 additions & 23 deletions
32
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import.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 * as AWS_DynamoDB from "@aws-sdk/client-dynamodb"; | ||
|
||
const { | ||
DynamoDB | ||
} = AWS_DynamoDB; | ||
|
||
import * as AWS_Lambda from "@aws-sdk/client-lambda"; | ||
|
||
const { | ||
Lambda | ||
} = AWS_Lambda; | ||
|
||
import * as AWS_STS from "@aws-sdk/client-sts"; | ||
|
||
const { | ||
STS | ||
} = AWS_STS; | ||
import { DynamoDB, ListTablesCommandInput, ListTablesCommandOutput } from "@aws-sdk/client-dynamodb"; | ||
import { InvokeCommandInput, InvokeCommandOutput, Lambda } from "@aws-sdk/client-lambda"; | ||
import { GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts"; | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); | ||
|
||
const lambdaClient = new Lambda({ region: "us-west-2" }); | ||
const invokeInput: AWS_Lambda.InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: AWS_Lambda.InvokeCommandOutput = await lambdaClient | ||
const invokeInput: InvokeCommandInput = { FunctionName: "my-function" }; | ||
const invokeOutput: InvokeCommandOutput = await lambdaClient | ||
.invoke(invokeInput); |
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
11 changes: 3 additions & 8 deletions
11
...transforms/v2-to-v3/__fixtures__/ddb-doc-client-input-output-type/global-import.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,16 +1,11 @@ | ||
import * as AWS_DynamoDBDocumentClient from "@aws-sdk/lib-dynamodb"; | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_DynamoDBDocumentClient; | ||
|
||
import { DynamoDBDocument, ScanCommandInput, ScanCommandOutput } from "@aws-sdk/lib-dynamodb"; | ||
import { DynamoDB } from "@aws-sdk/client-dynamodb"; | ||
|
||
const docClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_DynamoDBDocumentClient.ScanCommandInput = { | ||
const docClientScanInput: ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_DynamoDBDocumentClient.ScanCommandOutput = await docClient | ||
const docClientScanOutput: ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
11 changes: 3 additions & 8 deletions
11
...orms/v2-to-v3/__fixtures__/ddb-doc-client-input-output-type/service-import-deep.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,16 +1,11 @@ | ||
import * as AWS_DynDBDocumentClient from "@aws-sdk/lib-dynamodb"; | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_DynDBDocumentClient; | ||
|
||
import { DynamoDBDocument, ScanCommandInput, ScanCommandOutput } from "@aws-sdk/lib-dynamodb"; | ||
import { DynamoDB as DynDB } from "@aws-sdk/client-dynamodb"; | ||
|
||
const docClient = DynamoDBDocument.from(new DynDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_DynDBDocumentClient.ScanCommandInput = { | ||
const docClientScanInput: ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_DynDBDocumentClient.ScanCommandOutput = await docClient | ||
const docClientScanOutput: ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
11 changes: 3 additions & 8 deletions
11
...ransforms/v2-to-v3/__fixtures__/ddb-doc-client-input-output-type/service-import.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,16 +1,11 @@ | ||
import * as AWS_DynDBDocumentClient from "@aws-sdk/lib-dynamodb"; | ||
|
||
const { | ||
DynamoDBDocument | ||
} = AWS_DynDBDocumentClient; | ||
|
||
import { DynamoDBDocument, ScanCommandInput, ScanCommandOutput } from "@aws-sdk/lib-dynamodb"; | ||
import { DynamoDB as DynDB } from "@aws-sdk/client-dynamodb"; | ||
|
||
const docClient = DynamoDBDocument.from(new DynDB({ region: "us-west-2" })); | ||
|
||
const docClientScanInput: AWS_DynDBDocumentClient.ScanCommandInput = { | ||
const docClientScanInput: ScanCommandInput = { | ||
TableName: "TableName" | ||
}; | ||
|
||
const docClientScanOutput: AWS_DynDBDocumentClient.ScanCommandOutput = await docClient | ||
const docClientScanOutput: ScanCommandOutput = await docClient | ||
.scan(docClientScanInput); |
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,6 @@ | ||
export * from "./CLIENT_NAMES"; | ||
export * from "./CLIENT_NAMES_MAP"; | ||
export * from "./CLIENT_PACKAGE_NAMES_MAP"; | ||
export * from "./CLIENT_REQ_RESP_TYPES_MAP"; | ||
export * from "./CLIENT_TYPES_MAP"; | ||
export * from "./constants"; |
Oops, something went wrong.