Skip to content

Commit

Permalink
refactor(storage): decouple utils from Amplify singleton (#13562)
Browse files Browse the repository at this point in the history
* feat: add config constructor

* refactor: remove singleton reference from storage utils

* refactor: update storage utils

* chore: update upload api

* chore: address feedback

* chore: fix unit tests

* chore: remove singleton reference

* chore: add license headers

* chore: address feedback

* chore: update bundle size

* chore: address feedback

* chore: update bundle size
  • Loading branch information
israx authored Jul 10, 2024
1 parent 6f17f6c commit 1079e7f
Show file tree
Hide file tree
Showing 20 changed files with 621 additions and 409 deletions.
14 changes: 7 additions & 7 deletions packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,43 +461,43 @@
"name": "[Storage] copy (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ copy }",
"limit": "14.64 kB"
"limit": "14.71 kB"
},
{
"name": "[Storage] downloadData (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ downloadData }",
"limit": "15.27 kB"
"limit": "15.31 kB"
},
{
"name": "[Storage] getProperties (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ getProperties }",
"limit": "14.52 kB"
"limit": "14.58 kB"
},
{
"name": "[Storage] getUrl (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ getUrl }",
"limit": "15.62 kB"
"limit": "15.68 kB"
},
{
"name": "[Storage] list (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ list }",
"limit": "15.12 kB"
"limit": "15.18 kB"
},
{
"name": "[Storage] remove (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ remove }",
"limit": "14.38 kB"
"limit": "14.45 kB"
},
{
"name": "[Storage] uploadData (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ uploadData }",
"limit": "19.69 kB"
"limit": "19.77 kB"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,12 @@ describe('uploadData with path', () => {
uploadData(testInput);

expect(mockPutObjectJob).toHaveBeenCalledWith(
testInput,
expect.any(AbortSignal),
expect.any(Number),
expect.objectContaining({
input: testInput,
totalLength: expect.any(Number),
abortSignal: expect.any(AbortSignal),
config: expect.any(Object),
}),
);
expect(mockGetMultipartUploadHandlers).not.toHaveBeenCalled();
},
Expand Down Expand Up @@ -212,8 +215,11 @@ describe('uploadData with path', () => {

expect(mockPutObjectJob).not.toHaveBeenCalled();
expect(mockGetMultipartUploadHandlers).toHaveBeenCalledWith(
testInput,
expect.any(Number),
expect.objectContaining({
config: expect.any(Object),
input: testInput,
size: expect.any(Number),
}),
);
});

Expand Down
Loading

0 comments on commit 1079e7f

Please sign in to comment.