@aws-amplify/storage 5.6.3 → 5.6.4-api-v6.13

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 (252) hide show
  1. package/lib/AwsClients/S3/abortMultipartUpload.d.ts +21 -0
  2. package/lib/AwsClients/S3/abortMultipartUpload.js +85 -0
  3. package/lib/AwsClients/S3/base.d.ts +54 -0
  4. package/lib/AwsClients/S3/base.js +75 -0
  5. package/lib/AwsClients/S3/completeMultipartUpload.d.ts +20 -0
  6. package/lib/AwsClients/S3/completeMultipartUpload.js +162 -0
  7. package/lib/AwsClients/S3/copyObject.d.ts +24 -0
  8. package/lib/AwsClients/S3/copyObject.js +98 -0
  9. package/lib/AwsClients/S3/createMultipartUpload.d.ts +21 -0
  10. package/lib/AwsClients/S3/createMultipartUpload.js +95 -0
  11. package/lib/AwsClients/S3/deleteObject.d.ts +20 -0
  12. package/lib/AwsClients/S3/deleteObject.js +86 -0
  13. package/lib/AwsClients/S3/getObject.d.ts +27 -0
  14. package/lib/AwsClients/S3/getObject.js +216 -0
  15. package/lib/AwsClients/S3/headObject.d.ts +20 -0
  16. package/lib/AwsClients/S3/headObject.js +96 -0
  17. package/lib/AwsClients/S3/index.d.ts +13 -0
  18. package/lib/AwsClients/S3/index.js +30 -0
  19. package/lib/AwsClients/S3/index.native.d.ts +14 -0
  20. package/lib/AwsClients/S3/index.native.js +31 -0
  21. package/lib/AwsClients/S3/listObjectsV2.d.ts +20 -0
  22. package/lib/AwsClients/S3/listObjectsV2.js +146 -0
  23. package/lib/AwsClients/S3/listParts.d.ts +20 -0
  24. package/lib/AwsClients/S3/listParts.js +110 -0
  25. package/lib/AwsClients/S3/putObject.d.ts +23 -0
  26. package/lib/AwsClients/S3/putObject.js +93 -0
  27. package/lib/AwsClients/S3/runtime/base64/index.browser.d.ts +2 -0
  28. package/lib/AwsClients/S3/runtime/base64/index.browser.js +20 -0
  29. package/lib/AwsClients/S3/runtime/base64/index.native.d.ts +2 -0
  30. package/lib/AwsClients/S3/runtime/base64/index.native.js +17 -0
  31. package/lib/AwsClients/S3/runtime/constants.d.ts +9 -0
  32. package/lib/AwsClients/S3/runtime/constants.js +14 -0
  33. package/lib/AwsClients/S3/runtime/contentSha256middleware.d.ts +9 -0
  34. package/lib/AwsClients/S3/runtime/contentSha256middleware.js +70 -0
  35. package/lib/AwsClients/S3/runtime/index.browser.d.ts +5 -0
  36. package/lib/AwsClients/S3/runtime/index.browser.js +20 -0
  37. package/lib/AwsClients/S3/runtime/index.d.ts +5 -0
  38. package/lib/AwsClients/S3/runtime/index.js +21 -0
  39. package/lib/AwsClients/S3/runtime/index.native.d.ts +5 -0
  40. package/lib/AwsClients/S3/runtime/index.native.js +20 -0
  41. package/lib/AwsClients/S3/runtime/s3TransferHandler/fetch.d.ts +8 -0
  42. package/lib/AwsClients/S3/runtime/s3TransferHandler/fetch.js +15 -0
  43. package/lib/AwsClients/S3/runtime/s3TransferHandler/xhr.d.ts +8 -0
  44. package/lib/AwsClients/S3/runtime/s3TransferHandler/xhr.js +21 -0
  45. package/lib/AwsClients/S3/runtime/xhrTransferHandler.d.ts +22 -0
  46. package/lib/AwsClients/S3/runtime/xhrTransferHandler.js +201 -0
  47. package/lib/AwsClients/S3/runtime/xmlParser/dom.d.ts +8 -0
  48. package/lib/AwsClients/S3/runtime/xmlParser/dom.js +92 -0
  49. package/lib/AwsClients/S3/runtime/xmlParser/pureJs.d.ts +10 -0
  50. package/lib/AwsClients/S3/runtime/xmlParser/pureJs.js +57 -0
  51. package/lib/AwsClients/S3/types.d.ts +2857 -0
  52. package/lib/AwsClients/S3/types.js +4 -0
  53. package/lib/AwsClients/S3/uploadPart.d.ts +20 -0
  54. package/lib/AwsClients/S3/uploadPart.js +96 -0
  55. package/lib/AwsClients/S3/utils/deserializeHelpers.d.ts +78 -0
  56. package/lib/AwsClients/S3/utils/deserializeHelpers.js +153 -0
  57. package/lib/AwsClients/S3/utils/index.d.ts +5 -0
  58. package/lib/AwsClients/S3/utils/index.js +30 -0
  59. package/lib/AwsClients/S3/utils/parsePayload.d.ts +3 -0
  60. package/lib/AwsClients/S3/utils/parsePayload.js +96 -0
  61. package/lib/AwsClients/S3/utils/serializeHelpers.d.ts +42 -0
  62. package/lib/AwsClients/S3/utils/serializeHelpers.js +183 -0
  63. package/lib/Storage.d.ts +5 -5
  64. package/lib/Storage.js +60 -31
  65. package/lib/common/S3ClientUtils.d.ts +24 -15
  66. package/lib/common/S3ClientUtils.js +83 -95
  67. package/lib/common/StorageConstants.d.ts +0 -1
  68. package/lib/common/StorageConstants.js +3 -2
  69. package/lib/common/StorageErrorStrings.js +3 -1
  70. package/lib/common/StorageUtils.js +12 -6
  71. package/lib/index.js +19 -4
  72. package/lib/providers/AWSS3Provider.d.ts +4 -8
  73. package/lib/providers/AWSS3Provider.js +210 -139
  74. package/lib/providers/AWSS3ProviderManagedUpload.d.ts +7 -7
  75. package/lib/providers/AWSS3ProviderManagedUpload.js +184 -98
  76. package/lib/providers/AWSS3UploadTask.d.ts +8 -8
  77. package/lib/providers/AWSS3UploadTask.js +226 -129
  78. package/lib/providers/index.js +4 -2
  79. package/lib/tsconfig.tsbuildinfo +1 -0
  80. package/lib/types/AWSS3Provider.d.ts +62 -62
  81. package/lib/types/AWSS3Provider.js +0 -1
  82. package/lib/types/Provider.d.ts +1 -1
  83. package/lib/types/Provider.js +2 -1
  84. package/lib/types/Storage.d.ts +23 -23
  85. package/lib/types/Storage.js +0 -1
  86. package/lib/types/index.js +17 -1
  87. package/lib-esm/AwsClients/S3/abortMultipartUpload.d.ts +21 -0
  88. package/lib-esm/AwsClients/S3/abortMultipartUpload.js +82 -0
  89. package/lib-esm/AwsClients/S3/base.d.ts +54 -0
  90. package/lib-esm/AwsClients/S3/base.js +71 -0
  91. package/lib-esm/AwsClients/S3/completeMultipartUpload.d.ts +20 -0
  92. package/lib-esm/AwsClients/S3/completeMultipartUpload.js +159 -0
  93. package/lib-esm/AwsClients/S3/copyObject.d.ts +24 -0
  94. package/lib-esm/AwsClients/S3/copyObject.js +95 -0
  95. package/lib-esm/AwsClients/S3/createMultipartUpload.d.ts +21 -0
  96. package/lib-esm/AwsClients/S3/createMultipartUpload.js +92 -0
  97. package/lib-esm/AwsClients/S3/deleteObject.d.ts +20 -0
  98. package/lib-esm/AwsClients/S3/deleteObject.js +83 -0
  99. package/lib-esm/AwsClients/S3/getObject.d.ts +27 -0
  100. package/lib-esm/AwsClients/S3/getObject.js +212 -0
  101. package/lib-esm/AwsClients/S3/headObject.d.ts +20 -0
  102. package/lib-esm/AwsClients/S3/headObject.js +93 -0
  103. package/lib-esm/AwsClients/S3/index.d.ts +13 -0
  104. package/lib-esm/AwsClients/S3/index.js +14 -0
  105. package/lib-esm/AwsClients/S3/index.native.d.ts +14 -0
  106. package/lib-esm/AwsClients/S3/index.native.js +15 -0
  107. package/lib-esm/AwsClients/S3/listObjectsV2.d.ts +20 -0
  108. package/lib-esm/AwsClients/S3/listObjectsV2.js +143 -0
  109. package/lib-esm/AwsClients/S3/listParts.d.ts +20 -0
  110. package/lib-esm/AwsClients/S3/listParts.js +107 -0
  111. package/lib-esm/AwsClients/S3/putObject.d.ts +23 -0
  112. package/lib-esm/AwsClients/S3/putObject.js +90 -0
  113. package/lib-esm/AwsClients/S3/runtime/base64/index.browser.d.ts +2 -0
  114. package/lib-esm/AwsClients/S3/runtime/base64/index.browser.js +15 -0
  115. package/lib-esm/AwsClients/S3/runtime/base64/index.native.d.ts +2 -0
  116. package/lib-esm/AwsClients/S3/runtime/base64/index.native.js +12 -0
  117. package/lib-esm/AwsClients/S3/runtime/constants.d.ts +9 -0
  118. package/lib-esm/AwsClients/S3/runtime/constants.js +11 -0
  119. package/lib-esm/AwsClients/S3/runtime/contentSha256middleware.d.ts +9 -0
  120. package/lib-esm/AwsClients/S3/runtime/contentSha256middleware.js +66 -0
  121. package/lib-esm/AwsClients/S3/runtime/index.browser.d.ts +5 -0
  122. package/lib-esm/AwsClients/S3/runtime/index.browser.js +8 -0
  123. package/lib-esm/AwsClients/S3/runtime/index.d.ts +5 -0
  124. package/lib-esm/AwsClients/S3/runtime/index.js +9 -0
  125. package/lib-esm/AwsClients/S3/runtime/index.native.d.ts +5 -0
  126. package/lib-esm/AwsClients/S3/runtime/index.native.js +8 -0
  127. package/lib-esm/AwsClients/S3/runtime/s3TransferHandler/fetch.d.ts +8 -0
  128. package/lib-esm/AwsClients/S3/runtime/s3TransferHandler/fetch.js +12 -0
  129. package/lib-esm/AwsClients/S3/runtime/s3TransferHandler/xhr.d.ts +8 -0
  130. package/lib-esm/AwsClients/S3/runtime/s3TransferHandler/xhr.js +18 -0
  131. package/lib-esm/AwsClients/S3/runtime/xhrTransferHandler.d.ts +22 -0
  132. package/lib-esm/AwsClients/S3/runtime/xhrTransferHandler.js +196 -0
  133. package/lib-esm/AwsClients/S3/runtime/xmlParser/dom.d.ts +8 -0
  134. package/lib-esm/AwsClients/S3/runtime/xmlParser/dom.js +89 -0
  135. package/lib-esm/AwsClients/S3/runtime/xmlParser/pureJs.d.ts +10 -0
  136. package/lib-esm/AwsClients/S3/runtime/xmlParser/pureJs.js +54 -0
  137. package/lib-esm/AwsClients/S3/types.d.ts +2857 -0
  138. package/lib-esm/AwsClients/S3/types.js +3 -0
  139. package/lib-esm/AwsClients/S3/uploadPart.d.ts +20 -0
  140. package/lib-esm/AwsClients/S3/uploadPart.js +93 -0
  141. package/lib-esm/AwsClients/S3/utils/deserializeHelpers.d.ts +78 -0
  142. package/lib-esm/AwsClients/S3/utils/deserializeHelpers.js +144 -0
  143. package/lib-esm/AwsClients/S3/utils/index.d.ts +5 -0
  144. package/lib-esm/AwsClients/S3/utils/index.js +7 -0
  145. package/lib-esm/AwsClients/S3/utils/parsePayload.d.ts +3 -0
  146. package/lib-esm/AwsClients/S3/utils/parsePayload.js +91 -0
  147. package/lib-esm/AwsClients/S3/utils/serializeHelpers.d.ts +42 -0
  148. package/lib-esm/AwsClients/S3/utils/serializeHelpers.js +176 -0
  149. package/lib-esm/Storage.d.ts +5 -5
  150. package/lib-esm/Storage.js +53 -25
  151. package/lib-esm/common/S3ClientUtils.d.ts +24 -15
  152. package/lib-esm/common/S3ClientUtils.js +76 -93
  153. package/lib-esm/common/StorageConstants.d.ts +0 -1
  154. package/lib-esm/common/StorageConstants.js +2 -2
  155. package/lib-esm/common/StorageErrorStrings.js +2 -1
  156. package/lib-esm/common/StorageUtils.js +2 -1
  157. package/lib-esm/index.js +1 -1
  158. package/lib-esm/providers/AWSS3Provider.d.ts +4 -8
  159. package/lib-esm/providers/AWSS3Provider.js +162 -115
  160. package/lib-esm/providers/AWSS3ProviderManagedUpload.d.ts +7 -7
  161. package/lib-esm/providers/AWSS3ProviderManagedUpload.js +172 -87
  162. package/lib-esm/providers/AWSS3UploadTask.d.ts +8 -8
  163. package/lib-esm/providers/AWSS3UploadTask.js +202 -106
  164. package/lib-esm/providers/index.js +2 -1
  165. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  166. package/lib-esm/types/AWSS3Provider.d.ts +62 -62
  167. package/lib-esm/types/AWSS3Provider.js +1 -1
  168. package/lib-esm/types/Provider.d.ts +1 -1
  169. package/lib-esm/types/Provider.js +3 -1
  170. package/lib-esm/types/Storage.d.ts +23 -23
  171. package/lib-esm/types/Storage.js +1 -1
  172. package/lib-esm/types/index.js +3 -1
  173. package/package.json +21 -26
  174. package/src/AwsClients/S3/abortMultipartUpload.ts +62 -0
  175. package/src/AwsClients/S3/base.ts +109 -0
  176. package/src/AwsClients/S3/completeMultipartUpload.ts +154 -0
  177. package/src/AwsClients/S3/copyObject.ts +90 -0
  178. package/src/AwsClients/S3/createMultipartUpload.ts +75 -0
  179. package/src/AwsClients/S3/deleteObject.ts +69 -0
  180. package/src/AwsClients/S3/getObject.ts +173 -0
  181. package/src/AwsClients/S3/headObject.ts +91 -0
  182. package/src/AwsClients/S3/index.native.ts +42 -0
  183. package/src/AwsClients/S3/index.ts +41 -0
  184. package/src/AwsClients/S3/listObjectsV2.ts +130 -0
  185. package/src/AwsClients/S3/listParts.ts +97 -0
  186. package/src/AwsClients/S3/putObject.ts +94 -0
  187. package/src/AwsClients/S3/runtime/base64/index.browser.ts +21 -0
  188. package/src/AwsClients/S3/runtime/base64/index.native.ts +16 -0
  189. package/src/AwsClients/S3/runtime/constants.ts +16 -0
  190. package/src/AwsClients/S3/runtime/contentSha256middleware.ts +29 -0
  191. package/src/AwsClients/S3/runtime/index.browser.ts +14 -0
  192. package/src/AwsClients/S3/runtime/index.native.ts +14 -0
  193. package/src/AwsClients/S3/runtime/index.ts +15 -0
  194. package/src/AwsClients/S3/runtime/s3TransferHandler/fetch.ts +23 -0
  195. package/src/AwsClients/S3/runtime/s3TransferHandler/xhr.ts +35 -0
  196. package/src/AwsClients/S3/runtime/xhrTransferHandler.ts +254 -0
  197. package/src/AwsClients/S3/runtime/xmlParser/dom.ts +92 -0
  198. package/src/AwsClients/S3/runtime/xmlParser/pureJs.ts +55 -0
  199. package/src/AwsClients/S3/types.ts +2877 -0
  200. package/src/AwsClients/S3/uploadPart.ts +83 -0
  201. package/src/AwsClients/S3/utils/deserializeHelpers.ts +136 -0
  202. package/src/AwsClients/S3/utils/index.ts +27 -0
  203. package/src/AwsClients/S3/utils/parsePayload.ts +45 -0
  204. package/src/AwsClients/S3/utils/serializeHelpers.ts +112 -0
  205. package/src/Storage.ts +30 -27
  206. package/src/common/S3ClientUtils.ts +57 -113
  207. package/src/common/StorageConstants.ts +2 -2
  208. package/src/common/StorageErrorStrings.ts +2 -0
  209. package/src/common/StorageUtils.ts +2 -0
  210. package/src/providers/AWSS3Provider.ts +80 -100
  211. package/src/providers/AWSS3ProviderManagedUpload.ts +56 -63
  212. package/src/providers/AWSS3UploadTask.ts +86 -87
  213. package/src/providers/index.ts +2 -0
  214. package/src/types/AWSS3Provider.ts +55 -49
  215. package/src/types/Provider.ts +7 -2
  216. package/lib/.tsbuildinfo +0 -3
  217. package/lib/Storage.js.map +0 -1
  218. package/lib/common/S3ClientUtils.js.map +0 -1
  219. package/lib/common/StorageConstants.js.map +0 -1
  220. package/lib/common/StorageErrorStrings.js.map +0 -1
  221. package/lib/common/StorageUtils.js.map +0 -1
  222. package/lib/index.js.map +0 -1
  223. package/lib/providers/AWSS3Provider.js.map +0 -1
  224. package/lib/providers/AWSS3ProviderManagedUpload.js.map +0 -1
  225. package/lib/providers/AWSS3UploadTask.js.map +0 -1
  226. package/lib/providers/axios-http-handler.d.ts +0 -40
  227. package/lib/providers/axios-http-handler.js +0 -193
  228. package/lib/providers/axios-http-handler.js.map +0 -1
  229. package/lib/providers/index.js.map +0 -1
  230. package/lib/types/AWSS3Provider.js.map +0 -1
  231. package/lib/types/Provider.js.map +0 -1
  232. package/lib/types/Storage.js.map +0 -1
  233. package/lib/types/index.js.map +0 -1
  234. package/lib-esm/.tsbuildinfo +0 -3
  235. package/lib-esm/Storage.js.map +0 -1
  236. package/lib-esm/common/S3ClientUtils.js.map +0 -1
  237. package/lib-esm/common/StorageConstants.js.map +0 -1
  238. package/lib-esm/common/StorageErrorStrings.js.map +0 -1
  239. package/lib-esm/common/StorageUtils.js.map +0 -1
  240. package/lib-esm/index.js.map +0 -1
  241. package/lib-esm/providers/AWSS3Provider.js.map +0 -1
  242. package/lib-esm/providers/AWSS3ProviderManagedUpload.js.map +0 -1
  243. package/lib-esm/providers/AWSS3UploadTask.js.map +0 -1
  244. package/lib-esm/providers/axios-http-handler.d.ts +0 -40
  245. package/lib-esm/providers/axios-http-handler.js +0 -191
  246. package/lib-esm/providers/axios-http-handler.js.map +0 -1
  247. package/lib-esm/providers/index.js.map +0 -1
  248. package/lib-esm/types/AWSS3Provider.js.map +0 -1
  249. package/lib-esm/types/Provider.js.map +0 -1
  250. package/lib-esm/types/Storage.js.map +0 -1
  251. package/lib-esm/types/index.js.map +0 -1
  252. package/src/providers/axios-http-handler.ts +0 -242
@@ -0,0 +1,3 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
3
+ import type { UploadPartCommandInput, UploadPartCommandOutput } from './types';
4
+ export type UploadPartInput = Pick<UploadPartCommandInput, 'PartNumber' | 'Body' | 'UploadId' | 'Bucket' | 'Key' | 'SSECustomerAlgorithm' | 'SSECustomerKey' | 'SSECustomerKeyMD5'>;
5
+ export type UploadPartOutput = Pick<UploadPartCommandOutput, '$metadata' | 'ETag'>;
6
+ export declare const uploadPart: (config: Omit<import("@aws-amplify/core/internals/aws-client-utils").UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<HttpResponse> & import("@aws-amplify/core/internals/aws-client-utils").SigningOptions & import("./runtime/xhrTransferHandler").XhrTransferHandlerOptions & import("@aws-amplify/core/internals/aws-client-utils").ServiceClientOptions & Partial<import("@aws-amplify/core/internals/aws-client-utils").UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<HttpResponse> & import("@aws-amplify/core/internals/aws-client-utils").SigningOptions & import("./runtime/xhrTransferHandler").XhrTransferHandlerOptions & import("@aws-amplify/core/internals/aws-client-utils").ServiceClientOptions>, "region" | "maxAttempts" | "credentials" | "retryDecider" | "computeDelay" | "abortSignal" | "service" | "uriEscapePath" | "endpointResolver" | "emitter" | "responseType" | "userAgentHeader" | "userAgentValue"> & {
7
+ region?: string;
8
+ maxAttempts?: number;
9
+ credentials?: import("@aws-sdk/types/types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/types/credentials").Credentials>);
10
+ retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
11
+ computeDelay?: (attempt: number) => number;
12
+ abortSignal?: AbortSignal;
13
+ service?: string;
14
+ uriEscapePath?: boolean;
15
+ endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
16
+ emitter?: import("events").EventEmitter;
17
+ responseType?: "blob" | "text";
18
+ userAgentHeader?: string;
19
+ userAgentValue?: string;
20
+ }, input: UploadPartInput) => Promise<UploadPartOutput>;
@@ -0,0 +1,93 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var __assign = (this && this.__assign) || function () {
4
+ __assign = Object.assign || function(t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
+ t[p] = s[p];
9
+ }
10
+ return t;
11
+ };
12
+ return __assign.apply(this, arguments);
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ import { parseMetadata, } from '@aws-amplify/core/internals/aws-client-utils';
51
+ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';
52
+ import { defaultConfig } from './base';
53
+ import { map, parseXmlError, s3TransferHandler, serializeObjectSsecOptionsToHeaders, serializePathnameObjectKey, } from './utils';
54
+ var uploadPartSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var headers, url;
56
+ return __generator(this, function (_a) {
57
+ switch (_a.label) {
58
+ case 0: return [4 /*yield*/, serializeObjectSsecOptionsToHeaders(input)];
59
+ case 1:
60
+ headers = _a.sent();
61
+ headers['content-type'] = 'application/octet-stream';
62
+ url = new URL(endpoint.url.toString());
63
+ url.pathname = serializePathnameObjectKey(url, input.Key);
64
+ url.search = new URLSearchParams({
65
+ partNumber: input.PartNumber + '',
66
+ uploadId: input.UploadId,
67
+ }).toString();
68
+ return [2 /*return*/, {
69
+ method: 'PUT',
70
+ headers: headers,
71
+ url: url,
72
+ body: input.Body,
73
+ }];
74
+ }
75
+ });
76
+ }); };
77
+ var uploadPartDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
78
+ var error;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0:
82
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
83
+ return [4 /*yield*/, parseXmlError(response)];
84
+ case 1:
85
+ error = _a.sent();
86
+ throw error;
87
+ case 2: return [2 /*return*/, __assign(__assign({}, map(response.headers, {
88
+ ETag: 'etag',
89
+ })), { $metadata: parseMetadata(response) })];
90
+ }
91
+ });
92
+ }); };
93
+ export var uploadPart = composeServiceApi(s3TransferHandler, uploadPartSerializer, uploadPartDeserializer, __assign(__assign({}, defaultConfig), { responseType: 'text' }));
@@ -0,0 +1,78 @@
1
+ import { Headers } from '@aws-amplify/core/internals/aws-client-utils';
2
+ type PropertyNameWithStringValue = string;
3
+ type PropertyNameWithSubsequentDeserializer<T> = [string, (any: any) => T];
4
+ type Instruction<T> = PropertyNameWithStringValue | PropertyNameWithSubsequentDeserializer<T>;
5
+ type InferInstructionResultType<T extends Instruction<any>> = (T extends PropertyNameWithSubsequentDeserializer<infer R> ? R : string) | undefined;
6
+ /**
7
+ * Maps an object to a new object using the provided instructions.
8
+ * The instructions are a map of the returning mapped object's property names to a single instruction of how to map the
9
+ * value from the original object to the new object. There are two types of instructions:
10
+ *
11
+ * 1. A string representing the property name of the original object to map to the new object. The value mapped from
12
+ * the original object will be the same as the value in the new object, and it can ONLY be string.
13
+ *
14
+ * 2. An array of two elements. The first element is the property name of the original object to map to the new object.
15
+ * The second element is a function that takes the value from the original object and returns the value to be mapped to
16
+ * the new object. The function can return any type.
17
+ *
18
+ * Example:
19
+ * ```typescript
20
+ * const input = {
21
+ * Foo: 'foo',
22
+ * BarList: [{value: 'bar1'}, {value: 'bar2'}]
23
+ * }
24
+ * const output = map(input, {
25
+ * someFoo: 'Foo',
26
+ * bar: ['BarList', (barList) => barList.map(bar => bar.value)]
27
+ * baz: 'Baz' // Baz does not exist in input, so it will not be in the output.
28
+ * });
29
+ * // output = { someFoo: 'foo', bar: ['bar1', 'bar2'] }
30
+ * ```
31
+ *
32
+ * @param obj The object containing the data to compose mapped object.
33
+ * @param instructions The instructions mapping the object values to the new object.
34
+ * @returns A new object with the mapped values.
35
+ *
36
+ * @internal
37
+ */
38
+ export declare const map: <Instructions extends {
39
+ [key: string]: Instruction<any>;
40
+ }>(obj: Record<string, any>, instructions: Instructions) => { [K in keyof Instructions]: Instructions[K] extends infer T ? T extends Instructions[K] ? T extends PropertyNameWithSubsequentDeserializer<infer R> ? R : string : never : never; };
41
+ /**
42
+ * Deserializes a string to a number. Returns undefined if input is undefined.
43
+ *
44
+ * @internal
45
+ */
46
+ export declare const deserializeNumber: (value?: string) => number;
47
+ /**
48
+ * Deserializes a string to a boolean. Returns undefined if input is undefined. Returns true if input is 'true',
49
+ * otherwise false.
50
+ *
51
+ * @internal
52
+ */
53
+ export declare const deserializeBoolean: (value?: string) => boolean | undefined;
54
+ /**
55
+ * Deserializes a string to a Date. Returns undefined if input is undefined.
56
+ * It supports epoch timestamp; rfc3339(cannot have a UTC, fractional precision supported); rfc7231(section 7.1.1.1)
57
+ *
58
+ * @see https://www.epoch101.com/
59
+ * @see https://datatracker.ietf.org/doc/html/rfc3339.html#section-5.6
60
+ * @see https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1
61
+ *
62
+ * @note For bundle size consideration, we use Date constructor to parse the timestamp string. There might be slight
63
+ * difference among browsers.
64
+ *
65
+ * @internal
66
+ */
67
+ export declare const deserializeTimestamp: (value: string) => Date | undefined;
68
+ /**
69
+ * Function that makes sure the deserializer receives non-empty array.
70
+ *
71
+ * @internal
72
+ */
73
+ export declare const emptyArrayGuard: <T extends any[]>(value: any, deserializer: (value: any[]) => T) => T;
74
+ /**
75
+ * @internal
76
+ */
77
+ export declare const deserializeMetadata: (headers: Headers) => Record<string, string>;
78
+ export {};
@@ -0,0 +1,144 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var __values = (this && this.__values) || function(o) {
4
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
5
+ if (m) return m.call(o);
6
+ if (o && typeof o.length === "number") return {
7
+ next: function () {
8
+ if (o && i >= o.length) o = void 0;
9
+ return { value: o && o[i++], done: !o };
10
+ }
11
+ };
12
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
13
+ };
14
+ var __read = (this && this.__read) || function (o, n) {
15
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
16
+ if (!m) return o;
17
+ var i = m.call(o), r, ar = [], e;
18
+ try {
19
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
20
+ }
21
+ catch (error) { e = { error: error }; }
22
+ finally {
23
+ try {
24
+ if (r && !r.done && (m = i["return"])) m.call(i);
25
+ }
26
+ finally { if (e) throw e.error; }
27
+ }
28
+ return ar;
29
+ };
30
+ /**
31
+ * Maps an object to a new object using the provided instructions.
32
+ * The instructions are a map of the returning mapped object's property names to a single instruction of how to map the
33
+ * value from the original object to the new object. There are two types of instructions:
34
+ *
35
+ * 1. A string representing the property name of the original object to map to the new object. The value mapped from
36
+ * the original object will be the same as the value in the new object, and it can ONLY be string.
37
+ *
38
+ * 2. An array of two elements. The first element is the property name of the original object to map to the new object.
39
+ * The second element is a function that takes the value from the original object and returns the value to be mapped to
40
+ * the new object. The function can return any type.
41
+ *
42
+ * Example:
43
+ * ```typescript
44
+ * const input = {
45
+ * Foo: 'foo',
46
+ * BarList: [{value: 'bar1'}, {value: 'bar2'}]
47
+ * }
48
+ * const output = map(input, {
49
+ * someFoo: 'Foo',
50
+ * bar: ['BarList', (barList) => barList.map(bar => bar.value)]
51
+ * baz: 'Baz' // Baz does not exist in input, so it will not be in the output.
52
+ * });
53
+ * // output = { someFoo: 'foo', bar: ['bar1', 'bar2'] }
54
+ * ```
55
+ *
56
+ * @param obj The object containing the data to compose mapped object.
57
+ * @param instructions The instructions mapping the object values to the new object.
58
+ * @returns A new object with the mapped values.
59
+ *
60
+ * @internal
61
+ */
62
+ export var map = function (obj, instructions) {
63
+ var e_1, _a;
64
+ var result = {};
65
+ try {
66
+ for (var _b = __values(Object.entries(instructions)), _c = _b.next(); !_c.done; _c = _b.next()) {
67
+ var _d = __read(_c.value, 2), key = _d[0], instruction = _d[1];
68
+ var _e = __read(Array.isArray(instruction)
69
+ ? instruction
70
+ : [instruction], 2), accessor = _e[0], deserializer = _e[1];
71
+ if (obj.hasOwnProperty(accessor)) {
72
+ result[key] = deserializer
73
+ ? deserializer(obj[accessor])
74
+ : String(obj[accessor]);
75
+ }
76
+ }
77
+ }
78
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
79
+ finally {
80
+ try {
81
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
82
+ }
83
+ finally { if (e_1) throw e_1.error; }
84
+ }
85
+ return result;
86
+ };
87
+ /**
88
+ * Deserializes a string to a number. Returns undefined if input is undefined.
89
+ *
90
+ * @internal
91
+ */
92
+ export var deserializeNumber = function (value) {
93
+ return value ? Number(value) : undefined;
94
+ };
95
+ /**
96
+ * Deserializes a string to a boolean. Returns undefined if input is undefined. Returns true if input is 'true',
97
+ * otherwise false.
98
+ *
99
+ * @internal
100
+ */
101
+ export var deserializeBoolean = function (value) {
102
+ return value ? value === 'true' : undefined;
103
+ };
104
+ /**
105
+ * Deserializes a string to a Date. Returns undefined if input is undefined.
106
+ * It supports epoch timestamp; rfc3339(cannot have a UTC, fractional precision supported); rfc7231(section 7.1.1.1)
107
+ *
108
+ * @see https://www.epoch101.com/
109
+ * @see https://datatracker.ietf.org/doc/html/rfc3339.html#section-5.6
110
+ * @see https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1
111
+ *
112
+ * @note For bundle size consideration, we use Date constructor to parse the timestamp string. There might be slight
113
+ * difference among browsers.
114
+ *
115
+ * @internal
116
+ */
117
+ export var deserializeTimestamp = function (value) {
118
+ return value ? new Date(value) : undefined;
119
+ };
120
+ /**
121
+ * Function that makes sure the deserializer receives non-empty array.
122
+ *
123
+ * @internal
124
+ */
125
+ export var emptyArrayGuard = function (value, deserializer) {
126
+ if (value === '') {
127
+ return [];
128
+ }
129
+ var valueArray = (Array.isArray(value) ? value : [value]).filter(function (e) { return e != null; });
130
+ return deserializer(valueArray);
131
+ };
132
+ /**
133
+ * @internal
134
+ */
135
+ export var deserializeMetadata = function (headers) {
136
+ var objectMetadataHeaderPrefix = 'x-amz-meta-';
137
+ var deserialized = Object.keys(headers)
138
+ .filter(function (header) { return header.startsWith(objectMetadataHeaderPrefix); })
139
+ .reduce(function (acc, header) {
140
+ acc[header.replace(objectMetadataHeaderPrefix, '')] = headers[header];
141
+ return acc;
142
+ }, {});
143
+ return Object.keys(deserialized).length > 0 ? deserialized : undefined;
144
+ };
@@ -0,0 +1,5 @@
1
+ export { parseXmlBody, parseXmlError } from './parsePayload';
2
+ export { SEND_DOWNLOAD_PROGRESS_EVENT, SEND_UPLOAD_PROGRESS_EVENT, s3TransferHandler, CANCELED_ERROR_MESSAGE, isCancelError, CONTENT_SHA256_HEADER, } from '../runtime';
3
+ export { deserializeBoolean, deserializeMetadata, deserializeNumber, deserializeTimestamp, emptyArrayGuard, map, } from './deserializeHelpers';
4
+ export { assignStringVariables, serializeObjectConfigsToHeaders, serializePathnameObjectKey, serializeObjectSsecOptionsToHeaders, } from './serializeHelpers';
5
+ export { toBase64, utf8Encode } from '../runtime';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { parseXmlBody, parseXmlError } from './parsePayload';
4
+ export { SEND_DOWNLOAD_PROGRESS_EVENT, SEND_UPLOAD_PROGRESS_EVENT, s3TransferHandler, CANCELED_ERROR_MESSAGE, isCancelError, CONTENT_SHA256_HEADER, } from '../runtime';
5
+ export { deserializeBoolean, deserializeMetadata, deserializeNumber, deserializeTimestamp, emptyArrayGuard, map, } from './deserializeHelpers';
6
+ export { assignStringVariables, serializeObjectConfigsToHeaders, serializePathnameObjectKey, serializeObjectSsecOptionsToHeaders, } from './serializeHelpers';
7
+ export { toBase64, utf8Encode } from '../runtime';
@@ -0,0 +1,3 @@
1
+ import { ErrorParser, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
2
+ export declare const parseXmlError: ErrorParser;
3
+ export declare const parseXmlBody: (response: HttpResponse) => Promise<any>;
@@ -0,0 +1,91 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
39
+ import { parseMetadata, } from '@aws-amplify/core/internals/aws-client-utils';
40
+ import { parser } from '../runtime';
41
+ export var parseXmlError = function (response) { return __awaiter(void 0, void 0, void 0, function () {
42
+ var statusCode, body, code, message, error;
43
+ var _a, _b;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0:
47
+ if (!response || response.statusCode < 300) {
48
+ return [2 /*return*/];
49
+ }
50
+ statusCode = response.statusCode;
51
+ return [4 /*yield*/, parseXmlBody(response)];
52
+ case 1:
53
+ body = _c.sent();
54
+ code = (body === null || body === void 0 ? void 0 : body['Code'])
55
+ ? body.Code
56
+ : statusCode === 404
57
+ ? 'NotFound'
58
+ : statusCode.toString();
59
+ message = (_b = (_a = body === null || body === void 0 ? void 0 : body['message']) !== null && _a !== void 0 ? _a : body === null || body === void 0 ? void 0 : body['Message']) !== null && _b !== void 0 ? _b : code;
60
+ error = new Error(message);
61
+ return [2 /*return*/, Object.assign(error, {
62
+ name: code,
63
+ $metadata: parseMetadata(response),
64
+ })];
65
+ }
66
+ });
67
+ }); };
68
+ export var parseXmlBody = function (response) { return __awaiter(void 0, void 0, void 0, function () {
69
+ var data;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ if (!response.body) {
74
+ // S3 can return 200 without a body indicating failure.
75
+ throw new Error('S3 aborted request.');
76
+ }
77
+ return [4 /*yield*/, response.body.text()];
78
+ case 1:
79
+ data = _a.sent();
80
+ if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
81
+ try {
82
+ return [2 /*return*/, parser.parse(data)];
83
+ }
84
+ catch (error) {
85
+ throw new Error('Failed to parse XML response.');
86
+ }
87
+ }
88
+ return [2 /*return*/, {}];
89
+ }
90
+ });
91
+ }); };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const assignStringVariables: (values: Record<string, {
5
+ toString: () => string;
6
+ } | undefined>) => Record<string, string>;
7
+ interface ObjectSsecOptions {
8
+ SSECustomerAlgorithm?: string;
9
+ SSECustomerKey?: string;
10
+ SSECustomerKeyMD5?: string;
11
+ }
12
+ export declare const serializeObjectSsecOptionsToHeaders: (input: ObjectSsecOptions) => Promise<Record<string, string>>;
13
+ interface ObjectConfigs extends ObjectSsecOptions {
14
+ ServerSideEncryption?: string;
15
+ SSEKMSKeyId?: string;
16
+ ACL?: string;
17
+ CacheControl?: string;
18
+ ContentDisposition?: string;
19
+ ContentEncoding?: string;
20
+ ContentLanguage?: string;
21
+ ContentType?: string;
22
+ Expires?: Date;
23
+ Tagging?: string;
24
+ Metadata?: Record<string, string>;
25
+ }
26
+ /**
27
+ * Serailize the parameters for configuring the S3 object. Currently used by
28
+ * `putObject` and `createMultipartUpload` API.
29
+ *
30
+ * @internal
31
+ */
32
+ export declare const serializeObjectConfigsToHeaders: (input: ObjectConfigs) => Promise<{
33
+ [x: string]: string;
34
+ }>;
35
+ /**
36
+ * Serialize the object key to a URL pathname.
37
+ * @see https://github.com/aws/aws-sdk-js-v3/blob/7ed7101dcc4e81038b6c7f581162b959e6b33a04/clients/client-s3/src/protocols/Aws_restXml.ts#L1108
38
+ *
39
+ * @internal
40
+ */
41
+ export declare const serializePathnameObjectKey: (url: URL, key: string) => string;
42
+ export {};