@aws-amplify/storage 6.0.1-preview-testing.64b45b1.0 → 6.0.1-preview-testing.ddb17c0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -3
- package/lib/providers/s3/apis/copy.d.ts +2 -3
- package/lib/providers/s3/apis/copy.js +2 -3
- package/lib/providers/s3/apis/downloadData.d.ts +2 -3
- package/lib/providers/s3/apis/downloadData.js +2 -3
- package/lib/providers/s3/apis/getProperties.d.ts +2 -2
- package/lib/providers/s3/apis/getProperties.js +2 -2
- package/lib/providers/s3/apis/getUrl.d.ts +3 -2
- package/lib/providers/s3/apis/getUrl.js +3 -2
- package/lib/providers/s3/apis/list.d.ts +4 -4
- package/lib/providers/s3/apis/remove.d.ts +2 -2
- package/lib/providers/s3/apis/remove.js +2 -2
- package/lib/providers/s3/apis/uploadData/index.d.ts +2 -3
- package/lib/providers/s3/apis/uploadData/index.js +2 -3
- package/lib/providers/s3/types/index.d.ts +1 -1
- package/lib/providers/s3/types/inputs.d.ts +26 -2
- package/lib/providers/s3/types/options.d.ts +37 -24
- package/lib/providers/s3/types/outputs.d.ts +31 -1
- package/lib/providers/s3/utils/client/abortMultipartUpload.d.ts +1 -1
- package/lib/providers/s3/utils/client/completeMultipartUpload.d.ts +1 -1
- package/lib/providers/s3/utils/client/copyObject.d.ts +1 -1
- package/lib/providers/s3/utils/client/createMultipartUpload.d.ts +1 -1
- package/lib/providers/s3/utils/client/deleteObject.d.ts +1 -1
- package/lib/providers/s3/utils/client/getObject.d.ts +1 -1
- package/lib/providers/s3/utils/client/headObject.d.ts +1 -1
- package/lib/providers/s3/utils/client/listObjectsV2.d.ts +1 -1
- package/lib/providers/s3/utils/client/listParts.d.ts +1 -1
- package/lib/providers/s3/utils/client/putObject.d.ts +1 -1
- package/lib/providers/s3/utils/client/uploadPart.d.ts +1 -1
- package/lib/providers/s3/utils/transferTask.js +10 -13
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/common.d.ts +1 -7
- package/lib/types/common.js +0 -9
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +0 -3
- package/lib/types/inputs.d.ts +8 -5
- package/lib/types/options.d.ts +2 -12
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/index.js +0 -1
- package/lib-esm/providers/s3/apis/copy.d.ts +2 -3
- package/lib-esm/providers/s3/apis/copy.js +2 -3
- package/lib-esm/providers/s3/apis/downloadData.d.ts +2 -3
- package/lib-esm/providers/s3/apis/downloadData.js +2 -3
- package/lib-esm/providers/s3/apis/getProperties.d.ts +2 -2
- package/lib-esm/providers/s3/apis/getProperties.js +2 -2
- package/lib-esm/providers/s3/apis/getUrl.d.ts +3 -2
- package/lib-esm/providers/s3/apis/getUrl.js +3 -2
- package/lib-esm/providers/s3/apis/list.d.ts +4 -4
- package/lib-esm/providers/s3/apis/remove.d.ts +2 -2
- package/lib-esm/providers/s3/apis/remove.js +2 -2
- package/lib-esm/providers/s3/apis/uploadData/index.d.ts +2 -3
- package/lib-esm/providers/s3/apis/uploadData/index.js +2 -3
- package/lib-esm/providers/s3/types/index.d.ts +1 -1
- package/lib-esm/providers/s3/types/inputs.d.ts +26 -2
- package/lib-esm/providers/s3/types/options.d.ts +37 -24
- package/lib-esm/providers/s3/types/outputs.d.ts +31 -1
- package/lib-esm/providers/s3/utils/client/abortMultipartUpload.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/completeMultipartUpload.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/copyObject.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/createMultipartUpload.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/deleteObject.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/getObject.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/headObject.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/listObjectsV2.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/listParts.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/putObject.d.ts +1 -1
- package/lib-esm/providers/s3/utils/client/uploadPart.d.ts +1 -1
- package/lib-esm/providers/s3/utils/transferTask.js +10 -13
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/common.d.ts +1 -7
- package/lib-esm/types/common.js +1 -8
- package/lib-esm/types/index.d.ts +1 -1
- package/lib-esm/types/index.js +1 -1
- package/lib-esm/types/inputs.d.ts +8 -5
- package/lib-esm/types/options.d.ts +2 -12
- package/package.json +4 -4
- package/src/index.ts +1 -1
- package/src/providers/s3/apis/copy.ts +4 -4
- package/src/providers/s3/apis/downloadData.ts +3 -4
- package/src/providers/s3/apis/getProperties.ts +3 -3
- package/src/providers/s3/apis/getUrl.ts +5 -4
- package/src/providers/s3/apis/list.ts +4 -4
- package/src/providers/s3/apis/remove.ts +2 -2
- package/src/providers/s3/apis/uploadData/index.ts +3 -4
- package/src/providers/s3/types/index.ts +2 -0
- package/src/providers/s3/types/inputs.ts +31 -1
- package/src/providers/s3/types/options.ts +74 -53
- package/src/providers/s3/types/outputs.ts +33 -3
- package/src/providers/s3/utils/transferTask.ts +10 -14
- package/src/types/common.ts +6 -7
- package/src/types/index.ts +0 -2
- package/src/types/inputs.ts +10 -7
- package/src/types/options.ts +4 -16
|
@@ -3,16 +3,16 @@ type ListApi = {
|
|
|
3
3
|
/**
|
|
4
4
|
* List files with given prefix in pages
|
|
5
5
|
* pageSize defaulted to 1000. Additionally, the result will include a nextToken if there are more items to retrieve.
|
|
6
|
-
* @param
|
|
7
|
-
* @
|
|
6
|
+
* @param input - The ListPaginateInput object.
|
|
7
|
+
* @returns A list of keys and metadata with
|
|
8
8
|
* @throws service: {@link S3Exception} - S3 service errors thrown when checking for existence of bucket
|
|
9
9
|
* @throws validation: {@link StorageValidationErrorCode } - thrown when there are issues with credentials
|
|
10
10
|
*/
|
|
11
11
|
(input?: ListPaginateInput): Promise<ListPaginateOutput>;
|
|
12
12
|
/**
|
|
13
13
|
* List all files from S3. You can set `listAll` to true in `options` to get all the files from S3.
|
|
14
|
-
* @param
|
|
15
|
-
* @
|
|
14
|
+
* @param input - The ListAllInput object.
|
|
15
|
+
* @returns A list of keys and metadata for all objects in path
|
|
16
16
|
* @throws service: {@link S3Exception} - S3 service errors thrown when checking for existence of bucket
|
|
17
17
|
* @throws validation: {@link StorageValidationErrorCode } - thrown when there are issues with credentials
|
|
18
18
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RemoveInput, RemoveOutput } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Remove a file from your S3 bucket.
|
|
4
|
-
* @param
|
|
5
|
-
* @return
|
|
4
|
+
* @param input - The RemoveInput object.
|
|
5
|
+
* @return Output containing the removed object key
|
|
6
6
|
* @throws service: {@link S3Exception} - S3 service errors thrown while getting properties
|
|
7
7
|
* @throws validation: {@link StorageValidationErrorCode } - Validation errors thrown
|
|
8
8
|
*/
|
|
@@ -4,8 +4,8 @@ import { Amplify } from '@aws-amplify/core';
|
|
|
4
4
|
import { remove as removeInternal } from './internal/remove';
|
|
5
5
|
/**
|
|
6
6
|
* Remove a file from your S3 bucket.
|
|
7
|
-
* @param
|
|
8
|
-
* @return
|
|
7
|
+
* @param input - The RemoveInput object.
|
|
8
|
+
* @return Output containing the removed object key
|
|
9
9
|
* @throws service: {@link S3Exception} - S3 service errors thrown while getting properties
|
|
10
10
|
* @throws validation: {@link StorageValidationErrorCode } - Validation errors thrown
|
|
11
11
|
*/
|
|
@@ -7,9 +7,8 @@ import { UploadDataInput, UploadDataOutput } from '../../types';
|
|
|
7
7
|
* * Maximum object size is 5TB.
|
|
8
8
|
* * Maximum object size if the size cannot be determined before upload is 50GB.
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
11
|
-
*
|
|
12
|
-
* @returns {UploadDataOutput} Cancelable and Resumable task exposing result promise from `result`
|
|
10
|
+
* @param input - The UploadDataInput object.
|
|
11
|
+
* @returns A cancelable and resumable task exposing result promise from `result`
|
|
13
12
|
* property.
|
|
14
13
|
* @throws service: {@link S3Exception} - thrown when checking for existence of the object
|
|
15
14
|
* @throws validation: {@link StorageValidationErrorCode } - Validation errors.
|
|
@@ -15,9 +15,8 @@ import { getMultipartUploadHandlers } from './multipart';
|
|
|
15
15
|
* * Maximum object size is 5TB.
|
|
16
16
|
* * Maximum object size if the size cannot be determined before upload is 50GB.
|
|
17
17
|
*
|
|
18
|
-
* @param
|
|
19
|
-
*
|
|
20
|
-
* @returns {UploadDataOutput} Cancelable and Resumable task exposing result promise from `result`
|
|
18
|
+
* @param input - The UploadDataInput object.
|
|
19
|
+
* @returns A cancelable and resumable task exposing result promise from `result`
|
|
21
20
|
* property.
|
|
22
21
|
* @throws service: {@link S3Exception} - thrown when checking for existence of the object
|
|
23
22
|
* @throws validation: {@link StorageValidationErrorCode } - Validation errors.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { GetUrlOptions, UploadDataOptions, GetPropertiesOptions, ListAllOptions, ListPaginateOptions, RemoveOptions, DownloadDataOptions, } from './options';
|
|
1
|
+
export { GetUrlOptions, UploadDataOptions, GetPropertiesOptions, ListAllOptions, ListPaginateOptions, RemoveOptions, DownloadDataOptions, CopyDestinationOptions, CopySourceOptions, } from './options';
|
|
2
2
|
export { DownloadDataOutput, GetUrlOutput, UploadDataOutput, ListOutputItem, ListAllOutput, ListPaginateOutput, GetPropertiesOutput, CopyOutput, RemoveOutput, } from './outputs';
|
|
3
3
|
export { CopyInput, GetPropertiesInput, GetUrlInput, ListAllInput, ListPaginateInput, RemoveInput, DownloadDataInput, UploadDataInput, } from './inputs';
|
|
4
4
|
export { S3Exception } from './errors';
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import { StorageCopyInput, StorageGetPropertiesInput, StorageGetUrlInput, StorageListInput, StorageRemoveInput, StorageDownloadDataInput, StorageUploadDataInput } from '../../../types';
|
|
2
|
-
import { GetPropertiesOptions, GetUrlOptions, ListAllOptions, ListPaginateOptions, RemoveOptions, DownloadDataOptions, UploadDataOptions } from '../types';
|
|
3
|
-
|
|
2
|
+
import { GetPropertiesOptions, GetUrlOptions, ListAllOptions, ListPaginateOptions, RemoveOptions, DownloadDataOptions, UploadDataOptions, CopyDestinationOptions, CopySourceOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Input type for S3 copy API.
|
|
5
|
+
*/
|
|
6
|
+
export type CopyInput = StorageCopyInput<CopySourceOptions, CopyDestinationOptions>;
|
|
7
|
+
/**
|
|
8
|
+
* Input type for S3 getProperties API.
|
|
9
|
+
*/
|
|
4
10
|
export type GetPropertiesInput = StorageGetPropertiesInput<GetPropertiesOptions>;
|
|
11
|
+
/**
|
|
12
|
+
* Input type for S3 getUrl API.
|
|
13
|
+
*/
|
|
5
14
|
export type GetUrlInput = StorageGetUrlInput<GetUrlOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Input type for S3 list API. Lists all bucket objects.
|
|
17
|
+
*/
|
|
6
18
|
export type ListAllInput = StorageListInput<ListAllOptions>;
|
|
19
|
+
/**
|
|
20
|
+
* Input type for S3 list API. Lists bucket objects with pagination.
|
|
21
|
+
*/
|
|
7
22
|
export type ListPaginateInput = StorageListInput<ListPaginateOptions>;
|
|
23
|
+
/**
|
|
24
|
+
* Input type for S3 remove API.
|
|
25
|
+
*/
|
|
8
26
|
export type RemoveInput = StorageRemoveInput<RemoveOptions>;
|
|
27
|
+
/**
|
|
28
|
+
* Input type for S3 downloadData API.
|
|
29
|
+
*/
|
|
9
30
|
export type DownloadDataInput = StorageDownloadDataInput<DownloadDataOptions>;
|
|
31
|
+
/**
|
|
32
|
+
* Input type for S3 uploadData API.
|
|
33
|
+
*/
|
|
10
34
|
export type UploadDataInput = StorageUploadDataInput<UploadDataOptions>;
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
+
import { StorageAccessLevel } from '@aws-amplify/core';
|
|
1
2
|
import { Credentials } from '@aws-sdk/types';
|
|
2
3
|
import { TransferProgressEvent } from '../../../types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
* Input options type for S3 Storage operations.
|
|
6
|
-
*/
|
|
7
|
-
export type Options = StorageOptions & {
|
|
4
|
+
import { StorageListAllOptions, StorageListPaginateOptions } from '../../../types/options';
|
|
5
|
+
type CommonOptions = {
|
|
8
6
|
/**
|
|
9
7
|
* Whether to use accelerate endpoint.
|
|
10
8
|
* @default false
|
|
11
9
|
*/
|
|
12
10
|
useAccelerateEndpoint?: boolean;
|
|
13
11
|
};
|
|
12
|
+
type ReadOptions = {
|
|
13
|
+
accessLevel?: 'guest' | 'private';
|
|
14
|
+
} | {
|
|
15
|
+
accessLevel: 'protected';
|
|
16
|
+
targetIdentityId?: string;
|
|
17
|
+
};
|
|
18
|
+
type WriteOptions = {
|
|
19
|
+
accessLevel?: StorageAccessLevel;
|
|
20
|
+
};
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
22
|
+
* Transfer-related options type for S3 downloadData, uploadData APIs.
|
|
16
23
|
*/
|
|
17
|
-
|
|
24
|
+
type TransferOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* Callback function tracking the upload/download progress.
|
|
27
|
+
*/
|
|
28
|
+
onProgress?: (event: TransferProgressEvent) => void;
|
|
29
|
+
};
|
|
18
30
|
/**
|
|
19
31
|
* Input options type for S3 getProperties API.
|
|
20
32
|
*/
|
|
21
|
-
export type
|
|
33
|
+
export type GetPropertiesOptions = ReadOptions & CommonOptions;
|
|
22
34
|
/**
|
|
23
|
-
* Input options type for S3
|
|
35
|
+
* Input options type for S3 getProperties API.
|
|
24
36
|
*/
|
|
25
|
-
export type
|
|
37
|
+
export type RemoveOptions = WriteOptions & CommonOptions;
|
|
26
38
|
/**
|
|
27
39
|
* Input options type for S3 list API.
|
|
28
40
|
*/
|
|
29
|
-
export type
|
|
41
|
+
export type ListAllOptions = StorageListAllOptions & ReadOptions & CommonOptions;
|
|
30
42
|
/**
|
|
31
|
-
* Input options type for S3
|
|
43
|
+
* Input options type for S3 list API.
|
|
32
44
|
*/
|
|
33
|
-
export type
|
|
45
|
+
export type ListPaginateOptions = StorageListPaginateOptions & ReadOptions & CommonOptions;
|
|
34
46
|
/**
|
|
35
47
|
* Input options type for S3 getUrl API.
|
|
36
48
|
*/
|
|
37
|
-
export type GetUrlOptions =
|
|
49
|
+
export type GetUrlOptions = ReadOptions & CommonOptions & {
|
|
38
50
|
/**
|
|
39
51
|
* Whether to head object to make sure the object existence before downloading.
|
|
40
52
|
* @default false
|
|
@@ -46,7 +58,11 @@ export type GetUrlOptions = Options & {
|
|
|
46
58
|
*/
|
|
47
59
|
expiresIn?: number;
|
|
48
60
|
};
|
|
49
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Input options type for S3 downloadData API.
|
|
63
|
+
*/
|
|
64
|
+
export type DownloadDataOptions = ReadOptions & CommonOptions & TransferOptions;
|
|
65
|
+
export type UploadDataOptions = WriteOptions & CommonOptions & TransferOptions & {
|
|
50
66
|
/**
|
|
51
67
|
* The default content-disposition header value of the file when downloading it.
|
|
52
68
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
|
|
@@ -68,6 +84,12 @@ export type UploadDataOptions = Omit<TransferOptions, 'targetIdentityId'> & {
|
|
|
68
84
|
*/
|
|
69
85
|
metadata?: Record<string, string>;
|
|
70
86
|
};
|
|
87
|
+
export type CopySourceOptions = ReadOptions & {
|
|
88
|
+
key: string;
|
|
89
|
+
};
|
|
90
|
+
export type CopyDestinationOptions = WriteOptions & {
|
|
91
|
+
key: string;
|
|
92
|
+
};
|
|
71
93
|
/**
|
|
72
94
|
* Internal only type for S3 API handlers' config parameter.
|
|
73
95
|
*
|
|
@@ -80,13 +102,4 @@ export type ResolvedS3Config = {
|
|
|
80
102
|
forcePathStyle?: boolean;
|
|
81
103
|
useAccelerateEndpoint?: boolean;
|
|
82
104
|
};
|
|
83
|
-
/**
|
|
84
|
-
* Input options type for S3 downloadData, uploadData APIs.
|
|
85
|
-
*/
|
|
86
|
-
type TransferOptions = Options & {
|
|
87
|
-
/**
|
|
88
|
-
* Callback function tracking the upload/download progress.
|
|
89
|
-
*/
|
|
90
|
-
onProgress?: (event: TransferProgressEvent) => void;
|
|
91
|
-
};
|
|
92
105
|
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { StorageDownloadDataOutput, StorageGetUrlOutput, StorageItem, StorageListOutput, DownloadTask, UploadTask } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* type for S3 item.
|
|
4
|
+
*/
|
|
2
5
|
export interface Item extends StorageItem {
|
|
3
6
|
/**
|
|
4
7
|
* VersionId used to reference a specific version of the object.
|
|
@@ -9,14 +12,41 @@ export interface Item extends StorageItem {
|
|
|
9
12
|
*/
|
|
10
13
|
contentType?: string;
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* type for S3 list item.
|
|
17
|
+
*/
|
|
18
|
+
export type ListOutputItem = Omit<StorageItem, 'metadata'>;
|
|
19
|
+
/**
|
|
20
|
+
* Output type for S3 downloadData API.
|
|
21
|
+
*/
|
|
12
22
|
export type DownloadDataOutput = DownloadTask<StorageDownloadDataOutput<Item>>;
|
|
23
|
+
/**
|
|
24
|
+
* Output type for S3 getUrl API.
|
|
25
|
+
*/
|
|
13
26
|
export type GetUrlOutput = StorageGetUrlOutput;
|
|
27
|
+
/**
|
|
28
|
+
* Output type for S3 uploadData API.
|
|
29
|
+
*/
|
|
14
30
|
export type UploadDataOutput = UploadTask<Item>;
|
|
31
|
+
/**
|
|
32
|
+
* Output type for S3 getProperties API.
|
|
33
|
+
*/
|
|
15
34
|
export type GetPropertiesOutput = Item;
|
|
16
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Output type for S3 list API. Lists all bucket objects.
|
|
37
|
+
*/
|
|
17
38
|
export type ListAllOutput = StorageListOutput<ListOutputItem>;
|
|
39
|
+
/**
|
|
40
|
+
* Output type for S3 list API. Lists bucket objects with pagination.
|
|
41
|
+
*/
|
|
18
42
|
export type ListPaginateOutput = StorageListOutput<ListOutputItem> & {
|
|
19
43
|
nextToken?: string;
|
|
20
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Output type for S3 copy API.
|
|
47
|
+
*/
|
|
21
48
|
export type CopyOutput = Pick<Item, 'key'>;
|
|
49
|
+
/**
|
|
50
|
+
* Output type for S3 remove API.
|
|
51
|
+
*/
|
|
22
52
|
export type RemoveOutput = Pick<Item, 'key'>;
|
|
@@ -17,7 +17,7 @@ export declare const abortMultipartUpload: (config: {
|
|
|
17
17
|
useAccelerateEndpoint?: boolean | undefined;
|
|
18
18
|
uriEscapePath?: boolean | undefined;
|
|
19
19
|
} & {
|
|
20
|
-
credentials: import("@aws-sdk/types").
|
|
20
|
+
credentials: import("@aws-sdk/types").AwsCredentialIdentity | (() => Promise<import("@aws-sdk/types").AwsCredentialIdentity>);
|
|
21
21
|
maxAttempts?: number | undefined;
|
|
22
22
|
abortSignal?: AbortSignal | undefined;
|
|
23
23
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const completeMultipartUpload: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const copyObject: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -17,7 +17,7 @@ export declare const createMultipartUpload: (config: {
|
|
|
17
17
|
useAccelerateEndpoint?: boolean | undefined;
|
|
18
18
|
uriEscapePath?: boolean | undefined;
|
|
19
19
|
} & {
|
|
20
|
-
credentials: import("@aws-
|
|
20
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
21
21
|
maxAttempts?: number | undefined;
|
|
22
22
|
abortSignal?: AbortSignal | undefined;
|
|
23
23
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const deleteObject: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -17,7 +17,7 @@ export declare const getObject: (config: {
|
|
|
17
17
|
useAccelerateEndpoint?: boolean | undefined;
|
|
18
18
|
uriEscapePath?: boolean | undefined;
|
|
19
19
|
} & {
|
|
20
|
-
credentials: import("@aws-
|
|
20
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
21
21
|
maxAttempts?: number | undefined;
|
|
22
22
|
abortSignal?: AbortSignal | undefined;
|
|
23
23
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const headObject: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const listObjectsV2: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const listParts: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const putObject: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -16,7 +16,7 @@ export declare const uploadPart: (config: {
|
|
|
16
16
|
useAccelerateEndpoint?: boolean | undefined;
|
|
17
17
|
uriEscapePath?: boolean | undefined;
|
|
18
18
|
} & {
|
|
19
|
-
credentials: import("@aws-
|
|
19
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
20
20
|
maxAttempts?: number | undefined;
|
|
21
21
|
abortSignal?: AbortSignal | undefined;
|
|
22
22
|
region: string;
|
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { __awaiter, __generator } from "tslib";
|
|
4
4
|
import { isCancelError } from '../../../errors/CanceledError';
|
|
5
|
-
import { TransferTaskState, } from '../../../types/common';
|
|
6
5
|
var createCancellableTask = function (_a) {
|
|
7
6
|
var job = _a.job, onCancel = _a.onCancel;
|
|
8
|
-
var state =
|
|
7
|
+
var state = 'IN_PROGRESS';
|
|
9
8
|
var abortErrorOverwriteRecord = undefined;
|
|
10
9
|
var cancelableTask = {
|
|
11
10
|
cancel: function (abortErrorOverwrite) {
|
|
12
11
|
abortErrorOverwriteRecord = abortErrorOverwrite;
|
|
13
12
|
var state = cancelableTask.state;
|
|
14
|
-
if (state ===
|
|
15
|
-
state === TransferTaskState.ERROR ||
|
|
16
|
-
state === TransferTaskState.SUCCESS) {
|
|
13
|
+
if (state === 'CANCELED' || state === 'ERROR' || state === 'SUCCESS') {
|
|
17
14
|
return;
|
|
18
15
|
}
|
|
19
|
-
cancelableTask.state =
|
|
16
|
+
cancelableTask.state = 'CANCELED';
|
|
20
17
|
onCancel(abortErrorOverwrite);
|
|
21
18
|
},
|
|
22
19
|
state: state,
|
|
@@ -30,15 +27,15 @@ var createCancellableTask = function (_a) {
|
|
|
30
27
|
return [4 /*yield*/, job()];
|
|
31
28
|
case 1:
|
|
32
29
|
result = _a.sent();
|
|
33
|
-
cancelableTask.state =
|
|
30
|
+
cancelableTask.state = 'SUCCESS';
|
|
34
31
|
return [2 /*return*/, result];
|
|
35
32
|
case 2:
|
|
36
33
|
e_1 = _a.sent();
|
|
37
34
|
if (isCancelError(e_1)) {
|
|
38
|
-
cancelableTask.state =
|
|
35
|
+
cancelableTask.state = 'CANCELED';
|
|
39
36
|
throw abortErrorOverwriteRecord !== null && abortErrorOverwriteRecord !== void 0 ? abortErrorOverwriteRecord : e_1;
|
|
40
37
|
}
|
|
41
|
-
cancelableTask.state =
|
|
38
|
+
cancelableTask.state = 'ERROR';
|
|
42
39
|
throw e_1;
|
|
43
40
|
case 3: return [2 /*return*/];
|
|
44
41
|
}
|
|
@@ -58,20 +55,20 @@ export var createUploadTask = function (_a) {
|
|
|
58
55
|
var uploadTask = Object.assign(cancellableTask, {
|
|
59
56
|
pause: function () {
|
|
60
57
|
var state = uploadTask.state;
|
|
61
|
-
if (!isMultipartUpload || state !==
|
|
58
|
+
if (!isMultipartUpload || state !== 'IN_PROGRESS') {
|
|
62
59
|
return;
|
|
63
60
|
}
|
|
64
61
|
// @ts-ignore
|
|
65
|
-
uploadTask.state =
|
|
62
|
+
uploadTask.state = 'PAUSED';
|
|
66
63
|
onPause === null || onPause === void 0 ? void 0 : onPause();
|
|
67
64
|
},
|
|
68
65
|
resume: function () {
|
|
69
66
|
var state = uploadTask.state;
|
|
70
|
-
if (!isMultipartUpload || state !==
|
|
67
|
+
if (!isMultipartUpload || state !== 'PAUSED') {
|
|
71
68
|
return;
|
|
72
69
|
}
|
|
73
70
|
// @ts-ignore
|
|
74
|
-
uploadTask.state =
|
|
71
|
+
uploadTask.state = 'IN_PROGRESS';
|
|
75
72
|
onResume === null || onResume === void 0 ? void 0 : onResume();
|
|
76
73
|
},
|
|
77
74
|
});
|