@aws-amplify/storage 6.6.6 → 6.6.8-storage-browser.53c96b8.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 (390) hide show
  1. package/dist/cjs/errors/constants.js +8 -0
  2. package/dist/cjs/errors/constants.js.map +1 -0
  3. package/dist/cjs/errors/types/validation.js +12 -0
  4. package/dist/cjs/errors/types/validation.js.map +1 -1
  5. package/dist/cjs/providers/s3/apis/downloadData.js +3 -3
  6. package/dist/cjs/providers/s3/apis/downloadData.js.map +1 -1
  7. package/dist/cjs/providers/s3/apis/internal/copy.js +38 -6
  8. package/dist/cjs/providers/s3/apis/internal/copy.js.map +1 -1
  9. package/dist/cjs/providers/s3/apis/internal/getProperties.js +3 -4
  10. package/dist/cjs/providers/s3/apis/internal/getProperties.js.map +1 -1
  11. package/dist/cjs/providers/s3/apis/internal/getUrl.js +3 -3
  12. package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
  13. package/dist/cjs/providers/s3/apis/internal/list.js +4 -4
  14. package/dist/cjs/providers/s3/apis/internal/list.js.map +1 -1
  15. package/dist/cjs/providers/s3/apis/internal/remove.js +3 -4
  16. package/dist/cjs/providers/s3/apis/internal/remove.js.map +1 -1
  17. package/dist/cjs/providers/s3/apis/uploadData/multipart/initialUpload.js +22 -2
  18. package/dist/cjs/providers/s3/apis/uploadData/multipart/initialUpload.js.map +1 -1
  19. package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadCache.js +3 -2
  20. package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadCache.js.map +1 -1
  21. package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadHandlers.js +19 -8
  22. package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadHandlers.js.map +1 -1
  23. package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadPartExecutor.js +20 -11
  24. package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadPartExecutor.js.map +1 -1
  25. package/dist/cjs/providers/s3/apis/uploadData/putObjectJob.js +20 -7
  26. package/dist/cjs/providers/s3/apis/uploadData/putObjectJob.js.map +1 -1
  27. package/dist/cjs/providers/s3/apis/uploadData/validateObjectNotExists.js +25 -0
  28. package/dist/cjs/providers/s3/apis/uploadData/validateObjectNotExists.js.map +1 -0
  29. package/dist/cjs/providers/s3/types/index.js +0 -3
  30. package/dist/cjs/providers/s3/types/index.js.map +1 -1
  31. package/dist/cjs/providers/s3/utils/client/s3control/base.js +70 -0
  32. package/dist/cjs/providers/s3/utils/client/s3control/base.js.map +1 -0
  33. package/dist/cjs/providers/s3/utils/client/s3control/getDataAccess.js +58 -0
  34. package/dist/cjs/providers/s3/utils/client/s3control/getDataAccess.js.map +1 -0
  35. package/dist/cjs/providers/s3/utils/client/s3control/index.js +11 -0
  36. package/dist/cjs/providers/s3/utils/client/s3control/index.js.map +1 -0
  37. package/dist/cjs/providers/s3/utils/client/s3control/listCallerAccessGrants.js +63 -0
  38. package/dist/cjs/providers/s3/utils/client/s3control/listCallerAccessGrants.js.map +1 -0
  39. package/dist/cjs/providers/s3/utils/client/s3control/types.js.map +1 -0
  40. package/dist/cjs/providers/s3/utils/client/{abortMultipartUpload.js → s3data/abortMultipartUpload.js} +2 -2
  41. package/dist/cjs/providers/s3/utils/client/s3data/abortMultipartUpload.js.map +1 -0
  42. package/dist/cjs/providers/s3/utils/client/{base.js → s3data/base.js} +25 -3
  43. package/dist/cjs/providers/s3/utils/client/s3data/base.js.map +1 -0
  44. package/dist/cjs/providers/s3/utils/client/{completeMultipartUpload.js → s3data/completeMultipartUpload.js} +16 -11
  45. package/dist/cjs/providers/s3/utils/client/s3data/completeMultipartUpload.js.map +1 -0
  46. package/dist/cjs/providers/s3/utils/client/{copyObject.js → s3data/copyObject.js} +2 -2
  47. package/dist/cjs/providers/s3/utils/client/s3data/copyObject.js.map +1 -0
  48. package/dist/cjs/providers/s3/utils/client/{createMultipartUpload.js → s3data/createMultipartUpload.js} +8 -3
  49. package/dist/cjs/providers/s3/utils/client/s3data/createMultipartUpload.js.map +1 -0
  50. package/dist/cjs/providers/s3/utils/client/{deleteObject.js → s3data/deleteObject.js} +2 -2
  51. package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js.map +1 -0
  52. package/dist/cjs/providers/s3/utils/client/{getObject.js → s3data/getObject.js} +3 -3
  53. package/dist/cjs/providers/s3/utils/client/s3data/getObject.js.map +1 -0
  54. package/dist/cjs/providers/s3/utils/client/{headObject.js → s3data/headObject.js} +2 -2
  55. package/dist/cjs/providers/s3/utils/client/s3data/headObject.js.map +1 -0
  56. package/dist/cjs/providers/s3/utils/client/s3data/index.js.map +1 -0
  57. package/dist/cjs/providers/s3/utils/client/{listObjectsV2.js → s3data/listObjectsV2.js} +2 -2
  58. package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js.map +1 -0
  59. package/dist/cjs/providers/s3/utils/client/{listParts.js → s3data/listParts.js} +3 -2
  60. package/dist/cjs/providers/s3/utils/client/s3data/listParts.js.map +1 -0
  61. package/dist/cjs/providers/s3/utils/client/{putObject.js → s3data/putObject.js} +3 -2
  62. package/dist/cjs/providers/s3/utils/client/s3data/putObject.js.map +1 -0
  63. package/dist/cjs/providers/s3/utils/client/s3data/types.js +6 -0
  64. package/dist/cjs/providers/s3/utils/client/s3data/types.js.map +1 -0
  65. package/dist/cjs/providers/s3/utils/client/{uploadPart.js → s3data/uploadPart.js} +4 -3
  66. package/dist/cjs/providers/s3/utils/client/s3data/uploadPart.js.map +1 -0
  67. package/dist/cjs/providers/s3/utils/client/utils/createRetryDecider.js +57 -0
  68. package/dist/cjs/providers/s3/utils/client/utils/createRetryDecider.js.map +1 -0
  69. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js +34 -1
  70. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js.map +1 -1
  71. package/dist/cjs/providers/s3/utils/client/utils/index.js +4 -2
  72. package/dist/cjs/providers/s3/utils/client/utils/index.js.map +1 -1
  73. package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js +20 -6
  74. package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js.map +1 -1
  75. package/dist/cjs/providers/s3/utils/crc32.js +37 -0
  76. package/dist/cjs/providers/s3/utils/crc32.js.map +1 -0
  77. package/dist/cjs/providers/s3/utils/crc32.native.js +11 -0
  78. package/dist/cjs/providers/s3/utils/crc32.native.js.map +1 -0
  79. package/dist/cjs/providers/s3/utils/md5.js +2 -12
  80. package/dist/cjs/providers/s3/utils/md5.js.map +1 -1
  81. package/dist/cjs/providers/s3/utils/md5.native.js +2 -12
  82. package/dist/cjs/providers/s3/utils/md5.native.js.map +1 -1
  83. package/dist/cjs/providers/s3/utils/resolveIdentityId.js +14 -0
  84. package/dist/cjs/providers/s3/utils/resolveIdentityId.js.map +1 -0
  85. package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js +59 -13
  86. package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
  87. package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js +4 -1
  88. package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js.map +1 -1
  89. package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js +4 -1
  90. package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js.map +1 -1
  91. package/dist/cjs/storageBrowser/apis/constants.js +9 -0
  92. package/dist/cjs/storageBrowser/apis/constants.js.map +1 -0
  93. package/dist/cjs/storageBrowser/apis/getDataAccess.js +57 -0
  94. package/dist/cjs/storageBrowser/apis/getDataAccess.js.map +1 -0
  95. package/dist/cjs/storageBrowser/apis/listCallerAccessGrants.js +69 -0
  96. package/dist/cjs/storageBrowser/apis/listCallerAccessGrants.js.map +1 -0
  97. package/dist/cjs/storageBrowser/apis/types.js +6 -0
  98. package/dist/cjs/storageBrowser/apis/types.js.map +1 -0
  99. package/dist/cjs/storageBrowser/index.js +11 -0
  100. package/dist/cjs/storageBrowser/index.js.map +1 -0
  101. package/dist/cjs/storageBrowser/locationCredentialsStore/constants.js +9 -0
  102. package/dist/cjs/storageBrowser/locationCredentialsStore/constants.js.map +1 -0
  103. package/dist/cjs/storageBrowser/locationCredentialsStore/create.js +36 -0
  104. package/dist/cjs/storageBrowser/locationCredentialsStore/create.js.map +1 -0
  105. package/dist/cjs/storageBrowser/locationCredentialsStore/index.js +9 -0
  106. package/dist/cjs/storageBrowser/locationCredentialsStore/index.js.map +1 -0
  107. package/dist/cjs/storageBrowser/locationCredentialsStore/registry.js +58 -0
  108. package/dist/cjs/storageBrowser/locationCredentialsStore/registry.js.map +1 -0
  109. package/dist/cjs/storageBrowser/locationCredentialsStore/store.js +99 -0
  110. package/dist/cjs/storageBrowser/locationCredentialsStore/store.js.map +1 -0
  111. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.js +15 -0
  112. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.js.map +1 -0
  113. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.js +29 -0
  114. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.js.map +1 -0
  115. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.js +32 -0
  116. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.js.map +1 -0
  117. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/index.js +9 -0
  118. package/dist/cjs/storageBrowser/managedAuthConfigAdapter/index.js.map +1 -0
  119. package/dist/cjs/storageBrowser/types.js +6 -0
  120. package/dist/cjs/storageBrowser/types.js.map +1 -0
  121. package/dist/esm/errors/constants.d.ts +1 -0
  122. package/dist/esm/errors/constants.mjs +6 -0
  123. package/dist/esm/errors/constants.mjs.map +1 -0
  124. package/dist/esm/errors/types/validation.d.ts +4 -1
  125. package/dist/esm/errors/types/validation.mjs +12 -0
  126. package/dist/esm/errors/types/validation.mjs.map +1 -1
  127. package/dist/esm/providers/s3/apis/downloadData.mjs +13 -13
  128. package/dist/esm/providers/s3/apis/downloadData.mjs.map +1 -1
  129. package/dist/esm/providers/s3/apis/internal/copy.mjs +48 -16
  130. package/dist/esm/providers/s3/apis/internal/copy.mjs.map +1 -1
  131. package/dist/esm/providers/s3/apis/internal/getProperties.mjs +13 -14
  132. package/dist/esm/providers/s3/apis/internal/getProperties.mjs.map +1 -1
  133. package/dist/esm/providers/s3/apis/internal/getUrl.mjs +13 -13
  134. package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
  135. package/dist/esm/providers/s3/apis/internal/list.mjs +13 -13
  136. package/dist/esm/providers/s3/apis/internal/list.mjs.map +1 -1
  137. package/dist/esm/providers/s3/apis/internal/remove.mjs +13 -14
  138. package/dist/esm/providers/s3/apis/internal/remove.mjs.map +1 -1
  139. package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.d.ts +2 -1
  140. package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.mjs +32 -12
  141. package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.mjs.map +1 -1
  142. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.d.ts +3 -1
  143. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.mjs +13 -12
  144. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.mjs.map +1 -1
  145. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.mjs +27 -16
  146. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.mjs.map +1 -1
  147. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadPartExecutor.d.ts +3 -2
  148. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadPartExecutor.mjs +27 -18
  149. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadPartExecutor.mjs.map +1 -1
  150. package/dist/esm/providers/s3/apis/uploadData/putObjectJob.mjs +30 -17
  151. package/dist/esm/providers/s3/apis/uploadData/putObjectJob.mjs.map +1 -1
  152. package/dist/esm/providers/s3/apis/uploadData/validateObjectNotExists.d.ts +3 -0
  153. package/dist/esm/providers/s3/apis/uploadData/validateObjectNotExists.mjs +34 -0
  154. package/dist/esm/providers/s3/apis/uploadData/validateObjectNotExists.mjs.map +1 -0
  155. package/dist/esm/providers/s3/types/index.d.ts +1 -2
  156. package/dist/esm/providers/s3/types/index.mjs +1 -1
  157. package/dist/esm/providers/s3/types/inputs.d.ts +19 -15
  158. package/dist/esm/providers/s3/types/options.d.ts +44 -21
  159. package/dist/esm/providers/s3/utils/client/s3control/base.d.ts +56 -0
  160. package/dist/esm/providers/s3/utils/client/s3control/base.mjs +74 -0
  161. package/dist/esm/providers/s3/utils/client/s3control/base.mjs.map +1 -0
  162. package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.d.ts +26 -0
  163. package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.mjs +63 -0
  164. package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.mjs.map +1 -0
  165. package/dist/esm/providers/s3/utils/client/s3control/index.d.ts +2 -0
  166. package/dist/esm/providers/s3/utils/client/s3control/index.mjs +3 -0
  167. package/dist/esm/providers/s3/utils/client/s3control/index.mjs.map +1 -0
  168. package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.d.ts +26 -0
  169. package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.mjs +67 -0
  170. package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.mjs.map +1 -0
  171. package/dist/esm/providers/s3/utils/client/s3control/types.d.ts +188 -0
  172. package/dist/esm/providers/s3/utils/client/{abortMultipartUpload.d.ts → s3data/abortMultipartUpload.d.ts} +4 -4
  173. package/dist/esm/providers/s3/utils/client/{abortMultipartUpload.mjs → s3data/abortMultipartUpload.mjs} +5 -6
  174. package/dist/esm/providers/s3/utils/client/s3data/abortMultipartUpload.mjs.map +1 -0
  175. package/dist/esm/providers/s3/utils/client/{base.d.ts → s3data/base.d.ts} +23 -1
  176. package/dist/esm/providers/s3/utils/client/{base.mjs → s3data/base.mjs} +29 -6
  177. package/dist/esm/providers/s3/utils/client/s3data/base.mjs.map +1 -0
  178. package/dist/esm/providers/s3/utils/client/{completeMultipartUpload.d.ts → s3data/completeMultipartUpload.d.ts} +6 -6
  179. package/dist/esm/providers/s3/utils/client/{completeMultipartUpload.mjs → s3data/completeMultipartUpload.mjs} +19 -14
  180. package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs.map +1 -0
  181. package/dist/esm/providers/s3/utils/client/{copyObject.d.ts → s3data/copyObject.d.ts} +4 -4
  182. package/dist/esm/providers/s3/utils/client/{copyObject.mjs → s3data/copyObject.mjs} +6 -6
  183. package/dist/esm/providers/s3/utils/client/s3data/copyObject.mjs.map +1 -0
  184. package/dist/esm/providers/s3/utils/client/{createMultipartUpload.d.ts → s3data/createMultipartUpload.d.ts} +4 -4
  185. package/dist/esm/providers/s3/utils/client/{createMultipartUpload.mjs → s3data/createMultipartUpload.mjs} +12 -7
  186. package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.mjs.map +1 -0
  187. package/dist/esm/providers/s3/utils/client/{deleteObject.d.ts → s3data/deleteObject.d.ts} +4 -4
  188. package/dist/esm/providers/s3/utils/client/{deleteObject.mjs → s3data/deleteObject.mjs} +5 -6
  189. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs.map +1 -0
  190. package/dist/esm/providers/s3/utils/client/{getObject.d.ts → s3data/getObject.d.ts} +4 -4
  191. package/dist/esm/providers/s3/utils/client/{getObject.mjs → s3data/getObject.mjs} +7 -8
  192. package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs.map +1 -0
  193. package/dist/esm/providers/s3/utils/client/{headObject.d.ts → s3data/headObject.d.ts} +4 -4
  194. package/dist/esm/providers/s3/utils/client/{headObject.mjs → s3data/headObject.mjs} +5 -6
  195. package/dist/esm/providers/s3/utils/client/s3data/headObject.mjs.map +1 -0
  196. package/dist/esm/providers/s3/utils/client/{listObjectsV2.d.ts → s3data/listObjectsV2.d.ts} +4 -4
  197. package/dist/esm/providers/s3/utils/client/{listObjectsV2.mjs → s3data/listObjectsV2.mjs} +6 -6
  198. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs.map +1 -0
  199. package/dist/esm/providers/s3/utils/client/{listParts.d.ts → s3data/listParts.d.ts} +4 -4
  200. package/dist/esm/providers/s3/utils/client/{listParts.mjs → s3data/listParts.mjs} +7 -6
  201. package/dist/esm/providers/s3/utils/client/s3data/listParts.mjs.map +1 -0
  202. package/dist/esm/providers/s3/utils/client/{putObject.d.ts → s3data/putObject.d.ts} +5 -5
  203. package/dist/esm/providers/s3/utils/client/{putObject.mjs → s3data/putObject.mjs} +6 -6
  204. package/dist/esm/providers/s3/utils/client/s3data/putObject.mjs.map +1 -0
  205. package/dist/esm/providers/s3/utils/client/s3data/types.mjs +2 -0
  206. package/dist/esm/providers/s3/utils/client/s3data/types.mjs.map +1 -0
  207. package/dist/esm/providers/s3/utils/client/{uploadPart.d.ts → s3data/uploadPart.d.ts} +5 -5
  208. package/dist/esm/providers/s3/utils/client/{uploadPart.mjs → s3data/uploadPart.mjs} +7 -7
  209. package/dist/esm/providers/s3/utils/client/s3data/uploadPart.mjs.map +1 -0
  210. package/dist/esm/providers/s3/utils/client/utils/createRetryDecider.d.ts +22 -0
  211. package/dist/esm/providers/s3/utils/client/utils/createRetryDecider.mjs +55 -0
  212. package/dist/esm/providers/s3/utils/client/utils/createRetryDecider.mjs.map +1 -0
  213. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.d.ts +17 -0
  214. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs +33 -1
  215. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs.map +1 -1
  216. package/dist/esm/providers/s3/utils/client/utils/index.d.ts +2 -1
  217. package/dist/esm/providers/s3/utils/client/utils/index.mjs +2 -1
  218. package/dist/esm/providers/s3/utils/client/utils/index.mjs.map +1 -1
  219. package/dist/esm/providers/s3/utils/client/utils/parsePayload.d.ts +16 -1
  220. package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs +19 -5
  221. package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs.map +1 -1
  222. package/dist/esm/providers/s3/utils/crc32.d.ts +6 -0
  223. package/dist/esm/providers/s3/utils/crc32.mjs +34 -0
  224. package/dist/esm/providers/s3/utils/crc32.mjs.map +1 -0
  225. package/dist/esm/providers/s3/utils/crc32.native.d.ts +2 -0
  226. package/dist/esm/providers/s3/utils/crc32.native.mjs +8 -0
  227. package/dist/esm/providers/s3/utils/crc32.native.mjs.map +1 -0
  228. package/dist/esm/providers/s3/utils/md5.mjs +2 -12
  229. package/dist/esm/providers/s3/utils/md5.mjs.map +1 -1
  230. package/dist/esm/providers/s3/utils/md5.native.mjs +2 -12
  231. package/dist/esm/providers/s3/utils/md5.native.mjs.map +1 -1
  232. package/dist/esm/providers/s3/utils/resolveIdentityId.d.ts +1 -0
  233. package/dist/esm/providers/s3/utils/resolveIdentityId.mjs +12 -0
  234. package/dist/esm/providers/s3/utils/resolveIdentityId.mjs.map +1 -0
  235. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.d.ts +10 -2
  236. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs +57 -11
  237. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
  238. package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs +4 -1
  239. package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs.map +1 -1
  240. package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs +4 -1
  241. package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs.map +1 -1
  242. package/dist/esm/storageBrowser/apis/constants.d.ts +2 -0
  243. package/dist/esm/storageBrowser/apis/constants.mjs +7 -0
  244. package/dist/esm/storageBrowser/apis/constants.mjs.map +1 -0
  245. package/dist/esm/storageBrowser/apis/getDataAccess.d.ts +2 -0
  246. package/dist/esm/storageBrowser/apis/getDataAccess.mjs +57 -0
  247. package/dist/esm/storageBrowser/apis/getDataAccess.mjs.map +1 -0
  248. package/dist/esm/storageBrowser/apis/listCallerAccessGrants.d.ts +2 -0
  249. package/dist/esm/storageBrowser/apis/listCallerAccessGrants.mjs +69 -0
  250. package/dist/esm/storageBrowser/apis/listCallerAccessGrants.mjs.map +1 -0
  251. package/dist/esm/storageBrowser/apis/types.d.ts +18 -0
  252. package/dist/esm/storageBrowser/apis/types.mjs +2 -0
  253. package/dist/esm/storageBrowser/apis/types.mjs.map +1 -0
  254. package/dist/esm/storageBrowser/index.d.ts +6 -0
  255. package/dist/esm/storageBrowser/index.mjs +3 -0
  256. package/dist/esm/storageBrowser/index.mjs.map +1 -0
  257. package/dist/esm/storageBrowser/locationCredentialsStore/constants.d.ts +2 -0
  258. package/dist/esm/storageBrowser/locationCredentialsStore/constants.mjs +7 -0
  259. package/dist/esm/storageBrowser/locationCredentialsStore/constants.mjs.map +1 -0
  260. package/dist/esm/storageBrowser/locationCredentialsStore/create.d.ts +2 -0
  261. package/dist/esm/storageBrowser/locationCredentialsStore/create.mjs +34 -0
  262. package/dist/esm/storageBrowser/locationCredentialsStore/create.mjs.map +1 -0
  263. package/dist/esm/storageBrowser/locationCredentialsStore/index.d.ts +1 -0
  264. package/dist/esm/storageBrowser/locationCredentialsStore/index.mjs +2 -0
  265. package/dist/esm/storageBrowser/locationCredentialsStore/index.mjs.map +1 -0
  266. package/dist/esm/storageBrowser/locationCredentialsStore/registry.d.ts +23 -0
  267. package/dist/esm/storageBrowser/locationCredentialsStore/registry.mjs +54 -0
  268. package/dist/esm/storageBrowser/locationCredentialsStore/registry.mjs.map +1 -0
  269. package/dist/esm/storageBrowser/locationCredentialsStore/store.d.ts +35 -0
  270. package/dist/esm/storageBrowser/locationCredentialsStore/store.mjs +95 -0
  271. package/dist/esm/storageBrowser/locationCredentialsStore/store.mjs.map +1 -0
  272. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.d.ts +8 -0
  273. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.mjs +13 -0
  274. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.mjs.map +1 -0
  275. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.d.ts +8 -0
  276. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.mjs +27 -0
  277. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.mjs.map +1 -0
  278. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.d.ts +19 -0
  279. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.mjs +30 -0
  280. package/dist/esm/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.mjs.map +1 -0
  281. package/dist/esm/storageBrowser/managedAuthConfigAdapter/index.d.ts +1 -0
  282. package/dist/esm/storageBrowser/managedAuthConfigAdapter/index.mjs +2 -0
  283. package/dist/esm/storageBrowser/managedAuthConfigAdapter/index.mjs.map +1 -0
  284. package/dist/esm/storageBrowser/types.d.ts +92 -0
  285. package/dist/esm/storageBrowser/types.mjs +2 -0
  286. package/dist/esm/storageBrowser/types.mjs.map +1 -0
  287. package/package.json +117 -107
  288. package/src/errors/constants.ts +4 -0
  289. package/src/errors/types/validation.ts +12 -0
  290. package/src/providers/s3/apis/downloadData.ts +2 -2
  291. package/src/providers/s3/apis/internal/copy.ts +42 -12
  292. package/src/providers/s3/apis/internal/getProperties.ts +2 -3
  293. package/src/providers/s3/apis/internal/getUrl.ts +2 -2
  294. package/src/providers/s3/apis/internal/list.ts +6 -6
  295. package/src/providers/s3/apis/internal/remove.ts +2 -3
  296. package/src/providers/s3/apis/uploadData/multipart/initialUpload.ts +30 -1
  297. package/src/providers/s3/apis/uploadData/multipart/uploadCache.ts +4 -1
  298. package/src/providers/s3/apis/uploadData/multipart/uploadHandlers.ts +38 -19
  299. package/src/providers/s3/apis/uploadData/multipart/uploadPartExecutor.ts +23 -7
  300. package/src/providers/s3/apis/uploadData/putObjectJob.ts +22 -5
  301. package/src/providers/s3/apis/uploadData/validateObjectNotExists.ts +25 -0
  302. package/src/providers/s3/types/index.ts +14 -17
  303. package/src/providers/s3/types/inputs.ts +35 -29
  304. package/src/providers/s3/types/options.ts +55 -21
  305. package/src/providers/s3/utils/client/s3control/base.ts +97 -0
  306. package/src/providers/s3/utils/client/s3control/getDataAccess.ts +96 -0
  307. package/src/providers/s3/utils/client/s3control/index.ts +13 -0
  308. package/src/providers/s3/utils/client/s3control/listCallerAccessGrants.ts +107 -0
  309. package/src/providers/s3/utils/client/s3control/types.ts +216 -0
  310. package/src/providers/s3/utils/client/{abortMultipartUpload.ts → s3data/abortMultipartUpload.ts} +4 -4
  311. package/src/providers/s3/utils/client/{base.ts → s3data/base.ts} +26 -3
  312. package/src/providers/s3/utils/client/{completeMultipartUpload.ts → s3data/completeMultipartUpload.ts} +28 -19
  313. package/src/providers/s3/utils/client/{copyObject.ts → s3data/copyObject.ts} +4 -4
  314. package/src/providers/s3/utils/client/{createMultipartUpload.ts → s3data/createMultipartUpload.ts} +15 -9
  315. package/src/providers/s3/utils/client/{deleteObject.ts → s3data/deleteObject.ts} +7 -7
  316. package/src/providers/s3/utils/client/{getObject.ts → s3data/getObject.ts} +13 -9
  317. package/src/providers/s3/utils/client/{headObject.ts → s3data/headObject.ts} +4 -4
  318. package/src/providers/s3/utils/client/{listObjectsV2.ts → s3data/listObjectsV2.ts} +7 -7
  319. package/src/providers/s3/utils/client/{listParts.ts → s3data/listParts.ts} +9 -8
  320. package/src/providers/s3/utils/client/{putObject.ts → s3data/putObject.ts} +6 -4
  321. package/src/providers/s3/utils/client/{uploadPart.ts → s3data/uploadPart.ts} +13 -6
  322. package/src/providers/s3/utils/client/utils/createRetryDecider.ts +96 -0
  323. package/src/providers/s3/utils/client/utils/deserializeHelpers.ts +41 -0
  324. package/src/providers/s3/utils/client/utils/index.ts +2 -1
  325. package/src/providers/s3/utils/client/utils/parsePayload.ts +36 -18
  326. package/src/providers/s3/utils/crc32.native.ts +11 -0
  327. package/src/providers/s3/utils/crc32.ts +51 -0
  328. package/src/providers/s3/utils/md5.native.ts +2 -10
  329. package/src/providers/s3/utils/md5.ts +2 -10
  330. package/src/providers/s3/utils/resolveIdentityId.ts +11 -0
  331. package/src/providers/s3/utils/resolveS3ConfigAndInput.ts +109 -14
  332. package/src/providers/s3/utils/validateStorageOperationInput.ts +5 -1
  333. package/src/providers/s3/utils/validateStorageOperationInputWithPrefix.ts +5 -1
  334. package/src/storageBrowser/apis/constants.ts +5 -0
  335. package/src/storageBrowser/apis/getDataAccess.ts +79 -0
  336. package/src/storageBrowser/apis/listCallerAccessGrants.ts +94 -0
  337. package/src/storageBrowser/apis/types.ts +33 -0
  338. package/src/storageBrowser/index.ts +25 -0
  339. package/src/storageBrowser/locationCredentialsStore/constants.ts +5 -0
  340. package/src/storageBrowser/locationCredentialsStore/create.ts +54 -0
  341. package/src/storageBrowser/locationCredentialsStore/index.ts +4 -0
  342. package/src/storageBrowser/locationCredentialsStore/registry.ts +88 -0
  343. package/src/storageBrowser/locationCredentialsStore/store.ts +161 -0
  344. package/src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.ts +21 -0
  345. package/src/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.ts +40 -0
  346. package/src/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts +53 -0
  347. package/src/storageBrowser/managedAuthConfigAdapter/index.ts +8 -0
  348. package/src/storageBrowser/types.ts +117 -0
  349. package/dist/cjs/providers/s3/types/errors.js +0 -12
  350. package/dist/cjs/providers/s3/types/errors.js.map +0 -1
  351. package/dist/cjs/providers/s3/utils/client/abortMultipartUpload.js.map +0 -1
  352. package/dist/cjs/providers/s3/utils/client/base.js.map +0 -1
  353. package/dist/cjs/providers/s3/utils/client/completeMultipartUpload.js.map +0 -1
  354. package/dist/cjs/providers/s3/utils/client/copyObject.js.map +0 -1
  355. package/dist/cjs/providers/s3/utils/client/createMultipartUpload.js.map +0 -1
  356. package/dist/cjs/providers/s3/utils/client/deleteObject.js.map +0 -1
  357. package/dist/cjs/providers/s3/utils/client/getObject.js.map +0 -1
  358. package/dist/cjs/providers/s3/utils/client/headObject.js.map +0 -1
  359. package/dist/cjs/providers/s3/utils/client/index.js.map +0 -1
  360. package/dist/cjs/providers/s3/utils/client/listObjectsV2.js.map +0 -1
  361. package/dist/cjs/providers/s3/utils/client/listParts.js.map +0 -1
  362. package/dist/cjs/providers/s3/utils/client/putObject.js.map +0 -1
  363. package/dist/cjs/providers/s3/utils/client/types.js.map +0 -1
  364. package/dist/cjs/providers/s3/utils/client/uploadPart.js.map +0 -1
  365. package/dist/esm/providers/s3/types/errors.d.ts +0 -5
  366. package/dist/esm/providers/s3/types/errors.mjs +0 -11
  367. package/dist/esm/providers/s3/types/errors.mjs.map +0 -1
  368. package/dist/esm/providers/s3/utils/client/abortMultipartUpload.mjs.map +0 -1
  369. package/dist/esm/providers/s3/utils/client/base.mjs.map +0 -1
  370. package/dist/esm/providers/s3/utils/client/completeMultipartUpload.mjs.map +0 -1
  371. package/dist/esm/providers/s3/utils/client/copyObject.mjs.map +0 -1
  372. package/dist/esm/providers/s3/utils/client/createMultipartUpload.mjs.map +0 -1
  373. package/dist/esm/providers/s3/utils/client/deleteObject.mjs.map +0 -1
  374. package/dist/esm/providers/s3/utils/client/getObject.mjs.map +0 -1
  375. package/dist/esm/providers/s3/utils/client/headObject.mjs.map +0 -1
  376. package/dist/esm/providers/s3/utils/client/listObjectsV2.mjs.map +0 -1
  377. package/dist/esm/providers/s3/utils/client/listParts.mjs.map +0 -1
  378. package/dist/esm/providers/s3/utils/client/putObject.mjs.map +0 -1
  379. package/dist/esm/providers/s3/utils/client/uploadPart.mjs.map +0 -1
  380. package/src/providers/s3/types/errors.ts +0 -8
  381. /package/dist/cjs/providers/s3/utils/client/{types.js → s3control/types.js} +0 -0
  382. /package/dist/cjs/providers/s3/utils/client/{index.js → s3data/index.js} +0 -0
  383. /package/dist/esm/providers/s3/utils/client/{types.mjs → s3control/types.mjs} +0 -0
  384. /package/dist/esm/providers/s3/utils/client/{types.mjs.map → s3control/types.mjs.map} +0 -0
  385. /package/dist/esm/providers/s3/utils/client/{index.d.ts → s3data/index.d.ts} +0 -0
  386. /package/dist/esm/providers/s3/utils/client/{index.mjs → s3data/index.mjs} +0 -0
  387. /package/dist/esm/providers/s3/utils/client/{index.mjs.map → s3data/index.mjs.map} +0 -0
  388. /package/dist/esm/providers/s3/utils/client/{types.d.ts → s3data/types.d.ts} +0 -0
  389. /package/src/providers/s3/utils/client/{index.ts → s3data/index.ts} +0 -0
  390. /package/src/providers/s3/utils/client/{types.ts → s3data/types.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.INVALID_STORAGE_INPUT = void 0;
7
+ exports.INVALID_STORAGE_INPUT = 'InvalidStorageInput';
8
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../src/errors/constants.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.INVALID_STORAGE_INPUT = void 0;\nexports.INVALID_STORAGE_INPUT = 'InvalidStorageInput';\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC,CAAC;AACvC,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
@@ -23,6 +23,9 @@ var StorageValidationErrorCode;
23
23
  StorageValidationErrorCode["InvalidUploadSource"] = "InvalidUploadSource";
24
24
  StorageValidationErrorCode["ObjectIsTooLarge"] = "ObjectIsTooLarge";
25
25
  StorageValidationErrorCode["UrlExpirationMaxLimitExceed"] = "UrlExpirationMaxLimitExceed";
26
+ StorageValidationErrorCode["InvalidLocationCredentialsCacheSize"] = "InvalidLocationCredentialsCacheSize";
27
+ StorageValidationErrorCode["LocationCredentialsStoreDestroyed"] = "LocationCredentialsStoreDestroyed";
28
+ StorageValidationErrorCode["InvalidS3Uri"] = "InvalidS3Uri";
26
29
  })(StorageValidationErrorCode = exports.StorageValidationErrorCode || (exports.StorageValidationErrorCode = {}));
27
30
  exports.validationErrorMap = {
28
31
  [StorageValidationErrorCode.NoCredentials]: {
@@ -70,6 +73,15 @@ exports.validationErrorMap = {
70
73
  [StorageValidationErrorCode.InvalidStoragePathInput]: {
71
74
  message: 'Input `path` does not allow a leading slash (/).',
72
75
  },
76
+ [StorageValidationErrorCode.InvalidLocationCredentialsCacheSize]: {
77
+ message: 'locationCredentialsCacheSize must be a positive integer.',
78
+ },
79
+ [StorageValidationErrorCode.LocationCredentialsStoreDestroyed]: {
80
+ message: `Location-specific credentials store has been destroyed.`,
81
+ },
82
+ [StorageValidationErrorCode.InvalidS3Uri]: {
83
+ message: 'Invalid S3 URI.',
84
+ },
73
85
  [StorageValidationErrorCode.InvalidStorageBucket]: {
74
86
  message: 'Unable to lookup bucket from provided name in Amplify configuration.',
75
87
  },
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sources":["../../../../src/errors/types/validation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validationErrorMap = exports.StorageValidationErrorCode = void 0;\nvar StorageValidationErrorCode;\n(function (StorageValidationErrorCode) {\n StorageValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n StorageValidationErrorCode[\"NoIdentityId\"] = \"NoIdentityId\";\n StorageValidationErrorCode[\"NoKey\"] = \"NoKey\";\n StorageValidationErrorCode[\"NoSourceKey\"] = \"NoSourceKey\";\n StorageValidationErrorCode[\"NoDestinationKey\"] = \"NoDestinationKey\";\n StorageValidationErrorCode[\"NoSourcePath\"] = \"NoSourcePath\";\n StorageValidationErrorCode[\"NoDestinationPath\"] = \"NoDestinationPath\";\n StorageValidationErrorCode[\"NoBucket\"] = \"NoBucket\";\n StorageValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n StorageValidationErrorCode[\"InvalidStorageBucket\"] = \"InvalidStorageBucket\";\n StorageValidationErrorCode[\"InvalidCopyOperationStorageBucket\"] = \"InvalidCopyOperationStorageBucket\";\n StorageValidationErrorCode[\"InvalidStorageOperationPrefixInput\"] = \"InvalidStorageOperationPrefixInput\";\n StorageValidationErrorCode[\"InvalidStorageOperationInput\"] = \"InvalidStorageOperationInput\";\n StorageValidationErrorCode[\"InvalidStoragePathInput\"] = \"InvalidStoragePathInput\";\n StorageValidationErrorCode[\"InvalidUploadSource\"] = \"InvalidUploadSource\";\n StorageValidationErrorCode[\"ObjectIsTooLarge\"] = \"ObjectIsTooLarge\";\n StorageValidationErrorCode[\"UrlExpirationMaxLimitExceed\"] = \"UrlExpirationMaxLimitExceed\";\n})(StorageValidationErrorCode = exports.StorageValidationErrorCode || (exports.StorageValidationErrorCode = {}));\nexports.validationErrorMap = {\n [StorageValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [StorageValidationErrorCode.NoIdentityId]: {\n message: 'Missing identity ID when accessing objects in protected or private access level.',\n },\n [StorageValidationErrorCode.NoKey]: {\n message: 'Missing key in api call.',\n },\n [StorageValidationErrorCode.NoSourceKey]: {\n message: 'Missing source key in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationKey]: {\n message: 'Missing destination key in copy api call.',\n },\n [StorageValidationErrorCode.NoSourcePath]: {\n message: 'Missing source path in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationPath]: {\n message: 'Missing destination path in copy api call.',\n },\n [StorageValidationErrorCode.NoBucket]: {\n message: 'Missing bucket name while accessing object.',\n },\n [StorageValidationErrorCode.NoRegion]: {\n message: 'Missing region while accessing object.',\n },\n [StorageValidationErrorCode.UrlExpirationMaxLimitExceed]: {\n message: 'Url Expiration can not be greater than 7 Days.',\n },\n [StorageValidationErrorCode.ObjectIsTooLarge]: {\n message: 'Object size cannot not be greater than 5TB.',\n },\n [StorageValidationErrorCode.InvalidUploadSource]: {\n message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationInput]: {\n message: 'Path or key parameter must be specified in the input. Both can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationPrefixInput]: {\n message: 'Both path and prefix can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStoragePathInput]: {\n message: 'Input `path` does not allow a leading slash (/).',\n },\n [StorageValidationErrorCode.InvalidStorageBucket]: {\n message: 'Unable to lookup bucket from provided name in Amplify configuration.',\n },\n [StorageValidationErrorCode.InvalidCopyOperationStorageBucket]: {\n message: 'Missing bucket option in either source or destination.',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,GAAG,KAAK,CAAC,CAAC;AACzE,IAAI,0BAA0B,CAAC;AAC/B,CAAC,UAAU,0BAA0B,EAAE;AACvC,IAAI,0BAA0B,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAClE,IAAI,0BAA0B,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAChE,IAAI,0BAA0B,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAClD,IAAI,0B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A0B,CAAC,iCAAiC,GAAG;AACpE,QAAQ,OAAO,EAAE,wDAAwD;AACzE,KAAK;AACL,CAAC;;"}
1
+ {"version":3,"file":"validation.js","sources":["../../../../src/errors/types/validation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validationErrorMap = exports.StorageValidationErrorCode = void 0;\nvar StorageValidationErrorCode;\n(function (StorageValidationErrorCode) {\n StorageValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n StorageValidationErrorCode[\"NoIdentityId\"] = \"NoIdentityId\";\n StorageValidationErrorCode[\"NoKey\"] = \"NoKey\";\n StorageValidationErrorCode[\"NoSourceKey\"] = \"NoSourceKey\";\n StorageValidationErrorCode[\"NoDestinationKey\"] = \"NoDestinationKey\";\n StorageValidationErrorCode[\"NoSourcePath\"] = \"NoSourcePath\";\n StorageValidationErrorCode[\"NoDestinationPath\"] = \"NoDestinationPath\";\n StorageValidationErrorCode[\"NoBucket\"] = \"NoBucket\";\n StorageValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n StorageValidationErrorCode[\"InvalidStorageBucket\"] = \"InvalidStorageBucket\";\n StorageValidationErrorCode[\"InvalidCopyOperationStorageBucket\"] = \"InvalidCopyOperationStorageBucket\";\n StorageValidationErrorCode[\"InvalidStorageOperationPrefixInput\"] = \"InvalidStorageOperationPrefixInput\";\n StorageValidationErrorCode[\"InvalidStorageOperationInput\"] = \"InvalidStorageOperationInput\";\n StorageValidationErrorCode[\"InvalidStoragePathInput\"] = \"InvalidStoragePathInput\";\n StorageValidationErrorCode[\"InvalidUploadSource\"] = \"InvalidUploadSource\";\n StorageValidationErrorCode[\"ObjectIsTooLarge\"] = \"ObjectIsTooLarge\";\n StorageValidationErrorCode[\"UrlExpirationMaxLimitExceed\"] = \"UrlExpirationMaxLimitExceed\";\n StorageValidationErrorCode[\"InvalidLocationCredentialsCacheSize\"] = \"InvalidLocationCredentialsCacheSize\";\n StorageValidationErrorCode[\"LocationCredentialsStoreDestroyed\"] = \"LocationCredentialsStoreDestroyed\";\n StorageValidationErrorCode[\"InvalidS3Uri\"] = \"InvalidS3Uri\";\n})(StorageValidationErrorCode = exports.StorageValidationErrorCode || (exports.StorageValidationErrorCode = {}));\nexports.validationErrorMap = {\n [StorageValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [StorageValidationErrorCode.NoIdentityId]: {\n message: 'Missing identity ID when accessing objects in protected or private access level.',\n },\n [StorageValidationErrorCode.NoKey]: {\n message: 'Missing key in api call.',\n },\n [StorageValidationErrorCode.NoSourceKey]: {\n message: 'Missing source key in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationKey]: {\n message: 'Missing destination key in copy api call.',\n },\n [StorageValidationErrorCode.NoSourcePath]: {\n message: 'Missing source path in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationPath]: {\n message: 'Missing destination path in copy api call.',\n },\n [StorageValidationErrorCode.NoBucket]: {\n message: 'Missing bucket name while accessing object.',\n },\n [StorageValidationErrorCode.NoRegion]: {\n message: 'Missing region while accessing object.',\n },\n [StorageValidationErrorCode.UrlExpirationMaxLimitExceed]: {\n message: 'Url Expiration can not be greater than 7 Days.',\n },\n [StorageValidationErrorCode.ObjectIsTooLarge]: {\n message: 'Object size cannot not be greater than 5TB.',\n },\n [StorageValidationErrorCode.InvalidUploadSource]: {\n message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationInput]: {\n message: 'Path or key parameter must be specified in the input. Both can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationPrefixInput]: {\n message: 'Both path and prefix can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStoragePathInput]: {\n message: 'Input `path` does not allow a leading slash (/).',\n },\n [StorageValidationErrorCode.InvalidLocationCredentialsCacheSize]: {\n message: 'locationCredentialsCacheSize must be a positive integer.',\n },\n [StorageValidationErrorCode.LocationCredentialsStoreDestroyed]: {\n message: `Location-specific credentials store has been destroyed.`,\n },\n [StorageValidationErrorCode.InvalidS3Uri]: {\n message: 'Invalid S3 URI.',\n },\n [StorageValidationErrorCode.InvalidStorageBucket]: {\n message: 'Unable to lookup bucket from provided name in Amplify configuration.',\n },\n [StorageValidationErrorCode.InvalidCopyOperationStorageBucket]: {\n message: 'Missing bucket option in either source or destination.',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,GAAG,KAAK,CAAC,CAAC;AACzE,IAAI,0BAA0B,CAAC;AAC/B,CAAC,UAAU,0BAA0B,EAAE;AACvC,IAAI,0BAA0B,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAClE,IAAI,0BAA0B,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAChE,IAAI,0BAA0B,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAClD,IAAI,0BAA0B,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;AAC9D,IAAI,0BAA0B,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACxE,IAAI,0BAA0B,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAChE,IAAI,0BAA0B,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAC1E,IAAI,0BAA0B,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACxD,IAAI,0BAA0B,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACxD,IAAI,0BAA0B,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AAChF,IAAI,0BAA0B,CAAC,mCAAmC,CAAC,GAAG,mCAAmC,CAAC;AAC1G,IAAI,0B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AAC,iCAAiC,GAAG;AACpE,QAAQ,OAAO,EAAE,wDAAwD;AACzE,KAAK;AACL,CAAC;;"}
@@ -8,7 +8,7 @@ const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const resolveS3ConfigAndInput_1 = require("../utils/resolveS3ConfigAndInput");
10
10
  const utils_2 = require("../utils");
11
- const client_1 = require("../utils/client");
11
+ const s3data_1 = require("../utils/client/s3data");
12
12
  const userAgent_1 = require("../utils/userAgent");
13
13
  const utils_3 = require("../../../utils");
14
14
  const constants_1 = require("../utils/constants");
@@ -25,11 +25,11 @@ function downloadData(input) {
25
25
  exports.downloadData = downloadData;
26
26
  const downloadDataJob = (downloadDataInput, abortSignal) => async () => {
27
27
  const { options: downloadDataOptions } = downloadDataInput;
28
- const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataOptions);
28
+ const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataInput);
29
29
  const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);
30
30
  const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
31
31
  utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);
32
- const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, client_1.getObject)({
32
+ const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, s3data_1.getObject)({
33
33
  ...s3Config,
34
34
  abortSignal,
35
35
  onDownloadProgress: downloadDataOptions?.onProgress,
@@ -1 +1 @@
1
- {"version":3,"file":"downloadData.js","sources":["../../../../../src/providers/s3/apis/downloadData.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.downloadData = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst resolveS3ConfigAndInput_1 = require(\"../utils/resolveS3ConfigAndInput\");\nconst utils_2 = require(\"../utils\");\nconst client_1 = require(\"../utils/client\");\nconst userAgent_1 = require(\"../utils/userAgent\");\nconst utils_3 = require(\"../../../utils\");\nconst constants_1 = require(\"../utils/constants\");\nfunction downloadData(input) {\n const abortController = new AbortController();\n const downloadTask = (0, utils_2.createDownloadTask)({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n}\nexports.downloadData = downloadData;\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataOptions);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, client_1.getObject)({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === constants_1.STORAGE_INPU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AAC,CAAC;AACxG,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI;AACZ,QAAQ,YAAY;AACpB,QAAQ,IAAI;AACZ,QAAQ,WAAW;AACnB,QAAQ,IAAI;AACZ,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC,iBAAiB;AACtD,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACvC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;;"}
1
+ {"version":3,"file":"downloadData.js","sources":["../../../../../src/providers/s3/apis/downloadData.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.downloadData = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst resolveS3ConfigAndInput_1 = require(\"../utils/resolveS3ConfigAndInput\");\nconst utils_2 = require(\"../utils\");\nconst s3data_1 = require(\"../utils/client/s3data\");\nconst userAgent_1 = require(\"../utils/userAgent\");\nconst utils_3 = require(\"../../../utils\");\nconst constants_1 = require(\"../utils/constants\");\nfunction downloadData(input) {\n const abortController = new AbortController();\n const downloadTask = (0, utils_2.createDownloadTask)({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n}\nexports.downloadData = downloadData;\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataInput);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, s3data_1.getObject)({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,yBAAyB,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACnD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClD,SAAS,YAAY,CA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,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,GAAG,GAAG,MAAM,IAAI,QAAQ,CAAC,SAAS,EAAE;AAC3L,QAAQ,GAAG,QAAQ;AACnB,QAAQ,WAAW;AACnB,QAAQ,kBAAkB,EAAE,mBAAmB,EAAE,UAAU;AAC3D,QAAQ,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC;AACrG,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,GAAG,EAAE,QAAQ;AACrB,QAAQ,IAAI,mBAAmB,EAAE,UAAU,IAAI;AAC/C,YAAY,KAAK,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACxG,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI;AACZ,QAAQ,YAAY;AACpB,QAAQ,IAAI;AACZ,QAAQ,WAAW;AACnB,QAAQ,IAAI;AACZ,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC,iBAAiB;AACtD,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACvC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;;"}
@@ -8,7 +8,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const utils_2 = require("../../utils");
9
9
  const validation_1 = require("../../../../errors/types/validation");
10
10
  const assertValidationError_1 = require("../../../../errors/utils/assertValidationError");
11
- const client_1 = require("../../utils/client");
11
+ const s3data_1 = require("../../utils/client/s3data");
12
12
  const userAgent_1 = require("../../utils/userAgent");
13
13
  const utils_3 = require("../../../../utils");
14
14
  const isCopyInputWithPath = (input) => (0, utils_2.isInputWithPath)(input.source);
@@ -31,8 +31,22 @@ exports.copy = copy;
31
31
  const copyWithPath = async (amplify, input) => {
32
32
  const { source, destination } = input;
33
33
  storageBucketAssertion(source.bucket, destination.bucket);
34
- const { bucket: sourceBucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.source);
35
- const { s3Config, bucket: destBucket } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.destination); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.
34
+ const { bucket: sourceBucket } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {
35
+ path: input.source.path,
36
+ options: {
37
+ locationCredentialsProvider: input.options?.locationCredentialsProvider,
38
+ ...input.source,
39
+ },
40
+ });
41
+ // The bucket, region, credentials of s3 client are resolved from destination.
42
+ // Whereas the source bucket and path are a input parameter of S3 copy operation.
43
+ const { s3Config, bucket: destBucket, identityId, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {
44
+ path: input.destination.path,
45
+ options: {
46
+ locationCredentialsProvider: input.options?.locationCredentialsProvider,
47
+ ...input.destination,
48
+ },
49
+ }); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.
36
50
  (0, assertValidationError_1.assertValidationError)(!!source.path, validation_1.StorageValidationErrorCode.NoSourcePath);
37
51
  (0, assertValidationError_1.assertValidationError)(!!destination.path, validation_1.StorageValidationErrorCode.NoDestinationPath);
38
52
  const { objectKey: sourcePath } = (0, utils_2.validateStorageOperationInput)(source, identityId);
@@ -54,8 +68,26 @@ const copyWithKey = async (amplify, input) => {
54
68
  storageBucketAssertion(source.bucket, destination.bucket);
55
69
  (0, assertValidationError_1.assertValidationError)(!!source.key, validation_1.StorageValidationErrorCode.NoSourceKey);
56
70
  (0, assertValidationError_1.assertValidationError)(!!destination.key, validation_1.StorageValidationErrorCode.NoDestinationKey);
57
- const { bucket: sourceBucket, keyPrefix: sourceKeyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, source);
58
- const { s3Config, bucket: destBucket, keyPrefix: destinationKeyPrefix, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, destination); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.
71
+ const { bucket: sourceBucket, keyPrefix: sourceKeyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {
72
+ ...input,
73
+ options: {
74
+ // @ts-expect-error: 'options' does not exist on type 'CopyInput'. In case of JS users set the location
75
+ // credentials provider option, resolveS3ConfigAndInput will throw validation error.
76
+ locationCredentialsProvider: input.options?.locationCredentialsProvider,
77
+ ...input.source,
78
+ },
79
+ });
80
+ // The bucket, region, credentials of s3 client are resolved from destination.
81
+ // Whereas the source bucket and path are a input parameter of S3 copy operation.
82
+ const { s3Config, bucket: destBucket, keyPrefix: destinationKeyPrefix, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {
83
+ ...input,
84
+ options: {
85
+ // @ts-expect-error: 'options' does not exist on type 'CopyInput'. In case of JS users set the location
86
+ // credentials provider option, resolveS3ConfigAndInput will throw validation error.
87
+ locationCredentialsProvider: input.options?.locationCredentialsProvider,
88
+ ...input.destination,
89
+ },
90
+ }); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.
59
91
  // TODO(ashwinkumar6) V6-logger: warn `You may copy files from another user if the source level is "protected", currently it's ${srcLevel}`
60
92
  const finalCopySource = `${sourceBucket}/${sourceKeyPrefix}${source.key}`;
61
93
  const finalCopyDestination = `${destinationKeyPrefix}${destination.key}`;
@@ -72,7 +104,7 @@ const copyWithKey = async (amplify, input) => {
72
104
  };
73
105
  exports.copyWithKey = copyWithKey;
74
106
  const serviceCopy = async ({ source, destination, bucket, s3Config, }) => {
75
- await (0, client_1.copyObject)({
107
+ await (0, s3data_1.copyObject)({
76
108
  ...s3Config,
77
109
  userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Copy),
78
110
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"copy.js","sources":["../../../../../../src/providers/s3/apis/internal/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copyWithKey = exports.copy = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst isCopyInputWithPath = (input) => (0, utils_2.isInputWithPath)(input.source);\nconst storageBucketAssertion = (sourceBucket, destBucket) => {\n /** For multi-bucket, both source and destination bucket needs to be passed in\n * or both can be undefined and we fallback to singleton's default value\n */\n (0, assertValidationError_1.assertValidationError)(\n // Both src & dest bucket option is present is acceptable\n (sourceBucket !== undefined && destBucket !== undefined) ||\n // or both are undefined is also acceptable\n (!destBucket && !sourceBucket), validation_1.StorageValidationErrorCode.InvalidCopyOperationStorageBucket);\n};\nconst copy = async (amplify, input) => {\n return isCopyInputWithPath(input)\n ? copyWithPath(amplify, input)\n : (0, exports.copyWithKey)(amplify, input);\n};\nexports.copy = copy;\nconst copyWithPath = async (amplify, input) => {\n const { source, destination } = input;\n storageBucketAssertion(source.bucket, destination.bucket);\n const { bucket: sourceBucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.source);\n const { s3Config, bucket: destBucket } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input.destination); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.\n (0, assertValidationError_1.assertValidationError)(!!source.path, validation_1.StorageValidationErrorCode.NoSourcePath);\n (0, assertValidationError_1.assertValidationError)(!!destination.path, validation_1.StorageValidationErrorCode.NoDestinationPath);\n const { objectKey: sourcePath } = (0, utils_2.validateStorageOperationInput)(source, identityId);\n const { objectKey: destinationPath } = (0, utils_2.validateStorageOperationInput)(destination, identityId);\n const finalCopySource = `${sourceBucket}/${sourcePath}`;\n const finalCopyDestination = destinationPath;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await serviceCopy({\n source: finalCopySource,\n destination: finalCopyDestination,\n bucket: destBucket,\n s3Config,\n });\n return { path: finalCopyDestination };\n};\n/** @deprecated Use {@link copyWithPath} instead. */\nconst copyWithKey = async (amplify, input) => {\n const { source, destination } = input;\n storageBucketAssertion(source.bucket, destination.bucket);\n (0, assertValidationError_1.assertValidationError)(!!source.key, validation_1.StorageValidationErrorCode.NoSourceKey);\n (0, assertValidationError_1.assertValidationError)(!!destination.key, validation_1.StorageValidationErrorCode.NoDestinationKey);\n const { bucket: sourceBucket, keyPrefix: sourceKeyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, source);\n const { s3Config, bucket: destBucket, keyPrefix: destinationKeyPrefix, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, destination); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.\n // TODO(ashwinkumar6) V6-logger: warn `You may copy files from another user if the source level is \"protected\", currently it's ${srcLevel}`\n const finalCopySource = `${sourceBucket}/${sourceKeyPrefix}${source.key}`;\n const finalCopyDestination = `${destinationKeyPrefix}${destination.key}`;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await serviceCopy({\n source: finalCopySource,\n destination: finalCopyDestination,\n bucket: destBucket,\n s3Config,\n });\n return {\n key: destination.key,\n };\n};\nexports.copyWithKey = copyWithKey;\nconst serviceCopy = async ({ source, destination, bucket, s3Config, }) => {\n await (0, client_1.copyObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Copy),\n }, {\n Bucket: bucket,\n CopySource: source,\n Key: destination,\n MetadataDirective: 'COPY', // Copies over metadata like contentType as well\n });\n};\n"],"names":[],"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AAM,oBAAoB,GAAG,CAAC,EAAE,oBAAoB,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7E,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;AACvF,IAAI,MAAM,WAAW,CAAC;AACtB,QAAQ,MAAM,EAAE,eAAe;AAC/B,QAAQ,WAAW,EAAE,oBAAoB;AACzC,QAAQ,MAAM,EAAE,UAAU;AAC1B,QAAQ,QAAQ;AAChB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG;AAC5B,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAClC,MAAM,WAAW,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK;AAC1E,IAAI,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE;AACnC,QAAQ,GAAG,QAAQ;AACnB,QAAQ,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7F,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,UAAU,EAAE,MAAM;AAC1B,QAAQ,GAAG,EAAE,WAAW;AACxB,QAAQ,iBAAiB,EAAE,MAAM;AACjC,KAAK,CAAC,CAAC;AACP,CAAC;;"}
1
+ {"version":3,"file":"copy.js","sources":["../../../../../../src/providers/s3/apis/internal/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copyWithKey = exports.copy = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst isCopyInputWithPath = (input) => (0, utils_2.isInputWithPath)(input.source);\nconst storageBucketAssertion = (sourceBucket, destBucket) => {\n /** For multi-bucket, both source and destination bucket needs to be passed in\n * or both can be undefined and we fallback to singleton's default value\n */\n (0, assertValidationError_1.assertValidationError)(\n // Both src & dest bucket option is present is acceptable\n (sourceBucket !== undefined && destBucket !== undefined) ||\n // or both are undefined is also acceptable\n (!destBucket && !sourceBucket), validation_1.StorageValidationErrorCode.InvalidCopyOperationStorageBucket);\n};\nconst copy = async (amplify, input) => {\n return isCopyInputWithPath(input)\n ? copyWithPath(amplify, input)\n : (0, exports.copyWithKey)(amplify, input);\n};\nexports.copy = copy;\nconst copyWithPath = async (amplify, input) => {\n const { source, destination } = input;\n storageBucketAssertion(source.bucket, destination.bucket);\n const { bucket: sourceBucket } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {\n path: input.source.path,\n options: {\n locationCredentialsProvider: input.options?.locationCredentialsProvider,\n ...input.source,\n },\n });\n // The bucket, region, credentials of s3 client are resolved from destination.\n // Whereas the source bucket and path are a input parameter of S3 copy operation.\n const { s3Config, bucket: destBucket, identityId, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {\n path: input.destination.path,\n options: {\n locationCredentialsProvider: input.options?.locationCredentialsProvider,\n ...input.destination,\n },\n }); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.\n (0, assertValidationError_1.assertValidationError)(!!source.path, validation_1.StorageValidationErrorCode.NoSourcePath);\n (0, assertValidationError_1.assertValidationError)(!!destination.path, validation_1.StorageValidationErrorCode.NoDestinationPath);\n const { objectKey: sourcePath } = (0, utils_2.validateStorageOperationInput)(source, identityId);\n const { objectKey: destinationPath } = (0, utils_2.validateStorageOperationInput)(destination, identityId);\n const finalCopySource = `${sourceBucket}/${sourcePath}`;\n const finalCopyDestination = destinationPath;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await serviceCopy({\n source: finalCopySource,\n destination: finalCopyDestination,\n bucket: destBucket,\n s3Config,\n });\n return { path: finalCopyDestination };\n};\n/** @deprecated Use {@link copyWithPath} instead. */\nconst copyWithKey = async (amplify, input) => {\n const { source, destination } = input;\n storageBucketAssertion(source.bucket, destination.bucket);\n (0, assertValidationError_1.assertValidationError)(!!source.key, validation_1.StorageValidationErrorCode.NoSourceKey);\n (0, assertValidationError_1.assertValidationError)(!!destination.key, validation_1.StorageValidationErrorCode.NoDestinationKey);\n const { bucket: sourceBucket, keyPrefix: sourceKeyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {\n ...input,\n options: {\n // @ts-expect-error: 'options' does not exist on type 'CopyInput'. In case of JS users set the location\n // credentials provider option, resolveS3ConfigAndInput will throw validation error.\n locationCredentialsProvider: input.options?.locationCredentialsProvider,\n ...input.source,\n },\n });\n // The bucket, region, credentials of s3 client are resolved from destination.\n // Whereas the source bucket and path are a input parameter of S3 copy operation.\n const { s3Config, bucket: destBucket, keyPrefix: destinationKeyPrefix, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, {\n ...input,\n options: {\n // @ts-expect-error: 'options' does not exist on type 'CopyInput'. In case of JS users set the location\n // credentials provider option, resolveS3ConfigAndInput will throw validation error.\n locationCredentialsProvider: input.options?.locationCredentialsProvider,\n ...input.destination,\n },\n }); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.\n // TODO(ashwinkumar6) V6-logger: warn `You may copy files from another user if the source level is \"protected\", currently it's ${srcLevel}`\n const finalCopySource = `${sourceBucket}/${sourceKeyPrefix}${source.key}`;\n const finalCopyDestination = `${destinationKeyPrefix}${destination.key}`;\n utils_3.logger.debug(`copying \"${finalCopySource}\" to \"${finalCopyDestination}\".`);\n await serviceCopy({\n source: finalCopySource,\n destination: finalCopyDestination,\n bucket: destBucket,\n s3Config,\n });\n return {\n key: destination.key,\n };\n};\nexports.copyWithKey = copyWithKey;\nconst serviceCopy = async ({ source, destination, bucket, s3Config, }) => {\n await (0, s3data_1.copyObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Copy),\n }, {\n Bucket: bucket,\n CopySource: source,\n Key: destination,\n MetadataDirective: 'COPY', // Copies over metadata like contentType as well\n });\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,YAAY,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpE,MAAM,uBAAuB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAC1F,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,mBAAmB,GAAG,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAClF,MAAM,sBAAsB,GAAG,CAAC,YAAY,EAAE,UAAU,KAAK;AAC7D;AACA;AACA;AACA,IAAI,IAAI,uBAAuB,CAAC,qBAAqB;AACrD;AACA,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS;AAC3D;AACA,SAAS,CAA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M,EAAE,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;AACvF,IAAI,MAAM,WAAW,CAAC;AACtB,QAAQ,MAAM,EAAE,eAAe;AAC/B,QAAQ,WAAW,EAAE,oBAAoB;AACzC,QAAQ,MAAM,EAAE,UAAU;AAC1B,QAAQ,QAAQ;AAChB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG;AAC5B,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAClC,MAAM,WAAW,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK;AAC1E,IAAI,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE;AACnC,QAAQ,GAAG,QAAQ;AACnB,QAAQ,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7F,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,UAAU,EAAE,MAAM;AAC1B,QAAQ,GAAG,EAAE,WAAW;AACxB,QAAQ,iBAAiB,EAAE,MAAM;AACjC,KAAK,CAAC,CAAC;AACP,CAAC;;"}
@@ -6,17 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getProperties = void 0;
7
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const utils_2 = require("../../utils");
9
- const client_1 = require("../../utils/client");
9
+ const s3data_1 = require("../../utils/client/s3data");
10
10
  const userAgent_1 = require("../../utils/userAgent");
11
11
  const utils_3 = require("../../../../utils");
12
12
  const constants_1 = require("../../utils/constants");
13
13
  const getProperties = async (amplify, input, action) => {
14
- const { options: getPropertiesOptions } = input;
15
- const { s3Config, bucket, keyPrefix, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getPropertiesOptions);
14
+ const { s3Config, bucket, keyPrefix, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);
16
15
  const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);
17
16
  const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
18
17
  utils_3.logger.debug(`get properties of ${objectKey} from ${finalKey}`);
19
- const response = await (0, client_1.headObject)({
18
+ const response = await (0, s3data_1.headObject)({
20
19
  ...s3Config,
21
20
  userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(action ?? utils_1.StorageAction.GetProperties),
22
21
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"getProperties.js","sources":["../../../../../../src/providers/s3/apis/internal/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst getProperties = async (amplify, input, action) => {\n const { options: getPropertiesOptions } = input;\n const { s3Config, bucket, keyPrefix, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getPropertiesOptions);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`get properties of ${objectKey} from ${finalKey}`);\n const response = await (0, client_1.headObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(action ?? utils_1.StorageAction.GetProperties),\n }, {\n Bucket: bucket,\n Key: finalKey,\n });\n const result = {\n contentType: response.ContentType,\n size: response.ContentLength,\n eTag: response.ETag,\n lastModified: response.LastModified,\n metadata: response.Metadata,\n versionId: response.VersionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\nexports.getProperties = getProperties;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,OAAO,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK;AACxD,IAAI,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;AACpD,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,OAAO,CAAC,uBAAuB,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAClI,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,CAAC,6BAA6B,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AACnG,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,WAAW,CAAC,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AACrG,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5E,IAAI,MAAM,QAAQ,GAAG,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE;AACpD,QAAQ,GAAG,QAAQ;AACnB,QAAQ,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC;AAChH,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,GAAG,EAAE,QAAQ;AACrB,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,WAAW,EAAE,QAAQ,CAAC,WAAW;AACzC,QAAQ,IAAI,EAAE,QAAQ,CAAC,aAAa;AACpC,QAAQ,IAAI,EAAE,QAAQ,CAAC,IAAI;AAC3B,QAAQ,YAAY,EAAE,QAAQ,CAAC,YAAY;AAC3C,QAAQ,QAAQ,EAAE,QAAQ,CAAC,QAAQ;AACnC,QAAQ,SAAS,EAAE,QAAQ,CAAC,SAAS;AACrC,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC,iBAAiB;AACtD,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACvC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"getProperties.js","sources":["../../../../../../src/providers/s3/apis/internal/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst getProperties = async (amplify, input, action) => {\n const { s3Config, bucket, keyPrefix, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`get properties of ${objectKey} from ${finalKey}`);\n const response = await (0, s3data_1.headObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(action ?? utils_1.StorageAction.GetProperties),\n }, {\n Bucket: bucket,\n Key: finalKey,\n });\n const result = {\n contentType: response.ContentType,\n size: response.ContentLength,\n eTag: response.ETag,\n lastModified: response.LastModified,\n metadata: response.Metadata,\n versionId: response.VersionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\nexports.getProperties = getProperties;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,OAAO,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK;AACxD,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,E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,MAAM,EAAE,CAAC;AACzC,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getUrl = void 0;
7
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const validation_1 = require("../../../../errors/types/validation");
9
- const client_1 = require("../../utils/client");
9
+ const s3data_1 = require("../../utils/client/s3data");
10
10
  const utils_2 = require("../../utils");
11
11
  const assertValidationError_1 = require("../../../../errors/utils/assertValidationError");
12
12
  const constants_1 = require("../../utils/constants");
@@ -14,7 +14,7 @@ const constructContentDisposition_1 = require("../../utils/constructContentDispo
14
14
  const getProperties_1 = require("./getProperties");
15
15
  const getUrl = async (amplify, input) => {
16
16
  const { options: getUrlOptions } = input;
17
- const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getUrlOptions);
17
+ const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);
18
18
  const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);
19
19
  const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
20
20
  if (getUrlOptions?.validateObjectExistence) {
@@ -33,7 +33,7 @@ const getUrl = async (amplify, input) => {
33
33
  (0, assertValidationError_1.assertValidationError)(urlExpirationInSec <= maxUrlExpirationInSec, validation_1.StorageValidationErrorCode.UrlExpirationMaxLimitExceed);
34
34
  // expiresAt is the minimum of credential expiration and url expiration
35
35
  return {
36
- url: await (0, client_1.getPresignedGetObjectUrl)({
36
+ url: await (0, s3data_1.getPresignedGetObjectUrl)({
37
37
  ...s3Config,
38
38
  credentials: resolvedCredential,
39
39
  expiration: urlExpirationInSec,
@@ -1 +1 @@
1
- {"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst client_1 = require(\"../../utils/client\");\nconst utils_2 = require(\"../../utils\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst constants_1 = require(\"../../utils/constants\");\nconst constructContentDisposition_1 = require(\"../../utils/constructContentDisposition\");\nconst getProperties_1 = require(\"./getProperties\");\nconst getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, getUrlOptions);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await (0, getProperties_1.getProperties)(amplify, input, utils_1.StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;\n const 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 = constants_1.MAX_URL_EXPIRATION / 1000;\n (0, assertValidationError_1.assertValidationError)(urlExpirationInSec <= maxUrlExpirationInSec, validation_1.StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await (0, client_1.getPresignedGetObjectUrl)({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpE,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,uBAAuB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAC1F,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,6BAA6B,GAAG,OAAO,CAAC,yCAAyC,CAAC,CAAC;AACzF,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnD,MAAM,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AACzC,IAAI,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;AAC7C,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,OAAO,CAAC,uBAAuB,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAC3H,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,CAAC,6BAA6B,EAAE,KAAK,EAAE,UAAU,CAAC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1C,SAAS,EAAE;AACX,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,GAAG,EAAE,QAAQ;AACzB,YAAY,IAAI,aAAa,EAAE,kBAAkB,IAAI;AACrD,gBAAgB,0BAA0B,EAAE,IAAI,6BAA6B,CAAC,2BAA2B,EAAE,aAAa,CAAC,kBAAkB,CAAC;AAC5I,aAAa,CAAC;AACd,YAAY,IAAI,aAAa,EAAE,WAAW,IAAI;AAC9C,gBAAgB,mBAAmB,EAAE,aAAa,CAAC,WAAW;AAC9D,aAAa,CAAC;AACd,SAAS,CAAC;AACV,QAAQ,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,GAAG,IAAI,CAAC;AACnE,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst utils_2 = require(\"../../utils\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst constants_1 = require(\"../../utils/constants\");\nconst constructContentDisposition_1 = require(\"../../utils/constructContentDisposition\");\nconst getProperties_1 = require(\"./getProperties\");\nconst getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await (0, getProperties_1.getProperties)(amplify, input, utils_1.StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;\n const 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 = constants_1.MAX_URL_EXPIRATION / 1000;\n (0, assertValidationError_1.assertValidationError)(urlExpirationInSec <= maxUrlExpirationInSec, validation_1.StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await (0, s3data_1.getPresignedGetObjectUrl)({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpE,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,OAAO,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
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const utils_2 = require("../../utils");
9
- const client_1 = require("../../utils/client");
9
+ const s3data_1 = require("../../utils/client/s3data");
10
10
  const userAgent_1 = require("../../utils/userAgent");
11
11
  const utils_3 = require("../../../../utils");
12
12
  const constants_1 = require("../../utils/constants");
13
13
  const MAX_PAGE_SIZE = 1000;
14
14
  const list = async (amplify, input) => {
15
15
  const { options = {} } = input;
16
- const { s3Config, bucket, keyPrefix: generatedPrefix, identityId, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, options);
16
+ const { s3Config, bucket, keyPrefix: generatedPrefix, identityId, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);
17
17
  const { inputType, objectKey } = (0, utils_2.validateStorageOperationInputWithPrefix)(input, identityId);
18
18
  const isInputWithPrefix = inputType === constants_1.STORAGE_INPUT_PREFIX;
19
19
  // @ts-expect-error pageSize and nextToken should not coexist with listAll
@@ -82,7 +82,7 @@ const _listWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {
82
82
  utils_3.logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);
83
83
  listParamsClone.MaxKeys = MAX_PAGE_SIZE;
84
84
  }
85
- const response = await (0, client_1.listObjectsV2)({
85
+ const response = await (0, s3data_1.listObjectsV2)({
86
86
  ...s3Config,
87
87
  userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.List),
88
88
  }, listParamsClone);
@@ -131,7 +131,7 @@ const _listWithPath = async ({ s3Config, listParams, }) => {
131
131
  utils_3.logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);
132
132
  listParamsClone.MaxKeys = MAX_PAGE_SIZE;
133
133
  }
134
- const { Contents: contents, NextContinuationToken: nextContinuationToken, CommonPrefixes: commonPrefixes, } = await (0, client_1.listObjectsV2)({
134
+ const { Contents: contents, NextContinuationToken: nextContinuationToken, CommonPrefixes: commonPrefixes, } = await (0, s3data_1.listObjectsV2)({
135
135
  ...s3Config,
136
136
  userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.List),
137
137
  }, listParamsClone);
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sources":["../../../../../../src/providers/s3/apis/internal/list.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.list = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst MAX_PAGE_SIZE = 1000;\nconst list = async (amplify, input) => {\n const { options = {} } = input;\n const { s3Config, bucket, keyPrefix: generatedPrefix, identityId, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, options);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInputWithPrefix)(input, identityId);\n const isInputWithPrefix = inputType === constants_1.STORAGE_INPUT_PREFIX;\n // @ts-expect-error pageSize and nextToken should not coexist with listAll\n if (options?.listAll && (options?.pageSize || options?.nextToken)) {\n const anyOptions = options;\n utils_3.logger.debug(`listAll is set to true, ignoring ${anyOptions?.pageSize ? `pageSize: ${anyOptions?.pageSize}` : ''} ${anyOptions?.nextToken ? `nextToken: ${anyOptions?.nextToken}` : ''}.`);\n }\n const listParams = {\n Bucket: bucket,\n Prefix: isInputWithPrefix ? `${generatedPrefix}${objectKey}` : objectKey,\n MaxKeys: options?.listAll ? undefined : options?.pageSize,\n ContinuationToken: options?.listAll ? undefined : options?.nextToken,\n Delimiter: getDelimiter(options),\n };\n utils_3.logger.debug(`listing items from \"${listParams.Prefix}\"`);\n const listInputArgs = {\n s3Config,\n listParams,\n };\n if (options.listAll) {\n if (isInputWithPrefix) {\n return _listAllWithPrefix({\n ...listInputArgs,\n generatedPrefix,\n });\n }\n else {\n return _listAllWithPath(listInputArgs);\n }\n }\n else {\n if (isInputWithPrefix) {\n return _listWithPrefix({ ...listInputArgs, generatedPrefix });\n }\n else {\n return _listWithPath(listInputArgs);\n }\n }\n};\nexports.list = list;\n/** @deprecated Use {@link _listAllWithPath} instead. */\nconst _listAllWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {\n const listResult = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, nextToken: pageNextToken } = await _listWithPrefix({\n generatedPrefix,\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n };\n};\n/** @deprecated Use {@link _listWithPath} instead. */\nconst _listWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n utils_3.logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const response = await (0, client_1.listObjectsV2)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.List),\n }, listParamsClone);\n if (!response?.Contents) {\n return {\n items: [],\n };\n }\n return {\n items: response.Contents.map(item => ({\n key: generatedPrefix\n ? item.Key.substring(generatedPrefix.length)\n : item.Key,\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n })),\n nextToken: response.NextContinuationToken,\n };\n};\nconst _listAllWithPath = async ({ s3Config, listParams, }) => {\n const listResult = [];\n const excludedSubpaths = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, excludedSubpaths: pageExcludedSubpaths, nextToken: pageNextToken, } = await _listWithPath({\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n excludedSubpaths.push(...(pageExcludedSubpaths ?? []));\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n excludedSubpaths,\n };\n};\nconst _listWithPath = async ({ s3Config, listParams, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n utils_3.logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const { Contents: contents, NextContinuationToken: nextContinuationToken, CommonPrefixes: commonPrefixes, } = await (0, client_1.listObjectsV2)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.List),\n }, listParamsClone);\n const excludedSubpaths = commonPrefixes && mapCommonPrefixesToExcludedSubpaths(commonPrefixes);\n if (!contents) {\n return {\n items: [],\n excludedSubpaths,\n };\n }\n return {\n items: contents.map(item => ({\n path: item.Key,\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n })),\n nextToken: nextContinuationToken,\n excludedSubpaths,\n };\n};\nconst mapCommonPrefixesToExcludedSubpaths = (commonPrefixes) => {\n return commonPrefixes.reduce((mappedSubpaths, { Prefix }) => {\n if (Prefix) {\n mappedSubpaths.push(Prefix);\n }\n return mappedSubpaths;\n }, []);\n};\nconst getDelimiter = (options) => {\n if (options?.subpathStrategy?.strategy === 'exclude') {\n return options?.subpathStrategy?.delimiter ?? constants_1.DEFAULT_DELIMITER;\n }\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACtB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAA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AAC,GAAG;AAC1B,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,YAAY,YAAY,EAAE,IAAI,CAAC,YAAY;AAC3C,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,SAAS,CAAC,CAAC;AACX,QAAQ,SAAS,EAAE,qBAAqB;AACxC,QAAQ,gBAAgB;AACxB,KAAK,CAAC;AACN,CAAC,CAAC;AACF,MAAM,mCAAmC,GAAG,CAAC,cAAc,KAAK;AAChE,IAAI,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK;AACjE,QAAQ,IAAI,MAAM,EAAE;AACpB,YAAY,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxC,SAAS;AACT,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK,EAAE,EAAE,CAAC,CAAC;AACX,CAAC,CAAC;AACF,MAAM,YAAY,GAAG,CAAC,OAAO,KAAK;AAClC,IAAI,IAAI,OAAO,EAAE,eAAe,EAAE,QAAQ,KAAK,SAAS,EAAE;AAC1D,QAAQ,OAAO,OAAO,EAAE,eAAe,EAAE,SAAS,IAAI,WAAW,CAAC,iBAAiB,CAAC;AACpF,KAAK;AACL,CAAC;;"}
1
+ {"version":3,"file":"list.js","sources":["../../../../../../src/providers/s3/apis/internal/list.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.list = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst MAX_PAGE_SIZE = 1000;\nconst list = async (amplify, input) => {\n const { options = {} } = input;\n const { s3Config, bucket, keyPrefix: generatedPrefix, identityId, } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInputWithPrefix)(input, identityId);\n const isInputWithPrefix = inputType === constants_1.STORAGE_INPUT_PREFIX;\n // @ts-expect-error pageSize and nextToken should not coexist with listAll\n if (options?.listAll && (options?.pageSize || options?.nextToken)) {\n const anyOptions = options;\n utils_3.logger.debug(`listAll is set to true, ignoring ${anyOptions?.pageSize ? `pageSize: ${anyOptions?.pageSize}` : ''} ${anyOptions?.nextToken ? `nextToken: ${anyOptions?.nextToken}` : ''}.`);\n }\n const listParams = {\n Bucket: bucket,\n Prefix: isInputWithPrefix ? `${generatedPrefix}${objectKey}` : objectKey,\n MaxKeys: options?.listAll ? undefined : options?.pageSize,\n ContinuationToken: options?.listAll ? undefined : options?.nextToken,\n Delimiter: getDelimiter(options),\n };\n utils_3.logger.debug(`listing items from \"${listParams.Prefix}\"`);\n const listInputArgs = {\n s3Config,\n listParams,\n };\n if (options.listAll) {\n if (isInputWithPrefix) {\n return _listAllWithPrefix({\n ...listInputArgs,\n generatedPrefix,\n });\n }\n else {\n return _listAllWithPath(listInputArgs);\n }\n }\n else {\n if (isInputWithPrefix) {\n return _listWithPrefix({ ...listInputArgs, generatedPrefix });\n }\n else {\n return _listWithPath(listInputArgs);\n }\n }\n};\nexports.list = list;\n/** @deprecated Use {@link _listAllWithPath} instead. */\nconst _listAllWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {\n const listResult = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, nextToken: pageNextToken } = await _listWithPrefix({\n generatedPrefix,\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n };\n};\n/** @deprecated Use {@link _listWithPath} instead. */\nconst _listWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n utils_3.logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const response = await (0, s3data_1.listObjectsV2)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.List),\n }, listParamsClone);\n if (!response?.Contents) {\n return {\n items: [],\n };\n }\n return {\n items: response.Contents.map(item => ({\n key: generatedPrefix\n ? item.Key.substring(generatedPrefix.length)\n : item.Key,\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n })),\n nextToken: response.NextContinuationToken,\n };\n};\nconst _listAllWithPath = async ({ s3Config, listParams, }) => {\n const listResult = [];\n const excludedSubpaths = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, excludedSubpaths: pageExcludedSubpaths, nextToken: pageNextToken, } = await _listWithPath({\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n excludedSubpaths.push(...(pageExcludedSubpaths ?? []));\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n excludedSubpaths,\n };\n};\nconst _listWithPath = async ({ s3Config, listParams, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n utils_3.logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const { Contents: contents, NextContinuationToken: nextContinuationToken, CommonPrefixes: commonPrefixes, } = await (0, s3data_1.listObjectsV2)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.List),\n }, listParamsClone);\n const excludedSubpaths = commonPrefixes && mapCommonPrefixesToExcludedSubpaths(commonPrefixes);\n if (!contents) {\n return {\n items: [],\n excludedSubpaths,\n };\n }\n return {\n items: contents.map(item => ({\n path: item.Key,\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n })),\n nextToken: nextContinuationToken,\n excludedSubpaths,\n };\n};\nconst mapCommonPrefixesToExcludedSubpaths = (commonPrefixes) => {\n return commonPrefixes.reduce((mappedSubpaths, { Prefix }) => {\n if (Prefix) {\n mappedSubpaths.push(Prefix);\n }\n return mappedSubpaths;\n }, []);\n};\nconst getDelimiter = (options) => {\n if (options?.subpathStrategy?.strategy === 'exclude') {\n return options?.subpathStrategy?.delimiter ?? constants_1.DEFAULT_DELIMITER;\n }\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACtB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,IAAI,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AACvC,IAAI,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;AACnC,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,uBAAuB,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AC,CAAC;AACX,CAAC,CAAC;AACF,MAAM,YAAY,GAAG,CAAC,OAAO,KAAK;AAClC,IAAI,IAAI,OAAO,EAAE,eAAe,EAAE,QAAQ,KAAK,SAAS,EAAE;AAC1D,QAAQ,OAAO,OAAO,EAAE,eAAe,EAAE,SAAS,IAAI,WAAW,CAAC,iBAAiB,CAAC;AACpF,KAAK;AACL,CAAC;;"}
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.remove = void 0;
7
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const utils_2 = require("../../utils");
9
- const client_1 = require("../../utils/client");
9
+ const s3data_1 = require("../../utils/client/s3data");
10
10
  const userAgent_1 = require("../../utils/userAgent");
11
11
  const utils_3 = require("../../../../utils");
12
12
  const constants_1 = require("../../utils/constants");
13
13
  const remove = async (amplify, input) => {
14
- const { options = {} } = input ?? {};
15
- const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, options);
14
+ const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);
16
15
  const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);
17
16
  let finalKey;
18
17
  if (inputType === constants_1.STORAGE_INPUT_KEY) {
@@ -23,7 +22,7 @@ const remove = async (amplify, input) => {
23
22
  finalKey = objectKey;
24
23
  utils_3.logger.debug(`removing object in path "${finalKey}"`);
25
24
  }
26
- await (0, client_1.deleteObject)({
25
+ await (0, s3data_1.deleteObject)({
27
26
  ...s3Config,
28
27
  userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Remove),
29
28
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"remove.js","sources":["../../../../../../src/providers/s3/apis/internal/remove.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.remove = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst client_1 = require(\"../../utils/client\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst remove = async (amplify, input) => {\n const { options = {} } = input ?? {};\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, options);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n let finalKey;\n if (inputType === constants_1.STORAGE_INPUT_KEY) {\n finalKey = `${keyPrefix}${objectKey}`;\n utils_3.logger.debug(`remove \"${objectKey}\" from \"${finalKey}\".`);\n }\n else {\n finalKey = objectKey;\n utils_3.logger.debug(`removing object in path \"${finalKey}\"`);\n }\n await (0, client_1.deleteObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Remove),\n }, {\n Bucket: bucket,\n Key: finalKey,\n });\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? {\n key: objectKey,\n }\n : {\n path: objectKey,\n };\n};\nexports.remove = remove;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,WAAW,GAAG,OAAO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ACtD,UAAU;AACV,YAAY,GAAG,EAAE,SAAS;AAC1B,SAAS;AACT,UAAU;AACV,YAAY,IAAI,EAAE,SAAS;AAC3B,SAAS,CAAC;AACV,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"remove.js","sources":["../../../../../../src/providers/s3/apis/internal/remove.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.remove = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../utils\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst remove = async (amplify, input) => {\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n let finalKey;\n if (inputType === constants_1.STORAGE_INPUT_KEY) {\n finalKey = `${keyPrefix}${objectKey}`;\n utils_3.logger.debug(`remove \"${objectKey}\" from \"${finalKey}\".`);\n }\n else {\n finalKey = objectKey;\n utils_3.logger.debug(`removing object in path \"${finalKey}\"`);\n }\n await (0, s3data_1.deleteObject)({\n ...s3Config,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.Remove),\n }, {\n Bucket: bucket,\n Key: finalKey,\n });\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? {\n key: objectKey,\n }\n : {\n path: objectKey,\n };\n};\nexports.remove = remove;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KA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AACnB,QAAQ,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC;AAC/F,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,GAAG,EAAE,QAAQ;AACrB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC,iBAAiB;AACtD,UAAU;AACV,YAAY,GAAG,EAAE,SAAS;AAC1B,SAAS;AACT,UAAU;AACV,YAAY,IAAI,EAAE,SAAS;AAC3B,SAAS,CAAC;AACV,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -4,10 +4,12 @@
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.loadOrCreateMultipartUpload = void 0;
7
- const client_1 = require("../../../utils/client");
7
+ const s3data_1 = require("../../../utils/client/s3data");
8
8
  const utils_1 = require("../../../../../utils");
9
+ const crc32_1 = require("../../../utils/crc32");
9
10
  const constructContentDisposition_1 = require("../../../utils/constructContentDisposition");
10
11
  const uploadCache_1 = require("./uploadCache");
12
+ const getDataChunker_1 = require("./getDataChunker");
11
13
  /**
12
14
  * Load the in-progress multipart upload from local storage or async storage(RN) if it exists, or create a new multipart
13
15
  * upload.
@@ -44,10 +46,12 @@ const loadOrCreateMultipartUpload = async ({ s3Config, data, size, contentType,
44
46
  return {
45
47
  uploadId: cachedUpload.uploadId,
46
48
  cachedParts: cachedUpload.parts,
49
+ finalCrc32: cachedUpload.finalCrc32,
47
50
  };
48
51
  }
49
52
  else {
50
- const { UploadId } = await (0, client_1.createMultipartUpload)({
53
+ const finalCrc32 = await getCombinedCrc32(data, size);
54
+ const { UploadId } = await (0, s3data_1.createMultipartUpload)({
51
55
  ...s3Config,
52
56
  abortSignal,
53
57
  }, {
@@ -57,12 +61,14 @@ const loadOrCreateMultipartUpload = async ({ s3Config, data, size, contentType,
57
61
  ContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(contentDisposition),
58
62
  ContentEncoding: contentEncoding,
59
63
  Metadata: metadata,
64
+ ChecksumAlgorithm: finalCrc32 ? 'CRC32' : undefined,
60
65
  });
61
66
  if (size === undefined) {
62
67
  utils_1.logger.debug('uploaded data size cannot be determined, skipping cache.');
63
68
  return {
64
69
  uploadId: UploadId,
65
70
  cachedParts: [],
71
+ finalCrc32,
66
72
  };
67
73
  }
68
74
  const uploadCacheKey = (0, uploadCache_1.getUploadsCacheKey)({
@@ -77,13 +83,27 @@ const loadOrCreateMultipartUpload = async ({ s3Config, data, size, contentType,
77
83
  uploadId: UploadId,
78
84
  bucket,
79
85
  key,
86
+ finalCrc32,
80
87
  fileName: data instanceof File ? data.name : '',
81
88
  });
82
89
  return {
83
90
  uploadId: UploadId,
84
91
  cachedParts: [],
92
+ finalCrc32,
85
93
  };
86
94
  }
87
95
  };
88
96
  exports.loadOrCreateMultipartUpload = loadOrCreateMultipartUpload;
97
+ const getCombinedCrc32 = async (data, size) => {
98
+ const crc32List = [];
99
+ const dataChunker = (0, getDataChunker_1.getDataChunker)(data, size);
100
+ for (const { data: checkData } of dataChunker) {
101
+ const checksumArrayBuffer = (await (0, crc32_1.calculateContentCRC32)(checkData))
102
+ ?.checksumArrayBuffer;
103
+ if (checksumArrayBuffer === undefined)
104
+ return undefined;
105
+ crc32List.push(checksumArrayBuffer);
106
+ }
107
+ return `${(await (0, crc32_1.calculateContentCRC32)(new Blob(crc32List)))?.checksum}-${crc32List.length}`;
108
+ };
89
109
  //# sourceMappingURL=initialUpload.js.map