@aws-amplify/storage 6.5.3-storage-browser.a17ed4d.0 → 6.5.3-storage-browser.ed29226.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/providers/s3/utils/client/s3control/base.js +1 -1
- package/dist/cjs/providers/s3/utils/client/s3control/base.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/base.js +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/base.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/completeMultipartUpload.js +6 -7
- package/dist/cjs/providers/s3/utils/client/s3data/completeMultipartUpload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/index.js +3 -1
- package/dist/cjs/providers/s3/utils/client/utils/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/retryDecider.js +61 -0
- package/dist/cjs/providers/s3/utils/client/utils/retryDecider.js.map +1 -0
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js +8 -2
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
- package/dist/cjs/storageBrowser/apis/getDataAccess.js +5 -2
- package/dist/cjs/storageBrowser/apis/getDataAccess.js.map +1 -1
- package/dist/cjs/storageBrowser/apis/listCallerAccessGrants.js +2 -2
- package/dist/cjs/storageBrowser/apis/listCallerAccessGrants.js.map +1 -1
- package/dist/esm/providers/s3/types/options.d.ts +2 -4
- package/dist/esm/providers/s3/utils/client/s3control/base.d.ts +1 -1
- package/dist/esm/providers/s3/utils/client/s3control/base.mjs +3 -3
- package/dist/esm/providers/s3/utils/client/s3control/base.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/abortMultipartUpload.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/base.d.ts +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/base.mjs +3 -3
- package/dist/esm/providers/s3/utils/client/s3data/base.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.d.ts +3 -3
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs +7 -7
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/copyObject.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/deleteObject.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/getObject.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/headObject.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/listParts.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/putObject.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/uploadPart.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/utils/index.d.ts +1 -0
- package/dist/esm/providers/s3/utils/client/utils/index.mjs +1 -0
- package/dist/esm/providers/s3/utils/client/utils/index.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/utils/retryDecider.d.ts +13 -0
- package/dist/esm/providers/s3/utils/client/utils/retryDecider.mjs +59 -0
- package/dist/esm/providers/s3/utils/client/utils/retryDecider.mjs.map +1 -0
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs +8 -2
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
- package/dist/esm/storageBrowser/apis/getDataAccess.mjs +5 -2
- package/dist/esm/storageBrowser/apis/getDataAccess.mjs.map +1 -1
- package/dist/esm/storageBrowser/apis/listCallerAccessGrants.mjs +2 -2
- package/dist/esm/storageBrowser/apis/listCallerAccessGrants.mjs.map +1 -1
- package/dist/esm/storageBrowser/types.d.ts +2 -3
- package/package.json +5 -5
- package/src/providers/s3/types/options.ts +7 -4
- package/src/providers/s3/utils/client/s3control/base.ts +2 -3
- package/src/providers/s3/utils/client/s3data/base.ts +2 -3
- package/src/providers/s3/utils/client/s3data/completeMultipartUpload.ts +10 -8
- package/src/providers/s3/utils/client/utils/index.ts +1 -0
- package/src/providers/s3/utils/client/utils/retryDecider.ts +81 -0
- package/src/providers/s3/utils/resolveS3ConfigAndInput.ts +9 -2
- package/src/storageBrowser/apis/getDataAccess.ts +9 -2
- package/src/storageBrowser/apis/listCallerAccessGrants.ts +5 -2
- package/src/storageBrowser/types.ts +4 -3
|
@@ -37,7 +37,7 @@ const endpointResolver = (options, apiInput) => {
|
|
|
37
37
|
exports.defaultConfig = {
|
|
38
38
|
service: exports.SERVICE_NAME,
|
|
39
39
|
endpointResolver,
|
|
40
|
-
retryDecider:
|
|
40
|
+
retryDecider: utils_2.retryDecider,
|
|
41
41
|
computeDelay: aws_client_utils_1.jitteredBackoff,
|
|
42
42
|
userAgentValue: (0, utils_1.getAmplifyUserAgent)(),
|
|
43
43
|
uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../../../src/providers/s3/utils/client/s3control/base.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.defaultConfig = exports.SERVICE_NAME = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_2 = require(\"../utils\");\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nexports.SERVICE_NAME = 's3';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.\n */\nconst endpointResolver = (options, apiInput) => {\n const { region, customEndpoint } = options;\n const { AccountId: accountId } = apiInput || {};\n let endpoint;\n // 1. get base endpoint\n if (customEndpoint) {\n endpoint = new utils_1.AmplifyUrl(customEndpoint);\n }\n else if (accountId) {\n // Control plane operations\n endpoint = new utils_1.AmplifyUrl(`https://${accountId}.s3-control.${region}.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n else {\n endpoint = new utils_1.AmplifyUrl(`https://s3-control.${region}.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n return { url: endpoint };\n};\n/**\n * @internal\n */\nexports.defaultConfig = {\n service: exports.SERVICE_NAME,\n endpointResolver,\n retryDecider:
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../../../src/providers/s3/utils/client/s3control/base.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.defaultConfig = exports.SERVICE_NAME = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_2 = require(\"../utils\");\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nexports.SERVICE_NAME = 's3';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.\n */\nconst endpointResolver = (options, apiInput) => {\n const { region, customEndpoint } = options;\n const { AccountId: accountId } = apiInput || {};\n let endpoint;\n // 1. get base endpoint\n if (customEndpoint) {\n endpoint = new utils_1.AmplifyUrl(customEndpoint);\n }\n else if (accountId) {\n // Control plane operations\n endpoint = new utils_1.AmplifyUrl(`https://${accountId}.s3-control.${region}.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n else {\n endpoint = new utils_1.AmplifyUrl(`https://s3-control.${region}.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n return { url: endpoint };\n};\n/**\n * @internal\n */\nexports.defaultConfig = {\n service: exports.SERVICE_NAME,\n endpointResolver,\n retryDecider: utils_2.retryDecider,\n computeDelay: aws_client_utils_1.jitteredBackoff,\n userAgentValue: (0, utils_1.getAmplifyUserAgent)(),\n uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83\n};\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,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC,CAAC;AACnF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;AACA;AACA;AACA,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;AAC5B;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AAChD,IAAI,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;AAC/C,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAC;AACpD,IAAI,IAAI,QAAQ,CAAC;AACjB;AACA,IAAI,IAAI,cAAc,EAAE;AACxB,QAAQ,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAC1D,KAAK;AACL,SAAS,IAAI,SAAS,EAAE;AACxB;AACA,QAAQ,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvI,KAAK;AACL,SAAS;AACT,QAAQ,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1H,KAAK;AACL,IAAI,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC,CAAC;AACF;AACA;AACA;AACA,OAAO,CAAC,aAAa,GAAG;AACxB,IAAI,OAAO,EAAE,OAAO,CAAC,YAAY;AACjC,IAAI,gBAAgB;AACpB,IAAI,YAAY,EAAE,OAAO,CAAC,YAAY;AACtC,IAAI,YAAY,EAAE,kBAAkB,CAAC,eAAe;AACpD,IAAI,cAAc,EAAE,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtD,IAAI,aAAa,EAAE,KAAK;AACxB,CAAC;;"}
|
|
@@ -66,7 +66,7 @@ exports.isDnsCompatibleBucketName = isDnsCompatibleBucketName;
|
|
|
66
66
|
exports.defaultConfig = {
|
|
67
67
|
service: exports.SERVICE_NAME,
|
|
68
68
|
endpointResolver,
|
|
69
|
-
retryDecider:
|
|
69
|
+
retryDecider: utils_2.retryDecider,
|
|
70
70
|
computeDelay: aws_client_utils_1.jitteredBackoff,
|
|
71
71
|
userAgentValue: (0, utils_1.getAmplifyUserAgent)(),
|
|
72
72
|
useAccelerateEndpoint: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/base.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.defaultConfig = exports.isDnsCompatibleBucketName = exports.SERVICE_NAME = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_2 = require(\"../utils\");\nconst DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;\nconst IP_ADDRESS_PATTERN = /(\\d+\\.){3}\\d+/;\nconst DOTS_PATTERN = /\\.\\./;\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nexports.SERVICE_NAME = 's3';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.\n */\nconst endpointResolver = (options, apiInput) => {\n const { region, useAccelerateEndpoint, customEndpoint, forcePathStyle } = options;\n let endpoint;\n // 1. get base endpoint\n if (customEndpoint) {\n endpoint = new utils_1.AmplifyUrl(customEndpoint);\n }\n else if (useAccelerateEndpoint) {\n if (forcePathStyle) {\n throw new Error('Path style URLs are not supported with S3 Transfer Acceleration.');\n }\n endpoint = new utils_1.AmplifyUrl(`https://s3-accelerate.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n else {\n endpoint = new utils_1.AmplifyUrl(`https://s3.${region}.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n // 2. inject bucket name\n if (apiInput?.Bucket) {\n if (!(0, exports.isDnsCompatibleBucketName)(apiInput.Bucket)) {\n throw new Error(`Invalid bucket name: \"${apiInput.Bucket}\".`);\n }\n if (forcePathStyle || apiInput.Bucket.includes('.')) {\n endpoint.pathname = `/${apiInput.Bucket}`;\n }\n else {\n endpoint.host = `${apiInput.Bucket}.${endpoint.host}`;\n }\n }\n return { url: endpoint };\n};\n/**\n * Determines whether a given string is DNS compliant per the rules outlined by\n * S3. Length, capitaization, and leading dot restrictions are enforced by the\n * DOMAIN_PATTERN regular expression.\n * @internal\n *\n * @see https://github.com/aws/aws-sdk-js-v3/blob/f2da6182298d4d6b02e84fb723492c07c27469a8/packages/middleware-bucket-endpoint/src/bucketHostnameUtils.ts#L39-L48\n * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html\n */\nconst isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) &&\n !IP_ADDRESS_PATTERN.test(bucketName) &&\n !DOTS_PATTERN.test(bucketName);\nexports.isDnsCompatibleBucketName = isDnsCompatibleBucketName;\n/**\n * @internal\n */\nexports.defaultConfig = {\n service: exports.SERVICE_NAME,\n endpointResolver,\n retryDecider:
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/base.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.defaultConfig = exports.isDnsCompatibleBucketName = exports.SERVICE_NAME = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_2 = require(\"../utils\");\nconst DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;\nconst IP_ADDRESS_PATTERN = /(\\d+\\.){3}\\d+/;\nconst DOTS_PATTERN = /\\.\\./;\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nexports.SERVICE_NAME = 's3';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.\n */\nconst endpointResolver = (options, apiInput) => {\n const { region, useAccelerateEndpoint, customEndpoint, forcePathStyle } = options;\n let endpoint;\n // 1. get base endpoint\n if (customEndpoint) {\n endpoint = new utils_1.AmplifyUrl(customEndpoint);\n }\n else if (useAccelerateEndpoint) {\n if (forcePathStyle) {\n throw new Error('Path style URLs are not supported with S3 Transfer Acceleration.');\n }\n endpoint = new utils_1.AmplifyUrl(`https://s3-accelerate.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n else {\n endpoint = new utils_1.AmplifyUrl(`https://s3.${region}.${(0, aws_client_utils_1.getDnsSuffix)(region)}`);\n }\n // 2. inject bucket name\n if (apiInput?.Bucket) {\n if (!(0, exports.isDnsCompatibleBucketName)(apiInput.Bucket)) {\n throw new Error(`Invalid bucket name: \"${apiInput.Bucket}\".`);\n }\n if (forcePathStyle || apiInput.Bucket.includes('.')) {\n endpoint.pathname = `/${apiInput.Bucket}`;\n }\n else {\n endpoint.host = `${apiInput.Bucket}.${endpoint.host}`;\n }\n }\n return { url: endpoint };\n};\n/**\n * Determines whether a given string is DNS compliant per the rules outlined by\n * S3. Length, capitaization, and leading dot restrictions are enforced by the\n * DOMAIN_PATTERN regular expression.\n * @internal\n *\n * @see https://github.com/aws/aws-sdk-js-v3/blob/f2da6182298d4d6b02e84fb723492c07c27469a8/packages/middleware-bucket-endpoint/src/bucketHostnameUtils.ts#L39-L48\n * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html\n */\nconst isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) &&\n !IP_ADDRESS_PATTERN.test(bucketName) &&\n !DOTS_PATTERN.test(bucketName);\nexports.isDnsCompatibleBucketName = isDnsCompatibleBucketName;\n/**\n * @internal\n */\nexports.defaultConfig = {\n service: exports.SERVICE_NAME,\n endpointResolver,\n retryDecider: utils_2.retryDecider,\n computeDelay: aws_client_utils_1.jitteredBackoff,\n userAgentValue: (0, utils_1.getAmplifyUserAgent)(),\n useAccelerateEndpoint: false,\n uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83\n};\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,OAAO,CAAC,yBAAyB,GAAG,O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AACxB,CAAC;;"}
|
|
@@ -80,22 +80,21 @@ const completeMultipartUploadDeserializer = async (response) => {
|
|
|
80
80
|
// CompleteMultiPartUpload API returns 200 status code with empty body or error message.
|
|
81
81
|
// This indicates internal server error after the response has been sent to the client.
|
|
82
82
|
// Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4
|
|
83
|
-
const retryWhenErrorWith200StatusCode = async (response, error) => {
|
|
83
|
+
const retryWhenErrorWith200StatusCode = async (response, error, middlewareContext) => {
|
|
84
84
|
if (!response) {
|
|
85
|
-
return false;
|
|
85
|
+
return { retryable: false };
|
|
86
86
|
}
|
|
87
87
|
if (response.statusCode === 200) {
|
|
88
88
|
if (!response.body) {
|
|
89
|
-
return true;
|
|
89
|
+
return { retryable: true };
|
|
90
90
|
}
|
|
91
91
|
const parsed = await (0, utils_2.parseXmlBody)(response);
|
|
92
92
|
if (parsed.Code !== undefined && parsed.Message !== undefined) {
|
|
93
|
-
return true;
|
|
93
|
+
return { retryable: true };
|
|
94
94
|
}
|
|
95
|
-
return false;
|
|
95
|
+
return { retryable: false };
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
return defaultRetryDecider(response, error);
|
|
97
|
+
return (0, utils_2.retryDecider)(response, error, middlewareContext);
|
|
99
98
|
};
|
|
100
99
|
exports.completeMultipartUpload = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler, completeMultipartUploadSerializer, completeMultipartUploadDeserializer, {
|
|
101
100
|
...base_1.defaultConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completeMultipartUpload.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/completeMultipartUpload.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.completeMultipartUpload = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst composers_1 = require(\"@aws-amplify/core/internals/aws-client-utils/composers\");\nconst utils_2 = require(\"../utils\");\nconst base_1 = require(\"./base\");\nconst INVALID_PARAMETER_ERROR_MSG = 'Invalid parameter for ComplteMultipartUpload API';\nconst completeMultipartUploadSerializer = async (input, endpoint) => {\n const headers = {\n 'content-type': 'application/xml',\n };\n const url = new utils_1.AmplifyUrl(endpoint.url.toString());\n (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');\n url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);\n (0, utils_2.validateS3RequiredParameter)(!!input.UploadId, 'UploadId');\n url.search = new utils_1.AmplifyUrlSearchParams({\n uploadId: input.UploadId,\n }).toString();\n (0, utils_2.validateS3RequiredParameter)(!!input.MultipartUpload, 'MultipartUpload');\n return {\n method: 'POST',\n headers,\n url,\n body: '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\n serializeCompletedMultipartUpload(input.MultipartUpload),\n };\n};\nconst serializeCompletedMultipartUpload = (input) => {\n if (!input.Parts?.length) {\n throw new Error(`${INVALID_PARAMETER_ERROR_MSG}: ${input}`);\n }\n return `<CompleteMultipartUpload xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">${input.Parts.map(serializeCompletedPartList).join('')}</CompleteMultipartUpload>`;\n};\nconst serializeCompletedPartList = (input) => {\n if (!input.ETag || input.PartNumber == null) {\n throw new Error(`${INVALID_PARAMETER_ERROR_MSG}: ${input}`);\n }\n return `<Part><ETag>${input.ETag}</ETag><PartNumber>${input.PartNumber}</PartNumber></Part>`;\n};\n/**\n * Parse CompleteMultipartUpload API response payload, which may be empty or error indicating internal\n * server error, even when the status code is 200.\n *\n * Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4\n */\nconst parseXmlBodyOrThrow = async (response) => {\n const parsed = await (0, utils_2.parseXmlBody)(response); // Handles empty body case\n if (parsed.Code !== undefined && parsed.Message !== undefined) {\n const error = (await (0, utils_2.parseXmlError)({\n ...response,\n statusCode: 500, // To workaround the >=300 status code check common to other APIs.\n }));\n throw (0, utils_2.buildStorageServiceError)(error, response.statusCode);\n }\n return parsed;\n};\nconst completeMultipartUploadDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = (await (0, utils_2.parseXmlError)(response));\n throw (0, utils_2.buildStorageServiceError)(error, response.statusCode);\n }\n else {\n const parsed = await parseXmlBodyOrThrow(response);\n const contents = (0, utils_2.map)(parsed, {\n ETag: 'ETag',\n Key: 'Key',\n Location: 'Location',\n });\n return {\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n ...contents,\n };\n }\n};\n// CompleteMultiPartUpload API returns 200 status code with empty body or error message.\n// This indicates internal server error after the response has been sent to the client.\n// Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4\nconst retryWhenErrorWith200StatusCode = async (response, error) => {\n if (!response) {\n return false;\n }\n if (response.statusCode === 200) {\n if (!response.body) {\n return true;\n }\n const parsed = await (0, utils_2.parseXmlBody)(response);\n if (parsed.Code !== undefined && parsed.Message !== undefined) {\n return true;\n }\n return false;\n }\n
|
|
1
|
+
{"version":3,"file":"completeMultipartUpload.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/completeMultipartUpload.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.completeMultipartUpload = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst composers_1 = require(\"@aws-amplify/core/internals/aws-client-utils/composers\");\nconst utils_2 = require(\"../utils\");\nconst base_1 = require(\"./base\");\nconst INVALID_PARAMETER_ERROR_MSG = 'Invalid parameter for ComplteMultipartUpload API';\nconst completeMultipartUploadSerializer = async (input, endpoint) => {\n const headers = {\n 'content-type': 'application/xml',\n };\n const url = new utils_1.AmplifyUrl(endpoint.url.toString());\n (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');\n url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);\n (0, utils_2.validateS3RequiredParameter)(!!input.UploadId, 'UploadId');\n url.search = new utils_1.AmplifyUrlSearchParams({\n uploadId: input.UploadId,\n }).toString();\n (0, utils_2.validateS3RequiredParameter)(!!input.MultipartUpload, 'MultipartUpload');\n return {\n method: 'POST',\n headers,\n url,\n body: '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\n serializeCompletedMultipartUpload(input.MultipartUpload),\n };\n};\nconst serializeCompletedMultipartUpload = (input) => {\n if (!input.Parts?.length) {\n throw new Error(`${INVALID_PARAMETER_ERROR_MSG}: ${input}`);\n }\n return `<CompleteMultipartUpload xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">${input.Parts.map(serializeCompletedPartList).join('')}</CompleteMultipartUpload>`;\n};\nconst serializeCompletedPartList = (input) => {\n if (!input.ETag || input.PartNumber == null) {\n throw new Error(`${INVALID_PARAMETER_ERROR_MSG}: ${input}`);\n }\n return `<Part><ETag>${input.ETag}</ETag><PartNumber>${input.PartNumber}</PartNumber></Part>`;\n};\n/**\n * Parse CompleteMultipartUpload API response payload, which may be empty or error indicating internal\n * server error, even when the status code is 200.\n *\n * Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4\n */\nconst parseXmlBodyOrThrow = async (response) => {\n const parsed = await (0, utils_2.parseXmlBody)(response); // Handles empty body case\n if (parsed.Code !== undefined && parsed.Message !== undefined) {\n const error = (await (0, utils_2.parseXmlError)({\n ...response,\n statusCode: 500, // To workaround the >=300 status code check common to other APIs.\n }));\n throw (0, utils_2.buildStorageServiceError)(error, response.statusCode);\n }\n return parsed;\n};\nconst completeMultipartUploadDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = (await (0, utils_2.parseXmlError)(response));\n throw (0, utils_2.buildStorageServiceError)(error, response.statusCode);\n }\n else {\n const parsed = await parseXmlBodyOrThrow(response);\n const contents = (0, utils_2.map)(parsed, {\n ETag: 'ETag',\n Key: 'Key',\n Location: 'Location',\n });\n return {\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n ...contents,\n };\n }\n};\n// CompleteMultiPartUpload API returns 200 status code with empty body or error message.\n// This indicates internal server error after the response has been sent to the client.\n// Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4\nconst retryWhenErrorWith200StatusCode = async (response, error, middlewareContext) => {\n if (!response) {\n return { retryable: false };\n }\n if (response.statusCode === 200) {\n if (!response.body) {\n return { retryable: true };\n }\n const parsed = await (0, utils_2.parseXmlBody)(response);\n if (parsed.Code !== undefined && parsed.Message !== undefined) {\n return { retryable: true };\n }\n return { retryable: false };\n }\n return (0, utils_2.retryDecider)(response, error, middlewareContext);\n};\nexports.completeMultipartUpload = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler, completeMultipartUploadSerializer, completeMultipartUploadDeserializer, {\n ...base_1.defaultConfig,\n responseType: 'text',\n retryDecider: retryWhenErrorWith200StatusCode,\n});\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACzC,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC,CAAC;AACnF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,WAAW,GAAG,OAAO,CAAC,wDAAwD,CAAC,CAAC;AACtF,MAAM,OAAO,GAAG,OAAO,CAAC,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MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;AACvE,YAAY,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACvC,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpC,KAAK;AACL,IAAI,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;AACzE,CAAC,CAAC;AACF,OAAO,CAAC,uBAAuB,GAAG,IAAI,WAAW,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,iCAAiC,EAAE,mCAAmC,EAAE;AACxK,IAAI,GAAG,MAAM,CAAC,aAAa;AAC3B,IAAI,YAAY,EAAE,MAAM;AACxB,IAAI,YAAY,EAAE,+BAA+B;AACjD,CAAC,CAAC;;"}
|
|
@@ -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.validateS3RequiredParameter = exports.serializePathnameObjectKey = exports.serializeObjectConfigsToHeaders = exports.assignStringVariables = exports.map = exports.emptyArrayGuard = exports.deserializeTimestamp = exports.deserializeNumber = exports.deserializeMetadata = exports.deserializeBoolean = exports.buildStorageServiceError = exports.toBase64 = exports.CONTENT_SHA256_HEADER = exports.CANCELED_ERROR_MESSAGE = exports.s3TransferHandler = exports.SEND_UPLOAD_PROGRESS_EVENT = exports.SEND_DOWNLOAD_PROGRESS_EVENT = exports.parseXmlError = exports.parseXmlBody = void 0;
|
|
6
|
+
exports.retryDecider = exports.validateS3RequiredParameter = exports.serializePathnameObjectKey = exports.serializeObjectConfigsToHeaders = exports.assignStringVariables = exports.map = exports.emptyArrayGuard = exports.deserializeTimestamp = exports.deserializeNumber = exports.deserializeMetadata = exports.deserializeBoolean = exports.buildStorageServiceError = exports.toBase64 = exports.CONTENT_SHA256_HEADER = exports.CANCELED_ERROR_MESSAGE = exports.s3TransferHandler = exports.SEND_UPLOAD_PROGRESS_EVENT = exports.SEND_DOWNLOAD_PROGRESS_EVENT = exports.parseXmlError = exports.parseXmlBody = void 0;
|
|
7
7
|
var parsePayload_1 = require("./parsePayload");
|
|
8
8
|
Object.defineProperty(exports, "parseXmlBody", { enumerable: true, get: function () { return parsePayload_1.parseXmlBody; } });
|
|
9
9
|
Object.defineProperty(exports, "parseXmlError", { enumerable: true, get: function () { return parsePayload_1.parseXmlError; } });
|
|
@@ -27,4 +27,6 @@ Object.defineProperty(exports, "assignStringVariables", { enumerable: true, get:
|
|
|
27
27
|
Object.defineProperty(exports, "serializeObjectConfigsToHeaders", { enumerable: true, get: function () { return serializeHelpers_1.serializeObjectConfigsToHeaders; } });
|
|
28
28
|
Object.defineProperty(exports, "serializePathnameObjectKey", { enumerable: true, get: function () { return serializeHelpers_1.serializePathnameObjectKey; } });
|
|
29
29
|
Object.defineProperty(exports, "validateS3RequiredParameter", { enumerable: true, get: function () { return serializeHelpers_1.validateS3RequiredParameter; } });
|
|
30
|
+
var retryDecider_1 = require("./retryDecider");
|
|
31
|
+
Object.defineProperty(exports, "retryDecider", { enumerable: true, get: function () { return retryDecider_1.retryDecider; } });
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../src/providers/s3/utils/client/utils/index.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.validateS3RequiredParameter = exports.serializePathnameObjectKey = exports.serializeObjectConfigsToHeaders = exports.assignStringVariables = exports.map = exports.emptyArrayGuard = exports.deserializeTimestamp = exports.deserializeNumber = exports.deserializeMetadata = exports.deserializeBoolean = exports.buildStorageServiceError = exports.toBase64 = exports.CONTENT_SHA256_HEADER = exports.CANCELED_ERROR_MESSAGE = exports.s3TransferHandler = exports.SEND_UPLOAD_PROGRESS_EVENT = exports.SEND_DOWNLOAD_PROGRESS_EVENT = exports.parseXmlError = exports.parseXmlBody = void 0;\nvar parsePayload_1 = require(\"./parsePayload\");\nObject.defineProperty(exports, \"parseXmlBody\", { enumerable: true, get: function () { return parsePayload_1.parseXmlBody; } });\nObject.defineProperty(exports, \"parseXmlError\", { enumerable: true, get: function () { return parsePayload_1.parseXmlError; } });\nvar runtime_1 = require(\"../runtime\");\nObject.defineProperty(exports, \"SEND_DOWNLOAD_PROGRESS_EVENT\", { enumerable: true, get: function () { return runtime_1.SEND_DOWNLOAD_PROGRESS_EVENT; } });\nObject.defineProperty(exports, \"SEND_UPLOAD_PROGRESS_EVENT\", { enumerable: true, get: function () { return runtime_1.SEND_UPLOAD_PROGRESS_EVENT; } });\nObject.defineProperty(exports, \"s3TransferHandler\", { enumerable: true, get: function () { return runtime_1.s3TransferHandler; } });\nObject.defineProperty(exports, \"CANCELED_ERROR_MESSAGE\", { enumerable: true, get: function () { return runtime_1.CANCELED_ERROR_MESSAGE; } });\nObject.defineProperty(exports, \"CONTENT_SHA256_HEADER\", { enumerable: true, get: function () { return runtime_1.CONTENT_SHA256_HEADER; } });\nObject.defineProperty(exports, \"toBase64\", { enumerable: true, get: function () { return runtime_1.toBase64; } });\nvar deserializeHelpers_1 = require(\"./deserializeHelpers\");\nObject.defineProperty(exports, \"buildStorageServiceError\", { enumerable: true, get: function () { return deserializeHelpers_1.buildStorageServiceError; } });\nObject.defineProperty(exports, \"deserializeBoolean\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeBoolean; } });\nObject.defineProperty(exports, \"deserializeMetadata\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeMetadata; } });\nObject.defineProperty(exports, \"deserializeNumber\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeNumber; } });\nObject.defineProperty(exports, \"deserializeTimestamp\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeTimestamp; } });\nObject.defineProperty(exports, \"emptyArrayGuard\", { enumerable: true, get: function () { return deserializeHelpers_1.emptyArrayGuard; } });\nObject.defineProperty(exports, \"map\", { enumerable: true, get: function () { return deserializeHelpers_1.map; } });\nvar serializeHelpers_1 = require(\"./serializeHelpers\");\nObject.defineProperty(exports, \"assignStringVariables\", { enumerable: true, get: function () { return serializeHelpers_1.assignStringVariables; } });\nObject.defineProperty(exports, \"serializeObjectConfigsToHeaders\", { enumerable: true, get: function () { return serializeHelpers_1.serializeObjectConfigsToHeaders; } });\nObject.defineProperty(exports, \"serializePathnameObjectKey\", { enumerable: true, get: function () { return serializeHelpers_1.serializePathnameObjectKey; } });\nObject.defineProperty(exports, \"validateS3RequiredParameter\", { enumerable: true, get: function () { return serializeHelpers_1.validateS3RequiredParameter; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,2BAA2B,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../src/providers/s3/utils/client/utils/index.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.retryDecider = exports.validateS3RequiredParameter = exports.serializePathnameObjectKey = exports.serializeObjectConfigsToHeaders = exports.assignStringVariables = exports.map = exports.emptyArrayGuard = exports.deserializeTimestamp = exports.deserializeNumber = exports.deserializeMetadata = exports.deserializeBoolean = exports.buildStorageServiceError = exports.toBase64 = exports.CONTENT_SHA256_HEADER = exports.CANCELED_ERROR_MESSAGE = exports.s3TransferHandler = exports.SEND_UPLOAD_PROGRESS_EVENT = exports.SEND_DOWNLOAD_PROGRESS_EVENT = exports.parseXmlError = exports.parseXmlBody = void 0;\nvar parsePayload_1 = require(\"./parsePayload\");\nObject.defineProperty(exports, \"parseXmlBody\", { enumerable: true, get: function () { return parsePayload_1.parseXmlBody; } });\nObject.defineProperty(exports, \"parseXmlError\", { enumerable: true, get: function () { return parsePayload_1.parseXmlError; } });\nvar runtime_1 = require(\"../runtime\");\nObject.defineProperty(exports, \"SEND_DOWNLOAD_PROGRESS_EVENT\", { enumerable: true, get: function () { return runtime_1.SEND_DOWNLOAD_PROGRESS_EVENT; } });\nObject.defineProperty(exports, \"SEND_UPLOAD_PROGRESS_EVENT\", { enumerable: true, get: function () { return runtime_1.SEND_UPLOAD_PROGRESS_EVENT; } });\nObject.defineProperty(exports, \"s3TransferHandler\", { enumerable: true, get: function () { return runtime_1.s3TransferHandler; } });\nObject.defineProperty(exports, \"CANCELED_ERROR_MESSAGE\", { enumerable: true, get: function () { return runtime_1.CANCELED_ERROR_MESSAGE; } });\nObject.defineProperty(exports, \"CONTENT_SHA256_HEADER\", { enumerable: true, get: function () { return runtime_1.CONTENT_SHA256_HEADER; } });\nObject.defineProperty(exports, \"toBase64\", { enumerable: true, get: function () { return runtime_1.toBase64; } });\nvar deserializeHelpers_1 = require(\"./deserializeHelpers\");\nObject.defineProperty(exports, \"buildStorageServiceError\", { enumerable: true, get: function () { return deserializeHelpers_1.buildStorageServiceError; } });\nObject.defineProperty(exports, \"deserializeBoolean\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeBoolean; } });\nObject.defineProperty(exports, \"deserializeMetadata\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeMetadata; } });\nObject.defineProperty(exports, \"deserializeNumber\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeNumber; } });\nObject.defineProperty(exports, \"deserializeTimestamp\", { enumerable: true, get: function () { return deserializeHelpers_1.deserializeTimestamp; } });\nObject.defineProperty(exports, \"emptyArrayGuard\", { enumerable: true, get: function () { return deserializeHelpers_1.emptyArrayGuard; } });\nObject.defineProperty(exports, \"map\", { enumerable: true, get: function () { return deserializeHelpers_1.map; } });\nvar serializeHelpers_1 = require(\"./serializeHelpers\");\nObject.defineProperty(exports, \"assignStringVariables\", { enumerable: true, get: function () { return serializeHelpers_1.assignStringVariables; } });\nObject.defineProperty(exports, \"serializeObjectConfigsToHeaders\", { enumerable: true, get: function () { return serializeHelpers_1.serializeObjectConfigsToHeaders; } });\nObject.defineProperty(exports, \"serializePathnameObjectKey\", { enumerable: true, get: function () { return serializeHelpers_1.serializePathnameObjectKey; } });\nObject.defineProperty(exports, \"validateS3RequiredParameter\", { enumerable: true, get: function () { return serializeHelpers_1.validateS3RequiredParameter; } });\nvar retryDecider_1 = require(\"./retryDecider\");\nObject.defineProperty(exports, \"retryDecider\", { enumerable: true, get: function () { return retryDecider_1.retryDecider; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,eAA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EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,kBAAkB,CAAC,2BAA2B,CAAC,EAAE,EAAE,CAAC,CAAC;AACjK,IAAI,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC/C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.retryDecider = void 0;
|
|
5
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
const aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
|
|
8
|
+
const parsePayload_1 = require("./parsePayload");
|
|
9
|
+
/**
|
|
10
|
+
* Function to decide if the S3 request should be retried. For S3 APIs, we support forceRefresh option
|
|
11
|
+
* for {@link LocationCredentialsProvider | LocationCredentialsProvider } option. It's set when S3 returns
|
|
12
|
+
* credentials expired error. In the retry decider, we detect this response and set flag to signify a retry
|
|
13
|
+
* attempt. The retry attempt would invoke the LocationCredentialsProvider with forceRefresh option set.
|
|
14
|
+
*
|
|
15
|
+
* @param response Optional response of the request.
|
|
16
|
+
* @param error Optional error thrown from previous attempts.
|
|
17
|
+
* @param middlewareContext Optional context object to store data between retries.
|
|
18
|
+
* @returns True if the request should be retried.
|
|
19
|
+
*/
|
|
20
|
+
const retryDecider = async (response, error, middlewareContext) => {
|
|
21
|
+
const defaultRetryDecider = (0, aws_client_utils_1.getRetryDecider)(parsePayload_1.parseXmlError);
|
|
22
|
+
const defaultRetryDecision = await defaultRetryDecider(response, error);
|
|
23
|
+
if (!response || response.statusCode < 300) {
|
|
24
|
+
return { retryable: false };
|
|
25
|
+
}
|
|
26
|
+
const parsedError = await (0, parsePayload_1.parseXmlError)(response);
|
|
27
|
+
const errorCode = parsedError?.name;
|
|
28
|
+
const errorMessage = parsedError?.message;
|
|
29
|
+
const isCredentialsExpired = isCredentialsExpiredError(errorCode, errorMessage);
|
|
30
|
+
return {
|
|
31
|
+
retryable: defaultRetryDecision.retryable ||
|
|
32
|
+
// If we know the previous retry attempt sets isCredentialsExpired in the
|
|
33
|
+
// middleware context, we don't want to retry anymore.
|
|
34
|
+
!!(isCredentialsExpired && !middlewareContext?.isCredentialsExpired),
|
|
35
|
+
isCredentialsExpiredError: isCredentialsExpired,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.retryDecider = retryDecider;
|
|
39
|
+
// Ref: https://github.com/aws/aws-sdk-js/blob/54829e341181b41573c419bd870dd0e0f8f10632/lib/event_listeners.js#L522-L541
|
|
40
|
+
const INVALID_TOKEN_ERROR_CODES = [
|
|
41
|
+
'RequestExpired',
|
|
42
|
+
'ExpiredTokenException',
|
|
43
|
+
'ExpiredToken',
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Given an error code, returns true if it is related to invalid credentials.
|
|
47
|
+
*
|
|
48
|
+
* @param errorCode String representation of some error.
|
|
49
|
+
* @returns True if given error indicates the credentials used to authorize request
|
|
50
|
+
* are invalid.
|
|
51
|
+
*/
|
|
52
|
+
const isCredentialsExpiredError = (errorCode, errorMessage) => {
|
|
53
|
+
const isExpiredTokenError = !!errorCode && INVALID_TOKEN_ERROR_CODES.includes(errorCode);
|
|
54
|
+
// Ref: https://github.com/aws/aws-sdk-js/blob/54829e341181b41573c419bd870dd0e0f8f10632/lib/event_listeners.js#L536-L539
|
|
55
|
+
const isExpiredSignatureError = !!errorCode &&
|
|
56
|
+
!!errorMessage &&
|
|
57
|
+
errorCode.includes('Signature') &&
|
|
58
|
+
errorMessage.includes('expired');
|
|
59
|
+
return isExpiredTokenError || isExpiredSignatureError;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=retryDecider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retryDecider.js","sources":["../../../../../../../src/providers/s3/utils/client/utils/retryDecider.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.retryDecider = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst parsePayload_1 = require(\"./parsePayload\");\n/**\n * Function to decide if the S3 request should be retried. For S3 APIs, we support forceRefresh option\n * for {@link LocationCredentialsProvider | LocationCredentialsProvider } option. It's set when S3 returns\n * credentials expired error. In the retry decider, we detect this response and set flag to signify a retry\n * attempt. The retry attempt would invoke the LocationCredentialsProvider with forceRefresh option set.\n *\n * @param response Optional response of the request.\n * @param error Optional error thrown from previous attempts.\n * @param middlewareContext Optional context object to store data between retries.\n * @returns True if the request should be retried.\n */\nconst retryDecider = async (response, error, middlewareContext) => {\n const defaultRetryDecider = (0, aws_client_utils_1.getRetryDecider)(parsePayload_1.parseXmlError);\n const defaultRetryDecision = await defaultRetryDecider(response, error);\n if (!response || response.statusCode < 300) {\n return { retryable: false };\n }\n const parsedError = await (0, parsePayload_1.parseXmlError)(response);\n const errorCode = parsedError?.name;\n const errorMessage = parsedError?.message;\n const isCredentialsExpired = isCredentialsExpiredError(errorCode, errorMessage);\n return {\n retryable: defaultRetryDecision.retryable ||\n // If we know the previous retry attempt sets isCredentialsExpired in the\n // middleware context, we don't want to retry anymore.\n !!(isCredentialsExpired && !middlewareContext?.isCredentialsExpired),\n isCredentialsExpiredError: isCredentialsExpired,\n };\n};\nexports.retryDecider = retryDecider;\n// Ref: https://github.com/aws/aws-sdk-js/blob/54829e341181b41573c419bd870dd0e0f8f10632/lib/event_listeners.js#L522-L541\nconst INVALID_TOKEN_ERROR_CODES = [\n 'RequestExpired',\n 'ExpiredTokenException',\n 'ExpiredToken',\n];\n/**\n * Given an error code, returns true if it is related to invalid credentials.\n *\n * @param errorCode String representation of some error.\n * @returns True if given error indicates the credentials used to authorize request\n * are invalid.\n */\nconst isCredentialsExpiredError = (errorCode, errorMessage) => {\n const isExpiredTokenError = !!errorCode && INVALID_TOKEN_ERROR_CODES.includes(errorCode);\n // Ref: https://github.com/aws/aws-sdk-js/blob/54829e341181b41573c419bd870dd0e0f8f10632/lib/event_listeners.js#L536-L539\n const isExpiredSignatureError = !!errorCode &&\n !!errorMessage &&\n errorCode.includes('Signature') &&\n errorMessage.includes('expired');\n return isExpiredTokenError || isExpiredSignatureError;\n};\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AAC9B;AACA;AACA,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC,CAAC;AACnF,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,GAAG,OAAO,QAAQ,EAAE,KAAK,EAAE,iBAAiB,KAAK;AACnE,IAAI,MAAM,mBAAmB,GAAG,IAAI,kBAAkB,CAAC,eAAe,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;AACtG,IAAI,MAAM,oBAAoB,GAAG,MAAM,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5E,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAChD,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpC,KAAK;AACL,IAAI,MAAM,WAAW,GAAG,MAAM,IAAI,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAC1E,IAAI,MAAM,SAAS,GAAG,WAAW,EAAE,IAAI,CAAC;AACxC,IAAI,MAAM,YAAY,GAAG,WAAW,EAAE,OAAO,CAAC;AAC9C,IAAI,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACpF,IAAI,OAAO;AACX,QAAQ,SAAS,EAAE,oBAAoB,CAAC,SAAS;AACjD;AACA;AACA,YAAY,CAAC,EAAE,oBAAoB,IAAI,CAAC,iBAAiB,EAAE,oBAAoB,CAAC;AAChF,QAAQ,yBAAyB,EAAE,oBAAoB;AACvD,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;AACpC;AACA,MAAM,yBAAyB,GAAG;AAClC,IAAI,gBAAgB;AACpB,IAAI,uBAAuB;AAC3B,IAAI,cAAc;AAClB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,yBAAyB,GAAG,CAAC,SAAS,EAAE,YAAY,KAAK;AAC/D,IAAI,MAAM,mBAAmB,GAAG,CAAC,CAAC,SAAS,IAAI,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC7F;AACA,IAAI,MAAM,uBAAuB,GAAG,CAAC,CAAC,SAAS;AAC/C,QAAQ,CAAC,CAAC,YAAY;AACtB,QAAQ,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC;AACvC,QAAQ,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACzC,IAAI,OAAO,mBAAmB,IAAI,uBAAuB,CAAC;AAC1D,CAAC;;"}
|
|
@@ -33,13 +33,19 @@ const resolveS3ConfigAndInput = async (amplify, apiInput) => {
|
|
|
33
33
|
* used because the long-running tasks like multipart upload may span over the
|
|
34
34
|
* credentials expiry. Auth.fetchAuthSession() automatically refreshes the
|
|
35
35
|
* credentials if they are expired.
|
|
36
|
+
*
|
|
37
|
+
* The optional forceRefresh option is set when the S3 service returns expired
|
|
38
|
+
* tokens error in the previous API call attempt.
|
|
36
39
|
*/
|
|
37
|
-
const credentialsProvider = async () => {
|
|
40
|
+
const credentialsProvider = async (options) => {
|
|
38
41
|
if (isLocationCredentialsProvider(apiOptions)) {
|
|
39
42
|
assertStorageInput(apiInput);
|
|
40
43
|
}
|
|
44
|
+
// TODO: forceRefresh option of fetchAuthSession would refresh both tokens and
|
|
45
|
+
// AWS credentials. So we do not support forceRefreshing from the Auth until
|
|
46
|
+
// we support refreshing only the credentials.
|
|
41
47
|
const { credentials } = isLocationCredentialsProvider(apiOptions)
|
|
42
|
-
? await apiOptions.locationCredentialsProvider()
|
|
48
|
+
? await apiOptions.locationCredentialsProvider(options)
|
|
43
49
|
: await amplify.Auth.fetchAuthSession();
|
|
44
50
|
(0, assertValidationError_1.assertValidationError)(!!credentials, validation_1.StorageValidationErrorCode.NoCredentials);
|
|
45
51
|
return credentials;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveS3ConfigAndInput.js","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.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.resolveS3ConfigAndInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst resolvePrefix_1 = require(\"../../../utils/resolvePrefix\");\nconst StorageError_1 = require(\"../../../errors/StorageError\");\nconst constants_1 = require(\"../../../errors/constants\");\nconst constants_2 = require(\"./constants\");\n/**\n * resolve the common input options for S3 API handlers from Amplify configuration and library options.\n *\n * @param {AmplifyClassV6} amplify The Amplify instance.\n * @param {S3ApiOptions} apiOptions The input options for S3 provider.\n * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.\n * @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid\n * configurations or Amplify library options.\n *\n * @internal\n */\nconst resolveS3ConfigAndInput = async (amplify, apiInput) => {\n const { options: apiOptions } = apiInput ?? {};\n /**\n * IdentityId is always cached in memory so we can safely make calls here. It\n * should be stable even for unauthenticated users, regardless of credentials.\n */\n const { identityId } = await amplify.Auth.fetchAuthSession();\n /**\n * A credentials provider function instead of a static credentials object is\n * used because the long-running tasks like multipart upload may span over the\n * credentials expiry. Auth.fetchAuthSession() automatically refreshes the\n * credentials if they are expired.\n */\n const credentialsProvider = async () => {\n if (isLocationCredentialsProvider(apiOptions)) {\n assertStorageInput(apiInput);\n }\n const { credentials } = isLocationCredentialsProvider(apiOptions)\n ? await apiOptions.locationCredentialsProvider()\n : await amplify.Auth.fetchAuthSession();\n (0, assertValidationError_1.assertValidationError)(!!credentials, validation_1.StorageValidationErrorCode.NoCredentials);\n return credentials;\n };\n const { bucket: defaultBucket, region: defaultRegion, dangerouslyConnectToHttpEndpointForTesting, buckets, } = amplify.getConfig()?.Storage?.S3 ?? {};\n const { bucket = defaultBucket, region = defaultRegion } = (apiOptions?.bucket && resolveBucketConfig(apiOptions, buckets)) || {};\n (0, assertValidationError_1.assertValidationError)(!!bucket, validation_1.StorageValidationErrorCode.NoBucket);\n (0, assertValidationError_1.assertValidationError)(!!region, validation_1.StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = resolvePrefix_1.resolvePrefix, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const accessLevel = apiOptions?.accessLevel ?? defaultAccessLevel ?? constants_2.DEFAULT_ACCESS_LEVEL;\n const targetIdentityId = accessLevel === 'protected'\n ? apiOptions?.targetIdentityId ?? identityId\n : identityId;\n const keyPrefix = await prefixResolver({ accessLevel, targetIdentityId });\n return {\n s3Config: {\n credentials: credentialsProvider,\n region,\n useAccelerateEndpoint: apiOptions?.useAccelerateEndpoint,\n ...(dangerouslyConnectToHttpEndpointForTesting\n ? {\n customEndpoint: constants_2.LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n identityId,\n isObjectLockEnabled,\n };\n};\nexports.resolveS3ConfigAndInput = resolveS3ConfigAndInput;\nconst isLocationCredentialsProvider = (options) => {\n return !!options?.locationCredentialsProvider;\n};\nconst isInputWithCallbackPath = (input) => {\n return ((input?.path &&\n typeof input.path === 'function') ||\n (input?.destination?.path &&\n typeof input.destination?.path === 'function') ||\n (input?.source?.path &&\n typeof input.source?.path === 'function'));\n};\nconst isDeprecatedInput = (input) => {\n return (isInputWithKey(input) ||\n isInputWithPrefix(input) ||\n isInputWithCopySourceOrDestination(input));\n};\nconst assertStorageInput = (input) => {\n if (isDeprecatedInput(input) || isInputWithCallbackPath(input)) {\n throw new StorageError_1.StorageError({\n name: constants_1.INVALID_STORAGE_INPUT,\n message: 'The input needs to have a path as a string value.',\n recoverySuggestion: 'Please provide a valid path as a string value for the input.',\n });\n }\n};\nconst isInputWithKey = (input) => {\n return !!(typeof input.key === 'string');\n};\nconst isInputWithPrefix = (input) => {\n return !!(typeof input.prefix === 'string');\n};\nconst isInputWithCopySourceOrDestination = (input) => {\n return !!(typeof input.source?.key === 'string' ||\n typeof input.destination?.key === 'string');\n};\nconst resolveBucketConfig = (apiOptions, buckets) => {\n if (typeof apiOptions.bucket === 'string') {\n const bucketConfig = buckets?.[apiOptions.bucket];\n (0, assertValidationError_1.assertValidationError)(!!bucketConfig, validation_1.StorageValidationErrorCode.InvalidStorageBucket);\n return { bucket: bucketConfig.bucketName, region: bucketConfig.region };\n }\n if (typeof apiOptions.bucket === 'object') {\n return {\n bucket: apiOptions.bucket.bucketName,\n region: apiOptions.bucket.region,\n };\n }\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;A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veS3ConfigAndInput.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.resolveS3ConfigAndInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst resolvePrefix_1 = require(\"../../../utils/resolvePrefix\");\nconst StorageError_1 = require(\"../../../errors/StorageError\");\nconst constants_1 = require(\"../../../errors/constants\");\nconst constants_2 = require(\"./constants\");\n/**\n * resolve the common input options for S3 API handlers from Amplify configuration and library options.\n *\n * @param {AmplifyClassV6} amplify The Amplify instance.\n * @param {S3ApiOptions} apiOptions The input options for S3 provider.\n * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.\n * @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid\n * configurations or Amplify library options.\n *\n * @internal\n */\nconst resolveS3ConfigAndInput = async (amplify, apiInput) => {\n const { options: apiOptions } = apiInput ?? {};\n /**\n * IdentityId is always cached in memory so we can safely make calls here. It\n * should be stable even for unauthenticated users, regardless of credentials.\n */\n const { identityId } = await amplify.Auth.fetchAuthSession();\n /**\n * A credentials provider function instead of a static credentials object is\n * used because the long-running tasks like multipart upload may span over the\n * credentials expiry. Auth.fetchAuthSession() automatically refreshes the\n * credentials if they are expired.\n *\n * The optional forceRefresh option is set when the S3 service returns expired\n * tokens error in the previous API call attempt.\n */\n const credentialsProvider = async (options) => {\n if (isLocationCredentialsProvider(apiOptions)) {\n assertStorageInput(apiInput);\n }\n // TODO: forceRefresh option of fetchAuthSession would refresh both tokens and\n // AWS credentials. So we do not support forceRefreshing from the Auth until\n // we support refreshing only the credentials.\n const { credentials } = isLocationCredentialsProvider(apiOptions)\n ? await apiOptions.locationCredentialsProvider(options)\n : await amplify.Auth.fetchAuthSession();\n (0, assertValidationError_1.assertValidationError)(!!credentials, validation_1.StorageValidationErrorCode.NoCredentials);\n return credentials;\n };\n const { bucket: defaultBucket, region: defaultRegion, dangerouslyConnectToHttpEndpointForTesting, buckets, } = amplify.getConfig()?.Storage?.S3 ?? {};\n const { bucket = defaultBucket, region = defaultRegion } = (apiOptions?.bucket && resolveBucketConfig(apiOptions, buckets)) || {};\n (0, assertValidationError_1.assertValidationError)(!!bucket, validation_1.StorageValidationErrorCode.NoBucket);\n (0, assertValidationError_1.assertValidationError)(!!region, validation_1.StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = resolvePrefix_1.resolvePrefix, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const accessLevel = apiOptions?.accessLevel ?? defaultAccessLevel ?? constants_2.DEFAULT_ACCESS_LEVEL;\n const targetIdentityId = accessLevel === 'protected'\n ? apiOptions?.targetIdentityId ?? identityId\n : identityId;\n const keyPrefix = await prefixResolver({ accessLevel, targetIdentityId });\n return {\n s3Config: {\n credentials: credentialsProvider,\n region,\n useAccelerateEndpoint: apiOptions?.useAccelerateEndpoint,\n ...(dangerouslyConnectToHttpEndpointForTesting\n ? {\n customEndpoint: constants_2.LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n identityId,\n isObjectLockEnabled,\n };\n};\nexports.resolveS3ConfigAndInput = resolveS3ConfigAndInput;\nconst isLocationCredentialsProvider = (options) => {\n return !!options?.locationCredentialsProvider;\n};\nconst isInputWithCallbackPath = (input) => {\n return ((input?.path &&\n typeof input.path === 'function') ||\n (input?.destination?.path &&\n typeof input.destination?.path === 'function') ||\n (input?.source?.path &&\n typeof input.source?.path === 'function'));\n};\nconst isDeprecatedInput = (input) => {\n return (isInputWithKey(input) ||\n isInputWithPrefix(input) ||\n isInputWithCopySourceOrDestination(input));\n};\nconst assertStorageInput = (input) => {\n if (isDeprecatedInput(input) || isInputWithCallbackPath(input)) {\n throw new StorageError_1.StorageError({\n name: constants_1.INVALID_STORAGE_INPUT,\n message: 'The input needs to have a path as a string value.',\n recoverySuggestion: 'Please provide a valid path as a string value for the input.',\n });\n }\n};\nconst isInputWithKey = (input) => {\n return !!(typeof input.key === 'string');\n};\nconst isInputWithPrefix = (input) => {\n return !!(typeof input.prefix === 'string');\n};\nconst isInputWithCopySourceOrDestination = (input) => {\n return !!(typeof input.source?.key === 'string' ||\n typeof input.destination?.key === 'string');\n};\nconst resolveBucketConfig = (apiOptions, buckets) => {\n if (typeof apiOptions.bucket === 'string') {\n const bucketConfig = buckets?.[apiOptions.bucket];\n (0, assertValidationError_1.assertValidationError)(!!bucketConfig, validation_1.StorageValidationErrorCode.InvalidStorageBucket);\n return { bucket: bucketConfig.bucketName, region: bucketConfig.region };\n }\n if (typeof apiOptions.bucket === 'object') {\n return {\n bucket: apiOptions.bucket.bucketName,\n region: apiOptions.bucket.region,\n };\n }\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACzC,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC,CAAC;AACvF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACjE,MAAM,eAAe,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAChE,MAAM,cAAc,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACzD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,uBAAuB,GAAG,OAAO,OAAO,EAAE,QAAQ,KAAK;AAC7D,IAAI,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,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G,KAAK,QAAQ,CAAC,CAAC;AACpD,CAAC,CAAC;AACF,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,OAAO,KAAK;AACrD,IAAI,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,EAAE;AAC/C,QAAQ,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAC1D,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;AACzI,QAAQ,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;AAChF,KAAK;AACL,IAAI,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,EAAE;AAC/C,QAAQ,OAAO;AACf,YAAY,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU;AAChD,YAAY,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM;AAC5C,SAAS,CAAC;AACV,KAAK;AACL,CAAC;;"}
|
|
@@ -12,9 +12,12 @@ const utils_2 = require("../../utils");
|
|
|
12
12
|
const constants_1 = require("./constants");
|
|
13
13
|
const getDataAccess = async (input) => {
|
|
14
14
|
const targetType = input.scope.endsWith('*') ? undefined : 'Object';
|
|
15
|
-
const
|
|
15
|
+
const clientCredentialsProvider = async (options) => {
|
|
16
|
+
const { credentials } = await input.credentialsProvider(options);
|
|
17
|
+
return credentials;
|
|
18
|
+
};
|
|
16
19
|
const result = await (0, s3control_1.getDataAccess)({
|
|
17
|
-
credentials,
|
|
20
|
+
credentials: clientCredentialsProvider,
|
|
18
21
|
region: input.region,
|
|
19
22
|
userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.GetDataAccess),
|
|
20
23
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDataAccess.js","sources":["../../../../src/storageBrowser/apis/getDataAccess.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.getDataAccess = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst userAgent_1 = require(\"../../providers/s3/utils/userAgent\");\nconst s3control_1 = require(\"../../providers/s3/utils/client/s3control\");\nconst StorageError_1 = require(\"../../errors/StorageError\");\nconst utils_2 = require(\"../../utils\");\nconst constants_1 = require(\"./constants\");\nconst getDataAccess = async (input) => {\n const targetType = input.scope.endsWith('*') ? undefined : 'Object';\n const { credentials } = await input.credentialsProvider();\n const result = await (0, s3control_1.getDataAccess)({\n credentials,\n region: input.region,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.GetDataAccess),\n }, {\n AccountId: input.accountId,\n Target: input.scope,\n Permission: input.permission,\n TargetType: targetType,\n DurationSeconds: constants_1.DEFAULT_CRED_TTL,\n });\n const grantCredentials = result.Credentials;\n // Ensure that S3 returned credentials (this shouldn't happen)\n if (!grantCredentials) {\n throw new StorageError_1.StorageError({\n name: utils_1.AmplifyErrorCode.Unknown,\n message: 'Service did not return credentials.',\n });\n }\n else {\n utils_2.logger.debug(`Retrieved credentials for: ${result.MatchedGrantTarget}`);\n }\n const { AccessKeyId: accessKeyId, SecretAccessKey: secretAccessKey, SessionToken: sessionToken, Expiration: expiration, } = grantCredentials;\n return {\n credentials: {\n accessKeyId: accessKeyId,\n secretAccessKey: secretAccessKey,\n sessionToken,\n expiration,\n },\n scope: result.MatchedGrantTarget,\n };\n};\nexports.getDataAccess = getDataAccess;\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,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE,MAAM,WAAW,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,aAAa,GAAG,OAAO,KAAK,KAAK;AACvC,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,QAAQ,CAAC;AACxE,IAAI,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,KAAK,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"getDataAccess.js","sources":["../../../../src/storageBrowser/apis/getDataAccess.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.getDataAccess = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst userAgent_1 = require(\"../../providers/s3/utils/userAgent\");\nconst s3control_1 = require(\"../../providers/s3/utils/client/s3control\");\nconst StorageError_1 = require(\"../../errors/StorageError\");\nconst utils_2 = require(\"../../utils\");\nconst constants_1 = require(\"./constants\");\nconst getDataAccess = async (input) => {\n const targetType = input.scope.endsWith('*') ? undefined : 'Object';\n const clientCredentialsProvider = async (options) => {\n const { credentials } = await input.credentialsProvider(options);\n return credentials;\n };\n const result = await (0, s3control_1.getDataAccess)({\n credentials: clientCredentialsProvider,\n region: input.region,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.GetDataAccess),\n }, {\n AccountId: input.accountId,\n Target: input.scope,\n Permission: input.permission,\n TargetType: targetType,\n DurationSeconds: constants_1.DEFAULT_CRED_TTL,\n });\n const grantCredentials = result.Credentials;\n // Ensure that S3 returned credentials (this shouldn't happen)\n if (!grantCredentials) {\n throw new StorageError_1.StorageError({\n name: utils_1.AmplifyErrorCode.Unknown,\n message: 'Service did not return credentials.',\n });\n }\n else {\n utils_2.logger.debug(`Retrieved credentials for: ${result.MatchedGrantTarget}`);\n }\n const { AccessKeyId: accessKeyId, SecretAccessKey: secretAccessKey, SessionToken: sessionToken, Expiration: expiration, } = grantCredentials;\n return {\n credentials: {\n accessKeyId: accessKeyId,\n secretAccessKey: secretAccessKey,\n sessionToken,\n expiration,\n },\n scope: result.MatchedGrantTarget,\n };\n};\nexports.getDataAccess = getDataAccess;\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,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE,MAAM,WAAW,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,aAAa,GAAG,OAAO,KAAK,KAAK;AACvC,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,QAAQ,CAAC;AACxE,IAAI,MAAM,yBAAyB,GAAG,OAAO,OAAO,KAAK;AACzD,QAAQ,MAAM,EAAE,WA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pC,YAAY,eAAe,EAAE,eAAe;AAC5C,YAAY,YAAY;AACxB,YAAY,UAAU;AACtB,SAAS;AACT,QAAQ,KAAK,EAAE,MAAM,CAAC,kBAAkB;AACxC,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
|
|
@@ -16,8 +16,8 @@ const listCallerAccessGrants = async (input) => {
|
|
|
16
16
|
if (!!pageSize && pageSize > constants_1.MAX_PAGE_SIZE) {
|
|
17
17
|
utils_2.logger.debug(`defaulting pageSize to ${constants_1.MAX_PAGE_SIZE}.`);
|
|
18
18
|
}
|
|
19
|
-
const clientCredentialsProvider = async () => {
|
|
20
|
-
const { credentials } = await credentialsProvider();
|
|
19
|
+
const clientCredentialsProvider = async (options) => {
|
|
20
|
+
const { credentials } = await credentialsProvider(options);
|
|
21
21
|
return credentials;
|
|
22
22
|
};
|
|
23
23
|
const { CallerAccessGrantsList, NextToken } = await (0, s3control_1.listCallerAccessGrants)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listCallerAccessGrants.js","sources":["../../../../src/storageBrowser/apis/listCallerAccessGrants.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.listCallerAccessGrants = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst s3control_1 = require(\"../../providers/s3/utils/client/s3control\");\nconst StorageError_1 = require(\"../../errors/StorageError\");\nconst userAgent_1 = require(\"../../providers/s3/utils/userAgent\");\nconst constants_1 = require(\"./constants\");\nconst listCallerAccessGrants = async (input) => {\n const { credentialsProvider, accountId, region, nextToken, pageSize } = input;\n utils_2.logger.debug(`listing available locations from account ${input.accountId}`);\n if (!!pageSize && pageSize > constants_1.MAX_PAGE_SIZE) {\n utils_2.logger.debug(`defaulting pageSize to ${constants_1.MAX_PAGE_SIZE}.`);\n }\n const clientCredentialsProvider = async () => {\n const { credentials } = await credentialsProvider();\n return credentials;\n };\n const { CallerAccessGrantsList, NextToken } = await (0, s3control_1.listCallerAccessGrants)({\n credentials: clientCredentialsProvider,\n region,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.ListCallerAccessGrants),\n }, {\n AccountId: accountId,\n NextToken: nextToken,\n MaxResults: pageSize ?? constants_1.MAX_PAGE_SIZE,\n });\n const accessGrants = CallerAccessGrantsList?.map(grant => {\n // These values are correct from service mostly, but we add assertions to make TSC happy.\n assertPermission(grant.Permission);\n assertGrantScope(grant.GrantScope);\n return {\n scope: grant.GrantScope,\n permission: grant.Permission,\n applicationArn: grant.ApplicationArn,\n type: parseGrantType(grant.GrantScope),\n };\n }) ?? [];\n return {\n locations: accessGrants,\n nextToken: NextToken,\n };\n};\nexports.listCallerAccessGrants = listCallerAccessGrants;\nconst parseGrantType = (grantScope) => {\n const bucketScopeReg = /^s3:\\/\\/(.*)\\/\\*$/;\n const possibleBucketName = grantScope.match(bucketScopeReg)?.[1];\n if (!grantScope.endsWith('*')) {\n return 'OBJECT';\n }\n else if (grantScope.endsWith('/*') &&\n possibleBucketName &&\n possibleBucketName.indexOf('/') === -1) {\n return 'BUCKET';\n }\n else {\n return 'PREFIX';\n }\n};\nfunction assertPermission(permissionValue) {\n if (!['READ', 'READWRITE', 'WRITE'].includes(permissionValue ?? '')) {\n throw new StorageError_1.StorageError({\n name: 'InvalidPermission',\n message: `Invalid permission: ${permissionValue}`,\n });\n }\n}\nfunction assertGrantScope(value) {\n if (typeof value !== 'string' || !value.startsWith('s3://')) {\n throw new StorageError_1.StorageError({\n name: 'InvalidGrantScope',\n message: `Expected a valid grant scope, got ${value}`,\n });\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,CAAC;AACxC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,WAAW,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,sBAAsB,GAAG,OAAO,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AAClF,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,yCAAyC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACxF,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,GAAG,WAAW,CAAC,aAAa,EAAE;AAC5D,QAAQ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,KAAK;AACL,IAAI,MAAM,yBAAyB,GAAG,
|
|
1
|
+
{"version":3,"file":"listCallerAccessGrants.js","sources":["../../../../src/storageBrowser/apis/listCallerAccessGrants.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.listCallerAccessGrants = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst s3control_1 = require(\"../../providers/s3/utils/client/s3control\");\nconst StorageError_1 = require(\"../../errors/StorageError\");\nconst userAgent_1 = require(\"../../providers/s3/utils/userAgent\");\nconst constants_1 = require(\"./constants\");\nconst listCallerAccessGrants = async (input) => {\n const { credentialsProvider, accountId, region, nextToken, pageSize } = input;\n utils_2.logger.debug(`listing available locations from account ${input.accountId}`);\n if (!!pageSize && pageSize > constants_1.MAX_PAGE_SIZE) {\n utils_2.logger.debug(`defaulting pageSize to ${constants_1.MAX_PAGE_SIZE}.`);\n }\n const clientCredentialsProvider = async (options) => {\n const { credentials } = await credentialsProvider(options);\n return credentials;\n };\n const { CallerAccessGrantsList, NextToken } = await (0, s3control_1.listCallerAccessGrants)({\n credentials: clientCredentialsProvider,\n region,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.ListCallerAccessGrants),\n }, {\n AccountId: accountId,\n NextToken: nextToken,\n MaxResults: pageSize ?? constants_1.MAX_PAGE_SIZE,\n });\n const accessGrants = CallerAccessGrantsList?.map(grant => {\n // These values are correct from service mostly, but we add assertions to make TSC happy.\n assertPermission(grant.Permission);\n assertGrantScope(grant.GrantScope);\n return {\n scope: grant.GrantScope,\n permission: grant.Permission,\n applicationArn: grant.ApplicationArn,\n type: parseGrantType(grant.GrantScope),\n };\n }) ?? [];\n return {\n locations: accessGrants,\n nextToken: NextToken,\n };\n};\nexports.listCallerAccessGrants = listCallerAccessGrants;\nconst parseGrantType = (grantScope) => {\n const bucketScopeReg = /^s3:\\/\\/(.*)\\/\\*$/;\n const possibleBucketName = grantScope.match(bucketScopeReg)?.[1];\n if (!grantScope.endsWith('*')) {\n return 'OBJECT';\n }\n else if (grantScope.endsWith('/*') &&\n possibleBucketName &&\n possibleBucketName.indexOf('/') === -1) {\n return 'BUCKET';\n }\n else {\n return 'PREFIX';\n }\n};\nfunction assertPermission(permissionValue) {\n if (!['READ', 'READWRITE', 'WRITE'].includes(permissionValue ?? '')) {\n throw new StorageError_1.StorageError({\n name: 'InvalidPermission',\n message: `Invalid permission: ${permissionValue}`,\n });\n }\n}\nfunction assertGrantScope(value) {\n if (typeof value !== 'string' || !value.startsWith('s3://')) {\n throw new StorageError_1.StorageError({\n name: 'InvalidGrantScope',\n message: `Expected a valid grant scope, got ${value}`,\n });\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,CAAC;AACxC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,WAAW,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,sBAAsB,GAAG,OAAO,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AAClF,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,yCAAyC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACxF,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,GAAG,WAAW,CAAC,aAAa,EAAE;AAC5D,QAAQ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,KAAK;AACL,IAAI,MAAM,yBAAyB,GAAG,OAAO,OAAO,KAAK;AACzD,QAAQ,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,m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Options } from '@aws-amplify/core/internals/aws-client-utils';
|
|
3
|
+
import { CredentialsProviderOptions, SigningOptions } from '@aws-amplify/core/internals/aws-client-utils';
|
|
4
4
|
import { TransferProgressEvent } from '../../../types';
|
|
5
5
|
import { StorageListAllOptions, StorageListPaginateOptions, StorageSubpathStrategy } from '../../../types/options';
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export type LocationCredentialsProvider = (
|
|
10
|
-
forceRefresh?: boolean;
|
|
11
|
-
}) => Promise<{
|
|
9
|
+
export type LocationCredentialsProvider = (input?: CredentialsProviderOptions) => Promise<{
|
|
12
10
|
credentials: AWSCredentials;
|
|
13
11
|
}>;
|
|
14
12
|
export interface BucketInfo {
|
|
@@ -24,7 +24,7 @@ export declare const defaultConfig: {
|
|
|
24
24
|
}) => {
|
|
25
25
|
url: URL;
|
|
26
26
|
};
|
|
27
|
-
retryDecider: (response?: import("@aws-amplify/core/internals/aws-client-utils").HttpResponse | undefined, error?: unknown) => Promise<
|
|
27
|
+
retryDecider: (response?: import("@aws-amplify/core/internals/aws-client-utils").HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>;
|
|
28
28
|
computeDelay: (attempt: number) => number;
|
|
29
29
|
userAgentValue: string;
|
|
30
30
|
uriEscapePath: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getAmplifyUserAgent, AmplifyUrl } from '@aws-amplify/core/internals/utils';
|
|
2
|
-
import {
|
|
3
|
-
import { parseXmlError } from '../utils/parsePayload.mjs';
|
|
2
|
+
import { jitteredBackoff, getDnsSuffix } from '@aws-amplify/core/internals/aws-client-utils';
|
|
4
3
|
import '../runtime/s3TransferHandler/fetch.mjs';
|
|
5
4
|
import 'fast-xml-parser';
|
|
6
5
|
import '../runtime/s3TransferHandler/xhr.mjs';
|
|
7
6
|
import 'buffer';
|
|
7
|
+
import { retryDecider } from '../utils/retryDecider.mjs';
|
|
8
8
|
|
|
9
9
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -38,7 +38,7 @@ const endpointResolver = (options, apiInput) => {
|
|
|
38
38
|
const defaultConfig = {
|
|
39
39
|
service: SERVICE_NAME,
|
|
40
40
|
endpointResolver,
|
|
41
|
-
retryDecider
|
|
41
|
+
retryDecider,
|
|
42
42
|
computeDelay: jitteredBackoff,
|
|
43
43
|
userAgentValue: getAmplifyUserAgent(),
|
|
44
44
|
uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.mjs","sources":["../../../../../../../src/providers/s3/utils/client/s3control/base.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyUrl, getAmplifyUserAgent, } from '@aws-amplify/core/internals/utils';\nimport { getDnsSuffix,
|
|
1
|
+
{"version":3,"file":"base.mjs","sources":["../../../../../../../src/providers/s3/utils/client/s3control/base.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyUrl, getAmplifyUserAgent, } from '@aws-amplify/core/internals/utils';\nimport { getDnsSuffix, jitteredBackoff, } from '@aws-amplify/core/internals/aws-client-utils';\nimport { retryDecider } from '../utils';\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nexport const SERVICE_NAME = 's3';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.\n */\nconst endpointResolver = (options, apiInput) => {\n const { region, customEndpoint } = options;\n const { AccountId: accountId } = apiInput || {};\n let endpoint;\n // 1. get base endpoint\n if (customEndpoint) {\n endpoint = new AmplifyUrl(customEndpoint);\n }\n else if (accountId) {\n // Control plane operations\n endpoint = new AmplifyUrl(`https://${accountId}.s3-control.${region}.${getDnsSuffix(region)}`);\n }\n else {\n endpoint = new AmplifyUrl(`https://s3-control.${region}.${getDnsSuffix(region)}`);\n }\n return { url: endpoint };\n};\n/**\n * @internal\n */\nexport const defaultConfig = {\n service: SERVICE_NAME,\n endpointResolver,\n retryDecider,\n computeDelay: jitteredBackoff,\n userAgentValue: getAmplifyUserAgent(),\n uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83\n};\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAIA;AACA;AACA;AACY,MAAC,YAAY,GAAG,KAAK;AACjC;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AAChD,IAAI,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;AAC/C,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAC;AACpD,IAAI,IAAI,QAAQ,CAAC;AACjB;AACA,IAAI,IAAI,cAAc,EAAE;AACxB,QAAQ,QAAQ,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;AAClD,KAAK;AACL,SAAS,IAAI,SAAS,EAAE;AACxB;AACA,QAAQ,QAAQ,GAAG,IAAI,UAAU,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvG,KAAK;AACL,SAAS;AACT,QAAQ,QAAQ,GAAG,IAAI,UAAU,CAAC,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F,KAAK;AACL,IAAI,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC,CAAC;AACF;AACA;AACA;AACY,MAAC,aAAa,GAAG;AAC7B,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,gBAAgB;AACpB,IAAI,YAAY;AAChB,IAAI,YAAY,EAAE,eAAe;AACjC,IAAI,cAAc,EAAE,mBAAmB,EAAE;AACzC,IAAI,aAAa,EAAE,KAAK;AACxB;;;;"}
|
|
@@ -10,12 +10,12 @@ export declare const getDataAccess: (config: {
|
|
|
10
10
|
} | undefined) => {
|
|
11
11
|
url: URL;
|
|
12
12
|
})) | undefined;
|
|
13
|
-
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<
|
|
13
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>) & ((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>)) | undefined;
|
|
14
14
|
computeDelay?: ((attempt: number) => number) | undefined;
|
|
15
15
|
userAgentValue?: string | undefined;
|
|
16
16
|
uriEscapePath?: boolean | undefined;
|
|
17
17
|
} & {
|
|
18
|
-
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
18
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | ((options?: import("@aws-amplify/core/internals/aws-client-utils").CredentialsProviderOptions | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
19
19
|
region: string;
|
|
20
20
|
onDownloadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
|
|
21
21
|
onUploadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
|
|
@@ -10,12 +10,12 @@ export declare const listCallerAccessGrants: (config: {
|
|
|
10
10
|
} | undefined) => {
|
|
11
11
|
url: URL;
|
|
12
12
|
})) | undefined;
|
|
13
|
-
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<
|
|
13
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>) & ((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>)) | undefined;
|
|
14
14
|
computeDelay?: ((attempt: number) => number) | undefined;
|
|
15
15
|
userAgentValue?: string | undefined;
|
|
16
16
|
uriEscapePath?: boolean | undefined;
|
|
17
17
|
} & {
|
|
18
|
-
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | (() => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
18
|
+
credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | ((options?: import("@aws-amplify/core/internals/aws-client-utils").CredentialsProviderOptions | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
|
|
19
19
|
region: string;
|
|
20
20
|
onDownloadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
|
|
21
21
|
onUploadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
|
|
@@ -11,13 +11,13 @@ export declare const abortMultipartUpload: (config: {
|
|
|
11
11
|
} | undefined) => {
|
|
12
12
|
url: URL;
|
|
13
13
|
})) | undefined;
|
|
14
|
-
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<
|
|
14
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>) & ((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>)) | undefined;
|
|
15
15
|
computeDelay?: ((attempt: number) => number) | undefined;
|
|
16
16
|
userAgentValue?: string | undefined;
|
|
17
17
|
useAccelerateEndpoint?: boolean | undefined;
|
|
18
18
|
uriEscapePath?: boolean | undefined;
|
|
19
19
|
} & {
|
|
20
|
-
credentials: import("@aws-sdk/types").AwsCredentialIdentity | (() => Promise<import("@aws-sdk/types").AwsCredentialIdentity>);
|
|
20
|
+
credentials: import("@aws-sdk/types").AwsCredentialIdentity | ((options?: import("@aws-amplify/core/internals/aws-client-utils").CredentialsProviderOptions | undefined) => Promise<import("@aws-sdk/types").AwsCredentialIdentity>);
|
|
21
21
|
region: string;
|
|
22
22
|
onDownloadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
|
|
23
23
|
onUploadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
|
|
@@ -46,7 +46,7 @@ export declare const defaultConfig: {
|
|
|
46
46
|
}) => {
|
|
47
47
|
url: URL;
|
|
48
48
|
};
|
|
49
|
-
retryDecider: (response?: import("@aws-amplify/core/internals/aws-client-utils").HttpResponse | undefined, error?: unknown) => Promise<
|
|
49
|
+
retryDecider: (response?: import("@aws-amplify/core/internals/aws-client-utils").HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>;
|
|
50
50
|
computeDelay: (attempt: number) => number;
|
|
51
51
|
userAgentValue: string;
|
|
52
52
|
useAccelerateEndpoint: boolean;
|