Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]: Storage Input/Output types #13270

Merged
merged 20 commits into from
Apr 23, 2024

Conversation

ashika112
Copy link
Member

@ashika112 ashika112 commented Apr 19, 2024

Description of changes

Refactoring the input and output type to export both withKey and withPath types to customers

Description of how you validated changes

  • Unit test
  • Manual test
  • Integ test

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

export function getUrl(
contextSpec: AmplifyServer.ContextSpec,
input: GetUrlInputWithPath,
): Promise<GetUrlOutputWithPath>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering on getUrl if we should duplicate this for consistency or make it GetUrlOutput for both? Keeping together makes it just this API users in NMV.

@@ -77,7 +82,14 @@ describe('copy API', () => {
afterEach(() => {
jest.clearAllMocks();
});
[
const testCases: Array<{
source: { accessLevel?: StorageAccessLevel; targetIdentityId?: string };
Copy link
Member Author

@ashika112 ashika112 Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note on this: This is how a customer would have to pass in today if it is not done directly on API call. Please let me know if that is not the case since this is the pattern I followed on all APIs

@ashika112 ashika112 marked this pull request as ready for review April 23, 2024 00:13
@ashika112 ashika112 requested a review from a team as a code owner April 23, 2024 00:13
@ashika112 ashika112 changed the title Update/storage types [Fix]: Storage Input/Output types Apr 23, 2024
@ashika112 ashika112 requested a review from a team April 23, 2024 03:10
Comment on lines +94 to +95
source: StorageOperationInputWithPath;
destination: StorageOperationInputWithPath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the suffix be Input?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are still some internal type refernces WithKey and WithPath we do this for clear separation of concern but we should think about cleaning some of these up.

Copy link
Contributor

@jimblanc jimblanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thanks for getting this out so quickly! Variety of nits & questions below but overall looking solid.

Comment on lines +199 to +201
const copyWrapper = async (
input: CopyWithPathInput,
): Promise<CopyWithPathOutput> => copy(input);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Possible to hoist this up a few levels to re-use between suites?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i purposefully did this so we can have both direct usage and wrapper usage. Meaning This is used in all path happy cases but error cases one will have the direct usage. I mean we want to test both ways

packages/storage/src/providers/s3/apis/downloadData.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/downloadData.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/copy.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/copy.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/internal/list.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/server/copy.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/server/copy.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/server/copy.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@erinleigh90 erinleigh90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one issue, aside from that and the deprecation message changes pointed out by others, I'm good to approve.

packages/storage/src/providers/s3/apis/internal/list.ts Outdated Show resolved Hide resolved
@ashika112 ashika112 merged commit e54bfa9 into aws-amplify:gen2-storage Apr 23, 2024
28 checks passed
@ashwinkumar6
Copy link
Member

ashwinkumar6 commented Apr 23, 2024

lgtm, great work !!! 🚀🚀🚀

@ashika112 ashika112 mentioned this pull request Apr 25, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants