@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,21 @@
1
+ /// <reference types="node" />
2
+ import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
3
+ import { MetadataBearer } from '@aws-sdk/types';
4
+ import type { AbortMultipartUploadCommandInput } from './types';
5
+ export type AbortMultipartUploadInput = Pick<AbortMultipartUploadCommandInput, 'Bucket' | 'Key' | 'UploadId'>;
6
+ export type AbortMultipartUploadOutput = MetadataBearer;
7
+ export declare const abortMultipartUpload: (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"> & {
8
+ region?: string;
9
+ maxAttempts?: number;
10
+ credentials?: import("@aws-sdk/types").Credentials | (() => Promise<import("@aws-sdk/types").Credentials>);
11
+ retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
12
+ computeDelay?: (attempt: number) => number;
13
+ abortSignal?: AbortSignal;
14
+ service?: string;
15
+ uriEscapePath?: boolean;
16
+ endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
17
+ emitter?: import("events").EventEmitter;
18
+ responseType?: "blob" | "text";
19
+ userAgentHeader?: string;
20
+ userAgentValue?: string;
21
+ }, input: AbortMultipartUploadInput) => Promise<MetadataBearer>;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __assign = (this && this.__assign) || function () {
5
+ __assign = Object.assign || function(t) {
6
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7
+ s = arguments[i];
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
+ t[p] = s[p];
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
31
+ 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;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.abortMultipartUpload = void 0;
53
+ var aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
54
+ var composers_1 = require("@aws-amplify/core/internals/aws-client-utils/composers");
55
+ var base_1 = require("./base");
56
+ var utils_1 = require("./utils");
57
+ var abortMultipartUploadSerializer = function (input, endpoint) {
58
+ var url = new URL(endpoint.url.toString());
59
+ url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
60
+ url.search = new URLSearchParams({
61
+ uploadId: input.UploadId,
62
+ }).toString();
63
+ return {
64
+ method: 'DELETE',
65
+ headers: {},
66
+ url: url,
67
+ };
68
+ };
69
+ var abortMultipartUploadDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
70
+ var error;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0:
74
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
75
+ return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
76
+ case 1:
77
+ error = _a.sent();
78
+ throw error;
79
+ case 2: return [2 /*return*/, {
80
+ $metadata: (0, aws_client_utils_1.parseMetadata)(response),
81
+ }];
82
+ }
83
+ });
84
+ }); };
85
+ exports.abortMultipartUpload = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, abortMultipartUploadSerializer, abortMultipartUploadDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text' }));
@@ -0,0 +1,54 @@
1
+ import { EndpointResolverOptions } from '@aws-amplify/core/internals/aws-client-utils';
2
+ /**
3
+ * The service name used to sign requests if the API requires authentication.
4
+ */
5
+ export declare const SERVICE_NAME = "s3";
6
+ /**
7
+ * Options for endpoint resolver.
8
+ *
9
+ * @internal
10
+ */
11
+ export type S3EndpointResolverOptions = EndpointResolverOptions & {
12
+ /**
13
+ * Whether to use the S3 Transfer Acceleration endpoint.
14
+ */
15
+ useAccelerateEndpoint?: boolean;
16
+ /**
17
+ * Fully qualified custom endpoint for S3. If this is set, this endpoint will be used regardless of region or
18
+ * useAccelerateEndpoint config.
19
+ * The path of this endpoint
20
+ */
21
+ customEndpoint?: string;
22
+ /**
23
+ * Whether to force path style URLs for S3 objects (e.g., https://s3.amazonaws.com/<bucketName>/<key> instead of
24
+ * https://<bucketName>.s3.amazonaws.com/<key>
25
+ * @default false
26
+ */
27
+ forcePathStyle?: boolean;
28
+ };
29
+ /**
30
+ * Determines whether a given string is DNS compliant per the rules outlined by
31
+ * S3. Length, capitaization, and leading dot restrictions are enforced by the
32
+ * DOMAIN_PATTERN regular expression.
33
+ * @internal
34
+ *
35
+ * @see https://github.com/aws/aws-sdk-js-v3/blob/f2da6182298d4d6b02e84fb723492c07c27469a8/packages/middleware-bucket-endpoint/src/bucketHostnameUtils.ts#L39-L48
36
+ * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
37
+ */
38
+ export declare const isDnsCompatibleBucketName: (bucketName: string) => boolean;
39
+ /**
40
+ * @internal
41
+ */
42
+ export declare const defaultConfig: {
43
+ service: string;
44
+ endpointResolver: (options: S3EndpointResolverOptions, apiInput?: {
45
+ Bucket?: string;
46
+ }) => {
47
+ url: URL;
48
+ };
49
+ retryDecider: (response?: import("@aws-amplify/core/internals/aws-client-utils").HttpResponse, error?: Error) => Promise<boolean>;
50
+ computeDelay: (attempt: number) => number;
51
+ userAgentValue: string;
52
+ useAccelerateEndpoint: boolean;
53
+ uriEscapePath: boolean;
54
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.defaultConfig = exports.isDnsCompatibleBucketName = exports.SERVICE_NAME = void 0;
6
+ var core_1 = require("@aws-amplify/core");
7
+ var aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
8
+ var utils_1 = require("./utils");
9
+ var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
10
+ var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
11
+ var DOTS_PATTERN = /\.\./;
12
+ /**
13
+ * The service name used to sign requests if the API requires authentication.
14
+ */
15
+ exports.SERVICE_NAME = 's3';
16
+ /**
17
+ * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
18
+ */
19
+ var endpointResolver = function (options, apiInput) {
20
+ var region = options.region, useAccelerateEndpoint = options.useAccelerateEndpoint, customEndpoint = options.customEndpoint, forcePathStyle = options.forcePathStyle;
21
+ var endpoint;
22
+ // 1. get base endpoint
23
+ if (customEndpoint) {
24
+ endpoint = new URL(customEndpoint);
25
+ }
26
+ else if (useAccelerateEndpoint) {
27
+ if (forcePathStyle) {
28
+ throw new Error('Path style URLs are not supported with S3 Transfer Acceleration.');
29
+ }
30
+ endpoint = new URL("https://s3-accelerate.".concat((0, aws_client_utils_1.getDnsSuffix)(region)));
31
+ }
32
+ else {
33
+ endpoint = new URL("https://s3.".concat(region, ".").concat((0, aws_client_utils_1.getDnsSuffix)(region)));
34
+ }
35
+ // 2. inject bucket name
36
+ if (apiInput === null || apiInput === void 0 ? void 0 : apiInput.Bucket) {
37
+ if (!(0, exports.isDnsCompatibleBucketName)(apiInput.Bucket)) {
38
+ throw new Error("Invalid bucket name: \"".concat(apiInput.Bucket, "\"."));
39
+ }
40
+ if (forcePathStyle || apiInput.Bucket.includes('.')) {
41
+ endpoint.pathname = "/".concat(apiInput.Bucket);
42
+ }
43
+ else {
44
+ endpoint.host = "".concat(apiInput.Bucket, ".").concat(endpoint.host);
45
+ }
46
+ }
47
+ return { url: endpoint };
48
+ };
49
+ /**
50
+ * Determines whether a given string is DNS compliant per the rules outlined by
51
+ * S3. Length, capitaization, and leading dot restrictions are enforced by the
52
+ * DOMAIN_PATTERN regular expression.
53
+ * @internal
54
+ *
55
+ * @see https://github.com/aws/aws-sdk-js-v3/blob/f2da6182298d4d6b02e84fb723492c07c27469a8/packages/middleware-bucket-endpoint/src/bucketHostnameUtils.ts#L39-L48
56
+ * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
57
+ */
58
+ var isDnsCompatibleBucketName = function (bucketName) {
59
+ return DOMAIN_PATTERN.test(bucketName) &&
60
+ !IP_ADDRESS_PATTERN.test(bucketName) &&
61
+ !DOTS_PATTERN.test(bucketName);
62
+ };
63
+ exports.isDnsCompatibleBucketName = isDnsCompatibleBucketName;
64
+ /**
65
+ * @internal
66
+ */
67
+ exports.defaultConfig = {
68
+ service: exports.SERVICE_NAME,
69
+ endpointResolver: endpointResolver,
70
+ retryDecider: (0, aws_client_utils_1.getRetryDecider)(utils_1.parseXmlError),
71
+ computeDelay: aws_client_utils_1.jitteredBackoff,
72
+ userAgentValue: (0, core_1.getAmplifyUserAgent)(),
73
+ useAccelerateEndpoint: false,
74
+ uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83
75
+ };
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
3
+ import type { CompleteMultipartUploadCommandInput, CompleteMultipartUploadCommandOutput } from './types';
4
+ export type CompleteMultipartUploadInput = Pick<CompleteMultipartUploadCommandInput, 'Bucket' | 'Key' | 'UploadId' | 'MultipartUpload' | 'SSECustomerAlgorithm' | 'SSECustomerKey' | 'SSECustomerKeyMD5'>;
5
+ export type CompleteMultipartUploadOutput = Pick<CompleteMultipartUploadCommandOutput, '$metadata' | 'Key' | 'ETag' | 'Location'>;
6
+ export declare const completeMultipartUpload: (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: CompleteMultipartUploadInput) => Promise<CompleteMultipartUploadOutput>;
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __assign = (this && this.__assign) || function () {
5
+ __assign = Object.assign || function(t) {
6
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7
+ s = arguments[i];
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
+ t[p] = s[p];
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
31
+ 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;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.completeMultipartUpload = void 0;
53
+ var aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
54
+ var composers_1 = require("@aws-amplify/core/internals/aws-client-utils/composers");
55
+ var base_1 = require("./base");
56
+ var utils_1 = require("./utils");
57
+ var INVALID_PARAMETER_ERROR_MSG = 'Invalid parameter for ComplteMultipartUpload API';
58
+ var completeMultipartUploadSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
59
+ var headers, url;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0: return [4 /*yield*/, (0, utils_1.serializeObjectSsecOptionsToHeaders)(input)];
63
+ case 1:
64
+ headers = _a.sent();
65
+ headers['content-type'] = 'application/xml';
66
+ url = new URL(endpoint.url.toString());
67
+ url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
68
+ url.search = new URLSearchParams({ uploadId: input.UploadId }).toString();
69
+ return [2 /*return*/, {
70
+ method: 'POST',
71
+ headers: headers,
72
+ url: url,
73
+ body: '<?xml version="1.0" encoding="UTF-8"?>' +
74
+ serializeCompletedMultipartUpload(input.MultipartUpload),
75
+ }];
76
+ }
77
+ });
78
+ }); };
79
+ var serializeCompletedMultipartUpload = function (input) {
80
+ var _a;
81
+ if (!((_a = input.Parts) === null || _a === void 0 ? void 0 : _a.length)) {
82
+ throw new Error("".concat(INVALID_PARAMETER_ERROR_MSG, ": ").concat(input));
83
+ }
84
+ return "<CompleteMultipartUpload xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">".concat(input.Parts.map(serializeCompletedPartList).join(''), "</CompleteMultipartUpload>");
85
+ };
86
+ var serializeCompletedPartList = function (input) {
87
+ if (!input.ETag || input.PartNumber == null) {
88
+ throw new Error("".concat(INVALID_PARAMETER_ERROR_MSG, ": ").concat(input));
89
+ }
90
+ return "<Part><ETag>".concat(input.ETag, "</ETag><PartNumber>").concat(input.PartNumber, "</PartNumber></Part>");
91
+ };
92
+ /**
93
+ * Parse CompleteMultipartUpload API response payload, which may be empty or error indicating internal
94
+ * server error, even when the status code is 200.
95
+ *
96
+ * Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4
97
+ */
98
+ var parseXmlBodyOrThrow = function (response) { return __awaiter(void 0, void 0, void 0, function () {
99
+ var parsed, error;
100
+ return __generator(this, function (_a) {
101
+ switch (_a.label) {
102
+ case 0: return [4 /*yield*/, (0, utils_1.parseXmlBody)(response)];
103
+ case 1:
104
+ parsed = _a.sent();
105
+ if (!(parsed.Code !== undefined && parsed.Message !== undefined)) return [3 /*break*/, 3];
106
+ return [4 /*yield*/, (0, utils_1.parseXmlError)(__assign(__assign({}, response), { statusCode: 500 }))];
107
+ case 2:
108
+ error = _a.sent();
109
+ error.$metadata.httpStatusCode = response.statusCode;
110
+ throw error;
111
+ case 3: return [2 /*return*/, parsed];
112
+ }
113
+ });
114
+ }); };
115
+ var completeMultipartUploadDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
116
+ var error, parsed, contents;
117
+ return __generator(this, function (_a) {
118
+ switch (_a.label) {
119
+ case 0:
120
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
121
+ return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
122
+ case 1:
123
+ error = _a.sent();
124
+ throw error;
125
+ case 2: return [4 /*yield*/, parseXmlBodyOrThrow(response)];
126
+ case 3:
127
+ parsed = _a.sent();
128
+ contents = (0, utils_1.map)(parsed, {
129
+ ETag: 'ETag',
130
+ Key: 'Key',
131
+ Location: 'Location',
132
+ });
133
+ return [2 /*return*/, __assign({ $metadata: (0, aws_client_utils_1.parseMetadata)(response) }, contents)];
134
+ }
135
+ });
136
+ }); };
137
+ // CompleteMultiPartUpload API returns 200 status code with empty body or error message.
138
+ // This indicates internal server error after the response has been sent to the client.
139
+ // Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4
140
+ var retryWhenErrorWith200StatusCode = function (response, error) { return __awaiter(void 0, void 0, void 0, function () {
141
+ var parsed, defaultRetryDecider;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0:
145
+ if (!(response.statusCode === 200)) return [3 /*break*/, 2];
146
+ if (!response.body) {
147
+ return [2 /*return*/, true];
148
+ }
149
+ return [4 /*yield*/, (0, utils_1.parseXmlBody)(response)];
150
+ case 1:
151
+ parsed = _a.sent();
152
+ if (parsed.Code !== undefined && parsed.Message !== undefined) {
153
+ return [2 /*return*/, true];
154
+ }
155
+ return [2 /*return*/, false];
156
+ case 2:
157
+ defaultRetryDecider = base_1.defaultConfig.retryDecider;
158
+ return [2 /*return*/, defaultRetryDecider(response, error)];
159
+ }
160
+ });
161
+ }); };
162
+ exports.completeMultipartUpload = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, completeMultipartUploadSerializer, completeMultipartUploadDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text', retryDecider: retryWhenErrorWith200StatusCode }));
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
3
+ import { MetadataBearer } from '@aws-sdk/types';
4
+ import type { CopyObjectCommandInput } from './types';
5
+ /**
6
+ * @see {@link S3ProviderCopyConfig}
7
+ */
8
+ export type CopyObjectInput = Pick<CopyObjectCommandInput, 'Bucket' | 'CopySource' | 'Key' | 'MetadataDirective' | 'CacheControl' | 'ContentType' | 'ContentDisposition' | 'ContentLanguage' | 'Expires' | 'ACL' | 'ServerSideEncryption' | 'SSECustomerAlgorithm' | 'SSECustomerKey' | 'SSECustomerKeyMD5' | 'SSEKMSKeyId' | 'Tagging' | 'Metadata'>;
9
+ export type CopyObjectOutput = MetadataBearer;
10
+ export declare const copyObject: (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"> & {
11
+ region?: string;
12
+ maxAttempts?: number;
13
+ credentials?: import("@aws-sdk/types").Credentials | (() => Promise<import("@aws-sdk/types").Credentials>);
14
+ retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
15
+ computeDelay?: (attempt: number) => number;
16
+ abortSignal?: AbortSignal;
17
+ service?: string;
18
+ uriEscapePath?: boolean;
19
+ endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
20
+ emitter?: import("events").EventEmitter;
21
+ responseType?: "blob" | "text";
22
+ userAgentHeader?: string;
23
+ userAgentValue?: string;
24
+ }, input: CopyObjectInput) => Promise<MetadataBearer>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __assign = (this && this.__assign) || function () {
5
+ __assign = Object.assign || function(t) {
6
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7
+ s = arguments[i];
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
+ t[p] = s[p];
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
31
+ 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;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.copyObject = void 0;
53
+ var aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
54
+ var composers_1 = require("@aws-amplify/core/internals/aws-client-utils/composers");
55
+ var base_1 = require("./base");
56
+ var utils_1 = require("./utils");
57
+ var copyObjectSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
58
+ var headers, _a, url;
59
+ return __generator(this, function (_b) {
60
+ switch (_b.label) {
61
+ case 0:
62
+ _a = [{}];
63
+ return [4 /*yield*/, (0, utils_1.serializeObjectConfigsToHeaders)(input)];
64
+ case 1:
65
+ headers = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), (0, utils_1.assignStringVariables)({
66
+ 'x-amz-copy-source': input.CopySource,
67
+ 'x-amz-metadata-directive': input.MetadataDirective,
68
+ })]);
69
+ url = new URL(endpoint.url.toString());
70
+ url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
71
+ return [2 /*return*/, {
72
+ method: 'PUT',
73
+ headers: headers,
74
+ url: url,
75
+ }];
76
+ }
77
+ });
78
+ }); };
79
+ var copyObjectDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
80
+ var error;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0:
84
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
85
+ return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
86
+ case 1:
87
+ error = _a.sent();
88
+ throw error;
89
+ case 2: return [4 /*yield*/, (0, utils_1.parseXmlBody)(response)];
90
+ case 3:
91
+ _a.sent();
92
+ return [2 /*return*/, {
93
+ $metadata: (0, aws_client_utils_1.parseMetadata)(response),
94
+ }];
95
+ }
96
+ });
97
+ }); };
98
+ exports.copyObject = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, copyObjectSerializer, copyObjectDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text' }));
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" />
2
+ import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
3
+ import type { CreateMultipartUploadCommandInput, CreateMultipartUploadCommandOutput } from './types';
4
+ import type { PutObjectInput } from './putObject';
5
+ export type CreateMultipartUploadInput = Extract<CreateMultipartUploadCommandInput, PutObjectInput>;
6
+ export type CreateMultipartUploadOutput = Pick<CreateMultipartUploadCommandOutput, 'UploadId' | '$metadata'>;
7
+ export declare const createMultipartUpload: (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"> & {
8
+ region?: string;
9
+ maxAttempts?: number;
10
+ credentials?: import("@aws-sdk/types/types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/types/credentials").Credentials>);
11
+ retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
12
+ computeDelay?: (attempt: number) => number;
13
+ abortSignal?: AbortSignal;
14
+ service?: string;
15
+ uriEscapePath?: boolean;
16
+ endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
17
+ emitter?: import("events").EventEmitter;
18
+ responseType?: "blob" | "text";
19
+ userAgentHeader?: string;
20
+ userAgentValue?: string;
21
+ }, input: CreateMultipartUploadCommandInput) => Promise<CreateMultipartUploadOutput>;