Skip to content

Commit 432133e

Browse files
authored
Add namespace import instead of default import (#545)
1 parent 034a0d8 commit 432133e

15 files changed

+148
-32
lines changed

.changeset/brave-humans-wonder.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"aws-sdk-js-codemod": patch
3+
---
4+
5+
Add namespace import instead of default import
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import AWS_S3 from "@aws-sdk/client-s3";
1+
import * as AWS_S3 from "@aws-sdk/client-s3";
22

33
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import AWS_S3 from "@aws-sdk/client-s3";
1+
import * as AWS_S3 from "@aws-sdk/client-s3";
22

33
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import AWS_S3 from "@aws-sdk/client-s3";
1+
import * as AWS_S3 from "@aws-sdk/client-s3";
22

33
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];

src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-import.output.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import AWS_DynamoDB, { DynamoDB } from "@aws-sdk/client-dynamodb";
2-
import AWS_STS, { STS } from "@aws-sdk/client-sts";
1+
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
2+
3+
const {
4+
DynamoDB
5+
} = AWS_DynamoDB;
6+
7+
import * as AWS_STS from "@aws-sdk/client-sts";
8+
9+
const {
10+
STS
11+
} = AWS_STS;
312

413
const ddbClient = new DynamoDB({ region: "us-west-2" });
514
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 };

src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import-deep.output.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import AWS_DynamoDB, { DynamoDB } from "@aws-sdk/client-dynamodb";
2-
import AWS_STS, { STS } from "@aws-sdk/client-sts";
1+
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
2+
3+
const {
4+
DynamoDB
5+
} = AWS_DynamoDB;
6+
7+
import * as AWS_STS from "@aws-sdk/client-sts";
8+
9+
const {
10+
STS
11+
} = AWS_STS;
312

413
const ddbClient = new DynamoDB({ region: "us-west-2" });
514
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 };

src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import.output.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import AWS_DynamoDB, { DynamoDB } from "@aws-sdk/client-dynamodb";
2-
import AWS_STS, { STS } from "@aws-sdk/client-sts";
1+
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
2+
3+
const {
4+
DynamoDB
5+
} = AWS_DynamoDB;
6+
7+
import * as AWS_STS from "@aws-sdk/client-sts";
8+
9+
const {
10+
STS
11+
} = AWS_STS;
312

413
const ddbClient = new DynamoDB({ region: "us-west-2" });
514
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 };

src/transforms/v2-to-v3/__fixtures__/api-redundant-type/global-import.output.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import AWS_APIGateway from "@aws-sdk/client-api-gateway";
2-
import AWS_DynamoDB from "@aws-sdk/client-dynamodb";
3-
import AWS_S3 from "@aws-sdk/client-s3";
1+
import * as AWS_APIGateway from "@aws-sdk/client-api-gateway";
2+
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
3+
import * as AWS_S3 from "@aws-sdk/client-s3";
44

55
// Native types
66
const stringType: string = "string";

src/transforms/v2-to-v3/__fixtures__/api-redundant-type/service-import-deep.output.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import AWS_APIGateway from "@aws-sdk/client-api-gateway";
2-
import AWS_DynamoDB from "@aws-sdk/client-dynamodb";
3-
import AWS_S3 from "@aws-sdk/client-s3";
1+
import * as AWS_APIGateway from "@aws-sdk/client-api-gateway";
2+
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
3+
import * as AWS_S3 from "@aws-sdk/client-s3";
44

55
// Native types
66
const stringType: string = "string";

src/transforms/v2-to-v3/__fixtures__/api-redundant-type/service-import.output.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import AWS_APIGateway from "@aws-sdk/client-api-gateway";
2-
import AWS_DynamoDB from "@aws-sdk/client-dynamodb";
3-
import AWS_S3 from "@aws-sdk/client-s3";
1+
import * as AWS_APIGateway from "@aws-sdk/client-api-gateway";
2+
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
3+
import * as AWS_S3 from "@aws-sdk/client-s3";
44

55
// Native types
66
const stringType: string = "string";

0 commit comments

Comments
 (0)