Skip to content

Commit

Permalink
chore(storage): fix documents & formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed Oct 16, 2024
1 parent 2c24576 commit 6b01479
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ import { getDataChunker } from './getDataChunker';
type WithResumableCacheConfig<Input extends StorageOperationOptionsInput<any>> =
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;
};
};
Expand All @@ -55,6 +65,7 @@ type WithResumableCacheConfig<Input extends StorageOperationOptionsInput<any>> =
* 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<
Expand Down
3 changes: 2 additions & 1 deletion packages/storage/src/providers/s3/apis/uploadData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
UploadDataWithPathInput,
UploadDataWithPathOutput,
} from '../types';
// import { isDeprecatedInput } from '../utils/isDeprecatedInput';

import { uploadData as uploadDataInternal } from './internal/uploadData';

Expand Down Expand Up @@ -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,
},
});
Expand Down
51 changes: 0 additions & 51 deletions packages/storage/src/providers/s3/utils/isDeprecatedInput.ts

This file was deleted.

0 comments on commit 6b01479

Please sign in to comment.