@aws-amplify/storage 6.9.4-unstable.88f6e72.0 → 6.9.4-unstable.ce2ce10.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/CanceledError.js.map +1 -1
- package/dist/cjs/errors/IntegrityError.js.map +1 -1
- package/dist/cjs/errors/StorageError.js.map +1 -1
- package/dist/cjs/errors/utils/assertValidationError.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internals/apis/getDataAccess.js.map +1 -1
- package/dist/cjs/internals/apis/listCallerAccessGrants.js.map +1 -1
- package/dist/cjs/internals/apis/listPaths/getHighestPrecedenceUserGroup.js.map +1 -1
- package/dist/cjs/internals/apis/listPaths/index.js.map +1 -1
- package/dist/cjs/internals/apis/listPaths/listPaths.js.map +1 -1
- package/dist/cjs/internals/apis/listPaths/resolveLocationsForCurrentSession.js.map +1 -1
- package/dist/cjs/internals/index.js.map +1 -1
- package/dist/cjs/providers/s3/apis/index.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/downloadData.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/byteLength.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/index.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/calculatePartSize.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/getDataChunker.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/index.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/initialUpload.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/progressTracker.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadCache.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/index.js.map +1 -1
- package/dist/cjs/providers/s3/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/base64/index.browser.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/base64/index.native.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/contentSha256middleware.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/index.browser.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/index.native.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/xhrTransferHandler.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/xmlParser/dom.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/runtime/xmlParser/pureJs.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3control/base.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3control/getDataAccess.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3control/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3control/listCallerAccessGrants.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/abortMultipartUpload.js.map +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.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/copyObject.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/createMultipartUpload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/getObject.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/headObject.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/listParts.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/putObject.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/uploadPart.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/createRetryDecider.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/integrityHelpers.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/serializeHelpers.js.map +1 -1
- package/dist/cjs/providers/s3/utils/crc32.js.map +1 -1
- package/dist/cjs/providers/s3/utils/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/readFile.js.map +1 -1
- package/dist/cjs/providers/s3/utils/readFile.native.js.map +1 -1
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
- package/dist/cjs/providers/s3/utils/transferTask.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateBucketOwnerID.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateMultipartUploadXML.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateObjectUrl.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/resolvePrefix.js.map +1 -1
- package/dist/esm/errors/CanceledError.mjs.map +1 -1
- package/dist/esm/errors/IntegrityError.mjs.map +1 -1
- package/dist/esm/errors/StorageError.mjs.map +1 -1
- package/dist/esm/errors/utils/assertValidationError.mjs.map +1 -1
- package/dist/esm/internals/apis/getDataAccess.mjs.map +1 -1
- package/dist/esm/internals/apis/listCallerAccessGrants.mjs.map +1 -1
- package/dist/esm/internals/apis/listPaths/getHighestPrecedenceUserGroup.mjs.map +1 -1
- package/dist/esm/internals/apis/listPaths/listPaths.mjs.map +1 -1
- package/dist/esm/internals/apis/listPaths/resolveLocationsForCurrentSession.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/downloadData.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/byteLength.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/index.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/calculatePartSize.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/getDataChunker.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/initialUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/progressTracker.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/runtime/base64/index.browser.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/runtime/base64/index.native.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/runtime/contentSha256middleware.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/runtime/xhrTransferHandler.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/runtime/xmlParser/dom.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/runtime/xmlParser/pureJs.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3control/base.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/abortMultipartUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/base.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/copyObject.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/headObject.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/listParts.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/putObject.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/uploadPart.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/utils/createRetryDecider.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/utils/integrityHelpers.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/utils/serializeHelpers.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/crc32.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/readFile.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/readFile.native.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/transferTask.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateBucketOwnerID.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateMultipartUploadXML.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateObjectUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs.map +1 -1
- package/dist/esm/utils/resolvePrefix.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsePayload.js","sources":["../../../../../../../src/providers/s3/utils/client/utils/parsePayload.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.parseXmlBody = exports.createXmlErrorParser = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst runtime_1 = require(\"../runtime\");\n/**\n * Factory creating a parser that parses the JS Error object from the XML\n * response payload.\n *\n * @param input Input object\n * @param input.noErrorWrapping Whether the error code and message are located\n * directly in the root XML element, or in a nested `<Error>` element.\n * See: https://smithy.io/2.0/aws/protocols/aws-restxml-protocol.html#restxml-errors\n *\n * Default to false.\n *\n * @internal\n */\nconst createXmlErrorParser = ({ noErrorWrapping = false, } = {}) => async (response) => {\n if (!response || response.statusCode < 300) {\n return;\n }\n const { statusCode } = response;\n const body = await (0, exports.parseXmlBody)(response);\n const errorLocation = noErrorWrapping ? body : body.Error;\n const code = errorLocation?.Code\n ? errorLocation.Code\n : statusCode === 404\n ? 'NotFound'\n : statusCode.toString();\n const message = errorLocation?.message ?? errorLocation?.Message ?? code;\n const error = new Error(message);\n return Object.assign(error, {\n name: code,\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n });\n};\nexports.createXmlErrorParser = createXmlErrorParser;\nconst parseXmlBody = async (response) => {\n if (!response.body) {\n // S3 can return 200 without a body indicating failure.\n throw new Error('S3 aborted request.');\n }\n const data = await response.body.text();\n if (data?.length > 0) {\n try {\n return runtime_1.parser.parse(data);\n }\n catch (error) {\n throw new Error(`Failed to parse XML response: ${error}`);\n }\n }\n return {};\n};\nexports.parseXmlBody = parseXmlBody;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,oBAAoB,GAAG,MAAM;AAC5D,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,EAAE,eAAe,GAAG,KAAK,GAAG,GAAG,EAAE,KAAK,OAAO,QAAQ,KAAK;AACxF,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAChD,QAAQ;AACR;
|
|
1
|
+
{"version":3,"file":"parsePayload.js","sources":["../../../../../../../src/providers/s3/utils/client/utils/parsePayload.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.parseXmlBody = exports.createXmlErrorParser = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst runtime_1 = require(\"../runtime\");\n/**\n * Factory creating a parser that parses the JS Error object from the XML\n * response payload.\n *\n * @param input Input object\n * @param input.noErrorWrapping Whether the error code and message are located\n * directly in the root XML element, or in a nested `<Error>` element.\n * See: https://smithy.io/2.0/aws/protocols/aws-restxml-protocol.html#restxml-errors\n *\n * Default to false.\n *\n * @internal\n */\nconst createXmlErrorParser = ({ noErrorWrapping = false, } = {}) => async (response) => {\n if (!response || response.statusCode < 300) {\n return;\n }\n const { statusCode } = response;\n const body = await (0, exports.parseXmlBody)(response);\n const errorLocation = noErrorWrapping ? body : body.Error;\n const code = errorLocation?.Code\n ? errorLocation.Code\n : statusCode === 404\n ? 'NotFound'\n : statusCode.toString();\n const message = errorLocation?.message ?? errorLocation?.Message ?? code;\n const error = new Error(message);\n return Object.assign(error, {\n name: code,\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n });\n};\nexports.createXmlErrorParser = createXmlErrorParser;\nconst parseXmlBody = async (response) => {\n if (!response.body) {\n // S3 can return 200 without a body indicating failure.\n throw new Error('S3 aborted request.');\n }\n const data = await response.body.text();\n if (data?.length > 0) {\n try {\n return runtime_1.parser.parse(data);\n }\n catch (error) {\n throw new Error(`Failed to parse XML response: ${error}`);\n }\n }\n return {};\n};\nexports.parseXmlBody = parseXmlBody;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,oBAAoB,GAAG,MAAM;AAC5D,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,EAAE,eAAe,GAAG,KAAK,GAAG,GAAG,EAAE,KAAK,OAAO,QAAQ,KAAK;AACxF,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAChD,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ;AACnC,IAAI,MAAM,IAAI,GAAG,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC;AAC1D,IAAI,MAAM,aAAa,GAAG,e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/utils/client/utils/serializeHelpers.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serializePathnameObjectKey = exports.serializeObjectConfigsToHeaders = exports.assignStringVariables = void 0;\nexports.validateS3RequiredParameter = validateS3RequiredParameter;\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 utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst StorageError_1 = require(\"../../../../../errors/StorageError\");\n/**\n * @internal\n */\nconst assignStringVariables = (values) => {\n const queryParams = {};\n for (const [key, value] of Object.entries(values)) {\n if (value != null) {\n queryParams[key] = value.toString();\n }\n }\n return queryParams;\n};\nexports.assignStringVariables = assignStringVariables;\n/**\n * Serailize the parameters for configuring the S3 object. Currently used by\n * `putObject` and `createMultipartUpload` API.\n *\n * @internal\n */\nconst serializeObjectConfigsToHeaders = async (input) => ({\n ...(0, exports.assignStringVariables)({\n 'x-amz-acl': input.ACL,\n 'cache-control': input.CacheControl,\n 'content-disposition': input.ContentDisposition,\n 'content-language': input.ContentLanguage,\n 'content-encoding': input.ContentEncoding,\n 'content-type': input.ContentType,\n expires: input.Expires?.toUTCString(),\n 'x-amz-tagging': input.Tagging,\n ...serializeMetadata(input.Metadata),\n }),\n});\nexports.serializeObjectConfigsToHeaders = serializeObjectConfigsToHeaders;\nconst serializeMetadata = (metadata = {}) => Object.keys(metadata).reduce((acc, suffix) => {\n acc[`x-amz-meta-${suffix.toLowerCase()}`] = metadata[suffix];\n return acc;\n}, {});\n/**\n * Serialize the object key to a URL pathname.\n * @see https://github.com/aws/aws-sdk-js-v3/blob/7ed7101dcc4e81038b6c7f581162b959e6b33a04/clients/client-s3/src/protocols/Aws_restXml.ts#L1108\n *\n * @internal\n */\nconst serializePathnameObjectKey = (url, key) => {\n return (url.pathname.replace(/\\/$/, '') +\n `/${key.split('/').map(aws_client_utils_1.extendedEncodeURIComponent).join('/')}`);\n};\nexports.serializePathnameObjectKey = serializePathnameObjectKey;\nfunction validateS3RequiredParameter(assertion, paramName) {\n if (!assertion) {\n throw new StorageError_1.StorageError({\n name: utils_1.AmplifyErrorCode.Unknown,\n message: 'An unknown error has occurred.',\n underlyingError: new TypeError(`Expected a non-null value for S3 parameter ${paramName}`),\n recoverySuggestion: 'This is likely to be a bug. Please reach out to library authors.',\n });\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACrH,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;AACjE;AACA;AACA,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACpE;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,CAAC,MAAM,KAAK;AAC1C,IAAI,MAAM,WAAW,GAAG,EAAE;AAC1B,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACvD,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;AAC3B,YAAY,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE;AAC/C;
|
|
1
|
+
{"version":3,"file":"serializeHelpers.js","sources":["../../../../../../../src/providers/s3/utils/client/utils/serializeHelpers.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serializePathnameObjectKey = exports.serializeObjectConfigsToHeaders = exports.assignStringVariables = void 0;\nexports.validateS3RequiredParameter = validateS3RequiredParameter;\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 utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst StorageError_1 = require(\"../../../../../errors/StorageError\");\n/**\n * @internal\n */\nconst assignStringVariables = (values) => {\n const queryParams = {};\n for (const [key, value] of Object.entries(values)) {\n if (value != null) {\n queryParams[key] = value.toString();\n }\n }\n return queryParams;\n};\nexports.assignStringVariables = assignStringVariables;\n/**\n * Serailize the parameters for configuring the S3 object. Currently used by\n * `putObject` and `createMultipartUpload` API.\n *\n * @internal\n */\nconst serializeObjectConfigsToHeaders = async (input) => ({\n ...(0, exports.assignStringVariables)({\n 'x-amz-acl': input.ACL,\n 'cache-control': input.CacheControl,\n 'content-disposition': input.ContentDisposition,\n 'content-language': input.ContentLanguage,\n 'content-encoding': input.ContentEncoding,\n 'content-type': input.ContentType,\n expires: input.Expires?.toUTCString(),\n 'x-amz-tagging': input.Tagging,\n ...serializeMetadata(input.Metadata),\n }),\n});\nexports.serializeObjectConfigsToHeaders = serializeObjectConfigsToHeaders;\nconst serializeMetadata = (metadata = {}) => Object.keys(metadata).reduce((acc, suffix) => {\n acc[`x-amz-meta-${suffix.toLowerCase()}`] = metadata[suffix];\n return acc;\n}, {});\n/**\n * Serialize the object key to a URL pathname.\n * @see https://github.com/aws/aws-sdk-js-v3/blob/7ed7101dcc4e81038b6c7f581162b959e6b33a04/clients/client-s3/src/protocols/Aws_restXml.ts#L1108\n *\n * @internal\n */\nconst serializePathnameObjectKey = (url, key) => {\n return (url.pathname.replace(/\\/$/, '') +\n `/${key.split('/').map(aws_client_utils_1.extendedEncodeURIComponent).join('/')}`);\n};\nexports.serializePathnameObjectKey = serializePathnameObjectKey;\nfunction validateS3RequiredParameter(assertion, paramName) {\n if (!assertion) {\n throw new StorageError_1.StorageError({\n name: utils_1.AmplifyErrorCode.Unknown,\n message: 'An unknown error has occurred.',\n underlyingError: new TypeError(`Expected a non-null value for S3 parameter ${paramName}`),\n recoverySuggestion: 'This is likely to be a bug. Please reach out to library authors.',\n });\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACrH,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;AACjE;AACA;AACA,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACpE;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,CAAC,MAAM,KAAK;AAC1C,IAAI,MAAM,WAAW,GAAG,EAAE;AAC1B,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACvD,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;AAC3B,YAAY,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE;AAC/C,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,WAAW;AACtB,CAAC;AACD,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,+BAA+B,GAAG,OAAO,KAAK,MAAM;AAC1D,IAAI,GAAG,IAAI,OAAO,CAAC,qBAAqB,EAAE;AAC1C,QAAQ,WAAW,EAAE,KAAK,CAAC,GAAG;AAC9B,QAAQ,eAAe,EAAE,KAAK,CAAC,YAAY;AAC3C,QAAQ,qBAAqB,EAAE,KAAK,CAAC,kBAAkB;AACvD,QAAQ,kBAAkB,EAAE,KAAK,CAAC,eAA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,EAAE,gCAAgC;AACrD,YAAY,eAAe,EAAE,IAAI,SAAS,CAAC,CAAC,2CAA2C,EAAE,SAAS,CAAC,CAAC,CAAC;AACrG,YAAY,kBAAkB,EAAE,kEAAkE;AAClG,SAAS,CAAC;AACV,IAAI;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crc32.js","sources":["../../../../../src/providers/s3/utils/crc32.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.calculateContentCRC32 = void 0;\nconst tslib_1 = require(\"tslib\");\nconst crc_32_1 = tslib_1.__importDefault(require(\"crc-32\"));\nconst hexUtils_1 = require(\"./hexUtils\");\nconst readFile_1 = require(\"./readFile\");\nconst CHUNK_SIZE = 1024 * 1024; // 1MB chunks\n/**\n * Calculate the CRC32 checksum for given content and return base64 encoded checksum.\n */\nconst calculateContentCRC32 = async (content, seed = 0) => {\n let internalSeed = seed;\n if (content instanceof ArrayBuffer || ArrayBuffer.isView(content)) {\n let uint8Array;\n if (content instanceof ArrayBuffer) {\n uint8Array = new Uint8Array(content);\n }\n else {\n uint8Array = new Uint8Array(content.buffer, content.byteOffset, content.byteLength);\n }\n let offset = 0;\n while (offset < uint8Array.length) {\n const end = Math.min(offset + CHUNK_SIZE, uint8Array.length);\n const chunk = uint8Array.slice(offset, end);\n internalSeed = crc_32_1.default.buf(chunk, internalSeed) >>> 0;\n offset = end;\n }\n }\n else {\n let blob;\n if (content instanceof Blob) {\n blob = content;\n }\n else {\n blob = new Blob([content]);\n }\n let offset = 0;\n while (offset < blob.size) {\n const end = Math.min(offset + CHUNK_SIZE, blob.size);\n const chunk = blob.slice(offset, end);\n const arrayBuffer = await (0, readFile_1.readFile)(chunk);\n const uint8Array = new Uint8Array(arrayBuffer);\n internalSeed = crc_32_1.default.buf(uint8Array, internalSeed) >>> 0;\n offset = end;\n }\n }\n const hex = internalSeed.toString(16).padStart(8, '0');\n return (0, hexUtils_1.hexToBase64)(hex);\n};\nexports.calculateContentCRC32 = calculateContentCRC32;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACtC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3D,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/B;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,OAAO,OAAO,EAAE,IAAI,GAAG,CAAC,KAAK;AAC3D,IAAI,IAAI,YAAY,GAAG,IAAI;AAC3B,IAAI,IAAI,OAAO,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;AACvE,QAAQ,IAAI,UAAU;AACtB,QAAQ,IAAI,OAAO,YAAY,WAAW,EAAE;AAC5C,YAAY,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC;AAChD;
|
|
1
|
+
{"version":3,"file":"crc32.js","sources":["../../../../../src/providers/s3/utils/crc32.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.calculateContentCRC32 = void 0;\nconst tslib_1 = require(\"tslib\");\nconst crc_32_1 = tslib_1.__importDefault(require(\"crc-32\"));\nconst hexUtils_1 = require(\"./hexUtils\");\nconst readFile_1 = require(\"./readFile\");\nconst CHUNK_SIZE = 1024 * 1024; // 1MB chunks\n/**\n * Calculate the CRC32 checksum for given content and return base64 encoded checksum.\n */\nconst calculateContentCRC32 = async (content, seed = 0) => {\n let internalSeed = seed;\n if (content instanceof ArrayBuffer || ArrayBuffer.isView(content)) {\n let uint8Array;\n if (content instanceof ArrayBuffer) {\n uint8Array = new Uint8Array(content);\n }\n else {\n uint8Array = new Uint8Array(content.buffer, content.byteOffset, content.byteLength);\n }\n let offset = 0;\n while (offset < uint8Array.length) {\n const end = Math.min(offset + CHUNK_SIZE, uint8Array.length);\n const chunk = uint8Array.slice(offset, end);\n internalSeed = crc_32_1.default.buf(chunk, internalSeed) >>> 0;\n offset = end;\n }\n }\n else {\n let blob;\n if (content instanceof Blob) {\n blob = content;\n }\n else {\n blob = new Blob([content]);\n }\n let offset = 0;\n while (offset < blob.size) {\n const end = Math.min(offset + CHUNK_SIZE, blob.size);\n const chunk = blob.slice(offset, end);\n const arrayBuffer = await (0, readFile_1.readFile)(chunk);\n const uint8Array = new Uint8Array(arrayBuffer);\n internalSeed = crc_32_1.default.buf(uint8Array, internalSeed) >>> 0;\n offset = end;\n }\n }\n const hex = internalSeed.toString(16).padStart(8, '0');\n return (0, hexUtils_1.hexToBase64)(hex);\n};\nexports.calculateContentCRC32 = calculateContentCRC32;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACtC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3D,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/B;AACA;AACA;AAC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AC,GAAG,CAAC,MAAM,GAAG,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;AAChE,YAAY,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC;AACjD,YAAY,MAAM,WAAW,GAAG,MAAM,IAAI,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC;AACrE,YAAY,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;AAC1D,YAAY,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC;AAC/E,YAAY,MAAM,GAAG,GAAG;AACxB,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC1D,IAAI,OAAO,IAAI,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC;AAC3C,CAAC;AACD,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/providers/s3/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.urlDecode = exports.isInputWithPath = exports.validateStorageOperationInputWithPrefix = exports.validateStorageOperationInput = exports.validateBucketOwnerID = exports.createUploadTask = exports.createDownloadTask = exports.resolveS3ConfigAndInput = exports.calculateContentMd5 = void 0;\nvar md5_1 = require(\"./md5\");\nObject.defineProperty(exports, \"calculateContentMd5\", { enumerable: true, get: function () { return md5_1.calculateContentMd5; } });\nvar resolveS3ConfigAndInput_1 = require(\"./resolveS3ConfigAndInput\");\nObject.defineProperty(exports, \"resolveS3ConfigAndInput\", { enumerable: true, get: function () { return resolveS3ConfigAndInput_1.resolveS3ConfigAndInput; } });\nvar transferTask_1 = require(\"./transferTask\");\nObject.defineProperty(exports, \"createDownloadTask\", { enumerable: true, get: function () { return transferTask_1.createDownloadTask; } });\nObject.defineProperty(exports, \"createUploadTask\", { enumerable: true, get: function () { return transferTask_1.createUploadTask; } });\nvar validateBucketOwnerID_1 = require(\"./validateBucketOwnerID\");\nObject.defineProperty(exports, \"validateBucketOwnerID\", { enumerable: true, get: function () { return validateBucketOwnerID_1.validateBucketOwnerID; } });\nvar validateStorageOperationInput_1 = require(\"./validateStorageOperationInput\");\nObject.defineProperty(exports, \"validateStorageOperationInput\", { enumerable: true, get: function () { return validateStorageOperationInput_1.validateStorageOperationInput; } });\nvar validateStorageOperationInputWithPrefix_1 = require(\"./validateStorageOperationInputWithPrefix\");\nObject.defineProperty(exports, \"validateStorageOperationInputWithPrefix\", { enumerable: true, get: function () { return validateStorageOperationInputWithPrefix_1.validateStorageOperationInputWithPrefix; } });\nvar isInputWithPath_1 = require(\"./isInputWithPath\");\nObject.defineProperty(exports, \"isInputWithPath\", { enumerable: true, get: function () { return isInputWithPath_1.isInputWithPath; } });\nvar urlDecoder_1 = require(\"./urlDecoder\");\nObject.defineProperty(exports, \"urlDecode\", { enumerable: true, get: function () { return urlDecoder_1.urlDecode; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,uCAAuC,GAAG,OAAO,CAAC,6BAA6B,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,GAAG,MAAM;AACtS,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;AAC5B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,KAAK,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/providers/s3/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.urlDecode = exports.isInputWithPath = exports.validateStorageOperationInputWithPrefix = exports.validateStorageOperationInput = exports.validateBucketOwnerID = exports.createUploadTask = exports.createDownloadTask = exports.resolveS3ConfigAndInput = exports.calculateContentMd5 = void 0;\nvar md5_1 = require(\"./md5\");\nObject.defineProperty(exports, \"calculateContentMd5\", { enumerable: true, get: function () { return md5_1.calculateContentMd5; } });\nvar resolveS3ConfigAndInput_1 = require(\"./resolveS3ConfigAndInput\");\nObject.defineProperty(exports, \"resolveS3ConfigAndInput\", { enumerable: true, get: function () { return resolveS3ConfigAndInput_1.resolveS3ConfigAndInput; } });\nvar transferTask_1 = require(\"./transferTask\");\nObject.defineProperty(exports, \"createDownloadTask\", { enumerable: true, get: function () { return transferTask_1.createDownloadTask; } });\nObject.defineProperty(exports, \"createUploadTask\", { enumerable: true, get: function () { return transferTask_1.createUploadTask; } });\nvar validateBucketOwnerID_1 = require(\"./validateBucketOwnerID\");\nObject.defineProperty(exports, \"validateBucketOwnerID\", { enumerable: true, get: function () { return validateBucketOwnerID_1.validateBucketOwnerID; } });\nvar validateStorageOperationInput_1 = require(\"./validateStorageOperationInput\");\nObject.defineProperty(exports, \"validateStorageOperationInput\", { enumerable: true, get: function () { return validateStorageOperationInput_1.validateStorageOperationInput; } });\nvar validateStorageOperationInputWithPrefix_1 = require(\"./validateStorageOperationInputWithPrefix\");\nObject.defineProperty(exports, \"validateStorageOperationInputWithPrefix\", { enumerable: true, get: function () { return validateStorageOperationInputWithPrefix_1.validateStorageOperationInputWithPrefix; } });\nvar isInputWithPath_1 = require(\"./isInputWithPath\");\nObject.defineProperty(exports, \"isInputWithPath\", { enumerable: true, get: function () { return isInputWithPath_1.isInputWithPath; } });\nvar urlDecoder_1 = require(\"./urlDecoder\");\nObject.defineProperty(exports, \"urlDecode\", { enumerable: true, get: function () { return urlDecoder_1.urlDecode; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,uCAAuC,GAAG,OAAO,CAAC,6BAA6B,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,GAAG,MAAM;AACtS,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;AAC5B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;AACnI,IAAI,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACpE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,yBAAyB,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/J,IAAI,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAC9C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE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AY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readFile.js","sources":["../../../../../src/providers/s3/utils/readFile.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.readFile = void 0;\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n reader.readAsArrayBuffer(file);\n});\nexports.readFile = readFile;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,QAAQ,GAAG,MAAM;AACzB,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AACnC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,
|
|
1
|
+
{"version":3,"file":"readFile.js","sources":["../../../../../src/providers/s3/utils/readFile.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.readFile = void 0;\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n reader.readAsArrayBuffer(file);\n});\nexports.readFile = readFile;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,QAAQ,GAAG,MAAM;AACzB,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AACnC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,IAAI,CAAC;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AACzC,IAAI,CAAC;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;AAC5B,IAAI,CAAC;AACL,IAAI,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAClC,CAAC,CAAC;AACF,OAAO,CAAC,QAAQ,GAAG,QAAQ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readFile.native.js","sources":["../../../../../src/providers/s3/utils/readFile.native.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.readFile = void 0;\nconst buffer_1 = require(\"buffer\");\n// The FileReader in React Native 0.71 did not support `readAsArrayBuffer`. This native implementation accommodates this\n// by attempting to use `readAsArrayBuffer` and changing the file reading strategy if it throws an error.\n// TODO: This file should be removable when we drop support for React Native 0.71\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n try {\n reader.readAsArrayBuffer(file);\n }\n catch (e) {\n reader.onload = () => {\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n const [, base64Data] = reader.result.split(',');\n const arrayBuffer = buffer_1.Buffer.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\nexports.readFile = readFile;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,QAAQ,GAAG,MAAM;AACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;AAClC;AACA;AACA;AACA,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AACnC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,
|
|
1
|
+
{"version":3,"file":"readFile.native.js","sources":["../../../../../src/providers/s3/utils/readFile.native.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.readFile = void 0;\nconst buffer_1 = require(\"buffer\");\n// The FileReader in React Native 0.71 did not support `readAsArrayBuffer`. This native implementation accommodates this\n// by attempting to use `readAsArrayBuffer` and changing the file reading strategy if it throws an error.\n// TODO: This file should be removable when we drop support for React Native 0.71\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n try {\n reader.readAsArrayBuffer(file);\n }\n catch (e) {\n reader.onload = () => {\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n const [, base64Data] = reader.result.split(',');\n const arrayBuffer = buffer_1.Buffer.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\nexports.readFile = readFile;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,QAAQ,GAAG,MAAM;AACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;AAClC;AACA;AACA;AACA,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AACnC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,IAAI,CAAC;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AACzC,IAAI,CAAC;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;AAC5B,IAAI,CAAC;AACL,IAAI,IAAI;AACR,QAAQ,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AACtC,IAAI;AACJ,IAAI,OAAO,CAAC,EAAE;AACd,QAAQ,MAAM,CAAC,MAAM,GAAG,MAAM;AAC9B;AACA;AACA,YAAY,MAAM,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;AAC3D,YAAY,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;AAC1E,YAAY,OAAO,CAAC,WAAW,CAAC;AAChC,QAAQ,CAAC;AACT,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;AAClC,IAAI;AACJ,CAAC,CAAC;AACF,OAAO,CAAC,QAAQ,GAAG,QAAQ;;"}
|
|
@@ -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 * 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 ...(apiOptions?.customEndpoint\n ? { customEndpoint: apiOptions.customEndpoint }\n : {}),\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;AAC7D,OAAO,CAAC,uBAAuB,GAAG,MAAM;AACxC,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAA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,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAK;AACrC,IAAI,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC;AAC/C,CAAC;AACD,MAAM,kCAAkC,GAAG,CAAC,KAAK,KAAK;AACtD,IAAI,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ;AACnD,QAAQ,OAAO,KAAK,CAAC,WAAW,EAAE,GAAG,KAAK,QAAQ,CAAC;AACnD,CAAC;AACD,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;AACzD,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,0BAA0B,CAAC,oBAAoB,CAAC;AACxI,QAAQ,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE;AAC/E;AACA,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;AACT;AACA,CAAC;;"}
|
|
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 * 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 ...(apiOptions?.customEndpoint\n ? { customEndpoint: apiOptions.customEndpoint }\n : {}),\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;AAC7D,OAAO,CAAC,uBAAuB,GAAG,MAAM;AACxC,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,eAAe,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC/D,MAAM,cAAc,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C;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,QAAQ,IAAI,EAAE;AAClD;AACA;AACA;AACA;AACA,IAAI,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,mBAAmB,GAAG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AY,CAAC,0BAA0B,CAAC,oBAAoB,CAAC;AACxI,QAAQ,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE;AAC/E,IAAI;AACJ,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;AACT,IAAI;AACJ,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transferTask.js","sources":["../../../../../src/providers/s3/utils/transferTask.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.createUploadTask = exports.createDownloadTask = void 0;\nconst CanceledError_1 = require(\"../../../errors/CanceledError\");\nconst utils_1 = require(\"../../../utils\");\nconst createCancellableTask = ({ job, onCancel, }) => {\n const state = 'IN_PROGRESS';\n let canceledErrorMessage;\n const cancelableTask = {\n cancel: (message) => {\n const { state: taskState } = cancelableTask;\n if (taskState === 'CANCELED' ||\n taskState === 'ERROR' ||\n taskState === 'SUCCESS') {\n utils_1.logger.debug(`This task cannot be canceled. State: ${taskState}`);\n return;\n }\n cancelableTask.state = 'CANCELED';\n canceledErrorMessage = message;\n onCancel(canceledErrorMessage);\n },\n state,\n };\n const wrappedJobPromise = (async () => {\n try {\n const result = await job();\n cancelableTask.state = 'SUCCESS';\n return result;\n }\n catch (e) {\n if ((0, CanceledError_1.isCancelError)(e)) {\n cancelableTask.state = 'CANCELED';\n e.message = canceledErrorMessage ?? e.message;\n }\n cancelableTask.state = 'ERROR';\n throw e;\n }\n })();\n return Object.assign(cancelableTask, {\n result: wrappedJobPromise,\n });\n};\nexports.createDownloadTask = createCancellableTask;\nconst createUploadTask = ({ job, onCancel, onResume, onPause, isMultipartUpload, }) => {\n const cancellableTask = createCancellableTask({\n job,\n onCancel,\n });\n const uploadTask = Object.assign(cancellableTask, {\n pause: () => {\n const { state } = uploadTask;\n if (!isMultipartUpload || state !== 'IN_PROGRESS') {\n utils_1.logger.debug(`This task cannot be paused. State: ${state}`);\n return;\n }\n // TODO(eslint): remove this linter suppression.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n uploadTask.state = 'PAUSED';\n onPause?.();\n },\n resume: () => {\n const { state } = uploadTask;\n if (!isMultipartUpload || state !== 'PAUSED') {\n utils_1.logger.debug(`This task cannot be resumed. State: ${state}`);\n return;\n }\n // TODO(eslint): remove this linter suppression.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n uploadTask.state = 'IN_PROGRESS';\n onResume?.();\n },\n });\n return uploadTask;\n};\nexports.createUploadTask = createUploadTask;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,GAAG,MAAM;AAC9D,MAAM,eAAe,GAAG,OAAO,CAAC,+BAA+B,CAAC;AAChE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,qBAAqB,GAAG,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK;AACtD,IAAI,MAAM,KAAK,GAAG,aAAa;AAC/B,IAAI,IAAI,oBAAoB;AAC5B,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,MAAM,EAAE,CAAC,OAAO,KAAK;AAC7B,YAAY,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,cAAc;AACvD,YAAY,IAAI,SAAS,KAAK,UAAU;AACxC,gBAAgB,SAAS,KAAK,OAAO;AACrC,gBAAgB,SAAS,KAAK,SAAS,EAAE;AACzC,gBAAgB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC,CAAC;AACzF,gBAAgB;AAChB;
|
|
1
|
+
{"version":3,"file":"transferTask.js","sources":["../../../../../src/providers/s3/utils/transferTask.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.createUploadTask = exports.createDownloadTask = void 0;\nconst CanceledError_1 = require(\"../../../errors/CanceledError\");\nconst utils_1 = require(\"../../../utils\");\nconst createCancellableTask = ({ job, onCancel, }) => {\n const state = 'IN_PROGRESS';\n let canceledErrorMessage;\n const cancelableTask = {\n cancel: (message) => {\n const { state: taskState } = cancelableTask;\n if (taskState === 'CANCELED' ||\n taskState === 'ERROR' ||\n taskState === 'SUCCESS') {\n utils_1.logger.debug(`This task cannot be canceled. State: ${taskState}`);\n return;\n }\n cancelableTask.state = 'CANCELED';\n canceledErrorMessage = message;\n onCancel(canceledErrorMessage);\n },\n state,\n };\n const wrappedJobPromise = (async () => {\n try {\n const result = await job();\n cancelableTask.state = 'SUCCESS';\n return result;\n }\n catch (e) {\n if ((0, CanceledError_1.isCancelError)(e)) {\n cancelableTask.state = 'CANCELED';\n e.message = canceledErrorMessage ?? e.message;\n }\n cancelableTask.state = 'ERROR';\n throw e;\n }\n })();\n return Object.assign(cancelableTask, {\n result: wrappedJobPromise,\n });\n};\nexports.createDownloadTask = createCancellableTask;\nconst createUploadTask = ({ job, onCancel, onResume, onPause, isMultipartUpload, }) => {\n const cancellableTask = createCancellableTask({\n job,\n onCancel,\n });\n const uploadTask = Object.assign(cancellableTask, {\n pause: () => {\n const { state } = uploadTask;\n if (!isMultipartUpload || state !== 'IN_PROGRESS') {\n utils_1.logger.debug(`This task cannot be paused. State: ${state}`);\n return;\n }\n // TODO(eslint): remove this linter suppression.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n uploadTask.state = 'PAUSED';\n onPause?.();\n },\n resume: () => {\n const { state } = uploadTask;\n if (!isMultipartUpload || state !== 'PAUSED') {\n utils_1.logger.debug(`This task cannot be resumed. State: ${state}`);\n return;\n }\n // TODO(eslint): remove this linter suppression.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n uploadTask.state = 'IN_PROGRESS';\n onResume?.();\n },\n });\n return uploadTask;\n};\nexports.createUploadTask = createUploadTask;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,GAAG,MAAM;AAC9D,MAAM,eAAe,GAAG,OAAO,CAAC,+BAA+B,CAAC;AAChE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,qBAAqB,GAAG,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK;AACtD,IAAI,MAAM,KAAK,GAAG,aAAa;AAC/B,IAAI,IAAI,oBAAoB;AAC5B,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,MAAM,EAAE,CAAC,OAAO,KAAK;AAC7B,YAAY,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,cAAc;AACvD,YAAY,IAAI,SAAS,KAAK,UAAU;AACxC,gBAAgB,SAAS,KAAK,OAAO;AACrC,gBAAgB,SAAS,KAAK,SAAS,EAAE;AACzC,gBAAgB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC,CAAC;AACzF,gBAAgB;AAChB,YAAY;AACZ,YAAY,cAAc,CAAC,KAAK,GAAG,UAAU;AAC7C,YAAY,oBAAoB,GAAG,OAAO;AAC1C,YAAY,QAA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,EAAE,KAAK,CAAC,CAAC,CAAC;AACnF,gBAAgB;AAChB,YAAY;AACZ;AACA;AACA;AACA,YAAY,UAAU,CAAC,KAAK,GAAG,QAAQ;AACvC,YAAY,OAAO,IAAI;AACvB,QAAQ,CAAC;AACT,QAAQ,MAAM,EAAE,MAAM;AACtB,YAAY,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU;AACxC,YAAY,IAAI,CAAC,iBAAiB,IAAI,KAAK,KAAK,QAAQ,EAAE;AAC1D,gBAAgB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC,CAAC;AACpF,gBAAgB;AAChB,YAAY;AACZ;AACA;AACA;AACA,YAAY,UAAU,CAAC,KAAK,GAAG,aAAa;AAC5C,YAAY,QAAQ,IAAI;AACxB,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,OAAO,UAAU;AACrB,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateBucketOwnerID.js","sources":["../../../../../src/providers/s3/utils/validateBucketOwnerID.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.validateBucketOwnerID = void 0;\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst VALID_AWS_ACCOUNT_ID_PATTERN = /^\\d{12}/;\nconst validateBucketOwnerID = (accountID) => {\n if (accountID === undefined) {\n return;\n }\n (0, assertValidationError_1.assertValidationError)(VALID_AWS_ACCOUNT_ID_PATTERN.test(accountID), validation_1.StorageValidationErrorCode.InvalidAWSAccountID);\n};\nexports.validateBucketOwnerID = validateBucketOwnerID;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACtC,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,4BAA4B,GAAG,SAAS;AAC9C,MAAM,qBAAqB,GAAG,CAAC,SAAS,KAAK;AAC7C,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ;AACR;
|
|
1
|
+
{"version":3,"file":"validateBucketOwnerID.js","sources":["../../../../../src/providers/s3/utils/validateBucketOwnerID.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.validateBucketOwnerID = void 0;\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst VALID_AWS_ACCOUNT_ID_PATTERN = /^\\d{12}/;\nconst validateBucketOwnerID = (accountID) => {\n if (accountID === undefined) {\n return;\n }\n (0, assertValidationError_1.assertValidationError)(VALID_AWS_ACCOUNT_ID_PATTERN.test(accountID), validation_1.StorageValidationErrorCode.InvalidAWSAccountID);\n};\nexports.validateBucketOwnerID = validateBucketOwnerID;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACtC,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,4BAA4B,GAAG,SAAS;AAC9C,MAAM,qBAAqB,GAAG,CAAC,SAAS,KAAK;AAC7C,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ;AACR,IAAI;AACJ,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,mBAAmB,CAAC;AACjK,CAAC;AACD,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateMultipartUploadXML.js","sources":["../../../../../src/providers/s3/utils/validateMultipartUploadXML.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.validateMultipartUploadXML = validateMultipartUploadXML;\nconst IntegrityError_1 = require(\"../../../errors/IntegrityError\");\nconst runtime_1 = require(\"./client/runtime\");\nconst utils_1 = require(\"./client/utils\");\nconst integrityHelpers_1 = require(\"./client/utils/integrityHelpers\");\nfunction validateMultipartUploadXML(input, xml) {\n if (!input.Parts) {\n throw new IntegrityError_1.IntegrityError();\n }\n const parsedXML = runtime_1.parser.parse(xml);\n const mappedCompletedMultipartUpload = (0, utils_1.map)(parsedXML, {\n Parts: [\n 'Part',\n value => (0, utils_1.emptyArrayGuard)(value, utils_1.deserializeCompletedPartList),\n ],\n });\n if (!(0, integrityHelpers_1.isEqual)(input, mappedCompletedMultipartUpload)) {\n throw new IntegrityError_1.IntegrityError();\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;AAC/D,MAAM,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC;AAClE,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,kBAAkB,GAAG,OAAO,CAAC,iCAAiC,CAAC;AACrE,SAAS,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE;AAChD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACtB,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD;
|
|
1
|
+
{"version":3,"file":"validateMultipartUploadXML.js","sources":["../../../../../src/providers/s3/utils/validateMultipartUploadXML.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.validateMultipartUploadXML = validateMultipartUploadXML;\nconst IntegrityError_1 = require(\"../../../errors/IntegrityError\");\nconst runtime_1 = require(\"./client/runtime\");\nconst utils_1 = require(\"./client/utils\");\nconst integrityHelpers_1 = require(\"./client/utils/integrityHelpers\");\nfunction validateMultipartUploadXML(input, xml) {\n if (!input.Parts) {\n throw new IntegrityError_1.IntegrityError();\n }\n const parsedXML = runtime_1.parser.parse(xml);\n const mappedCompletedMultipartUpload = (0, utils_1.map)(parsedXML, {\n Parts: [\n 'Part',\n value => (0, utils_1.emptyArrayGuard)(value, utils_1.deserializeCompletedPartList),\n ],\n });\n if (!(0, integrityHelpers_1.isEqual)(input, mappedCompletedMultipartUpload)) {\n throw new IntegrityError_1.IntegrityError();\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;AAC/D,MAAM,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC;AAClE,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,kBAAkB,GAAG,OAAO,CAAC,iCAAiC,CAAC;AACrE,SAAS,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE;AAChD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACtB,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;AACjD,IAAI,MAAM,8BAA8B,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE;AACvE,QAAQ,KAAK,EAAE;AACf,YAAY,MAAM;AAClB,YAAY,KAAK,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,4BAA4B,CAAC;AAC9F,SAAS;AACT,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,IAAI,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,8BAA8B,CAAC,EAAE;AACjF,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD,IAAI;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateObjectUrl.js","sources":["../../../../../src/providers/s3/utils/validateObjectUrl.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.validateObjectUrl = validateObjectUrl;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst IntegrityError_1 = require(\"../../../errors/IntegrityError\");\nfunction validateObjectUrl({ bucketName, key, objectURL, }) {\n if (!bucketName || !key || !objectURL) {\n throw new IntegrityError_1.IntegrityError();\n }\n const bucketWithDots = bucketName.includes('.');\n const encodedBucketName = (0, aws_client_utils_1.extendedEncodeURIComponent)(bucketName);\n const encodedKey = key.split('/').map(aws_client_utils_1.extendedEncodeURIComponent).join('/');\n const isPathStyleUrl = objectURL.pathname === `/${encodedBucketName}/${encodedKey}`;\n const isSubdomainUrl = objectURL.hostname.startsWith(`${encodedBucketName}.`) &&\n objectURL.pathname === `/${encodedKey}`;\n if (!(isPathStyleUrl || (!bucketWithDots && isSubdomainUrl))) {\n throw new IntegrityError_1.IntegrityError();\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;AAC7C,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC;AAClE,SAAS,iBAAiB,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE;AAC5D,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE;AAC3C,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD;
|
|
1
|
+
{"version":3,"file":"validateObjectUrl.js","sources":["../../../../../src/providers/s3/utils/validateObjectUrl.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.validateObjectUrl = validateObjectUrl;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst IntegrityError_1 = require(\"../../../errors/IntegrityError\");\nfunction validateObjectUrl({ bucketName, key, objectURL, }) {\n if (!bucketName || !key || !objectURL) {\n throw new IntegrityError_1.IntegrityError();\n }\n const bucketWithDots = bucketName.includes('.');\n const encodedBucketName = (0, aws_client_utils_1.extendedEncodeURIComponent)(bucketName);\n const encodedKey = key.split('/').map(aws_client_utils_1.extendedEncodeURIComponent).join('/');\n const isPathStyleUrl = objectURL.pathname === `/${encodedBucketName}/${encodedKey}`;\n const isSubdomainUrl = objectURL.hostname.startsWith(`${encodedBucketName}.`) &&\n objectURL.pathname === `/${encodedKey}`;\n if (!(isPathStyleUrl || (!bucketWithDots && isSubdomainUrl))) {\n throw new IntegrityError_1.IntegrityError();\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;AAC7C,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC;AAClE,SAAS,iBAAiB,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE;AAC5D,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE;AAC3C,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AACnD,IAAI,MAAM,iBAAiB,GAAG,IAAI,kBAAkB,CAAC,0BAA0B,EAAE,UAAU,CAAC;AAC5F,IAAI,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAClG,IAAI,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AACvF,IAAI,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACjF,QAAQ,SAAS,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,IAAI,EAAE,cAAc,KAAK,CAAC,cAAc,IAAI,cAAc,CAAC,CAAC,EAAE;AAClE,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD,IAAI;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateStorageOperationInput.js","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInput.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.validateStorageOperationInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst isInputWithPath_1 = require(\"./isInputWithPath\");\nconst constants_1 = require(\"./constants\");\nconst resolveIdentityId_1 = require(\"./resolveIdentityId\");\nconst validateStorageOperationInput = (input, identityId) => {\n (0, assertValidationError_1.assertValidationError)(\n // Key present without a path\n (!!input.key && !input.path) ||\n // Path present without a key\n (!input.key && !!input.path), validation_1.StorageValidationErrorCode.InvalidStorageOperationInput);\n if ((0, isInputWithPath_1.isInputWithPath)(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: (0, resolveIdentityId_1.resolveIdentityId)(identityId) });\n (0, assertValidationError_1.assertValidationError)(!objectKey.startsWith('/'), validation_1.StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: constants_1.STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: constants_1.STORAGE_INPUT_KEY, objectKey: input.key };\n }\n};\nexports.validateStorageOperationInput = validateStorageOperationInput;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,6BAA6B,GAAG,MAAM;AAC9C,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAC1D,MAAM,6BAA6B,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AAC7D,IAAI,IAAI,uBAAuB,CAAC,qBAAqB;AACrD;AACA,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI;AAC/B;AACA,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,4BAA4B,CAAC;AAC3G,IAAI,IAAI,IAAI,iBAAiB,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE;AACvD,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AAC9B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK;AAC1C,cAAc;AACd,cAAc,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC1F,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,uBAAuB,CAAC;AACvJ,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,WAAW,CAAC,kBAAkB;AACrD,YAAY,SAAS;AACrB,SAAS;AACT;
|
|
1
|
+
{"version":3,"file":"validateStorageOperationInput.js","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInput.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.validateStorageOperationInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst isInputWithPath_1 = require(\"./isInputWithPath\");\nconst constants_1 = require(\"./constants\");\nconst resolveIdentityId_1 = require(\"./resolveIdentityId\");\nconst validateStorageOperationInput = (input, identityId) => {\n (0, assertValidationError_1.assertValidationError)(\n // Key present without a path\n (!!input.key && !input.path) ||\n // Path present without a key\n (!input.key && !!input.path), validation_1.StorageValidationErrorCode.InvalidStorageOperationInput);\n if ((0, isInputWithPath_1.isInputWithPath)(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: (0, resolveIdentityId_1.resolveIdentityId)(identityId) });\n (0, assertValidationError_1.assertValidationError)(!objectKey.startsWith('/'), validation_1.StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: constants_1.STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: constants_1.STORAGE_INPUT_KEY, objectKey: input.key };\n }\n};\nexports.validateStorageOperationInput = validateStorageOperationInput;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,6BAA6B,GAAG,MAAM;AAC9C,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAC1D,MAAM,6BAA6B,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AAC7D,IAAI,IAAI,uBAAuB,CAAC,qBAAqB;AACrD;AACA,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI;AAC/B;AACA,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,4BAA4B,CAAC;AAC3G,IAAI,IAAI,IAAI,iBAAiB,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE;AACvD,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AAC9B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK;AAC1C,cAAc;AACd,cAAc,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC1F,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,uBAAuB,CAAC;AACvJ,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,WAAW,CAAC,kBAAkB;AACrD,YAAY,SAAS;AACrB,SAAS;AACT,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;AACjF,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateStorageOperationInputWithPrefix.js","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInputWithPrefix.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.validateStorageOperationInputWithPrefix = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst constants_1 = require(\"./constants\");\nconst resolveIdentityId_1 = require(\"./resolveIdentityId\");\n// Local assertion function with StorageOperationInputWithPrefixPath as Input\nconst _isInputWithPath = (input) => {\n return input.path !== undefined;\n};\nconst validateStorageOperationInputWithPrefix = (input, identityId) => {\n // Validate prefix & path not present at the same time\n (0, assertValidationError_1.assertValidationError)(!(input.prefix && input.path), validation_1.StorageValidationErrorCode.InvalidStorageOperationPrefixInput);\n if (_isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: (0, resolveIdentityId_1.resolveIdentityId)(identityId) });\n // Assert on no leading slash in the path parameter\n (0, assertValidationError_1.assertValidationError)(!objectKey.startsWith('/'), validation_1.StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: constants_1.STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: constants_1.STORAGE_INPUT_PREFIX, objectKey: input.prefix ?? '' };\n }\n};\nexports.validateStorageOperationInputWithPrefix = validateStorageOperationInputWithPrefix;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,MAAM;AACxD,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAC1D;AACA,MAAM,gBAAgB,GAAG,CAAC,KAAK,KAAK;AACpC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS;AACnC,CAAC;AACD,MAAM,uCAAuC,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AACvE;AACA,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,kCAAkC,CAAC;AACjK,IAAI,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;AACjC,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AAC9B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK;AAC1C,cAAc;AACd,cAAc,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC1F;AACA,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,uBAAuB,CAAC;AACvJ,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,WAAW,CAAC,kBAAkB;AACrD,YAAY,SAAS;AACrB,SAAS;AACT;
|
|
1
|
+
{"version":3,"file":"validateStorageOperationInputWithPrefix.js","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInputWithPrefix.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.validateStorageOperationInputWithPrefix = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst constants_1 = require(\"./constants\");\nconst resolveIdentityId_1 = require(\"./resolveIdentityId\");\n// Local assertion function with StorageOperationInputWithPrefixPath as Input\nconst _isInputWithPath = (input) => {\n return input.path !== undefined;\n};\nconst validateStorageOperationInputWithPrefix = (input, identityId) => {\n // Validate prefix & path not present at the same time\n (0, assertValidationError_1.assertValidationError)(!(input.prefix && input.path), validation_1.StorageValidationErrorCode.InvalidStorageOperationPrefixInput);\n if (_isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: (0, resolveIdentityId_1.resolveIdentityId)(identityId) });\n // Assert on no leading slash in the path parameter\n (0, assertValidationError_1.assertValidationError)(!objectKey.startsWith('/'), validation_1.StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: constants_1.STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: constants_1.STORAGE_INPUT_PREFIX, objectKey: input.prefix ?? '' };\n }\n};\nexports.validateStorageOperationInputWithPrefix = validateStorageOperationInputWithPrefix;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,MAAM;AACxD,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAC1D;AACA,MAAM,gBAAgB,GAAG,CAAC,KAAK,KAAK;AACpC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS;AACnC,CAAC;AACD,MAAM,uCAAuC,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AACvE;AACA,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,kCAAkC,CAAC;AACjK,IAAI,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;AACjC,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AAC9B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK;AAC1C,cAAc;AACd,cAAc,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC1F;AACA,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,uBAAuB,CAAC;AACvJ,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,WAAW,CAAC,kBAAkB;AACrD,YAAY,SAAS;AACrB,SAAS;AACT,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,oBAAoB,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE;AAC7F,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,uCAAuC,GAAG,uCAAuC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/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.logger = exports.resolvePrefix = void 0;\nvar resolvePrefix_1 = require(\"./resolvePrefix\");\nObject.defineProperty(exports, \"resolvePrefix\", { enumerable: true, get: function () { return resolvePrefix_1.resolvePrefix; } });\nvar logger_1 = require(\"./logger\");\nObject.defineProperty(exports, \"logger\", { enumerable: true, get: function () { return logger_1.logger; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AAC/C,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAChD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/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.logger = exports.resolvePrefix = void 0;\nvar resolvePrefix_1 = require(\"./resolvePrefix\");\nObject.defineProperty(exports, \"resolvePrefix\", { enumerable: true, get: function () { return resolvePrefix_1.resolvePrefix; } });\nvar logger_1 = require(\"./logger\");\nObject.defineProperty(exports, \"logger\", { enumerable: true, get: function () { return logger_1.logger; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AAC/C,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAChD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACjI,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePrefix.js","sources":["../../../src/utils/resolvePrefix.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.resolvePrefix = void 0;\nconst assertValidationError_1 = require(\"../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../errors/types/validation\");\nconst resolvePrefix = ({ accessLevel, targetIdentityId, }) => {\n if (accessLevel === 'private') {\n (0, assertValidationError_1.assertValidationError)(!!targetIdentityId, validation_1.StorageValidationErrorCode.NoIdentityId);\n return `private/${targetIdentityId}/`;\n }\n else if (accessLevel === 'protected') {\n (0, assertValidationError_1.assertValidationError)(!!targetIdentityId, validation_1.StorageValidationErrorCode.NoIdentityId);\n return `protected/${targetIdentityId}/`;\n }\n else {\n return 'public/';\n }\n};\nexports.resolvePrefix = resolvePrefix;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,MAAM;AAC9B,MAAM,uBAAuB,GAAG,OAAO,CAAC,uCAAuC,CAAC;AAChF,MAAM,YAAY,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC1D,MAAM,aAAa,GAAG,CAAC,EAAE,WAAW,EAAE,gBAAgB,GAAG,KAAK;AAC9D,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE;AACnC,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,0BAA0B,CAAC,YAAY,CAAC;AACpI,QAAQ,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC7C;
|
|
1
|
+
{"version":3,"file":"resolvePrefix.js","sources":["../../../src/utils/resolvePrefix.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.resolvePrefix = void 0;\nconst assertValidationError_1 = require(\"../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../errors/types/validation\");\nconst resolvePrefix = ({ accessLevel, targetIdentityId, }) => {\n if (accessLevel === 'private') {\n (0, assertValidationError_1.assertValidationError)(!!targetIdentityId, validation_1.StorageValidationErrorCode.NoIdentityId);\n return `private/${targetIdentityId}/`;\n }\n else if (accessLevel === 'protected') {\n (0, assertValidationError_1.assertValidationError)(!!targetIdentityId, validation_1.StorageValidationErrorCode.NoIdentityId);\n return `protected/${targetIdentityId}/`;\n }\n else {\n return 'public/';\n }\n};\nexports.resolvePrefix = resolvePrefix;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,MAAM;AAC9B,MAAM,uBAAuB,GAAG,OAAO,CAAC,uCAAuC,CAAC;AAChF,MAAM,YAAY,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC1D,MAAM,aAAa,GAAG,CAAC,EAAE,WAAW,EAAE,gBAAgB,GAAG,KAAK;AAC9D,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE;AACnC,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,0BAA0B,CAAC,YAAY,CAAC;AACpI,QAAQ,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC7C,IAAI;AACJ,SAAS,IAAI,WAAW,KAAK,WAAW,EAAE;AAC1C,QAAQ,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,0BAA0B,CAAC,YAAY,CAAC;AACpI,QAAQ,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC/C,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanceledError.mjs","sources":["../../../src/errors/CanceledError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageError } from './StorageError';\n/**\n * Internal-only class for CanceledError thrown by XHR handler or multipart upload when cancellation is invoked\n * without overwriting behavior.\n *\n * @internal\n */\nexport class CanceledError extends StorageError {\n constructor(params = {}) {\n super({\n name: 'CanceledError',\n message: 'Upload is canceled by user',\n ...params,\n });\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = CanceledError;\n Object.setPrototypeOf(this, CanceledError.prototype);\n }\n}\n/**\n * Check if an error is caused by user calling `cancel()` on a upload/download task. If an overwriting error is\n * supplied to `task.cancel(errorOverwrite)`, this function will return `false`.\n * @param {unknown} error The unknown exception to be checked.\n * @returns - A boolean indicating if the error was from an upload cancellation\n */\nexport const isCancelError = (error) => !!error && error instanceof CanceledError;\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAa,SAAS,YAAY,CAAC;AAChD,IAAI,WAAW,CAAC,MAAM,GAAG,EAAE,EAAE;AAC7B,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,OAAO,EAAE,4BAA4B;AACjD,YAAY,GAAG,MAAM;AACrB,SAAS,CAAC;AACV;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,aAAa;AACxC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;AAC5D;
|
|
1
|
+
{"version":3,"file":"CanceledError.mjs","sources":["../../../src/errors/CanceledError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageError } from './StorageError';\n/**\n * Internal-only class for CanceledError thrown by XHR handler or multipart upload when cancellation is invoked\n * without overwriting behavior.\n *\n * @internal\n */\nexport class CanceledError extends StorageError {\n constructor(params = {}) {\n super({\n name: 'CanceledError',\n message: 'Upload is canceled by user',\n ...params,\n });\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = CanceledError;\n Object.setPrototypeOf(this, CanceledError.prototype);\n }\n}\n/**\n * Check if an error is caused by user calling `cancel()` on a upload/download task. If an overwriting error is\n * supplied to `task.cancel(errorOverwrite)`, this function will return `false`.\n * @param {unknown} error The unknown exception to be checked.\n * @returns - A boolean indicating if the error was from an upload cancellation\n */\nexport const isCancelError = (error) => !!error && error instanceof CanceledError;\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAa,SAAS,YAAY,CAAC;AAChD,IAAI,WAAW,CAAC,MAAM,GAAG,EAAE,EAAE;AAC7B,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,OAAO,EAAE,4BAA4B;AACjD,YAAY,GAAG,MAAM;AACrB,SAAS,CAAC;AACV;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,aAAa;AACxC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;AAC5D,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,KAAK,YAAY;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrityError.mjs","sources":["../../../src/errors/IntegrityError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode, } from '@aws-amplify/core/internals/utils';\nimport { StorageError } from './StorageError';\nexport class IntegrityError extends StorageError {\n constructor(params) {\n super({\n name: AmplifyErrorCode.Unknown,\n message: 'An unknown error has occurred.',\n recoverySuggestion: 'This may be a bug. Please reach out to library authors.',\n metadata: params?.metadata,\n });\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = IntegrityError;\n Object.setPrototypeOf(this, IntegrityError.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,MAAM,cAAc,SAAS,YAAY,CAAC;AACjD,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,gBAAgB,CAAC,OAAO;AAC1C,YAAY,OAAO,EAAE,gCAAgC;AACrD,YAAY,kBAAkB,EAAE,yDAAyD;AACzF,YAAY,QAAQ,EAAE,MAAM,EAAE,QAAQ;AACtC,SAAS,CAAC;AACV;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,cAAc;AACzC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC;AAC7D;
|
|
1
|
+
{"version":3,"file":"IntegrityError.mjs","sources":["../../../src/errors/IntegrityError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode, } from '@aws-amplify/core/internals/utils';\nimport { StorageError } from './StorageError';\nexport class IntegrityError extends StorageError {\n constructor(params) {\n super({\n name: AmplifyErrorCode.Unknown,\n message: 'An unknown error has occurred.',\n recoverySuggestion: 'This may be a bug. Please reach out to library authors.',\n metadata: params?.metadata,\n });\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = IntegrityError;\n Object.setPrototypeOf(this, IntegrityError.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,MAAM,cAAc,SAAS,YAAY,CAAC;AACjD,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,gBAAgB,CAAC,OAAO;AAC1C,YAAY,OAAO,EAAE,gCAAgC;AACrD,YAAY,kBAAkB,EAAE,yDAAyD;AACzF,YAAY,QAAQ,EAAE,MAAM,EAAE,QAAQ;AACtC,SAAS,CAAC;AACV;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,cAAc;AACzC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC;AAC7D,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageError.mjs","sources":["../../../src/errors/StorageError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError, } from '@aws-amplify/core/internals/utils';\nexport class StorageError extends AmplifyError {\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = StorageError;\n Object.setPrototypeOf(this, StorageError.prototype);\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEO,MAAM,YAAY,SAAS,YAAY,CAAC;AAC/C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC;AACrB;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,YAAY;AACvC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;AAC3D;
|
|
1
|
+
{"version":3,"file":"StorageError.mjs","sources":["../../../src/errors/StorageError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError, } from '@aws-amplify/core/internals/utils';\nexport class StorageError extends AmplifyError {\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = StorageError;\n Object.setPrototypeOf(this, StorageError.prototype);\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEO,MAAM,YAAY,SAAS,YAAY,CAAC;AAC/C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC;AACrB;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,YAAY;AACvC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;AAC3D,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertValidationError.mjs","sources":["../../../../src/errors/utils/assertValidationError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { validationErrorMap, } from '../types/validation';\nimport { StorageError } from '../StorageError';\nexport function assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validationErrorMap[name];\n if (!assertion) {\n throw new StorageError({ name, message, recoverySuggestion });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AACvD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC;AACpE,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AACrE;
|
|
1
|
+
{"version":3,"file":"assertValidationError.mjs","sources":["../../../../src/errors/utils/assertValidationError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { validationErrorMap, } from '../types/validation';\nimport { StorageError } from '../StorageError';\nexport function assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validationErrorMap[name];\n if (!assertion) {\n throw new StorageError({ name, message, recoverySuggestion });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AACvD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC;AACpE,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AACrE,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDataAccess.mjs","sources":["../../../../src/internals/apis/getDataAccess.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode, StorageAction, } from '@aws-amplify/core/internals/utils';\nimport { getStorageUserAgentValue } from '../../providers/s3/utils/userAgent';\nimport { getDataAccess as getDataAccessClient } from '../../providers/s3/utils/client/s3control';\nimport { StorageError } from '../../errors/StorageError';\nimport { logger } from '../../utils';\nimport { DEFAULT_CRED_TTL } from '../utils/constants';\n/**\n * @internal\n */\nexport const 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 getDataAccessClient({\n credentials: clientCredentialsProvider,\n customEndpoint: input.customEndpoint,\n region: input.region,\n userAgentValue: getStorageUserAgentValue(StorageAction.GetDataAccess),\n }, {\n AccountId: input.accountId,\n Target: input.scope,\n Permission: input.permission,\n TargetType: targetType,\n DurationSeconds: DEFAULT_CRED_TTL,\n });\n const grantCredentials = result.Credentials;\n // Ensure that S3 returned credentials (this shouldn't happen)\n if (!grantCredentials ||\n !grantCredentials.AccessKeyId ||\n !grantCredentials.SecretAccessKey ||\n !grantCredentials.SessionToken ||\n !grantCredentials.Expiration) {\n throw new StorageError({\n name: AmplifyErrorCode.Unknown,\n message: 'Service did not return valid temporary credentials.',\n metadata: result.$metadata,\n });\n }\n else {\n 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,\n secretAccessKey,\n sessionToken,\n expiration,\n },\n scope: result.MatchedGrantTarget,\n };\n};\n"],"names":["getDataAccessClient"],"mappings":";;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACY,MAAC,aAAa,GAAG,OAAO,KAAK,KAAK;AAC9C,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,QAAQ;AACvE,IAAI,MAAM,yBAAyB,GAAG,OAAO,OAAO,KAAK;AACzD,QAAQ,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC;AACxE,QAAQ,OAAO,WAAW;AAC1B,
|
|
1
|
+
{"version":3,"file":"getDataAccess.mjs","sources":["../../../../src/internals/apis/getDataAccess.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode, StorageAction, } from '@aws-amplify/core/internals/utils';\nimport { getStorageUserAgentValue } from '../../providers/s3/utils/userAgent';\nimport { getDataAccess as getDataAccessClient } from '../../providers/s3/utils/client/s3control';\nimport { StorageError } from '../../errors/StorageError';\nimport { logger } from '../../utils';\nimport { DEFAULT_CRED_TTL } from '../utils/constants';\n/**\n * @internal\n */\nexport const 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 getDataAccessClient({\n credentials: clientCredentialsProvider,\n customEndpoint: input.customEndpoint,\n region: input.region,\n userAgentValue: getStorageUserAgentValue(StorageAction.GetDataAccess),\n }, {\n AccountId: input.accountId,\n Target: input.scope,\n Permission: input.permission,\n TargetType: targetType,\n DurationSeconds: DEFAULT_CRED_TTL,\n });\n const grantCredentials = result.Credentials;\n // Ensure that S3 returned credentials (this shouldn't happen)\n if (!grantCredentials ||\n !grantCredentials.AccessKeyId ||\n !grantCredentials.SecretAccessKey ||\n !grantCredentials.SessionToken ||\n !grantCredentials.Expiration) {\n throw new StorageError({\n name: AmplifyErrorCode.Unknown,\n message: 'Service did not return valid temporary credentials.',\n metadata: result.$metadata,\n });\n }\n else {\n 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,\n secretAccessKey,\n sessionToken,\n expiration,\n },\n scope: result.MatchedGrantTarget,\n };\n};\n"],"names":["getDataAccessClient"],"mappings":";;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACY,MAAC,aAAa,GAAG,OAAO,KAAK,KAAK;AAC9C,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,QAAQ;AACvE,IAAI,MAAM,yBAAyB,GAAG,OAAO,OAAO,KAAK;AACzD,QAAQ,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC;AACxE,QAAQ,OAAO,WAAW;AAC1B,IAAI,CAAC;AACL,IAAI,MAAM,MAAM,GAAG,MAAMA,eAAmB,CAAC;AAC7C,QAAQ,WAAW,EAAE,yBAAyB;AAC9C,QAAQ,cAAc,EAAE,KAAK,CAAC,cAAc;AAC5C,QAAQ,MAAM,EAAE,KAAK,CAAC,MAAM;AAC5B,QAAQ,cAAc,EAAE,wBAAwB,CAAC,aAAa,CAAC,aAAa,CAAC;AAC7E,KAAK,EAAE;AACP,QAAQ,SAAS,EAAE,KAAK,CAAC,SAAS;AAClC,QAAQ,MAAM,EAAE,KAAK,CAAC,KAAK;AAC3B,QAAQ,UAAU,EAAE,KAAK,CAAC,UAAU;AACpC,QAAQ,UAAU,EAAE,UAAU;AAC9B,QAAQ,eAAe,EAAE,gBAAgB;AACzC,KAAK,CAAC;AACN,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,WAAW;AAC/C;AACA,IAAI,IAAI,CAAC,gBAAgB;AACzB,QAAQ,CAAC,gBAAgB,CAAC,WAAW;AACrC,QAAQ,CAAC,gBAAgB,CAAC,eAAe;AACzC,QAAQ,CAAC,gBAAgB,CAAC,YAAY;AACtC,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE;AACtC,QAAQ,MAAM,IAAI,YAAY,CAAC;AAC/B,YAAY,IAAI,EAAE,gBAAgB,CAAC,OAAO;AAC1C,YAAY,OAAO,EAAE,qDAAqD;AAC1E,YAAY,QAAQ,EAAE,MAAM,CAAC,SAAS;AACtC,SAAS,CAAC;AACV,IAAI;AACJ,SAAS;AACT,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,2BAA2B,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC/E,IAAI;AACJ,IAAI,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,GAAG,GAAG,gBAAgB;AAChJ,IAAI,OAAO;AACX,QAAQ,WAAW,EAAE;AACrB,YAAY,WAAW;AACvB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,UAAU;AACtB,SAAS;AACT,QAAQ,KAAK,EAAE,MAAM,CAAC,kBAAkB;AACxC,KAAK;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listCallerAccessGrants.mjs","sources":["../../../../src/internals/apis/listCallerAccessGrants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { logger } from '../../utils';\nimport { listCallerAccessGrants as listCallerAccessGrantsClient } from '../../providers/s3/utils/client/s3control';\nimport { StorageError } from '../../errors/StorageError';\nimport { getStorageUserAgentValue } from '../../providers/s3/utils/userAgent';\nimport { MAX_PAGE_SIZE } from '../utils/constants';\n/**\n * @internal\n */\nexport const listCallerAccessGrants = async (input) => {\n const { credentialsProvider, accountId, region, nextToken, pageSize, customEndpoint, } = input;\n logger.debug(`listing available locations from account ${input.accountId}`);\n if (!!pageSize && pageSize > MAX_PAGE_SIZE) {\n logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n }\n const clientCredentialsProvider = async (options) => {\n const { credentials } = await credentialsProvider(options);\n return credentials;\n };\n const { CallerAccessGrantsList, NextToken, $metadata } = await listCallerAccessGrantsClient({\n credentials: clientCredentialsProvider,\n customEndpoint,\n region,\n userAgentValue: getStorageUserAgentValue(StorageAction.ListCallerAccessGrants),\n }, {\n AccountId: accountId,\n NextToken: nextToken,\n MaxResults: pageSize ?? MAX_PAGE_SIZE,\n AllowedByApplication: true,\n });\n const accessGrants = CallerAccessGrantsList?.map(grant => {\n assertGrantScope(grant.GrantScope, $metadata);\n return {\n scope: grant.GrantScope,\n permission: grant.Permission,\n type: parseGrantType(grant.GrantScope),\n };\n }) ?? [];\n return {\n locations: accessGrants,\n nextToken: NextToken,\n };\n};\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 assertGrantScope(value, responseMetadata) {\n if (typeof value !== 'string' || !value.startsWith('s3://')) {\n throw new StorageError({\n name: 'InvalidGrantScope',\n message: `Expected a valid grant scope, got ${value}`,\n metadata: responseMetadata,\n });\n }\n}\n"],"names":["listCallerAccessGrantsClient"],"mappings":";;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,OAAO,KAAK,KAAK;AACvD,IAAI,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,GAAG,KAAK;AAClG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,yCAAyC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/E,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,GAAG,aAAa,EAAE;AAChD,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;AAChE;
|
|
1
|
+
{"version":3,"file":"listCallerAccessGrants.mjs","sources":["../../../../src/internals/apis/listCallerAccessGrants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { logger } from '../../utils';\nimport { listCallerAccessGrants as listCallerAccessGrantsClient } from '../../providers/s3/utils/client/s3control';\nimport { StorageError } from '../../errors/StorageError';\nimport { getStorageUserAgentValue } from '../../providers/s3/utils/userAgent';\nimport { MAX_PAGE_SIZE } from '../utils/constants';\n/**\n * @internal\n */\nexport const listCallerAccessGrants = async (input) => {\n const { credentialsProvider, accountId, region, nextToken, pageSize, customEndpoint, } = input;\n logger.debug(`listing available locations from account ${input.accountId}`);\n if (!!pageSize && pageSize > MAX_PAGE_SIZE) {\n logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n }\n const clientCredentialsProvider = async (options) => {\n const { credentials } = await credentialsProvider(options);\n return credentials;\n };\n const { CallerAccessGrantsList, NextToken, $metadata } = await listCallerAccessGrantsClient({\n credentials: clientCredentialsProvider,\n customEndpoint,\n region,\n userAgentValue: getStorageUserAgentValue(StorageAction.ListCallerAccessGrants),\n }, {\n AccountId: accountId,\n NextToken: nextToken,\n MaxResults: pageSize ?? MAX_PAGE_SIZE,\n AllowedByApplication: true,\n });\n const accessGrants = CallerAccessGrantsList?.map(grant => {\n assertGrantScope(grant.GrantScope, $metadata);\n return {\n scope: grant.GrantScope,\n permission: grant.Permission,\n type: parseGrantType(grant.GrantScope),\n };\n }) ?? [];\n return {\n locations: accessGrants,\n nextToken: NextToken,\n };\n};\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 assertGrantScope(value, responseMetadata) {\n if (typeof value !== 'string' || !value.startsWith('s3://')) {\n throw new StorageError({\n name: 'InvalidGrantScope',\n message: `Expected a valid grant scope, got ${value}`,\n metadata: responseMetadata,\n });\n }\n}\n"],"names":["listCallerAccessGrantsClient"],"mappings":";;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,OAAO,KAAK,KAAK;AACvD,IAAI,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,GAAG,KAAK;AAClG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,yCAAyC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/E,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,GAAG,aAAa,EAAE;AAChD,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;AAChE,IAAI;AACJ,IAAI,MAAM,yBAAyB,GAAG,OAAO,OAAO,KAAK;AACzD,QAAQ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,SAAS,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;AACtC,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE;AAChD,QAAQ,OAAO,QAAQ;AACvB,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,QAAQ;AACvB,IAAI;AACJ,CAAC;AACD,SAAS,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE;AACnD,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;AACjE,QAAQ,MAAM,IAAI,YAAY,CAAC;AAC/B,YAAY,IAAI,EAAE,mBAAmB;AACrC,YAAY,OAAO,EAAE,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AACjE,YAAY,QAAQ,EAAE,gBAAgB;AACtC,SAAS,CAAC;AACV,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHighestPrecedenceUserGroup.mjs","sources":["../../../../../src/internals/apis/listPaths/getHighestPrecedenceUserGroup.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Given the Cognito user groups associated to current user session\n * and all the user group configurations defined by backend.\n * This function returns the user group with the highest precedence.\n * Reference: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-user-groups.html#assigning-precedence-values-to-groups\n *\n * @param {UserGroupConfig} userGroupsFromConfig - User groups with their precedence values based on Amplify outputs.\n * @param {string[]} currentUserGroups - The list of current user's groups.\n * @returns {string | undefined} - The user group with the highest precedence (0), or undefined if no matching group is found.\n */\nexport const getHighestPrecedenceUserGroup = (userGroupsFromConfig, currentUserGroups) => {\n if (userGroupsFromConfig && currentUserGroups) {\n const precedenceMap = userGroupsFromConfig.reduce((acc, group) => {\n Object.entries(group).forEach(([key, value]) => {\n acc[key] = value.precedence;\n });\n return acc;\n }, {});\n const sortedUserGroup = currentUserGroups\n .filter(group => Object.prototype.hasOwnProperty.call(precedenceMap, group))\n .sort((a, b) => precedenceMap[a] - precedenceMap[b]);\n return sortedUserGroup[0];\n }\n return undefined;\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,6BAA6B,GAAG,CAAC,oBAAoB,EAAE,iBAAiB,KAAK;AAC1F,IAAI,IAAI,oBAAoB,IAAI,iBAAiB,EAAE;AACnD,QAAQ,MAAM,aAAa,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK;AAC1E,YAAY,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAC5D,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU;AAC3C,
|
|
1
|
+
{"version":3,"file":"getHighestPrecedenceUserGroup.mjs","sources":["../../../../../src/internals/apis/listPaths/getHighestPrecedenceUserGroup.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Given the Cognito user groups associated to current user session\n * and all the user group configurations defined by backend.\n * This function returns the user group with the highest precedence.\n * Reference: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-user-groups.html#assigning-precedence-values-to-groups\n *\n * @param {UserGroupConfig} userGroupsFromConfig - User groups with their precedence values based on Amplify outputs.\n * @param {string[]} currentUserGroups - The list of current user's groups.\n * @returns {string | undefined} - The user group with the highest precedence (0), or undefined if no matching group is found.\n */\nexport const getHighestPrecedenceUserGroup = (userGroupsFromConfig, currentUserGroups) => {\n if (userGroupsFromConfig && currentUserGroups) {\n const precedenceMap = userGroupsFromConfig.reduce((acc, group) => {\n Object.entries(group).forEach(([key, value]) => {\n acc[key] = value.precedence;\n });\n return acc;\n }, {});\n const sortedUserGroup = currentUserGroups\n .filter(group => Object.prototype.hasOwnProperty.call(precedenceMap, group))\n .sort((a, b) => precedenceMap[a] - precedenceMap[b]);\n return sortedUserGroup[0];\n }\n return undefined;\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,6BAA6B,GAAG,CAAC,oBAAoB,EAAE,iBAAiB,KAAK;AAC1F,IAAI,IAAI,oBAAoB,IAAI,iBAAiB,EAAE;AACnD,QAAQ,MAAM,aAAa,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK;AAC1E,YAAY,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAC5D,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU;AAC3C,YAAY,CAAC,CAAC;AACd,YAAY,OAAO,GAAG;AACtB,QAAQ,CAAC,EAAE,EAAE,CAAC;AACd,QAAQ,MAAM,eAAe,GAAG;AAChC,aAAa,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC;AACvF,aAAa,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAChE,QAAQ,OAAO,eAAe,CAAC,CAAC,CAAC;AACjC,IAAI;AACJ,IAAI,OAAO,SAAS;AACpB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listPaths.mjs","sources":["../../../../../src/internals/apis/listPaths/listPaths.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify, fetchAuthSession } from '@aws-amplify/core';\nimport { resolveLocationsForCurrentSession } from './resolveLocationsForCurrentSession';\nimport { getHighestPrecedenceUserGroup } from './getHighestPrecedenceUserGroup';\nexport const listPaths = async () => {\n const { buckets } = Amplify.getConfig().Storage.S3;\n const { groups } = Amplify.getConfig().Auth.Cognito;\n if (!buckets) {\n return { locations: [] };\n }\n const { tokens, identityId } = await fetchAuthSession();\n const currentUserGroups = tokens?.accessToken.payload['cognito:groups'];\n const userGroupToUse = getHighestPrecedenceUserGroup(groups, currentUserGroups);\n const locations = resolveLocationsForCurrentSession({\n buckets,\n isAuthenticated: !!tokens,\n identityId,\n userGroup: userGroupToUse,\n });\n return { locations };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,SAAS,GAAG,YAAY;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE;AACtD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO;AACvD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;AAChC;
|
|
1
|
+
{"version":3,"file":"listPaths.mjs","sources":["../../../../../src/internals/apis/listPaths/listPaths.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify, fetchAuthSession } from '@aws-amplify/core';\nimport { resolveLocationsForCurrentSession } from './resolveLocationsForCurrentSession';\nimport { getHighestPrecedenceUserGroup } from './getHighestPrecedenceUserGroup';\nexport const listPaths = async () => {\n const { buckets } = Amplify.getConfig().Storage.S3;\n const { groups } = Amplify.getConfig().Auth.Cognito;\n if (!buckets) {\n return { locations: [] };\n }\n const { tokens, identityId } = await fetchAuthSession();\n const currentUserGroups = tokens?.accessToken.payload['cognito:groups'];\n const userGroupToUse = getHighestPrecedenceUserGroup(groups, currentUserGroups);\n const locations = resolveLocationsForCurrentSession({\n buckets,\n isAuthenticated: !!tokens,\n identityId,\n userGroup: userGroupToUse,\n });\n return { locations };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,SAAS,GAAG,YAAY;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE;AACtD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO;AACvD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;AAChC,IAAI;AACJ,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,gBAAgB,EAAE;AAC3D,IAAI,MAAM,iBAAiB,GAAG,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAC3E,IAAI,MAAM,cAAc,GAAG,6BAA6B,CAAC,MAAM,EAAE,iBAAiB,CAAC;AACnF,IAAI,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACxD,QAAQ,OAAO;AACf,QAAQ,eAAe,EAAE,CAAC,CAAC,MAAM;AACjC,QAAQ,UAAU;AAClB,QAAQ,SAAS,EAAE,cAAc;AACjC,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,SAAS,EAAE;AACxB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveLocationsForCurrentSession.mjs","sources":["../../../../../src/internals/apis/listPaths/resolveLocationsForCurrentSession.ts"],"sourcesContent":["import { ENTITY_IDENTITY_URL } from '../../utils/constants';\nconst resolvePermissions = (accessRule, isAuthenticated, groups) => {\n if (!isAuthenticated) {\n return {\n permission: accessRule.guest,\n };\n }\n if (groups) {\n const selectedKey = Object.keys(accessRule).find(access => access.includes(groups));\n return {\n permission: selectedKey ? accessRule[selectedKey] : undefined,\n };\n }\n return {\n permission: accessRule.authenticated,\n };\n};\nexport const resolveLocationsForCurrentSession = ({ buckets, isAuthenticated, identityId, userGroup, }) => {\n const locations = [];\n for (const [, bucketInfo] of Object.entries(buckets)) {\n const { bucketName, paths } = bucketInfo;\n if (!paths) {\n continue;\n }\n for (const [path, accessRules] of Object.entries(paths)) {\n const shouldIncludeEntityIdPath = !userGroup &&\n path.includes(ENTITY_IDENTITY_URL) &&\n isAuthenticated &&\n identityId;\n if (shouldIncludeEntityIdPath) {\n locations.push({\n type: 'PREFIX',\n permission: accessRules.entityidentity,\n bucket: bucketName,\n prefix: path.replace(ENTITY_IDENTITY_URL, identityId),\n });\n }\n const location = {\n type: 'PREFIX',\n ...resolvePermissions(accessRules, isAuthenticated, userGroup),\n bucket: bucketName,\n prefix: path,\n };\n if (location.permission)\n locations.push(location);\n }\n }\n return locations;\n};\n"],"names":[],"mappings":";;AACA,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,KAAK;AACpE,IAAI,IAAI,CAAC,eAAe,EAAE;AAC1B,QAAQ,OAAO;AACf,YAAY,UAAU,EAAE,UAAU,CAAC,KAAK;AACxC,SAAS;AACT;
|
|
1
|
+
{"version":3,"file":"resolveLocationsForCurrentSession.mjs","sources":["../../../../../src/internals/apis/listPaths/resolveLocationsForCurrentSession.ts"],"sourcesContent":["import { ENTITY_IDENTITY_URL } from '../../utils/constants';\nconst resolvePermissions = (accessRule, isAuthenticated, groups) => {\n if (!isAuthenticated) {\n return {\n permission: accessRule.guest,\n };\n }\n if (groups) {\n const selectedKey = Object.keys(accessRule).find(access => access.includes(groups));\n return {\n permission: selectedKey ? accessRule[selectedKey] : undefined,\n };\n }\n return {\n permission: accessRule.authenticated,\n };\n};\nexport const resolveLocationsForCurrentSession = ({ buckets, isAuthenticated, identityId, userGroup, }) => {\n const locations = [];\n for (const [, bucketInfo] of Object.entries(buckets)) {\n const { bucketName, paths } = bucketInfo;\n if (!paths) {\n continue;\n }\n for (const [path, accessRules] of Object.entries(paths)) {\n const shouldIncludeEntityIdPath = !userGroup &&\n path.includes(ENTITY_IDENTITY_URL) &&\n isAuthenticated &&\n identityId;\n if (shouldIncludeEntityIdPath) {\n locations.push({\n type: 'PREFIX',\n permission: accessRules.entityidentity,\n bucket: bucketName,\n prefix: path.replace(ENTITY_IDENTITY_URL, identityId),\n });\n }\n const location = {\n type: 'PREFIX',\n ...resolvePermissions(accessRules, isAuthenticated, userGroup),\n bucket: bucketName,\n prefix: path,\n };\n if (location.permission)\n locations.push(location);\n }\n }\n return locations;\n};\n"],"names":[],"mappings":";;AACA,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,KAAK;AACpE,IAAI,IAAI,CAAC,eAAe,EAAE;AAC1B,QAAQ,OAAO;AACf,YAAY,UAAU,EAAE,UAAU,CAAC,KAAK;AACxC,SAAS;AACT,IAAI;AACJ,IAAI,IAAI,MAAM,EAAE;AAChB,QAAQ,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC3F,QAAQ,OAAO;AACf,YAAY,UAAU,EAAE,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,SAAS;AACzE,SAAS;AACT,IAAI;AACJ,IAAI,OAAO;AACX,QAAQ,UAAU,EAAE,UAAU,CAAC,aAAa;AAC5C,KAAK;AACL,CAAC;AACW,MAAC,iCAAiC,GAAG,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,GAAG,KAAK;AAC3G,IAAI,MAAM,SAAS,GAAG,EAAE;AACxB,IAAI,KAAK,MAAM,GAAG,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AAC1D,QAAQ,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,UAAU;AAChD,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY;AACZ,QAAQ;AACR,QAAQ,KAAK,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACjE,YAAY,MAAM,yBAAyB,GAAG,CAAC,SAAS;AACxD,gBAAgB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;AAClD,gBAAgB,eAAe;AAC/B,gBAAgB,UAAU;AAC1B,YAAY,IAAI,yBAAyB,EAAE;AAC3C,gBAAgB,SAAS,CAAC,IAAI,CAAC;AAC/B,oBAAoB,IAAI,EAAE,QAAQ;AAClC,oBAAoB,UAAU,EAAE,WAAW,CAAC,cAAc;AAC1D,oBAAoB,MAAM,EAAE,UAAU;AACtC,oBAAoB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC;AACzE,iBAAiB,CAAC;AAClB,YAAY;AACZ,YAAY,MAAM,QAAQ,GAAG;AAC7B,gBAAgB,IAAI,EAAE,QAAQ;AAC9B,gBAAgB,GAAG,kBAAkB,CAAC,WAAW,EAAE,eAAe,EAAE,SAAS,CAAC;AAC9E,gBAAgB,MAAM,EAAE,UAAU;AAClC,gBAAgB,MAAM,EAAE,IAAI;AAC5B,aAAa;AACb,YAAY,IAAI,QAAQ,CAAC,UAAU;AACnC,gBAAgB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;AACxC,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,SAAS;AACpB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadData.mjs","sources":["../../../../../../src/providers/s3/apis/internal/downloadData.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput';\nimport { createDownloadTask, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { getObject } from '../../utils/client/s3data';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nimport { STORAGE_INPUT_KEY } from '../../utils/constants';\nexport const downloadData = (input) => {\n const abortController = new AbortController();\n const downloadTask = createDownloadTask({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n};\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await resolveS3ConfigAndInput(Amplify, downloadDataInput);\n const { inputType, objectKey } = validateStorageOperationInput(downloadDataInput, identityId);\n validateBucketOwnerID(downloadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await getObject({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC5C,QAAQ,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;AAC3D,QAAQ,QAAQ,EAAE,CAAC,OAAO,KAAK;AAC/B,YAAY,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;AAC1C,
|
|
1
|
+
{"version":3,"file":"downloadData.mjs","sources":["../../../../../../src/providers/s3/apis/internal/downloadData.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput';\nimport { createDownloadTask, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { getObject } from '../../utils/client/s3data';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nimport { STORAGE_INPUT_KEY } from '../../utils/constants';\nexport const downloadData = (input) => {\n const abortController = new AbortController();\n const downloadTask = createDownloadTask({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n};\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await resolveS3ConfigAndInput(Amplify, downloadDataInput);\n const { inputType, objectKey } = validateStorageOperationInput(downloadDataInput, identityId);\n validateBucketOwnerID(downloadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await getObject({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC5C,QAAQ,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;AAC3D,QAAQ,QAAQ,EAAE,CAAC,OAAO,KAAK;AAC/B,YAAY,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;AAC1C,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,OAAO,YAAY;AACvB;AACA,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,WAAW,KAAK,YAAY;AACxE,IAAI,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,iBAAiB;AAC9D,IAAI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACjH,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,iBAAiB,EAAE,UAAU,CAAC;AACjG,IAAI,qBAAqB,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;AACnE,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG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"getUrl.mjs","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { StorageValidationErrorCode } from '../../../../errors/types/validation';\nimport { getPresignedGetObjectUrl } from '../../utils/client/s3data';\nimport { resolveS3ConfigAndInput, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { assertValidationError } from '../../../../errors/utils/assertValidationError';\nimport { DEFAULT_PRESIGN_EXPIRATION, MAX_URL_EXPIRATION, STORAGE_INPUT_KEY, } from '../../utils/constants';\nimport { constructContentDisposition } from '../../utils/constructContentDisposition';\nimport { getProperties } from './getProperties';\nexport const getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, input);\n const { inputType, objectKey } = validateStorageOperationInput(input, identityId);\n validateBucketOwnerID(getUrlOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await getProperties(amplify, input, StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? DEFAULT_PRESIGN_EXPIRATION;\n const resolvedCredential = typeof s3Config.credentials === 'function'\n ? await s3Config.credentials()\n : s3Config.credentials;\n const awsCredExpiration = resolvedCredential.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = MAX_URL_EXPIRATION / 1000;\n assertValidationError(urlExpirationInSec <= maxUrlExpirationInSec, StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await getPresignedGetObjectUrl({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: constructContentDisposition(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK;AAC5C,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC;AACrG,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,KAAK,EAAE,UAAU,CAAC;AACrF,IAAI,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,CAAC;AAC7D,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AACxF,IAAI,IAAI,aAAa,EAAE,uBAAuB,EAAE;AAChD,QAAQ,MAAM,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC;AACjE;
|
|
1
|
+
{"version":3,"file":"getUrl.mjs","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { StorageValidationErrorCode } from '../../../../errors/types/validation';\nimport { getPresignedGetObjectUrl } from '../../utils/client/s3data';\nimport { resolveS3ConfigAndInput, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { assertValidationError } from '../../../../errors/utils/assertValidationError';\nimport { DEFAULT_PRESIGN_EXPIRATION, MAX_URL_EXPIRATION, STORAGE_INPUT_KEY, } from '../../utils/constants';\nimport { constructContentDisposition } from '../../utils/constructContentDisposition';\nimport { getProperties } from './getProperties';\nexport const getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, input);\n const { inputType, objectKey } = validateStorageOperationInput(input, identityId);\n validateBucketOwnerID(getUrlOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await getProperties(amplify, input, StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? DEFAULT_PRESIGN_EXPIRATION;\n const resolvedCredential = typeof s3Config.credentials === 'function'\n ? await s3Config.credentials()\n : s3Config.credentials;\n const awsCredExpiration = resolvedCredential.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = MAX_URL_EXPIRATION / 1000;\n assertValidationError(urlExpirationInSec <= maxUrlExpirationInSec, StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await getPresignedGetObjectUrl({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: constructContentDisposition(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,\n }),\n expiresAt: new Date(Date.now() + ur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