@aws-amplify/storage 6.9.4-unstable.e5a8569.0 → 6.9.5-unstable.76548ca.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.
Files changed (134) hide show
  1. package/dist/cjs/errors/CanceledError.js.map +1 -1
  2. package/dist/cjs/errors/IntegrityError.js.map +1 -1
  3. package/dist/cjs/errors/StorageError.js.map +1 -1
  4. package/dist/cjs/errors/utils/assertValidationError.js.map +1 -1
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/internals/apis/getDataAccess.js.map +1 -1
  7. package/dist/cjs/internals/apis/listCallerAccessGrants.js.map +1 -1
  8. package/dist/cjs/internals/apis/listPaths/getHighestPrecedenceUserGroup.js.map +1 -1
  9. package/dist/cjs/internals/apis/listPaths/index.js.map +1 -1
  10. package/dist/cjs/internals/apis/listPaths/listPaths.js.map +1 -1
  11. package/dist/cjs/internals/apis/listPaths/resolveLocationsForCurrentSession.js.map +1 -1
  12. package/dist/cjs/internals/index.js.map +1 -1
  13. package/dist/cjs/providers/s3/apis/index.js.map +1 -1
  14. package/dist/cjs/providers/s3/apis/internal/downloadData.js.map +1 -1
  15. package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
  16. package/dist/cjs/providers/s3/apis/internal/list.js.map +1 -1
  17. package/dist/cjs/providers/s3/apis/internal/remove.js.map +1 -1
  18. package/dist/cjs/providers/s3/apis/internal/uploadData/byteLength.js.map +1 -1
  19. package/dist/cjs/providers/s3/apis/internal/uploadData/index.js.map +1 -1
  20. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/calculatePartSize.js.map +1 -1
  21. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/getDataChunker.js.map +1 -1
  22. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/index.js.map +1 -1
  23. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/initialUpload.js.map +1 -1
  24. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/progressTracker.js.map +1 -1
  25. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadCache.js.map +1 -1
  26. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.js.map +1 -1
  27. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.js.map +1 -1
  28. package/dist/cjs/providers/s3/apis/server/index.js.map +1 -1
  29. package/dist/cjs/providers/s3/index.js.map +1 -1
  30. package/dist/cjs/providers/s3/utils/client/runtime/base64/index.browser.js.map +1 -1
  31. package/dist/cjs/providers/s3/utils/client/runtime/base64/index.native.js.map +1 -1
  32. package/dist/cjs/providers/s3/utils/client/runtime/contentSha256middleware.js.map +1 -1
  33. package/dist/cjs/providers/s3/utils/client/runtime/index.browser.js.map +1 -1
  34. package/dist/cjs/providers/s3/utils/client/runtime/index.js.map +1 -1
  35. package/dist/cjs/providers/s3/utils/client/runtime/index.native.js.map +1 -1
  36. package/dist/cjs/providers/s3/utils/client/runtime/xhrTransferHandler.js.map +1 -1
  37. package/dist/cjs/providers/s3/utils/client/runtime/xmlParser/dom.js.map +1 -1
  38. package/dist/cjs/providers/s3/utils/client/runtime/xmlParser/pureJs.js.map +1 -1
  39. package/dist/cjs/providers/s3/utils/client/s3control/base.js.map +1 -1
  40. package/dist/cjs/providers/s3/utils/client/s3control/getDataAccess.js.map +1 -1
  41. package/dist/cjs/providers/s3/utils/client/s3control/index.js.map +1 -1
  42. package/dist/cjs/providers/s3/utils/client/s3control/listCallerAccessGrants.js.map +1 -1
  43. package/dist/cjs/providers/s3/utils/client/s3data/abortMultipartUpload.js.map +1 -1
  44. package/dist/cjs/providers/s3/utils/client/s3data/base.js.map +1 -1
  45. package/dist/cjs/providers/s3/utils/client/s3data/completeMultipartUpload.js.map +1 -1
  46. package/dist/cjs/providers/s3/utils/client/s3data/copyObject.js.map +1 -1
  47. package/dist/cjs/providers/s3/utils/client/s3data/createMultipartUpload.js.map +1 -1
  48. package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js.map +1 -1
  49. package/dist/cjs/providers/s3/utils/client/s3data/getObject.js.map +1 -1
  50. package/dist/cjs/providers/s3/utils/client/s3data/headObject.js.map +1 -1
  51. package/dist/cjs/providers/s3/utils/client/s3data/index.js.map +1 -1
  52. package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js.map +1 -1
  53. package/dist/cjs/providers/s3/utils/client/s3data/listParts.js.map +1 -1
  54. package/dist/cjs/providers/s3/utils/client/s3data/putObject.js.map +1 -1
  55. package/dist/cjs/providers/s3/utils/client/s3data/uploadPart.js.map +1 -1
  56. package/dist/cjs/providers/s3/utils/client/utils/createRetryDecider.js.map +1 -1
  57. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js.map +1 -1
  58. package/dist/cjs/providers/s3/utils/client/utils/index.js.map +1 -1
  59. package/dist/cjs/providers/s3/utils/client/utils/integrityHelpers.js.map +1 -1
  60. package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js.map +1 -1
  61. package/dist/cjs/providers/s3/utils/client/utils/serializeHelpers.js.map +1 -1
  62. package/dist/cjs/providers/s3/utils/crc32.js.map +1 -1
  63. package/dist/cjs/providers/s3/utils/index.js.map +1 -1
  64. package/dist/cjs/providers/s3/utils/readFile.js.map +1 -1
  65. package/dist/cjs/providers/s3/utils/readFile.native.js.map +1 -1
  66. package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
  67. package/dist/cjs/providers/s3/utils/transferTask.js.map +1 -1
  68. package/dist/cjs/providers/s3/utils/validateBucketOwnerID.js.map +1 -1
  69. package/dist/cjs/providers/s3/utils/validateMultipartUploadXML.js.map +1 -1
  70. package/dist/cjs/providers/s3/utils/validateObjectUrl.js.map +1 -1
  71. package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js.map +1 -1
  72. package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js.map +1 -1
  73. package/dist/cjs/utils/index.js.map +1 -1
  74. package/dist/cjs/utils/resolvePrefix.js.map +1 -1
  75. package/dist/esm/errors/CanceledError.mjs.map +1 -1
  76. package/dist/esm/errors/IntegrityError.mjs.map +1 -1
  77. package/dist/esm/errors/StorageError.mjs.map +1 -1
  78. package/dist/esm/errors/utils/assertValidationError.mjs.map +1 -1
  79. package/dist/esm/internals/apis/getDataAccess.mjs.map +1 -1
  80. package/dist/esm/internals/apis/listCallerAccessGrants.mjs.map +1 -1
  81. package/dist/esm/internals/apis/listPaths/getHighestPrecedenceUserGroup.mjs.map +1 -1
  82. package/dist/esm/internals/apis/listPaths/listPaths.mjs.map +1 -1
  83. package/dist/esm/internals/apis/listPaths/resolveLocationsForCurrentSession.mjs.map +1 -1
  84. package/dist/esm/providers/s3/apis/internal/downloadData.mjs.map +1 -1
  85. package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
  86. package/dist/esm/providers/s3/apis/internal/list.mjs.map +1 -1
  87. package/dist/esm/providers/s3/apis/internal/remove.mjs.map +1 -1
  88. package/dist/esm/providers/s3/apis/internal/uploadData/byteLength.mjs.map +1 -1
  89. package/dist/esm/providers/s3/apis/internal/uploadData/index.mjs.map +1 -1
  90. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/calculatePartSize.mjs.map +1 -1
  91. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/getDataChunker.mjs.map +1 -1
  92. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/initialUpload.mjs.map +1 -1
  93. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/progressTracker.mjs.map +1 -1
  94. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.mjs.map +1 -1
  95. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.mjs.map +1 -1
  96. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.mjs.map +1 -1
  97. package/dist/esm/providers/s3/utils/client/runtime/base64/index.browser.mjs.map +1 -1
  98. package/dist/esm/providers/s3/utils/client/runtime/base64/index.native.mjs.map +1 -1
  99. package/dist/esm/providers/s3/utils/client/runtime/contentSha256middleware.mjs.map +1 -1
  100. package/dist/esm/providers/s3/utils/client/runtime/xhrTransferHandler.mjs.map +1 -1
  101. package/dist/esm/providers/s3/utils/client/runtime/xmlParser/dom.mjs.map +1 -1
  102. package/dist/esm/providers/s3/utils/client/runtime/xmlParser/pureJs.mjs.map +1 -1
  103. package/dist/esm/providers/s3/utils/client/s3control/base.mjs.map +1 -1
  104. package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.mjs.map +1 -1
  105. package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.mjs.map +1 -1
  106. package/dist/esm/providers/s3/utils/client/s3data/abortMultipartUpload.mjs.map +1 -1
  107. package/dist/esm/providers/s3/utils/client/s3data/base.mjs.map +1 -1
  108. package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs.map +1 -1
  109. package/dist/esm/providers/s3/utils/client/s3data/copyObject.mjs.map +1 -1
  110. package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.mjs.map +1 -1
  111. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs.map +1 -1
  112. package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs.map +1 -1
  113. package/dist/esm/providers/s3/utils/client/s3data/headObject.mjs.map +1 -1
  114. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs.map +1 -1
  115. package/dist/esm/providers/s3/utils/client/s3data/listParts.mjs.map +1 -1
  116. package/dist/esm/providers/s3/utils/client/s3data/putObject.mjs.map +1 -1
  117. package/dist/esm/providers/s3/utils/client/s3data/uploadPart.mjs.map +1 -1
  118. package/dist/esm/providers/s3/utils/client/utils/createRetryDecider.mjs.map +1 -1
  119. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs.map +1 -1
  120. package/dist/esm/providers/s3/utils/client/utils/integrityHelpers.mjs.map +1 -1
  121. package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs.map +1 -1
  122. package/dist/esm/providers/s3/utils/client/utils/serializeHelpers.mjs.map +1 -1
  123. package/dist/esm/providers/s3/utils/crc32.mjs.map +1 -1
  124. package/dist/esm/providers/s3/utils/readFile.mjs.map +1 -1
  125. package/dist/esm/providers/s3/utils/readFile.native.mjs.map +1 -1
  126. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
  127. package/dist/esm/providers/s3/utils/transferTask.mjs.map +1 -1
  128. package/dist/esm/providers/s3/utils/validateBucketOwnerID.mjs.map +1 -1
  129. package/dist/esm/providers/s3/utils/validateMultipartUploadXML.mjs.map +1 -1
  130. package/dist/esm/providers/s3/utils/validateObjectUrl.mjs.map +1 -1
  131. package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs.map +1 -1
  132. package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs.map +1 -1
  133. package/dist/esm/utils/resolvePrefix.mjs.map +1 -1
  134. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"readFile.native.mjs","sources":["../../../../../src/providers/s3/utils/readFile.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Buffer } from '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\nexport const 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.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AACnE,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AACnC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;AAC5B,KAAK;AACL,IAAI,IAAI;AACR,QAAQ,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AACtC;AACA,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,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;AACjE,YAAY,OAAO,CAAC,WAAW,CAAC;AAChC,SAAS;AACT,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;AAClC;AACA,CAAC;;;;"}
1
+ {"version":3,"file":"readFile.native.mjs","sources":["../../../../../src/providers/s3/utils/readFile.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Buffer } from '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\nexport const 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.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AACnE,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,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;AACjE,YAAY,OAAO,CAAC,WAAW,CAAC;AAChC,QAAQ,CAAC;AACT,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;AAClC,IAAI;AACJ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveS3ConfigAndInput.mjs","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { resolvePrefix as defaultPrefixResolver } from '../../../utils/resolvePrefix';\nimport { StorageError } from '../../../errors/StorageError';\nimport { INVALID_STORAGE_INPUT } from '../../../errors/constants';\nimport { DEFAULT_ACCESS_LEVEL, LOCAL_TESTING_S3_ENDPOINT } from './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 */\nexport const 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 assertValidationError(!!credentials, 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 assertValidationError(!!bucket, StorageValidationErrorCode.NoBucket);\n assertValidationError(!!region, StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = defaultPrefixResolver, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const accessLevel = apiOptions?.accessLevel ?? defaultAccessLevel ?? 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: LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n identityId,\n isObjectLockEnabled,\n };\n};\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({\n name: 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 assertValidationError(!!bucketConfig, 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":["defaultPrefixResolver"],"mappings":";;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,OAAO,OAAO,EAAE,QAAQ,KAAK;AACpE,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,OAAO,OAAO,KAAK;AACnD,QAAQ,IAAI,6BAA6B,CAAC,UAAU,CAAC,EAAE;AACvD,YAAY,kBAAkB,CAAC,QAAQ,CA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;;;;"}
1
+ {"version":3,"file":"resolveS3ConfigAndInput.mjs","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { resolvePrefix as defaultPrefixResolver } from '../../../utils/resolvePrefix';\nimport { StorageError } from '../../../errors/StorageError';\nimport { INVALID_STORAGE_INPUT } from '../../../errors/constants';\nimport { DEFAULT_ACCESS_LEVEL, LOCAL_TESTING_S3_ENDPOINT } from './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 */\nexport const 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 assertValidationError(!!credentials, 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 assertValidationError(!!bucket, StorageValidationErrorCode.NoBucket);\n assertValidationError(!!region, StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = defaultPrefixResolver, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const accessLevel = apiOptions?.accessLevel ?? defaultAccessLevel ?? 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: LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n identityId,\n isObjectLockEnabled,\n };\n};\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({\n name: 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 assertValidationError(!!bucketConfig, 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":["defaultPrefixResolver"],"mappings":";;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,OAAO,OAAO,EAAE,QAAQ,KAAK;AACpE,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,OAAO,OAAO,KAAK;AACnD,QAAQ,IAAI,6BAA6B,CAAC,UAAU,CAAC,EAAE;AACvD,YAAY,kBAAkB,CAAC,QAAQ,CAAC;AACxC,QAAQ;AACR;AACA;AACA;AACA,QAAQ,MAAM,EAAE,WAAW,EAAE,GAAG,6BAA6B,CAAC,UAAU;AACxE,cAAc,MAAM,UAAU,CAAC,2BAA2B,CAAC,OAAO;AAClE,cAAc,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;AACnD,QAA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AAM,cAAc,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;AAC5C,CAAC;AACD,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,qBAAqB,CAAC,CAAC,CAAC,YAAY,EAAE,0BAA0B,CAAC,oBAAoB,CAAC;AAC9F,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.mjs","sources":["../../../../../src/providers/s3/utils/transferTask.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isCancelError } from '../../../errors/CanceledError';\nimport { logger } from '../../../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 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 (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};\nexport const createDownloadTask = createCancellableTask;\nexport const 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 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 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};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGA,MAAM,qBAAqB,GAAG,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,K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G,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK;AAC9F,IAAI,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAClD,QAAQ,GAAG;AACX,QAAQ,QAAQ;AAChB,KAAK,CAAC;AACN,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;AACtD,QAAQ,KAAK,EAAE,MAAM;AACrB,YAAY,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU;AACxC,YAAY,IAAI,CAAC,iBAAiB,IAAI,KAAK,KAAK,aAAa,EAAE;AAC/D,gBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,gBAAgB;AAChB;AACA;AACA;AACA;AACA,YAAY,UAAU,CAAC,KAAK,GAAG,QAAQ;AACvC,YAAY,OAAO,IAAI;AACvB,SAAS;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,MAAM,CAAC,KAAK,CAAC,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5E,gBAAgB;AAChB;AACA;AACA;AACA;AACA,YAAY,UAAU,CAAC,KAAK,GAAG,aAAa;AAC5C,YAAY,QAAQ,IAAI;AACxB,SAAS;AACT,KAAK,CAAC;AACN,IAAI,OAAO,UAAU;AACrB;;;;"}
1
+ {"version":3,"file":"transferTask.mjs","sources":["../../../../../src/providers/s3/utils/transferTask.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isCancelError } from '../../../errors/CanceledError';\nimport { logger } from '../../../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 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 (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};\nexport const createDownloadTask = createCancellableTask;\nexport const 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 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 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};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGA,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,Q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;AAC9F,IAAI,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAClD,QAAQ,GAAG;AACX,QAAQ,QAAQ;AAChB,KAAK,CAAC;AACN,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;AACtD,QAAQ,KAAK,EAAE,MAAM;AACrB,YAAY,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU;AACxC,YAAY,IAAI,CAAC,iBAAiB,IAAI,KAAK,KAAK,aAAa,EAAE;AAC/D,gBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,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,MAAM,CAAC,KAAK,CAAC,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5E,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;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateBucketOwnerID.mjs","sources":["../../../../../src/providers/s3/utils/validateBucketOwnerID.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nconst VALID_AWS_ACCOUNT_ID_PATTERN = /^\\d{12}/;\nexport const validateBucketOwnerID = (accountID) => {\n if (accountID === undefined) {\n return;\n }\n assertValidationError(VALID_AWS_ACCOUNT_ID_PATTERN.test(accountID), StorageValidationErrorCode.InvalidAWSAccountID);\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,4BAA4B,GAAG,SAAS;AAClC,MAAC,qBAAqB,GAAG,CAAC,SAAS,KAAK;AACpD,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ;AACR;AACA,IAAI,qBAAqB,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,0BAA0B,CAAC,mBAAmB,CAAC;AACvH;;;;"}
1
+ {"version":3,"file":"validateBucketOwnerID.mjs","sources":["../../../../../src/providers/s3/utils/validateBucketOwnerID.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nconst VALID_AWS_ACCOUNT_ID_PATTERN = /^\\d{12}/;\nexport const validateBucketOwnerID = (accountID) => {\n if (accountID === undefined) {\n return;\n }\n assertValidationError(VALID_AWS_ACCOUNT_ID_PATTERN.test(accountID), StorageValidationErrorCode.InvalidAWSAccountID);\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,4BAA4B,GAAG,SAAS;AAClC,MAAC,qBAAqB,GAAG,CAAC,SAAS,KAAK;AACpD,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ;AACR,IAAI;AACJ,IAAI,qBAAqB,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,0BAA0B,CAAC,mBAAmB,CAAC;AACvH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateMultipartUploadXML.mjs","sources":["../../../../../src/providers/s3/utils/validateMultipartUploadXML.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IntegrityError } from '../../../errors/IntegrityError';\nimport { parser } from './client/runtime';\nimport { deserializeCompletedPartList, emptyArrayGuard, map, } from './client/utils';\nimport { isEqual } from './client/utils/integrityHelpers';\nexport function validateMultipartUploadXML(input, xml) {\n if (!input.Parts) {\n throw new IntegrityError();\n }\n const parsedXML = parser.parse(xml);\n const mappedCompletedMultipartUpload = map(parsedXML, {\n Parts: [\n 'Part',\n value => emptyArrayGuard(value, deserializeCompletedPartList),\n ],\n });\n if (!isEqual(input, mappedCompletedMultipartUpload)) {\n throw new IntegrityError();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;AAKO,SAAS,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE;AACvD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACtB,QAAQ,MAAM,IAAI,cAAc,EAAE;AAClC;AACA,IAAI,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;AACvC,IAAI,MAAM,8BAA8B,GAAG,GAAG,CAAC,SAAS,EAAE;AAC1D,QAAQ,KAAK,EAAE;AACf,YAAY,MAAM;AAClB,YAAY,KAAK,IAAI,eAAe,CAAC,KAAK,EAAE,4BAA4B,CAAC;AACzE,SAAS;AACT,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,8BAA8B,CAAC,EAAE;AACzD,QAAQ,MAAM,IAAI,cAAc,EAAE;AAClC;AACA;;;;"}
1
+ {"version":3,"file":"validateMultipartUploadXML.mjs","sources":["../../../../../src/providers/s3/utils/validateMultipartUploadXML.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IntegrityError } from '../../../errors/IntegrityError';\nimport { parser } from './client/runtime';\nimport { deserializeCompletedPartList, emptyArrayGuard, map, } from './client/utils';\nimport { isEqual } from './client/utils/integrityHelpers';\nexport function validateMultipartUploadXML(input, xml) {\n if (!input.Parts) {\n throw new IntegrityError();\n }\n const parsedXML = parser.parse(xml);\n const mappedCompletedMultipartUpload = map(parsedXML, {\n Parts: [\n 'Part',\n value => emptyArrayGuard(value, deserializeCompletedPartList),\n ],\n });\n if (!isEqual(input, mappedCompletedMultipartUpload)) {\n throw new IntegrityError();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;AAKO,SAAS,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE;AACvD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACtB,QAAQ,MAAM,IAAI,cAAc,EAAE;AAClC,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;AACvC,IAAI,MAAM,8BAA8B,GAAG,GAAG,CAAC,SAAS,EAAE;AAC1D,QAAQ,KAAK,EAAE;AACf,YAAY,MAAM;AAClB,YAAY,KAAK,IAAI,eAAe,CAAC,KAAK,EAAE,4BAA4B,CAAC;AACzE,SAAS;AACT,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,8BAA8B,CAAC,EAAE;AACzD,QAAQ,MAAM,IAAI,cAAc,EAAE;AAClC,IAAI;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateObjectUrl.mjs","sources":["../../../../../src/providers/s3/utils/validateObjectUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { extendedEncodeURIComponent } from '@aws-amplify/core/internals/aws-client-utils';\nimport { IntegrityError } from '../../../errors/IntegrityError';\nexport function validateObjectUrl({ bucketName, key, objectURL, }) {\n if (!bucketName || !key || !objectURL) {\n throw new IntegrityError();\n }\n const bucketWithDots = bucketName.includes('.');\n const encodedBucketName = extendedEncodeURIComponent(bucketName);\n const encodedKey = key.split('/').map(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();\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,iBAAiB,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE;AACnE,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE;AAC3C,QAAQ,MAAM,IAAI,cAAc,EAAE;AAClC;AACA,IAAI,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AACnD,IAAI,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,UAAU,CAAC;AACpE,IAAI,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAC/E,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,cAAc,EAAE;AAClC;AACA;;;;"}
1
+ {"version":3,"file":"validateObjectUrl.mjs","sources":["../../../../../src/providers/s3/utils/validateObjectUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { extendedEncodeURIComponent } from '@aws-amplify/core/internals/aws-client-utils';\nimport { IntegrityError } from '../../../errors/IntegrityError';\nexport function validateObjectUrl({ bucketName, key, objectURL, }) {\n if (!bucketName || !key || !objectURL) {\n throw new IntegrityError();\n }\n const bucketWithDots = bucketName.includes('.');\n const encodedBucketName = extendedEncodeURIComponent(bucketName);\n const encodedKey = key.split('/').map(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();\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,iBAAiB,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE;AACnE,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE;AAC3C,QAAQ,MAAM,IAAI,cAAc,EAAE;AAClC,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AACnD,IAAI,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,UAAU,CAAC;AACpE,IAAI,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAC/E,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,cAAc,EAAE;AAClC,IAAI;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateStorageOperationInput.mjs","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { isInputWithPath } from './isInputWithPath';\nimport { STORAGE_INPUT_KEY, STORAGE_INPUT_PATH } from './constants';\nimport { resolveIdentityId } from './resolveIdentityId';\nexport const validateStorageOperationInput = (input, identityId) => {\n assertValidationError(\n // Key present without a path\n (!!input.key && !input.path) ||\n // Path present without a key\n (!input.key && !!input.path), StorageValidationErrorCode.InvalidStorageOperationInput);\n if (isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: resolveIdentityId(identityId) });\n assertValidationError(!objectKey.startsWith('/'), StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: STORAGE_INPUT_KEY, objectKey: input.key };\n }\n};\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAMY,MAAC,6BAA6B,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AACpE,IAAI,qBAAqB;AACzB;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,0BAA0B,CAAC,4BAA4B,CAAC;AAC9F,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE;AAChC,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AAC9B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK;AAC1C,cAAc;AACd,cAAc,IAAI,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;AACjE,QAAQ,qBAAqB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,0BAA0B,CAAC,uBAAuB,CAAC;AAC7G,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,kBAAkB;AACzC,YAAY,SAAS;AACrB,SAAS;AACT;AACA,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;AACrE;AACA;;;;"}
1
+ {"version":3,"file":"validateStorageOperationInput.mjs","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { isInputWithPath } from './isInputWithPath';\nimport { STORAGE_INPUT_KEY, STORAGE_INPUT_PATH } from './constants';\nimport { resolveIdentityId } from './resolveIdentityId';\nexport const validateStorageOperationInput = (input, identityId) => {\n assertValidationError(\n // Key present without a path\n (!!input.key && !input.path) ||\n // Path present without a key\n (!input.key && !!input.path), StorageValidationErrorCode.InvalidStorageOperationInput);\n if (isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: resolveIdentityId(identityId) });\n assertValidationError(!objectKey.startsWith('/'), StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: STORAGE_INPUT_KEY, objectKey: input.key };\n }\n};\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAMY,MAAC,6BAA6B,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AACpE,IAAI,qBAAqB;AACzB;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,0BAA0B,CAAC,4BAA4B,CAAC;AAC9F,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE;AAChC,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AAC9B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK;AAC1C,cAAc;AACd,cAAc,IAAI,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;AACjE,QAAQ,qBAAqB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,0BAA0B,CAAC,uBAAuB,CAAC;AAC7G,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,kBAAkB;AACzC,YAAY,SAAS;AACrB,SAAS;AACT,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;AACrE,IAAI;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateStorageOperationInputWithPrefix.mjs","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInputWithPrefix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { STORAGE_INPUT_PATH, STORAGE_INPUT_PREFIX } from './constants';\nimport { resolveIdentityId } from './resolveIdentityId';\n// Local assertion function with StorageOperationInputWithPrefixPath as Input\nconst _isInputWithPath = (input) => {\n return input.path !== undefined;\n};\nexport const validateStorageOperationInputWithPrefix = (input, identityId) => {\n // Validate prefix & path not present at the same time\n assertValidationError(!(input.prefix && input.path), StorageValidationErrorCode.InvalidStorageOperationPrefixInput);\n if (_isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: resolveIdentityId(identityId) });\n // Assert on no leading slash in the path parameter\n assertValidationError(!objectKey.startsWith('/'), StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: STORAGE_INPUT_PREFIX, objectKey: input.prefix ?? '' };\n }\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA,MAAM,gBAAgB,GAAG,CAAC,KAAK,KAAK;AACpC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS;AACnC,CAAC;AACW,MAAC,uCAAuC,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AAC9E;AACA,IAAI,qBAAqB,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC,kCAAkC,CAAC;AACvH,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,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;AACjE;AACA,QAAQ,qBAAqB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,0BAA0B,CAAC,uBAAuB,CAAC;AAC7G,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,kBAAkB;AACzC,YAAY,SAAS;AACrB,SAAS;AACT;AACA,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE;AACjF;AACA;;;;"}
1
+ {"version":3,"file":"validateStorageOperationInputWithPrefix.mjs","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInputWithPrefix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { STORAGE_INPUT_PATH, STORAGE_INPUT_PREFIX } from './constants';\nimport { resolveIdentityId } from './resolveIdentityId';\n// Local assertion function with StorageOperationInputWithPrefixPath as Input\nconst _isInputWithPath = (input) => {\n return input.path !== undefined;\n};\nexport const validateStorageOperationInputWithPrefix = (input, identityId) => {\n // Validate prefix & path not present at the same time\n assertValidationError(!(input.prefix && input.path), StorageValidationErrorCode.InvalidStorageOperationPrefixInput);\n if (_isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string'\n ? path\n : path({ identityId: resolveIdentityId(identityId) });\n // Assert on no leading slash in the path parameter\n assertValidationError(!objectKey.startsWith('/'), StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: STORAGE_INPUT_PREFIX, objectKey: input.prefix ?? '' };\n }\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA,MAAM,gBAAgB,GAAG,CAAC,KAAK,KAAK;AACpC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS;AACnC,CAAC;AACW,MAAC,uCAAuC,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AAC9E;AACA,IAAI,qBAAqB,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC,kCAAkC,CAAC;AACvH,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,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;AACjE;AACA,QAAQ,qBAAqB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,0BAA0B,CAAC,uBAAuB,CAAC;AAC7G,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,kBAAkB;AACzC,YAAY,SAAS;AACrB,SAAS;AACT,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE;AACjF,IAAI;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePrefix.mjs","sources":["../../../src/utils/resolvePrefix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../errors/types/validation';\nexport const resolvePrefix = ({ accessLevel, targetIdentityId, }) => {\n if (accessLevel === 'private') {\n assertValidationError(!!targetIdentityId, StorageValidationErrorCode.NoIdentityId);\n return `private/${targetIdentityId}/`;\n }\n else if (accessLevel === 'protected') {\n assertValidationError(!!targetIdentityId, StorageValidationErrorCode.NoIdentityId);\n return `protected/${targetIdentityId}/`;\n }\n else {\n return 'public/';\n }\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,aAAa,GAAG,CAAC,EAAE,WAAW,EAAE,gBAAgB,GAAG,KAAK;AACrE,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE;AACnC,QAAQ,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,YAAY,CAAC;AAC1F,QAAQ,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC7C;AACA,SAAS,IAAI,WAAW,KAAK,WAAW,EAAE;AAC1C,QAAQ,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,YAAY,CAAC;AAC1F,QAAQ,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC/C;AACA,SAAS;AACT,QAAQ,OAAO,SAAS;AACxB;AACA;;;;"}
1
+ {"version":3,"file":"resolvePrefix.mjs","sources":["../../../src/utils/resolvePrefix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../errors/types/validation';\nexport const resolvePrefix = ({ accessLevel, targetIdentityId, }) => {\n if (accessLevel === 'private') {\n assertValidationError(!!targetIdentityId, StorageValidationErrorCode.NoIdentityId);\n return `private/${targetIdentityId}/`;\n }\n else if (accessLevel === 'protected') {\n assertValidationError(!!targetIdentityId, StorageValidationErrorCode.NoIdentityId);\n return `protected/${targetIdentityId}/`;\n }\n else {\n return 'public/';\n }\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,aAAa,GAAG,CAAC,EAAE,WAAW,EAAE,gBAAgB,GAAG,KAAK;AACrE,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE;AACnC,QAAQ,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,YAAY,CAAC;AAC1F,QAAQ,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC7C,IAAI;AACJ,SAAS,IAAI,WAAW,KAAK,WAAW,EAAE;AAC1C,QAAQ,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,YAAY,CAAC;AAC1F,QAAQ,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC/C,IAAI;AACJ,SAAS;AACT,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/storage",
3
- "version": "6.9.4-unstable.e5a8569.0+e5a8569",
3
+ "version": "6.9.5-unstable.76548ca.0+76548ca",
4
4
  "description": "Storage category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -108,12 +108,12 @@
108
108
  "./package.json": "./package.json"
109
109
  },
110
110
  "peerDependencies": {
111
- "@aws-amplify/core": "6.12.4-unstable.e5a8569.0+e5a8569"
111
+ "@aws-amplify/core": "6.13.1-unstable.76548ca.0+76548ca"
112
112
  },
113
113
  "devDependencies": {
114
- "@aws-amplify/core": "6.12.4-unstable.e5a8569.0+e5a8569",
115
- "@aws-amplify/react-native": "1.1.11-unstable.e5a8569.0+e5a8569",
114
+ "@aws-amplify/core": "6.13.1-unstable.76548ca.0+76548ca",
115
+ "@aws-amplify/react-native": "1.1.11-unstable.76548ca.0+76548ca",
116
116
  "@types/node": "20.14.12"
117
117
  },
118
- "gitHead": "e5a85697101735c21548e397832fab12d001a5dc"
118
+ "gitHead": "76548ca51f2df7b5faac3233a1cc1d54d176b2ac"
119
119
  }