diff --git a/packages/aws-amplify/package.json b/packages/aws-amplify/package.json
index 889d7112966..1d10721644d 100644
--- a/packages/aws-amplify/package.json
+++ b/packages/aws-amplify/package.json
@@ -497,7 +497,7 @@
"name": "[Storage] uploadData (S3)",
"path": "./dist/esm/storage/index.mjs",
"import": "{ uploadData }",
- "limit": "22.35 kB"
+ "limit": "22.39 kB"
}
]
}
diff --git a/packages/storage/__tests__/providers/s3/apis/uploadData/multipartHandlers.test.ts b/packages/storage/__tests__/providers/s3/apis/uploadData/multipartHandlers.test.ts
index a56ee30c1e5..06771dce52e 100644
--- a/packages/storage/__tests__/providers/s3/apis/uploadData/multipartHandlers.test.ts
+++ b/packages/storage/__tests__/providers/s3/apis/uploadData/multipartHandlers.test.ts
@@ -593,7 +593,6 @@ describe('getMultipartUploadHandlers with key', () => {
});
it('should cache the upload with file including file lastModified property', async () => {
- // mockCalculateContentCRC32Mock();
mockMultipartUploadSuccess();
mockListParts.mockResolvedValueOnce({ Parts: [], $metadata: {} });
const size = 8 * MB;
diff --git a/packages/storage/src/providers/s3/apis/internal/uploadData/index.ts b/packages/storage/src/providers/s3/apis/internal/uploadData/index.ts
index 602fcab83e7..68d428c0b55 100644
--- a/packages/storage/src/providers/s3/apis/internal/uploadData/index.ts
+++ b/packages/storage/src/providers/s3/apis/internal/uploadData/index.ts
@@ -1,7 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
-// TODO: Remove this interface when we move to public advanced APIs.
import { createUploadTask } from '../../../utils';
import { assertValidationError } from '../../../../../errors/utils/assertValidationError';
import { StorageValidationErrorCode } from '../../../../../errors/types/validation';
diff --git a/packages/storage/src/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.ts b/packages/storage/src/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.ts
index 42988f2b3ce..c23d2cc5052 100644
--- a/packages/storage/src/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.ts
+++ b/packages/storage/src/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.ts
@@ -47,6 +47,16 @@ import { getDataChunker } from './getDataChunker';
type WithResumableCacheConfig> =
Input & {
options?: Input['options'] & {
+ /**
+ * The cache instance to store the in-progress multipart uploads so they can be resumed
+ * after page refresh. By default the library caches the uploaded file name,
+ * last modified, final checksum, size, bucket, key, and corresponded in-progress
+ * multipart upload ID from S3. If the library detects the same input corresponds to a
+ * previously in-progress upload from within 1 hour ago, it will continue
+ * the upload from where it left.
+ *
+ * By default, this option is not set. The upload caching is disabled.
+ */
resumableUploadsCache?: KeyValueStorageInterface;
};
};
@@ -55,6 +65,7 @@ type WithResumableCacheConfig> =
* The input interface for UploadData API with the options needed for multi-part upload.
* It supports both legacy Gen 1 input with key and Gen2 input with path. It also support additional
* advanced options for StorageBrowser.
+ *
* @internal
*/
export type MultipartUploadDataInput = WithResumableCacheConfig<
diff --git a/packages/storage/src/providers/s3/apis/uploadData.ts b/packages/storage/src/providers/s3/apis/uploadData.ts
index 5739109e7b8..b6173d3777e 100644
--- a/packages/storage/src/providers/s3/apis/uploadData.ts
+++ b/packages/storage/src/providers/s3/apis/uploadData.ts
@@ -9,7 +9,6 @@ import {
UploadDataWithPathInput,
UploadDataWithPathOutput,
} from '../types';
-// import { isDeprecatedInput } from '../utils/isDeprecatedInput';
import { uploadData as uploadDataInternal } from './internal/uploadData';
@@ -128,6 +127,8 @@ export function uploadData(input: UploadDataInput | UploadDataWithPathInput) {
...input,
options: {
...input?.options,
+ // This option enables caching in-progress multipart uploads.
+ // It's ONLY needed for client-side API.
resumableUploadsCache: defaultStorage,
},
});
diff --git a/packages/storage/src/providers/s3/utils/isDeprecatedInput.ts b/packages/storage/src/providers/s3/utils/isDeprecatedInput.ts
deleted file mode 100644
index aca27bbd658..00000000000
--- a/packages/storage/src/providers/s3/utils/isDeprecatedInput.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
-// SPDX-License-Identifier: Apache-2.0
-
-import {
- StorageOperationInputWithKey,
- StorageOperationInputWithPath,
- StorageOperationInputWithPrefix,
-} from '../../../types/inputs';
-import { CopyInput, CopyWithPathInput } from '../types';
-
-export type StorageWithPathInput =
- | StorageOperationInputWithPath
- | CopyWithPathInput;
-
-export type DeprecatedStorageInput =
- | StorageOperationInputWithKey
- | StorageOperationInputWithPrefix
- | CopyInput;
-
-type StorageInput = DeprecatedStorageInput | StorageWithPathInput;
-
-export const isDeprecatedInput = (
- input?: StorageInput,
-): input is DeprecatedStorageInput => {
- return (
- isInputWithKey(input) ||
- isInputWithPrefix(input) ||
- isInputWithCopySourceOrDestination(input)
- );
-};
-
-const isInputWithKey = (
- input?: StorageInput,
-): input is StorageOperationInputWithKey => {
- return !!(typeof (input as StorageOperationInputWithKey).key === 'string');
-};
-const isInputWithPrefix = (
- input?: StorageInput,
-): input is StorageOperationInputWithPrefix => {
- return !!(
- typeof (input as StorageOperationInputWithPrefix).prefix === 'string'
- );
-};
-const isInputWithCopySourceOrDestination = (
- input?: StorageInput,
-): input is CopyInput => {
- return !!(
- typeof (input as CopyInput).source?.key === 'string' ||
- typeof (input as CopyInput).destination?.key === 'string'
- );
-};