-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support transformation of waiter API on a client class member (#431)
- Loading branch information
Showing
7 changed files
with
74 additions
and
5 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 | ||
--- | ||
|
||
Support transformation of waiter API on a client class member |
12 changes: 12 additions & 0 deletions
12
src/transforms/v2-to-v3/__fixtures__/waiters/client-class-member.input.js
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,12 @@ | ||
import AWS from "aws-sdk"; | ||
|
||
// Client as class member | ||
class ClientClassMember { | ||
constructor(clientInCtr = new AWS.S3()) { | ||
this.clientInClass = clientInCtr; | ||
} | ||
|
||
async listTables() { | ||
return this.clientInClass.waitFor("bucketExists", { Bucket: "BUCKET" }).promise(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/transforms/v2-to-v3/__fixtures__/waiters/client-class-member.input.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import AWS from "aws-sdk"; | ||
|
||
// Client as class member | ||
class ClientClassMember { | ||
private clientInClass: AWS.S3; | ||
|
||
constructor(clientInCtr: AWS.S3) { | ||
this.clientInClass = clientInCtr; | ||
} | ||
|
||
async listTables() { | ||
return this.clientInClass.waitFor("bucketExists", { Bucket: "BUCKET" }).promise(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/transforms/v2-to-v3/__fixtures__/waiters/client-class-member.output.js
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,15 @@ | ||
import { S3, waitUntilBucketExists } from "@aws-sdk/client-s3"; | ||
|
||
// Client as class member | ||
class ClientClassMember { | ||
constructor(clientInCtr = new S3()) { | ||
this.clientInClass = clientInCtr; | ||
} | ||
|
||
async listTables() { | ||
return waitUntilBucketExists({ | ||
client: this.clientInClass, | ||
maxWaitTime: 200 | ||
}, { Bucket: "BUCKET" }); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/transforms/v2-to-v3/__fixtures__/waiters/client-class-member.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { S3, waitUntilBucketExists } from "@aws-sdk/client-s3"; | ||
|
||
// Client as class member | ||
class ClientClassMember { | ||
private clientInClass: S3; | ||
|
||
constructor(clientInCtr: S3) { | ||
this.clientInClass = clientInCtr; | ||
} | ||
|
||
async listTables() { | ||
return waitUntilBucketExists({ | ||
client: this.clientInClass, | ||
maxWaitTime: 200 | ||
}, { Bucket: "BUCKET" }); | ||
} | ||
} |
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