@aws-amplify/storage 6.0.28 → 6.0.29-gen2-storage.e54bfa9.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/dist/cjs/errors/types/validation.js +22 -2
- package/dist/cjs/errors/types/validation.js.map +1 -1
- package/dist/cjs/providers/s3/apis/copy.js +2 -12
- package/dist/cjs/providers/s3/apis/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/downloadData.js +13 -38
- package/dist/cjs/providers/s3/apis/downloadData.js.map +1 -1
- package/dist/cjs/providers/s3/apis/getProperties.js +2 -11
- package/dist/cjs/providers/s3/apis/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/getUrl.js +2 -18
- package/dist/cjs/providers/s3/apis/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/copy.js +41 -7
- package/dist/cjs/providers/s3/apis/internal/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/getProperties.js +10 -6
- package/dist/cjs/providers/s3/apis/internal/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/getUrl.js +8 -6
- package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/list.js +86 -16
- package/dist/cjs/providers/s3/apis/internal/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/remove.js +20 -7
- package/dist/cjs/providers/s3/apis/internal/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/list.js +4 -4
- package/dist/cjs/providers/s3/apis/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/remove.js +2 -9
- package/dist/cjs/providers/s3/apis/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/copy.js +4 -4
- package/dist/cjs/providers/s3/apis/server/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/getProperties.js +2 -2
- package/dist/cjs/providers/s3/apis/server/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/getUrl.js +2 -2
- package/dist/cjs/providers/s3/apis/server/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/list.js +4 -4
- package/dist/cjs/providers/s3/apis/server/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/remove.js +2 -2
- package/dist/cjs/providers/s3/apis/server/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/index.js +4 -50
- package/dist/cjs/providers/s3/apis/uploadData/index.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/initialUpload.js +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/initialUpload.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadCache.js +8 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadCache.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadHandlers.js +28 -13
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadHandlers.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/putObjectJob.js +10 -5
- package/dist/cjs/providers/s3/apis/uploadData/putObjectJob.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/constants.js +4 -1
- package/dist/cjs/providers/s3/utils/constants.js.map +1 -1
- package/dist/cjs/providers/s3/utils/index.js +7 -1
- package/dist/cjs/providers/s3/utils/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/isInputWithPath.js +11 -0
- package/dist/cjs/providers/s3/utils/isInputWithPath.js.map +1 -0
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js +2 -1
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js +31 -0
- package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js.map +1 -0
- package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js +32 -0
- package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js.map +1 -0
- package/dist/esm/errors/types/validation.d.ts +7 -2
- package/dist/esm/errors/types/validation.mjs +22 -2
- package/dist/esm/errors/types/validation.mjs.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/providers/s3/apis/copy.d.ts +22 -9
- package/dist/esm/providers/s3/apis/copy.mjs +2 -12
- package/dist/esm/providers/s3/apis/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/downloadData.d.ts +41 -7
- package/dist/esm/providers/s3/apis/downloadData.mjs +15 -39
- package/dist/esm/providers/s3/apis/downloadData.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/getProperties.d.ts +18 -5
- package/dist/esm/providers/s3/apis/getProperties.mjs +2 -11
- package/dist/esm/providers/s3/apis/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/getUrl.d.ts +27 -7
- package/dist/esm/providers/s3/apis/getUrl.mjs +2 -18
- package/dist/esm/providers/s3/apis/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/copy.d.ts +4 -2
- package/dist/esm/providers/s3/apis/internal/copy.mjs +41 -6
- package/dist/esm/providers/s3/apis/internal/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/getProperties.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/getProperties.mjs +11 -6
- package/dist/esm/providers/s3/apis/internal/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/getUrl.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs +10 -7
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/list.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/list.mjs +87 -16
- package/dist/esm/providers/s3/apis/internal/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/remove.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/remove.mjs +21 -7
- package/dist/esm/providers/s3/apis/internal/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/list.d.ts +39 -22
- package/dist/esm/providers/s3/apis/list.mjs +2 -2
- package/dist/esm/providers/s3/apis/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/remove.d.ts +18 -5
- package/dist/esm/providers/s3/apis/remove.mjs +2 -9
- package/dist/esm/providers/s3/apis/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/copy.d.ts +27 -2
- package/dist/esm/providers/s3/apis/server/copy.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/getProperties.d.ts +26 -2
- package/dist/esm/providers/s3/apis/server/getProperties.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/getUrl.d.ts +40 -2
- package/dist/esm/providers/s3/apis/server/getUrl.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/list.d.ts +41 -22
- package/dist/esm/providers/s3/apis/server/list.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/remove.d.ts +24 -2
- package/dist/esm/providers/s3/apis/server/remove.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/index.d.ts +64 -7
- package/dist/esm/providers/s3/apis/uploadData/index.mjs +4 -50
- package/dist/esm/providers/s3/apis/uploadData/index.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.d.ts +2 -2
- package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.mjs +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.d.ts +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.mjs +8 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.d.ts +4 -4
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.mjs +30 -14
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.d.ts +3 -3
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.mjs +11 -5
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.mjs.map +1 -1
- package/dist/esm/providers/s3/index.d.ts +2 -2
- package/dist/esm/providers/s3/types/index.d.ts +3 -3
- package/dist/esm/providers/s3/types/inputs.d.ts +51 -11
- package/dist/esm/providers/s3/types/options.d.ts +41 -10
- package/dist/esm/providers/s3/types/outputs.d.ts +68 -13
- package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs +1 -1
- package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/constants.d.ts +3 -0
- package/dist/esm/providers/s3/utils/constants.mjs +4 -1
- package/dist/esm/providers/s3/utils/constants.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/index.d.ts +3 -0
- package/dist/esm/providers/s3/utils/index.mjs +3 -0
- package/dist/esm/providers/s3/utils/index.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/isInputWithPath.d.ts +2 -0
- package/dist/esm/providers/s3/utils/isInputWithPath.mjs +8 -0
- package/dist/esm/providers/s3/utils/isInputWithPath.mjs.map +1 -0
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.d.ts +2 -1
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs +2 -1
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.d.ts +5 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs +29 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs.map +1 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.d.ts +5 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs +30 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs.map +1 -0
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/inputs.d.ts +41 -13
- package/dist/esm/types/options.d.ts +1 -0
- package/dist/esm/types/outputs.d.ts +26 -6
- package/package.json +107 -107
- package/src/errors/types/validation.ts +23 -2
- package/src/index.ts +16 -0
- package/src/providers/s3/apis/copy.ts +30 -11
- package/src/providers/s3/apis/downloadData.ts +78 -19
- package/src/providers/s3/apis/getProperties.ts +31 -8
- package/src/providers/s3/apis/getUrl.ts +37 -10
- package/src/providers/s3/apis/internal/copy.ts +89 -8
- package/src/providers/s3/apis/internal/getProperties.ts +27 -12
- package/src/providers/s3/apis/internal/getUrl.ts +28 -14
- package/src/providers/s3/apis/internal/list.ts +135 -29
- package/src/providers/s3/apis/internal/remove.ts +36 -13
- package/src/providers/s3/apis/list.ts +54 -26
- package/src/providers/s3/apis/remove.ts +28 -7
- package/src/providers/s3/apis/server/copy.ts +42 -5
- package/src/providers/s3/apis/server/getProperties.ts +41 -4
- package/src/providers/s3/apis/server/getUrl.ts +55 -4
- package/src/providers/s3/apis/server/list.ts +64 -32
- package/src/providers/s3/apis/server/remove.ts +39 -4
- package/src/providers/s3/apis/uploadData/index.ts +77 -8
- package/src/providers/s3/apis/uploadData/multipart/initialUpload.ts +4 -3
- package/src/providers/s3/apis/uploadData/multipart/uploadCache.ts +11 -2
- package/src/providers/s3/apis/uploadData/multipart/uploadHandlers.ts +50 -20
- package/src/providers/s3/apis/uploadData/putObjectJob.ts +23 -9
- package/src/providers/s3/index.ts +16 -0
- package/src/providers/s3/types/index.ts +37 -14
- package/src/providers/s3/types/inputs.ts +95 -26
- package/src/providers/s3/types/options.ts +73 -27
- package/src/providers/s3/types/outputs.ts +80 -13
- package/src/providers/s3/utils/client/utils/parsePayload.ts +1 -1
- package/src/providers/s3/utils/constants.ts +4 -0
- package/src/providers/s3/utils/index.ts +3 -0
- package/src/providers/s3/utils/isInputWithPath.ts +13 -0
- package/src/providers/s3/utils/resolveS3ConfigAndInput.ts +3 -2
- package/src/providers/s3/utils/validateStorageOperationInput.ts +39 -0
- package/src/providers/s3/utils/validateStorageOperationInputWithPrefix.ts +46 -0
- package/src/types/index.ts +16 -8
- package/src/types/inputs.ts +73 -20
- package/src/types/options.ts +1 -0
- package/src/types/outputs.ts +29 -6
|
@@ -2,35 +2,58 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
GetUrlOptionsWithKey,
|
|
6
|
+
GetUrlOptionsWithPath,
|
|
7
|
+
UploadDataOptionsWithPath,
|
|
8
|
+
UploadDataOptionsWithKey,
|
|
9
|
+
GetPropertiesOptionsWithKey,
|
|
10
|
+
GetPropertiesOptionsWithPath,
|
|
11
|
+
ListAllOptionsWithPrefix,
|
|
12
|
+
ListPaginateOptionsWithPrefix,
|
|
13
|
+
ListAllOptionsWithPath,
|
|
14
|
+
ListPaginateOptionsWithPath,
|
|
10
15
|
RemoveOptions,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
DownloadDataOptionsWithPath,
|
|
17
|
+
DownloadDataOptionsWithKey,
|
|
18
|
+
CopyDestinationOptionsWithKey,
|
|
19
|
+
CopySourceOptionsWithKey,
|
|
14
20
|
} from './options';
|
|
15
21
|
export {
|
|
16
|
-
DownloadDataOutput,
|
|
17
|
-
GetUrlOutput,
|
|
18
22
|
UploadDataOutput,
|
|
19
|
-
|
|
23
|
+
UploadDataWithPathOutput,
|
|
24
|
+
DownloadDataOutput,
|
|
25
|
+
DownloadDataWithPathOutput,
|
|
26
|
+
RemoveOutput,
|
|
27
|
+
RemoveWithPathOutput,
|
|
20
28
|
ListAllOutput,
|
|
29
|
+
ListAllWithPathOutput,
|
|
21
30
|
ListPaginateOutput,
|
|
31
|
+
ListPaginateWithPathOutput,
|
|
22
32
|
GetPropertiesOutput,
|
|
33
|
+
GetPropertiesWithPathOutput,
|
|
23
34
|
CopyOutput,
|
|
24
|
-
|
|
35
|
+
CopyWithPathOutput,
|
|
36
|
+
GetUrlOutput,
|
|
37
|
+
GetUrlWithPathOutput,
|
|
38
|
+
ListOutputItem,
|
|
39
|
+
ListOutputItemWithPath,
|
|
25
40
|
} from './outputs';
|
|
26
41
|
export {
|
|
27
42
|
CopyInput,
|
|
43
|
+
CopyWithPathInput,
|
|
28
44
|
GetPropertiesInput,
|
|
45
|
+
GetPropertiesWithPathInput,
|
|
29
46
|
GetUrlInput,
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
GetUrlWithPathInput,
|
|
48
|
+
RemoveWithPathInput,
|
|
32
49
|
RemoveInput,
|
|
33
50
|
DownloadDataInput,
|
|
51
|
+
DownloadDataWithPathInput,
|
|
34
52
|
UploadDataInput,
|
|
53
|
+
UploadDataWithPathInput,
|
|
54
|
+
ListAllInput,
|
|
55
|
+
ListPaginateInput,
|
|
56
|
+
ListAllWithPathInput,
|
|
57
|
+
ListPaginateWithPathInput,
|
|
35
58
|
} from './inputs';
|
|
36
59
|
export { S3Exception } from './errors';
|
|
@@ -2,67 +2,136 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
StorageCopyInputWithKey,
|
|
6
|
+
StorageCopyInputWithPath,
|
|
7
|
+
StorageDownloadDataInputWithKey,
|
|
8
|
+
StorageDownloadDataInputWithPath,
|
|
9
|
+
StorageGetPropertiesInputWithKey,
|
|
10
|
+
StorageGetPropertiesInputWithPath,
|
|
11
|
+
StorageGetUrlInputWithKey,
|
|
12
|
+
StorageGetUrlInputWithPath,
|
|
13
|
+
StorageListInputWithPath,
|
|
14
|
+
StorageListInputWithPrefix,
|
|
15
|
+
StorageRemoveInputWithKey,
|
|
16
|
+
StorageRemoveInputWithPath,
|
|
17
|
+
StorageUploadDataInputWithKey,
|
|
18
|
+
StorageUploadDataInputWithPath,
|
|
12
19
|
} from '../../../types';
|
|
13
20
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
CopyDestinationOptionsWithKey,
|
|
22
|
+
CopySourceOptionsWithKey,
|
|
23
|
+
DownloadDataOptionsWithKey,
|
|
24
|
+
DownloadDataOptionsWithPath,
|
|
25
|
+
GetPropertiesOptionsWithKey,
|
|
26
|
+
GetPropertiesOptionsWithPath,
|
|
27
|
+
GetUrlOptionsWithKey,
|
|
28
|
+
GetUrlOptionsWithPath,
|
|
29
|
+
ListAllOptionsWithPath,
|
|
30
|
+
ListAllOptionsWithPrefix,
|
|
31
|
+
ListPaginateOptionsWithPath,
|
|
32
|
+
ListPaginateOptionsWithPrefix,
|
|
21
33
|
RemoveOptions,
|
|
22
|
-
|
|
34
|
+
UploadDataOptionsWithKey,
|
|
35
|
+
UploadDataOptionsWithPath,
|
|
23
36
|
} from '../types';
|
|
24
37
|
|
|
25
38
|
// TODO: support use accelerate endpoint option
|
|
26
39
|
/**
|
|
40
|
+
* @deprecated Use {@link CopyWithPathInput} instead.
|
|
27
41
|
* Input type for S3 copy API.
|
|
28
42
|
*/
|
|
29
|
-
export type CopyInput =
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
export type CopyInput = StorageCopyInputWithKey<
|
|
44
|
+
CopySourceOptionsWithKey,
|
|
45
|
+
CopyDestinationOptionsWithKey
|
|
32
46
|
>;
|
|
47
|
+
/**
|
|
48
|
+
* Input type with path for S3 copy API.
|
|
49
|
+
*/
|
|
50
|
+
export type CopyWithPathInput = StorageCopyInputWithPath;
|
|
33
51
|
|
|
34
52
|
/**
|
|
53
|
+
* @deprecated Use {@link GetPropertiesWithPathInput} instead.
|
|
35
54
|
* Input type for S3 getProperties API.
|
|
36
55
|
*/
|
|
37
56
|
export type GetPropertiesInput =
|
|
38
|
-
|
|
57
|
+
StorageGetPropertiesInputWithKey<GetPropertiesOptionsWithKey>;
|
|
58
|
+
/**
|
|
59
|
+
* Input type with for S3 getProperties API.
|
|
60
|
+
*/
|
|
61
|
+
export type GetPropertiesWithPathInput =
|
|
62
|
+
StorageGetPropertiesInputWithPath<GetPropertiesOptionsWithPath>;
|
|
39
63
|
|
|
40
64
|
/**
|
|
65
|
+
* @deprecated Use {@link GetUrlWithPathInput} instead.
|
|
41
66
|
* Input type for S3 getUrl API.
|
|
42
67
|
*/
|
|
43
|
-
export type GetUrlInput =
|
|
68
|
+
export type GetUrlInput = StorageGetUrlInputWithKey<GetUrlOptionsWithKey>;
|
|
69
|
+
/**
|
|
70
|
+
* Input type with path for S3 getUrl API.
|
|
71
|
+
*/
|
|
72
|
+
export type GetUrlWithPathInput =
|
|
73
|
+
StorageGetUrlInputWithPath<GetUrlOptionsWithPath>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Input type with path for S3 list API. Lists all bucket objects.
|
|
77
|
+
*/
|
|
78
|
+
export type ListAllWithPathInput =
|
|
79
|
+
StorageListInputWithPath<ListAllOptionsWithPath>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Input type with path for S3 list API. Lists bucket objects with pagination.
|
|
83
|
+
*/
|
|
84
|
+
export type ListPaginateWithPathInput =
|
|
85
|
+
StorageListInputWithPath<ListPaginateOptionsWithPath>;
|
|
44
86
|
|
|
45
87
|
/**
|
|
88
|
+
* @deprecated Use {@link ListAllWithPathInput} instead.
|
|
46
89
|
* Input type for S3 list API. Lists all bucket objects.
|
|
47
90
|
*/
|
|
48
|
-
export type ListAllInput =
|
|
91
|
+
export type ListAllInput = StorageListInputWithPrefix<ListAllOptionsWithPrefix>;
|
|
49
92
|
|
|
50
93
|
/**
|
|
94
|
+
* @deprecated Use {@link ListPaginateWithPathInput} instead.
|
|
51
95
|
* Input type for S3 list API. Lists bucket objects with pagination.
|
|
52
96
|
*/
|
|
53
|
-
export type ListPaginateInput =
|
|
97
|
+
export type ListPaginateInput =
|
|
98
|
+
StorageListInputWithPrefix<ListPaginateOptionsWithPrefix>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use {@link RemoveWithPathInput} instead.
|
|
102
|
+
* Input type with key for S3 remove API.
|
|
103
|
+
*/
|
|
104
|
+
export type RemoveInput = StorageRemoveInputWithKey<RemoveOptions>;
|
|
54
105
|
|
|
55
106
|
/**
|
|
56
|
-
* Input type for S3 remove API.
|
|
107
|
+
* Input type with path for S3 remove API.
|
|
57
108
|
*/
|
|
58
|
-
export type
|
|
109
|
+
export type RemoveWithPathInput = StorageRemoveInputWithPath<
|
|
110
|
+
Omit<RemoveOptions, 'accessLevel'>
|
|
111
|
+
>;
|
|
59
112
|
|
|
60
113
|
/**
|
|
114
|
+
* @deprecated Use {@link DownloadDataWithPathInput} instead.
|
|
61
115
|
* Input type for S3 downloadData API.
|
|
62
116
|
*/
|
|
63
|
-
export type DownloadDataInput =
|
|
117
|
+
export type DownloadDataInput =
|
|
118
|
+
StorageDownloadDataInputWithKey<DownloadDataOptionsWithKey>;
|
|
64
119
|
|
|
65
120
|
/**
|
|
121
|
+
* Input type with path for S3 downloadData API.
|
|
122
|
+
*/
|
|
123
|
+
export type DownloadDataWithPathInput =
|
|
124
|
+
StorageDownloadDataInputWithPath<DownloadDataOptionsWithPath>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated Use {@link UploadDataWithPathInput} instead.
|
|
66
128
|
* Input type for S3 uploadData API.
|
|
67
129
|
*/
|
|
68
|
-
export type UploadDataInput =
|
|
130
|
+
export type UploadDataInput =
|
|
131
|
+
StorageUploadDataInputWithKey<UploadDataOptionsWithKey>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Input type with path for S3 uploadData API.
|
|
135
|
+
*/
|
|
136
|
+
export type UploadDataWithPathInput =
|
|
137
|
+
StorageUploadDataInputWithPath<UploadDataOptionsWithPath>;
|
|
@@ -18,11 +18,22 @@ interface CommonOptions {
|
|
|
18
18
|
useAccelerateEndpoint?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/** @deprecated This may be removed in the next major version. */
|
|
21
22
|
type ReadOptions =
|
|
22
|
-
| {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
| {
|
|
24
|
+
/** @deprecated This may be removed in the next major version. */
|
|
25
|
+
accessLevel?: 'guest' | 'private';
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
/** @deprecated This may be removed in the next major version. */
|
|
29
|
+
accessLevel: 'protected';
|
|
30
|
+
/** @deprecated This may be removed in the next major version. */
|
|
31
|
+
targetIdentityId?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @deprecated This may be removed in the next major version. */
|
|
25
35
|
interface WriteOptions {
|
|
36
|
+
/** @deprecated This may be removed in the next major version. */
|
|
26
37
|
accessLevel?: StorageAccessLevel;
|
|
27
38
|
}
|
|
28
39
|
|
|
@@ -46,7 +57,9 @@ interface TransferOptions {
|
|
|
46
57
|
/**
|
|
47
58
|
* Input options type for S3 getProperties API.
|
|
48
59
|
*/
|
|
49
|
-
|
|
60
|
+
/** @deprecated Use {@link GetPropertiesOptionsWithPath} instead. */
|
|
61
|
+
export type GetPropertiesOptionsWithKey = ReadOptions & CommonOptions;
|
|
62
|
+
export type GetPropertiesOptionsWithPath = CommonOptions;
|
|
50
63
|
|
|
51
64
|
/**
|
|
52
65
|
* Input options type for S3 getProperties API.
|
|
@@ -54,46 +67,71 @@ export type GetPropertiesOptions = ReadOptions & CommonOptions;
|
|
|
54
67
|
export type RemoveOptions = WriteOptions & CommonOptions;
|
|
55
68
|
|
|
56
69
|
/**
|
|
57
|
-
*
|
|
70
|
+
* @deprecated Use {@link ListAllOptionsWithPath} instead.
|
|
71
|
+
* Input options type with prefix for S3 list all API.
|
|
58
72
|
*/
|
|
59
|
-
export type
|
|
73
|
+
export type ListAllOptionsWithPrefix = StorageListAllOptions &
|
|
60
74
|
ReadOptions &
|
|
61
75
|
CommonOptions;
|
|
62
76
|
|
|
63
77
|
/**
|
|
64
|
-
*
|
|
78
|
+
* @deprecated Use {@link ListPaginateOptionsWithPath} instead.
|
|
79
|
+
* Input options type with prefix for S3 list API to paginate items.
|
|
65
80
|
*/
|
|
66
|
-
export type
|
|
81
|
+
export type ListPaginateOptionsWithPrefix = StorageListPaginateOptions &
|
|
67
82
|
ReadOptions &
|
|
68
83
|
CommonOptions;
|
|
69
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Input options type with path for S3 list all API.
|
|
87
|
+
*/
|
|
88
|
+
export type ListAllOptionsWithPath = Omit<
|
|
89
|
+
StorageListAllOptions,
|
|
90
|
+
'accessLevel'
|
|
91
|
+
> &
|
|
92
|
+
CommonOptions;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Input options type with path for S3 list API to paginate items.
|
|
96
|
+
*/
|
|
97
|
+
export type ListPaginateOptionsWithPath = Omit<
|
|
98
|
+
StorageListPaginateOptions,
|
|
99
|
+
'accessLevel'
|
|
100
|
+
> &
|
|
101
|
+
CommonOptions;
|
|
102
|
+
|
|
70
103
|
/**
|
|
71
104
|
* Input options type for S3 getUrl API.
|
|
72
105
|
*/
|
|
73
|
-
export type GetUrlOptions =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
106
|
+
export type GetUrlOptions = CommonOptions & {
|
|
107
|
+
/**
|
|
108
|
+
* Whether to head object to make sure the object existence before downloading.
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
validateObjectExistence?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Number of seconds till the URL expires.
|
|
114
|
+
* @default 900 (15 minutes)
|
|
115
|
+
*/
|
|
116
|
+
expiresIn?: number;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** @deprecated Use {@link GetUrlOptionsWithPath} instead. */
|
|
120
|
+
export type GetUrlOptionsWithKey = ReadOptions & GetUrlOptions;
|
|
121
|
+
export type GetUrlOptionsWithPath = GetUrlOptions;
|
|
86
122
|
|
|
87
123
|
/**
|
|
88
124
|
* Input options type for S3 downloadData API.
|
|
89
125
|
*/
|
|
90
|
-
export type DownloadDataOptions =
|
|
91
|
-
CommonOptions &
|
|
126
|
+
export type DownloadDataOptions = CommonOptions &
|
|
92
127
|
TransferOptions &
|
|
93
128
|
BytesRangeOptions;
|
|
94
129
|
|
|
95
|
-
|
|
96
|
-
|
|
130
|
+
/** @deprecated Use {@link DownloadDataOptionsWithPath} instead. */
|
|
131
|
+
export type DownloadDataOptionsWithKey = ReadOptions & DownloadDataOptions;
|
|
132
|
+
export type DownloadDataOptionsWithPath = DownloadDataOptions;
|
|
133
|
+
|
|
134
|
+
export type UploadDataOptions = CommonOptions &
|
|
97
135
|
TransferOptions & {
|
|
98
136
|
/**
|
|
99
137
|
* The default content-disposition header value of the file when downloading it.
|
|
@@ -117,11 +155,19 @@ export type UploadDataOptions = WriteOptions &
|
|
|
117
155
|
metadata?: Record<string, string>;
|
|
118
156
|
};
|
|
119
157
|
|
|
120
|
-
|
|
158
|
+
/** @deprecated Use {@link UploadDataOptionsWithPath} instead. */
|
|
159
|
+
export type UploadDataOptionsWithKey = WriteOptions & UploadDataOptions;
|
|
160
|
+
export type UploadDataOptionsWithPath = UploadDataOptions;
|
|
161
|
+
|
|
162
|
+
/** @deprecated This may be removed in the next major version. */
|
|
163
|
+
export type CopySourceOptionsWithKey = ReadOptions & {
|
|
164
|
+
/** @deprecated This may be removed in the next major version. */
|
|
121
165
|
key: string;
|
|
122
166
|
};
|
|
123
167
|
|
|
124
|
-
|
|
168
|
+
/** @deprecated This may be removed in the next major version. */
|
|
169
|
+
export type CopyDestinationOptionsWithKey = WriteOptions & {
|
|
170
|
+
/** @deprecated This may be removed in the next major version. */
|
|
125
171
|
key: string;
|
|
126
172
|
};
|
|
127
173
|
|
|
@@ -5,15 +5,16 @@ import {
|
|
|
5
5
|
DownloadTask,
|
|
6
6
|
StorageDownloadDataOutput,
|
|
7
7
|
StorageGetUrlOutput,
|
|
8
|
-
|
|
8
|
+
StorageItemWithKey,
|
|
9
|
+
StorageItemWithPath,
|
|
9
10
|
StorageListOutput,
|
|
10
11
|
UploadTask,
|
|
11
12
|
} from '../../../types';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* type for S3 item.
|
|
15
|
+
* Base type for an S3 item.
|
|
15
16
|
*/
|
|
16
|
-
export interface
|
|
17
|
+
export interface ItemBase {
|
|
17
18
|
/**
|
|
18
19
|
* VersionId used to reference a specific version of the object.
|
|
19
20
|
*/
|
|
@@ -25,36 +26,83 @@ export interface Item extends StorageItem {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* @deprecated Use {@link ListOutputItemWithPath} instead.
|
|
30
|
+
* type for S3 list item with key.
|
|
29
31
|
*/
|
|
30
|
-
export type ListOutputItem = Omit<
|
|
32
|
+
export type ListOutputItem = Omit<ItemWithKey, 'metadata'>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* type for S3 list item with path.
|
|
36
|
+
*/
|
|
37
|
+
export type ListOutputItemWithPath = Omit<ItemWithPath, 'metadata'>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use {@link ItemWithPath} instead.
|
|
41
|
+
*/
|
|
42
|
+
export type ItemWithKey = ItemBase & StorageItemWithKey;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* type for S3 list item with path.
|
|
46
|
+
*/
|
|
47
|
+
export type ItemWithPath = ItemBase & StorageItemWithPath;
|
|
31
48
|
|
|
32
49
|
/**
|
|
33
50
|
* Output type for S3 downloadData API.
|
|
51
|
+
* @deprecated Use {@link DownloadDataWithPathOutput} instead.
|
|
52
|
+
*/
|
|
53
|
+
export type DownloadDataOutput = DownloadTask<
|
|
54
|
+
StorageDownloadDataOutput<ItemWithKey>
|
|
55
|
+
>;
|
|
56
|
+
/**
|
|
57
|
+
* Output type with path for S3 downloadData API.
|
|
34
58
|
*/
|
|
35
|
-
export type
|
|
59
|
+
export type DownloadDataWithPathOutput = DownloadTask<
|
|
60
|
+
StorageDownloadDataOutput<ItemWithPath>
|
|
61
|
+
>;
|
|
36
62
|
|
|
37
63
|
/**
|
|
38
64
|
* Output type for S3 getUrl API.
|
|
65
|
+
* @deprecated Use {@link GetUrlWithPathOutput} instead.
|
|
39
66
|
*/
|
|
40
67
|
export type GetUrlOutput = StorageGetUrlOutput;
|
|
68
|
+
/**
|
|
69
|
+
* Output type with path for S3 getUrl API.
|
|
70
|
+
* */
|
|
71
|
+
export type GetUrlWithPathOutput = StorageGetUrlOutput;
|
|
41
72
|
|
|
42
73
|
/**
|
|
43
74
|
* Output type for S3 uploadData API.
|
|
75
|
+
* @deprecated Use {@link UploadDataWithPathOutput} instead.
|
|
44
76
|
*/
|
|
45
|
-
export type UploadDataOutput = UploadTask<
|
|
77
|
+
export type UploadDataOutput = UploadTask<ItemWithKey>;
|
|
78
|
+
/**
|
|
79
|
+
* Output type with path for S3 uploadData API.
|
|
80
|
+
* */
|
|
81
|
+
export type UploadDataWithPathOutput = UploadTask<ItemWithPath>;
|
|
46
82
|
|
|
47
83
|
/**
|
|
48
84
|
* Output type for S3 getProperties API.
|
|
49
|
-
|
|
50
|
-
|
|
85
|
+
* @deprecated Use {@link GetPropertiesWithPathOutput} instead.
|
|
86
|
+
* */
|
|
87
|
+
export type GetPropertiesOutput = ItemBase & StorageItemWithKey;
|
|
88
|
+
/**
|
|
89
|
+
* Output type with path for S3 getProperties API.
|
|
90
|
+
* */
|
|
91
|
+
export type GetPropertiesWithPathOutput = ItemBase & StorageItemWithPath;
|
|
51
92
|
|
|
52
93
|
/**
|
|
94
|
+
* @deprecated Use {@link ListAllWithPathOutput} instead.
|
|
53
95
|
* Output type for S3 list API. Lists all bucket objects.
|
|
54
96
|
*/
|
|
55
97
|
export type ListAllOutput = StorageListOutput<ListOutputItem>;
|
|
56
98
|
|
|
57
99
|
/**
|
|
100
|
+
* Output type with path for S3 list API. Lists all bucket objects.
|
|
101
|
+
*/
|
|
102
|
+
export type ListAllWithPathOutput = StorageListOutput<ListOutputItemWithPath>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Use {@link ListPaginateWithPathOutput} instead.
|
|
58
106
|
* Output type for S3 list API. Lists bucket objects with pagination.
|
|
59
107
|
*/
|
|
60
108
|
export type ListPaginateOutput = StorageListOutput<ListOutputItem> & {
|
|
@@ -62,11 +110,30 @@ export type ListPaginateOutput = StorageListOutput<ListOutputItem> & {
|
|
|
62
110
|
};
|
|
63
111
|
|
|
64
112
|
/**
|
|
65
|
-
* Output type for S3
|
|
113
|
+
* Output type with path for S3 list API. Lists bucket objects with pagination.
|
|
114
|
+
*/
|
|
115
|
+
export type ListPaginateWithPathOutput =
|
|
116
|
+
StorageListOutput<ListOutputItemWithPath> & {
|
|
117
|
+
nextToken?: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Output type with path for S3 copy API.
|
|
122
|
+
* @deprecated Use {@link CopyWithPathOutput} instead.
|
|
123
|
+
*/
|
|
124
|
+
export type CopyOutput = Pick<ItemWithKey, 'key'>;
|
|
125
|
+
/**
|
|
126
|
+
* Output type with path for S3 copy API.
|
|
127
|
+
*/
|
|
128
|
+
export type CopyWithPathOutput = Pick<ItemWithPath, 'path'>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated Use {@link RemoveWithPathOutput} instead.
|
|
132
|
+
* Output type with key for S3 remove API.
|
|
66
133
|
*/
|
|
67
|
-
export type
|
|
134
|
+
export type RemoveOutput = Pick<ItemWithKey, 'key'>;
|
|
68
135
|
|
|
69
136
|
/**
|
|
70
|
-
* Output type for S3 remove API.
|
|
137
|
+
* Output type with path for S3 remove API.
|
|
71
138
|
*/
|
|
72
|
-
export type
|
|
139
|
+
export type RemoveWithPathOutput = Pick<ItemWithPath, 'path'>;
|
|
@@ -39,7 +39,7 @@ export const parseXmlBody = async (response: HttpResponse): Promise<any> => {
|
|
|
39
39
|
try {
|
|
40
40
|
return parser.parse(data);
|
|
41
41
|
} catch (error) {
|
|
42
|
-
throw new Error(
|
|
42
|
+
throw new Error(`Failed to parse XML response: ${error}`);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -19,3 +19,7 @@ export const MAX_PARTS_COUNT = 10000;
|
|
|
19
19
|
export const DEFAULT_QUEUE_SIZE = 4;
|
|
20
20
|
|
|
21
21
|
export const UPLOADS_STORAGE_KEY = '__uploadInProgress';
|
|
22
|
+
|
|
23
|
+
export const STORAGE_INPUT_PREFIX = 'prefix';
|
|
24
|
+
export const STORAGE_INPUT_KEY = 'key';
|
|
25
|
+
export const STORAGE_INPUT_PATH = 'path';
|
|
@@ -4,3 +4,6 @@
|
|
|
4
4
|
export { calculateContentMd5 } from './md5';
|
|
5
5
|
export { resolveS3ConfigAndInput } from './resolveS3ConfigAndInput';
|
|
6
6
|
export { createDownloadTask, createUploadTask } from './transferTask';
|
|
7
|
+
export { validateStorageOperationInput } from './validateStorageOperationInput';
|
|
8
|
+
export { validateStorageOperationInputWithPrefix } from './validateStorageOperationInputWithPrefix';
|
|
9
|
+
export { isInputWithPath } from './isInputWithPath';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
StorageOperationInput,
|
|
6
|
+
StorageOperationInputWithPath,
|
|
7
|
+
} from '../../../types/inputs';
|
|
8
|
+
|
|
9
|
+
export const isInputWithPath = (
|
|
10
|
+
input: StorageOperationInput,
|
|
11
|
+
): input is StorageOperationInputWithPath => {
|
|
12
|
+
return input.path !== undefined;
|
|
13
|
+
};
|
|
@@ -5,7 +5,6 @@ import { AmplifyClassV6, StorageAccessLevel } from '@aws-amplify/core';
|
|
|
5
5
|
|
|
6
6
|
import { assertValidationError } from '../../../errors/utils/assertValidationError';
|
|
7
7
|
import { StorageValidationErrorCode } from '../../../errors/types/validation';
|
|
8
|
-
import { StorageError } from '../../../errors/StorageError';
|
|
9
8
|
import { resolvePrefix as defaultPrefixResolver } from '../../../utils/resolvePrefix';
|
|
10
9
|
import { ResolvedS3Config } from '../types/options';
|
|
11
10
|
|
|
@@ -22,6 +21,7 @@ interface ResolvedS3ConfigAndInput {
|
|
|
22
21
|
bucket: string;
|
|
23
22
|
keyPrefix: string;
|
|
24
23
|
isObjectLockEnabled?: boolean;
|
|
24
|
+
identityId?: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -30,7 +30,7 @@ interface ResolvedS3ConfigAndInput {
|
|
|
30
30
|
* @param {AmplifyClassV6} amplify The Amplify instance.
|
|
31
31
|
* @param {S3ApiOptions} apiOptions The input options for S3 provider.
|
|
32
32
|
* @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.
|
|
33
|
-
* @throws A
|
|
33
|
+
* @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid
|
|
34
34
|
* configurations or Amplify library options.
|
|
35
35
|
*
|
|
36
36
|
* @internal
|
|
@@ -84,6 +84,7 @@ export const resolveS3ConfigAndInput = async (
|
|
|
84
84
|
},
|
|
85
85
|
bucket,
|
|
86
86
|
keyPrefix,
|
|
87
|
+
identityId,
|
|
87
88
|
isObjectLockEnabled,
|
|
88
89
|
};
|
|
89
90
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { StorageOperationInput as Input } from '../../../types/inputs';
|
|
5
|
+
import { assertValidationError } from '../../../errors/utils/assertValidationError';
|
|
6
|
+
import { StorageValidationErrorCode } from '../../../errors/types/validation';
|
|
7
|
+
|
|
8
|
+
import { isInputWithPath } from './isInputWithPath';
|
|
9
|
+
import { STORAGE_INPUT_KEY, STORAGE_INPUT_PATH } from './constants';
|
|
10
|
+
|
|
11
|
+
export const validateStorageOperationInput = (
|
|
12
|
+
input: Input,
|
|
13
|
+
identityId?: string,
|
|
14
|
+
) => {
|
|
15
|
+
assertValidationError(
|
|
16
|
+
// Key present without a path
|
|
17
|
+
(!!(input as Input).key && !(input as Input).path) ||
|
|
18
|
+
// Path present without a key
|
|
19
|
+
(!(input as Input).key && !!(input as Input).path),
|
|
20
|
+
StorageValidationErrorCode.InvalidStorageOperationInput,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (isInputWithPath(input)) {
|
|
24
|
+
const { path } = input;
|
|
25
|
+
const objectKey = typeof path === 'string' ? path : path({ identityId });
|
|
26
|
+
|
|
27
|
+
assertValidationError(
|
|
28
|
+
!objectKey.startsWith('/'),
|
|
29
|
+
StorageValidationErrorCode.InvalidStoragePathInput,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
inputType: STORAGE_INPUT_PATH,
|
|
34
|
+
objectKey,
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
return { inputType: STORAGE_INPUT_KEY, objectKey: input.key };
|
|
38
|
+
}
|
|
39
|
+
};
|