Skip to content

feat(storage-manager): add metadata #3788

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

Merged
merged 11 commits into from
May 1, 2023
Merged

Conversation

dbanksdesign
Copy link
Contributor

@dbanksdesign dbanksdesign commented Apr 27, 2023

Description of changes

Adding metadata prop to StorageManager and to the processFile function so users can add metadata per-session and per-file.

Issue #, if available

#3683

Description of how you validated changes

Added an example

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • Relevant documentation is changed or added (and PR referenced)
  • yarn test passes and tests are updated/added
  • No side effects or sideEffects field updated

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

@dbanksdesign dbanksdesign requested a review from a team as a code owner April 27, 2023 22:51
@changeset-bot
Copy link

changeset-bot bot commented Apr 27, 2023

🦋 Changeset detected

Latest commit: 548b05b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@aws-amplify/ui-react-storage Minor
@aws-amplify/ui-react Patch
@aws-amplify/ui Patch
@aws-amplify/ui-react-liveness Patch
@aws-amplify/ui-react-core Patch
@aws-amplify/ui-react-native Patch
@aws-amplify/ui-vue Patch
@aws-amplify/ui-angular Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -32,6 +32,12 @@ export type StorageFiles = StorageFile[];

export type DefaultFile = Pick<StorageFile, 'key'>;

type ProcessFileProps = Required<Pick<StorageFile, 'file' | 'key'>> & {
Copy link
Member

Choose a reason for hiding this comment

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

Prefer Props for component props, Params for function params

@dbanksdesign dbanksdesign temporarily deployed to ci April 27, 2023 23:08 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 27, 2023 23:08 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 27, 2023 23:08 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 27, 2023 23:08 — with GitHub Actions Inactive
@@ -12,7 +12,8 @@ type BaseDropZoneTokens<OutputType> = DesignTokenProperties<

export interface FileUploaderTokens<OutputType extends OutputVariantKey> {
dropzone?: DesignTokenProperties<
'gap' | 'paddingBlock' | 'paddingInline' | 'textAlign'
'gap' | 'paddingBlock' | 'paddingInline' | 'textAlign',
OutputType
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this is a bug because with the 2nd arg all these properties become required

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you already fix this in StorageManager, or did you mean to fix this in FileUploader?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

StorageManger basically just extends this type so it is fixed in both :)

Copy link
Contributor

Choose a reason for hiding this comment

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

So do we need to rename this type? When we delete the FileUploader tokens in next release, won't StorageManager break?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we do that breaking change we will inline that type into the storagemanager type

Copy link
Member

@calebpollman calebpollman left a comment

Choose a reason for hiding this comment

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

LGTM! Left some suggestions, lmk what you think 😅

dbanksdesign and others added 5 commits April 28, 2023 09:31
Co-authored-by: Caleb Pollman <cpollman@amazon.com>
…manager/props.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>
…oadFile.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>
…oadFile.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>
…oadFile.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 16:52 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 16:52 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 16:52 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 16:52 — with GitHub Actions Inactive
calebpollman
calebpollman previously approved these changes Apr 28, 2023
Copy link
Member

@calebpollman calebpollman left a comment

Choose a reason for hiding this comment

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

🚢

@@ -32,6 +32,12 @@ export type StorageFiles = StorageFile[];

export type DefaultFile = Pick<StorageFile, 'key'>;

type ProcessFileParams = Required<Pick<StorageFile, 'file' | 'key'>>;

type ProcessFile = (
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the answer, but will this be exported since the interface below is exported?

@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 20:09 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 20:09 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 20:09 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign temporarily deployed to ci April 28, 2023 20:09 — with GitHub Actions Inactive
@dbanksdesign dbanksdesign merged commit 37d6342 into main May 1, 2023
@dbanksdesign dbanksdesign deleted the storagemanager-metadata branch May 1, 2023 16:32
@github-actions github-actions bot mentioned this pull request May 1, 2023
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.

3 participants