@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
|
@@ -11,11 +11,16 @@ var StorageValidationErrorCode;
|
|
|
11
11
|
StorageValidationErrorCode["NoKey"] = "NoKey";
|
|
12
12
|
StorageValidationErrorCode["NoSourceKey"] = "NoSourceKey";
|
|
13
13
|
StorageValidationErrorCode["NoDestinationKey"] = "NoDestinationKey";
|
|
14
|
+
StorageValidationErrorCode["NoSourcePath"] = "NoSourcePath";
|
|
15
|
+
StorageValidationErrorCode["NoDestinationPath"] = "NoDestinationPath";
|
|
14
16
|
StorageValidationErrorCode["NoBucket"] = "NoBucket";
|
|
15
17
|
StorageValidationErrorCode["NoRegion"] = "NoRegion";
|
|
16
|
-
StorageValidationErrorCode["
|
|
17
|
-
StorageValidationErrorCode["
|
|
18
|
+
StorageValidationErrorCode["InvalidStorageOperationPrefixInput"] = "InvalidStorageOperationPrefixInput";
|
|
19
|
+
StorageValidationErrorCode["InvalidStorageOperationInput"] = "InvalidStorageOperationInput";
|
|
20
|
+
StorageValidationErrorCode["InvalidStoragePathInput"] = "InvalidStoragePathInput";
|
|
18
21
|
StorageValidationErrorCode["InvalidUploadSource"] = "InvalidUploadSource";
|
|
22
|
+
StorageValidationErrorCode["ObjectIsTooLarge"] = "ObjectIsTooLarge";
|
|
23
|
+
StorageValidationErrorCode["UrlExpirationMaxLimitExceed"] = "UrlExpirationMaxLimitExceed";
|
|
19
24
|
})(StorageValidationErrorCode = exports.StorageValidationErrorCode || (exports.StorageValidationErrorCode = {}));
|
|
20
25
|
exports.validationErrorMap = {
|
|
21
26
|
[StorageValidationErrorCode.NoCredentials]: {
|
|
@@ -33,6 +38,12 @@ exports.validationErrorMap = {
|
|
|
33
38
|
[StorageValidationErrorCode.NoDestinationKey]: {
|
|
34
39
|
message: 'Missing destination key in copy api call.',
|
|
35
40
|
},
|
|
41
|
+
[StorageValidationErrorCode.NoSourcePath]: {
|
|
42
|
+
message: 'Missing source path in copy api call.',
|
|
43
|
+
},
|
|
44
|
+
[StorageValidationErrorCode.NoDestinationPath]: {
|
|
45
|
+
message: 'Missing destination path in copy api call.',
|
|
46
|
+
},
|
|
36
47
|
[StorageValidationErrorCode.NoBucket]: {
|
|
37
48
|
message: 'Missing bucket name while accessing object.',
|
|
38
49
|
},
|
|
@@ -48,5 +59,14 @@ exports.validationErrorMap = {
|
|
|
48
59
|
[StorageValidationErrorCode.InvalidUploadSource]: {
|
|
49
60
|
message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',
|
|
50
61
|
},
|
|
62
|
+
[StorageValidationErrorCode.InvalidStorageOperationInput]: {
|
|
63
|
+
message: 'Path or key parameter must be specified in the input. Both can not be specified at the same time.',
|
|
64
|
+
},
|
|
65
|
+
[StorageValidationErrorCode.InvalidStorageOperationPrefixInput]: {
|
|
66
|
+
message: 'Both path and prefix can not be specified at the same time.',
|
|
67
|
+
},
|
|
68
|
+
[StorageValidationErrorCode.InvalidStoragePathInput]: {
|
|
69
|
+
message: 'Input `path` does not allow a leading slash (/).',
|
|
70
|
+
},
|
|
51
71
|
};
|
|
52
72
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sources":["../../../../src/errors/types/validation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validationErrorMap = exports.StorageValidationErrorCode = void 0;\nvar StorageValidationErrorCode;\n(function (StorageValidationErrorCode) {\n StorageValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n StorageValidationErrorCode[\"NoIdentityId\"] = \"NoIdentityId\";\n StorageValidationErrorCode[\"NoKey\"] = \"NoKey\";\n StorageValidationErrorCode[\"NoSourceKey\"] = \"NoSourceKey\";\n StorageValidationErrorCode[\"NoDestinationKey\"] = \"NoDestinationKey\";\n StorageValidationErrorCode[\"NoBucket\"] = \"NoBucket\";\n StorageValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n StorageValidationErrorCode[\"
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["../../../../src/errors/types/validation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validationErrorMap = exports.StorageValidationErrorCode = void 0;\nvar StorageValidationErrorCode;\n(function (StorageValidationErrorCode) {\n StorageValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n StorageValidationErrorCode[\"NoIdentityId\"] = \"NoIdentityId\";\n StorageValidationErrorCode[\"NoKey\"] = \"NoKey\";\n StorageValidationErrorCode[\"NoSourceKey\"] = \"NoSourceKey\";\n StorageValidationErrorCode[\"NoDestinationKey\"] = \"NoDestinationKey\";\n StorageValidationErrorCode[\"NoSourcePath\"] = \"NoSourcePath\";\n StorageValidationErrorCode[\"NoDestinationPath\"] = \"NoDestinationPath\";\n StorageValidationErrorCode[\"NoBucket\"] = \"NoBucket\";\n StorageValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n StorageValidationErrorCode[\"InvalidStorageOperationPrefixInput\"] = \"InvalidStorageOperationPrefixInput\";\n StorageValidationErrorCode[\"InvalidStorageOperationInput\"] = \"InvalidStorageOperationInput\";\n StorageValidationErrorCode[\"InvalidStoragePathInput\"] = \"InvalidStoragePathInput\";\n StorageValidationErrorCode[\"InvalidUploadSource\"] = \"InvalidUploadSource\";\n StorageValidationErrorCode[\"ObjectIsTooLarge\"] = \"ObjectIsTooLarge\";\n StorageValidationErrorCode[\"UrlExpirationMaxLimitExceed\"] = \"UrlExpirationMaxLimitExceed\";\n})(StorageValidationErrorCode = exports.StorageValidationErrorCode || (exports.StorageValidationErrorCode = {}));\nexports.validationErrorMap = {\n [StorageValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [StorageValidationErrorCode.NoIdentityId]: {\n message: 'Missing identity ID when accessing objects in protected or private access level.',\n },\n [StorageValidationErrorCode.NoKey]: {\n message: 'Missing key in api call.',\n },\n [StorageValidationErrorCode.NoSourceKey]: {\n message: 'Missing source key in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationKey]: {\n message: 'Missing destination key in copy api call.',\n },\n [StorageValidationErrorCode.NoSourcePath]: {\n message: 'Missing source path in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationPath]: {\n message: 'Missing destination path in copy api call.',\n },\n [StorageValidationErrorCode.NoBucket]: {\n message: 'Missing bucket name while accessing object.',\n },\n [StorageValidationErrorCode.NoRegion]: {\n message: 'Missing region while accessing object.',\n },\n [StorageValidationErrorCode.UrlExpirationMaxLimitExceed]: {\n message: 'Url Expiration can not be greater than 7 Days.',\n },\n [StorageValidationErrorCode.ObjectIsTooLarge]: {\n message: 'Object size cannot not be greater than 5TB.',\n },\n [StorageValidationErrorCode.InvalidUploadSource]: {\n message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationInput]: {\n message: 'Path or key parameter must be specified in the input. Both can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationPrefixInput]: {\n message: 'Both path and prefix can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStoragePathInput]: {\n message: 'Input `path` does not allow a leading slash (/).',\n },\n};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AAE,mGAAmG;AACpH,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,kCAAkC,GAAG;AACrE,QAAQ,OAAO,EAAE,6DAA6D;AAC9E,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,uBAAuB,GAAG;AAC1D,QAAQ,OAAO,EAAE,kDAAkD;AACnE,KAAK;AACL,CAAC;;"}
|
|
@@ -6,18 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.copy = void 0;
|
|
7
7
|
const core_1 = require("@aws-amplify/core");
|
|
8
8
|
const copy_1 = require("./internal/copy");
|
|
9
|
-
|
|
10
|
-
* Copy an object from a source object to a new object within the same bucket. Can optionally copy files across
|
|
11
|
-
* different level or identityId (if source object's level is 'protected').
|
|
12
|
-
*
|
|
13
|
-
* @param input - The CopyInput object.
|
|
14
|
-
* @returns Output containing the destination key.
|
|
15
|
-
* @throws service: {@link S3Exception} - Thrown when checking for existence of the object
|
|
16
|
-
* @throws validation: {@link StorageValidationErrorCode } - Thrown when
|
|
17
|
-
* source or destination key are not defined.
|
|
18
|
-
*/
|
|
19
|
-
const copy = async (input) => {
|
|
9
|
+
function copy(input) {
|
|
20
10
|
return (0, copy_1.copy)(core_1.Amplify, input);
|
|
21
|
-
}
|
|
11
|
+
}
|
|
22
12
|
exports.copy = copy;
|
|
23
13
|
//# sourceMappingURL=copy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","sources":["../../../../../src/providers/s3/apis/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copy = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst copy_1 = require(\"./internal/copy\");\
|
|
1
|
+
{"version":3,"file":"copy.js","sources":["../../../../../src/providers/s3/apis/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copy = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst copy_1 = require(\"./internal/copy\");\nfunction copy(input) {\n return (0, copy_1.copy)(core_1.Amplify, input);\n}\nexports.copy = copy;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACtB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC1C,SAAS,IAAI,CAAC,KAAK,EAAE;AACrB,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AACD,OAAO,CAAC,IAAI,GAAG,IAAI;;"}
|
|
@@ -11,37 +11,8 @@ const utils_2 = require("../utils");
|
|
|
11
11
|
const client_1 = require("../utils/client");
|
|
12
12
|
const userAgent_1 = require("../utils/userAgent");
|
|
13
13
|
const utils_3 = require("../../../utils");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
* @param input - The DownloadDataInput object.
|
|
18
|
-
* @returns A cancelable task exposing result promise from `result` property.
|
|
19
|
-
* @throws service: {@link S3Exception} - thrown when checking for existence of the object
|
|
20
|
-
* @throws validation: {@link StorageValidationErrorCode } - Validation errors
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* // Download a file from s3 bucket
|
|
25
|
-
* const { body, eTag } = await downloadData({ key, data: file, options: {
|
|
26
|
-
* onProgress, // Optional progress callback.
|
|
27
|
-
* } }).result;
|
|
28
|
-
* ```
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* // Cancel a task
|
|
32
|
-
* const downloadTask = downloadData({ key, data: file });
|
|
33
|
-
* //...
|
|
34
|
-
* downloadTask.cancel();
|
|
35
|
-
* try {
|
|
36
|
-
* await downloadTask.result;
|
|
37
|
-
* } catch (error) {
|
|
38
|
-
* if(isCancelError(error)) {
|
|
39
|
-
* // Handle error thrown by task cancelation.
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
*```
|
|
43
|
-
*/
|
|
44
|
-
const downloadData = (input) => {
|
|
14
|
+
const constants_1 = require("../utils/constants");
|
|
15
|
+
function downloadData(input) {
|
|
45
16
|
const abortController = new AbortController();
|
|
46
17
|
const downloadTask = (0, utils_2.createDownloadTask)({
|
|
47
18
|
job: downloadDataJob(input, abortController.signal),
|
|
@@ -50,12 +21,14 @@ const downloadData = (input) => {
|
|
|
50
21
|
},
|
|
51
22
|
});
|
|
52
23
|
return downloadTask;
|
|
53
|
-
}
|
|
24
|
+
}
|
|
54
25
|
exports.downloadData = downloadData;
|
|
55
|
-
const downloadDataJob = (
|
|
56
|
-
const {
|
|
57
|
-
const
|
|
58
|
-
|
|
26
|
+
const downloadDataJob = (downloadDataInput, abortSignal) => async () => {
|
|
27
|
+
const { options: downloadDataOptions } = downloadDataInput;
|
|
28
|
+
const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataOptions);
|
|
29
|
+
const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);
|
|
30
|
+
const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
|
|
31
|
+
utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);
|
|
59
32
|
const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, client_1.getObject)({
|
|
60
33
|
...s3Config,
|
|
61
34
|
abortSignal,
|
|
@@ -68,8 +41,7 @@ const downloadDataJob = ({ options: downloadDataOptions, key }, abortSignal) =>
|
|
|
68
41
|
Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,
|
|
69
42
|
}),
|
|
70
43
|
});
|
|
71
|
-
|
|
72
|
-
key,
|
|
44
|
+
const result = {
|
|
73
45
|
body,
|
|
74
46
|
lastModified,
|
|
75
47
|
size,
|
|
@@ -78,5 +50,8 @@ const downloadDataJob = ({ options: downloadDataOptions, key }, abortSignal) =>
|
|
|
78
50
|
metadata,
|
|
79
51
|
versionId,
|
|
80
52
|
};
|
|
53
|
+
return inputType === constants_1.STORAGE_INPUT_KEY
|
|
54
|
+
? { key: objectKey, ...result }
|
|
55
|
+
: { path: objectKey, ...result };
|
|
81
56
|
};
|
|
82
57
|
//# sourceMappingURL=downloadData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadData.js","sources":["../../../../../src/providers/s3/apis/downloadData.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.downloadData = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst resolveS3ConfigAndInput_1 = require(\"../utils/resolveS3ConfigAndInput\");\nconst utils_2 = require(\"../utils\");\nconst client_1 = require(\"../utils/client\");\nconst userAgent_1 = require(\"../utils/userAgent\");\nconst utils_3 = require(\"../../../utils\");\
|
|
1
|
+
{"version":3,"file":"downloadData.js","sources":["../../../../../src/providers/s3/apis/downloadData.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.downloadData = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst resolveS3ConfigAndInput_1 = require(\"../utils/resolveS3ConfigAndInput\");\nconst utils_2 = require(\"../utils\");\nconst client_1 = require(\"../utils/client\");\nconst userAgent_1 = require(\"../utils/userAgent\");\nconst utils_3 = require(\"../../../utils\");\nconst constants_1 = require(\"../utils/constants\");\nfunction downloadData(input) {\n const abortController = new AbortController();\n const downloadTask = (0, utils_2.createDownloadTask)({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n}\nexports.downloadData = downloadData;\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataOptions);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, client_1.getObject)({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAA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AACZ,QAAQ,WAAW;AACnB,QAAQ,IAAI;AACZ,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC,iBAAiB;AACtD,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACvC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;;"}
|
|
@@ -6,17 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getProperties = void 0;
|
|
7
7
|
const core_1 = require("@aws-amplify/core");
|
|
8
8
|
const getProperties_1 = require("./internal/getProperties");
|
|
9
|
-
|
|
10
|
-
* Gets the properties of a file. The properties include S3 system metadata and
|
|
11
|
-
* the user metadata that was provided when uploading the file.
|
|
12
|
-
*
|
|
13
|
-
* @param input - The GetPropertiesInput object.
|
|
14
|
-
* @returns Requested object properties.
|
|
15
|
-
* @throws A {@link S3Exception} when the underlying S3 service returned error.
|
|
16
|
-
* @throws A {@link StorageValidationErrorCode} when API call parameters are invalid.
|
|
17
|
-
*/
|
|
18
|
-
const getProperties = (input) => {
|
|
9
|
+
function getProperties(input) {
|
|
19
10
|
return (0, getProperties_1.getProperties)(core_1.Amplify, input);
|
|
20
|
-
}
|
|
11
|
+
}
|
|
21
12
|
exports.getProperties = getProperties;
|
|
22
13
|
//# sourceMappingURL=getProperties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProperties.js","sources":["../../../../../src/providers/s3/apis/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst getProperties_1 = require(\"./internal/getProperties\");\
|
|
1
|
+
{"version":3,"file":"getProperties.js","sources":["../../../../../src/providers/s3/apis/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst getProperties_1 = require(\"./internal/getProperties\");\nfunction getProperties(input) {\n return (0, getProperties_1.getProperties)(core_1.Amplify, input);\n}\nexports.getProperties = getProperties;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,eAAe,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC5D,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
|
|
@@ -6,24 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getUrl = void 0;
|
|
7
7
|
const core_1 = require("@aws-amplify/core");
|
|
8
8
|
const getUrl_1 = require("./internal/getUrl");
|
|
9
|
-
|
|
10
|
-
* Get a temporary presigned URL to download the specified S3 object.
|
|
11
|
-
* The presigned URL expires when the associated role used to sign the request expires or
|
|
12
|
-
* the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
|
|
13
|
-
*
|
|
14
|
-
* By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
|
|
15
|
-
* to true, this method will verify the given object already exists in S3 before returning a presigned
|
|
16
|
-
* URL, and will throw {@link StorageError} if the object does not exist.
|
|
17
|
-
*
|
|
18
|
-
* @param input - The GetUrlInput object.
|
|
19
|
-
* @returns Presigned URL and timestamp when the URL MAY expire.
|
|
20
|
-
* @throws service: {@link S3Exception} - thrown when checking for existence of the object
|
|
21
|
-
* @throws validation: {@link StorageValidationErrorCode } - Validation errors
|
|
22
|
-
* thrown either username or key are not defined.
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
const getUrl = (input) => {
|
|
9
|
+
function getUrl(input) {
|
|
26
10
|
return (0, getUrl_1.getUrl)(core_1.Amplify, input);
|
|
27
|
-
}
|
|
11
|
+
}
|
|
28
12
|
exports.getUrl = getUrl;
|
|
29
13
|
//# sourceMappingURL=getUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUrl.js","sources":["../../../../../src/providers/s3/apis/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst getUrl_1 = require(\"./internal/getUrl\");\
|
|
1
|
+
{"version":3,"file":"getUrl.js","sources":["../../../../../src/providers/s3/apis/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst getUrl_1 = require(\"./internal/getUrl\");\nfunction getUrl(input) {\n return (0, getUrl_1.getUrl)(core_1.Amplify, input);\n}\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC9C,SAAS,MAAM,CAAC,KAAK,EAAE;AACvB,IAAI,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.copy = void 0;
|
|
6
|
+
exports.copyWithKey = exports.copy = void 0;
|
|
7
7
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
const utils_2 = require("../../utils");
|
|
9
9
|
const validation_1 = require("../../../../errors/types/validation");
|
|
@@ -11,7 +11,33 @@ const assertValidationError_1 = require("../../../../errors/utils/assertValidati
|
|
|
11
11
|
const client_1 = require("../../utils/client");
|
|
12
12
|
const userAgent_1 = require("../../utils/userAgent");
|
|
13
13
|
const utils_3 = require("../../../../utils");
|
|
14
|
+
const isCopyInputWithPath = (input) => (0, utils_2.isInputWithPath)(input.source);
|
|
14
15
|
const copy = async (amplify, input) => {
|
|
16
|
+
return isCopyInputWithPath(input)
|
|
17
|
+
? copyWithPath(amplify, input)
|
|
18
|
+
: (0, exports.copyWithKey)(amplify, input);
|
|
19
|
+
};
|
|
20
|
+
exports.copy = copy;
|
|
21
|
+
const copyWithPath = async (amplify, input) => {
|
|
22
|
+
const { source, destination } = input;
|
|
23
|
+
const { s3Config, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify);
|
|
24
|
+
(0, assertValidationError_1.assertValidationError)(!!source.path, validation_1.StorageValidationErrorCode.NoSourcePath);
|
|
25
|
+
(0, assertValidationError_1.assertValidationError)(!!destination.path, validation_1.StorageValidationErrorCode.NoDestinationPath);
|
|
26
|
+
const { objectKey: sourcePath } = (0, utils_2.validateStorageOperationInput)(source, identityId);
|
|
27
|
+
const { objectKey: destinationPath } = (0, utils_2.validateStorageOperationInput)(destination, identityId);
|
|
28
|
+
const finalCopySource = `${bucket}/${sourcePath}`;
|
|
29
|
+
const finalCopyDestination = destinationPath;
|
|
30
|
+
utils_3.logger.debug(`copying "${finalCopySource}" to "${finalCopyDestination}".`);
|
|
31
|
+
await serviceCopy({
|
|
32
|
+
source: finalCopySource,
|
|
33
|
+
destination: finalCopyDestination,
|
|
34
|
+
bucket,
|
|
35
|
+
s3Config,
|
|
36
|
+
});
|
|
37
|
+
return { path: finalCopyDestination };
|
|
38
|
+
};
|
|
39
|
+
/** @deprecated Use {@link copyWithPath} instead. */
|
|
40
|
+
const copyWithKey = async (amplify, input) => {
|
|
15
41
|
const { source: { key: sourceKey }, destination: { key: destinationKey }, } = input;
|
|
16
42
|
(0, assertValidationError_1.assertValidationError)(!!sourceKey, validation_1.StorageValidationErrorCode.NoSourceKey);
|
|
17
43
|
(0, assertValidationError_1.assertValidationError)(!!destinationKey, validation_1.StorageValidationErrorCode.NoDestinationKey);
|
|
@@ -21,18 +47,26 @@ const copy = async (amplify, input) => {
|
|
|
21
47
|
const finalCopySource = `${bucket}/${sourceKeyPrefix}${sourceKey}`;
|
|
22
48
|
const finalCopyDestination = `${destinationKeyPrefix}${destinationKey}`;
|
|
23
49
|
utils_3.logger.debug(`copying "${finalCopySource}" to "${finalCopyDestination}".`);
|
|
50
|
+
await serviceCopy({
|
|
51
|
+
source: finalCopySource,
|
|
52
|
+
destination: finalCopyDestination,
|
|
53
|
+
bucket,
|
|
54
|
+
s3Config,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
key: destinationKey,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
exports.copyWithKey = copyWithKey;
|
|
61
|
+
const serviceCopy = async ({ source, destination, bucket, s3Config, }) => {
|
|
24
62
|
await (0, client_1.copyObject)({
|
|
25
63
|
...s3Config,
|
|
26
64
|
userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Copy),
|
|
27
65
|
}, {
|
|
28
66
|
Bucket: bucket,
|
|
29
|
-
CopySource:
|
|
30
|
-
Key:
|
|
67
|
+
CopySource: source,
|
|
68
|
+
Key: destination,
|
|
31
69
|
MetadataDirective: 'COPY', // Copies over metadata like contentType as well
|
|
32
70
|
});
|
|
33
|
-
return {
|
|
34
|
-
key: destinationKey,
|
|
35
|
-
};
|
|
36
71
|
};
|
|
37
|
-
exports.copy = copy;
|
|
38
72
|
//# sourceMappingURL=copy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","sources":["../../../../../../src/providers/s3/apis/internal/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copy = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst copy = async (amplify, input) => {\n const { source: { key: sourceKey }, destination: { key: destinationKey }, } = input;\n (0, assertValidationError_1.assertValidationError)(!!sourceKey, validation_1.StorageValidationErrorCode.NoSourceKey);\n (0, assertValidationError_1.assertValidationError)(!!destinationKey, validation_1.StorageValidationErrorCode.NoDestinationKey);\n const { s3Config, bucket, keyPrefix: sourceKeyPrefix, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.source);\n const { keyPrefix: destinationKeyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.destination); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.\n // TODO(ashwinkumar6) V6-logger: warn `You may copy files from another user if the source level is \"protected\", currently it's ${srcLevel}`\n const finalCopySource = `${bucket}/${sourceKeyPrefix}${sourceKey}`;\n const finalCopyDestination = `${destinationKeyPrefix}${destinationKey}`;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await (0, client_1.copyObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Copy),\n }, {\n Bucket: bucket,\n CopySource:
|
|
1
|
+
{"version":3,"file":"copy.js","sources":["../../../../../../src/providers/s3/apis/internal/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copyWithKey = exports.copy = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst isCopyInputWithPath = (input) => (0, utils_2.isInputWithPath)(input.source);\nconst copy = async (amplify, input) => {\n return isCopyInputWithPath(input)\n ? copyWithPath(amplify, input)\n : (0, exports.copyWithKey)(amplify, input);\n};\nexports.copy = copy;\nconst copyWithPath = async (amplify, input) => {\n const { source, destination } = input;\n const { s3Config, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify);\n (0, assertValidationError_1.assertValidationError)(!!source.path, validation_1.StorageValidationErrorCode.NoSourcePath);\n (0, assertValidationError_1.assertValidationError)(!!destination.path, validation_1.StorageValidationErrorCode.NoDestinationPath);\n const { objectKey: sourcePath } = (0, utils_2.validateStorageOperationInput)(source, identityId);\n const { objectKey: destinationPath } = (0, utils_2.validateStorageOperationInput)(destination, identityId);\n const finalCopySource = `${bucket}/${sourcePath}`;\n const finalCopyDestination = destinationPath;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await serviceCopy({\n source: finalCopySource,\n destination: finalCopyDestination,\n bucket,\n s3Config,\n });\n return { path: finalCopyDestination };\n};\n/** @deprecated Use {@link copyWithPath} instead. */\nconst copyWithKey = async (amplify, input) => {\n const { source: { key: sourceKey }, destination: { key: destinationKey }, } = input;\n (0, assertValidationError_1.assertValidationError)(!!sourceKey, validation_1.StorageValidationErrorCode.NoSourceKey);\n (0, assertValidationError_1.assertValidationError)(!!destinationKey, validation_1.StorageValidationErrorCode.NoDestinationKey);\n const { s3Config, bucket, keyPrefix: sourceKeyPrefix, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.source);\n const { keyPrefix: destinationKeyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.destination); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.\n // TODO(ashwinkumar6) V6-logger: warn `You may copy files from another user if the source level is \"protected\", currently it's ${srcLevel}`\n const finalCopySource = `${bucket}/${sourceKeyPrefix}${sourceKey}`;\n const finalCopyDestination = `${destinationKeyPrefix}${destinationKey}`;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await serviceCopy({\n source: finalCopySource,\n destination: finalCopyDestination,\n bucket,\n s3Config,\n });\n return {\n key: destinationKey,\n };\n};\nexports.copyWithKey = copyWithKey;\nconst serviceCopy = async ({ source, destination, bucket, s3Config, }) => {\n await (0, client_1.copyObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Copy),\n }, {\n Bucket: bucket,\n CopySource: source,\n Key: destination,\n MetadataDirective: 'COPY', // Copies over metadata like contentType as well\n });\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,c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,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7F,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,UAAU,EAAE,MAAM;AAC1B,QAAQ,GAAG,EAAE,WAAW;AACxB,QAAQ,iBAAiB,EAAE,MAAM;AACjC,KAAK,CAAC,CAAC;AACP,CAAC;;"}
|
|
@@ -9,11 +9,13 @@ const utils_2 = require("../../utils");
|
|
|
9
9
|
const client_1 = require("../../utils/client");
|
|
10
10
|
const userAgent_1 = require("../../utils/userAgent");
|
|
11
11
|
const utils_3 = require("../../../../utils");
|
|
12
|
+
const constants_1 = require("../../utils/constants");
|
|
12
13
|
const getProperties = async (amplify, input, action) => {
|
|
13
|
-
const {
|
|
14
|
-
const { s3Config, bucket, keyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify,
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
const { options: getPropertiesOptions } = input;
|
|
15
|
+
const { s3Config, bucket, keyPrefix, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getPropertiesOptions);
|
|
16
|
+
const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);
|
|
17
|
+
const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
|
|
18
|
+
utils_3.logger.debug(`get properties of ${objectKey} from ${finalKey}`);
|
|
17
19
|
const response = await (0, client_1.headObject)({
|
|
18
20
|
...s3Config,
|
|
19
21
|
userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(action ?? utils_1.StorageAction.GetProperties),
|
|
@@ -21,8 +23,7 @@ const getProperties = async (amplify, input, action) => {
|
|
|
21
23
|
Bucket: bucket,
|
|
22
24
|
Key: finalKey,
|
|
23
25
|
});
|
|
24
|
-
|
|
25
|
-
key,
|
|
26
|
+
const result = {
|
|
26
27
|
contentType: response.ContentType,
|
|
27
28
|
size: response.ContentLength,
|
|
28
29
|
eTag: response.ETag,
|
|
@@ -30,6 +31,9 @@ const getProperties = async (amplify, input, action) => {
|
|
|
30
31
|
metadata: response.Metadata,
|
|
31
32
|
versionId: response.VersionId,
|
|
32
33
|
};
|
|
34
|
+
return inputType === constants_1.STORAGE_INPUT_KEY
|
|
35
|
+
? { key: objectKey, ...result }
|
|
36
|
+
: { path: objectKey, ...result };
|
|
33
37
|
};
|
|
34
38
|
exports.getProperties = getProperties;
|
|
35
39
|
//# sourceMappingURL=getProperties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProperties.js","sources":["../../../../../../src/providers/s3/apis/internal/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst getProperties = async (amplify, input, action) => {\n const {
|
|
1
|
+
{"version":3,"file":"getProperties.js","sources":["../../../../../../src/providers/s3/apis/internal/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst getProperties = async (amplify, input, action) => {\n const { options: getPropertiesOptions } = input;\n const { s3Config, bucket, keyPrefix, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getPropertiesOptions);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`get properties of ${objectKey} from ${finalKey}`);\n const response = await (0, client_1.headObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(action ?? utils_1.StorageAction.GetProperties),\n }, {\n Bucket: bucket,\n Key: finalKey,\n });\n const result = {\n contentType: response.ContentType,\n size: response.ContentLength,\n eTag: response.ETag,\n lastModified: response.LastModified,\n metadata: response.Metadata,\n versionId: response.VersionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\nexports.getProperties = getProperties;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,OAAO,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK;AACxD,IAAI,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;AACpD,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,OAAO,CAAC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AAa,GAAG,aAAa;;"}
|
|
@@ -12,12 +12,14 @@ const assertValidationError_1 = require("../../../../errors/utils/assertValidati
|
|
|
12
12
|
const constants_1 = require("../../utils/constants");
|
|
13
13
|
const getProperties_1 = require("./getProperties");
|
|
14
14
|
const getUrl = async (amplify, input) => {
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const { options: getUrlOptions } = input;
|
|
16
|
+
const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getUrlOptions);
|
|
17
|
+
const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);
|
|
18
|
+
const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
|
|
19
|
+
if (getUrlOptions?.validateObjectExistence) {
|
|
20
|
+
await (0, getProperties_1.getProperties)(amplify, input, utils_1.StorageAction.GetUrl);
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
let urlExpirationInSec = options?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;
|
|
22
|
+
let urlExpirationInSec = getUrlOptions?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;
|
|
21
23
|
const awsCredExpiration = s3Config.credentials?.expiration;
|
|
22
24
|
if (awsCredExpiration) {
|
|
23
25
|
const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);
|
|
@@ -32,7 +34,7 @@ const getUrl = async (amplify, input) => {
|
|
|
32
34
|
expiration: urlExpirationInSec,
|
|
33
35
|
}, {
|
|
34
36
|
Bucket: bucket,
|
|
35
|
-
Key:
|
|
37
|
+
Key: finalKey,
|
|
36
38
|
}),
|
|
37
39
|
expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),
|
|
38
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst client_1 = require(\"../../utils/client\");\nconst utils_2 = require(\"../../utils\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst constants_1 = require(\"../../utils/constants\");\nconst getProperties_1 = require(\"./getProperties\");\nconst getUrl = async (amplify, input) => {\n const {
|
|
1
|
+
{"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst client_1 = require(\"../../utils/client\");\nconst utils_2 = require(\"../../utils\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst constants_1 = require(\"../../utils/constants\");\nconst getProperties_1 = require(\"./getProperties\");\nconst getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getUrlOptions);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await (0, getProperties_1.getProperties)(amplify, input, utils_1.StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;\n const awsCredExpiration = s3Config.credentials?.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = constants_1.MAX_URL_EXPIRATION / 1000;\n (0, assertValidationError_1.assertValidationError)(urlExpirationInSec <= maxUrlExpirationInSec, validation_1.StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await (0, client_1.getPresignedGetObjectUrl)({\n ...s3Config,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpE,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,uBAAuB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAC1F,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnD,MAAM,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AACzC,IAAI,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;AAC7C,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,OAAO,CAAC,uBAAu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