aws-sdk-js-codemod icon indicating copy to clipboard operation
aws-sdk-js-codemod copied to clipboard

[Feature]: The v2-to-v3 transform should convert to v3 style of making API calls

Open trivikr opened this issue 1 year ago • 5 comments

Self-service

  • [ ] I'd be willing to implement this feature

Template name

v2-to-v3

Input code

import AWS from "aws-sdk";

const region = "us-west-2";
const client = new AWS.DynamoDB({ region });
const response = await client.listTables().promise();

Expected Output

Existing output

import { DynamoDB } from "@aws-sdk/client-dynamodb";

const region = "us-west-2";
const client = new DynamoDB({ region });
const response = await client.listTables();

Recommended output

import { DynamoDB, ListTablesCommand } from "@aws-sdk/client-dynamodb";

const region = "us-west-2";
const client = new DynamoDB({ region });
const response = await client.send(new ListTablesCommand({}));

Additional context

Reference blog post: https://www.10printiamcool.com/updating-to-nodejs-18-and-aws-javascript-sdk-v3-part-1

trivikr avatar Jun 21 '23 16:06 trivikr