aws / aws/aws-sdk-js-codemod

[Feature]: support transformation of AWS.S3.ManagedUpload

Open
#495 2 comments 0 reactions 0 assignees View on GitHub
enhancement p3
Dominant language
TypeScript
Stars
89
Forks
13
Avg merge
9h 59m
Merged PRs (30d)
1

Description

### Self-service

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

### Problem

When running:
npx aws-sdk-js-codemod -t v2-to-v3 example.js
I get:
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
All done.
Results:
0 errors
1 unmodified
0 skipped
0 ok
Time elapsed: 0.340seconds

import AWS from 'aws-sdk';
import { getUploadCredentials } from './boatregisterposts';

export async function postPhotos(values, fileList) {
if (fileList?.length > 0) {
try {
const r = await getUploadCredentials();
const uploadConfig = r.data;
AWS.config.update({
region: uploadConfig.region,
credentials: new AWS.CognitoIdentityCredentials({
IdentityPoolId: `${uploadConfig.region}:${uploadConfig.identityId}`,
})
});
const uploads = fileList.map((file) => {
const photoKey = `${values.email}/${file.name}`;
const params = {
Bucket: uploadConfig.bucketName,
Key: photoKey,
ContentType: file.type,
Body: file,
Metadata: {
albumKey: values.albumKey,
copyright: values.copyright,
},
};
return new AWS.S3.ManagedUpload({ params }).promise();
});
return Promise.allSettled(uploads);
} catch (e) {
// console.log(e);
}
}
return undefined;
}

### Solution

I want a working v3

### Alternatives

n/a

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Run the v2-to-v3 transform from the issue against example.js and locate the transformation handling AWS.S3.ManagedUpload. Trace why the example is reported as unmodified, then verify that the command produces a working v3 equivalent for the ManagedUpload usage shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, nodejs, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.