@aws-amplify/storage 5.6.4-graphql-api-functional-options.1 → 5.6.4-unstable.28bc873.6

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,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,71 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { getAmplifyUserAgent } from '@aws-amplify/core';
4
+ import { getDnsSuffix, jitteredBackoff, getRetryDecider, } from '@aws-amplify/core/internals/aws-client-utils';
5
+ import { parseXmlError } from './utils';
6
+ var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
7
+ var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
8
+ var DOTS_PATTERN = /\.\./;
9
+ /**
10
+ * The service name used to sign requests if the API requires authentication.
11
+ */
12
+ export var SERVICE_NAME = 's3';
13
+ /**
14
+ * The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
15
+ */
16
+ var endpointResolver = function (options, apiInput) {
17
+ var region = options.region, useAccelerateEndpoint = options.useAccelerateEndpoint, customEndpoint = options.customEndpoint, forcePathStyle = options.forcePathStyle;
18
+ var endpoint;
19
+ // 1. get base endpoint
20
+ if (customEndpoint) {
21
+ endpoint = new URL(customEndpoint);
22
+ }
23
+ else if (useAccelerateEndpoint) {
24
+ if (forcePathStyle) {
25
+ throw new Error('Path style URLs are not supported with S3 Transfer Acceleration.');
26
+ }
27
+ endpoint = new URL("https://s3-accelerate.".concat(getDnsSuffix(region)));
28
+ }
29
+ else {
30
+ endpoint = new URL("https://s3.".concat(region, ".").concat(getDnsSuffix(region)));
31
+ }
32
+ // 2. inject bucket name
33
+ if (apiInput === null || apiInput === void 0 ? void 0 : apiInput.Bucket) {
34
+ if (!isDnsCompatibleBucketName(apiInput.Bucket)) {
35
+ throw new Error("Invalid bucket name: \"".concat(apiInput.Bucket, "\"."));
36
+ }
37
+ if (forcePathStyle || apiInput.Bucket.includes('.')) {
38
+ endpoint.pathname = "/".concat(apiInput.Bucket);
39
+ }
40
+ else {
41
+ endpoint.host = "".concat(apiInput.Bucket, ".").concat(endpoint.host);
42
+ }
43
+ }
44
+ return { url: endpoint };
45
+ };
46
+ /**
47
+ * Determines whether a given string is DNS compliant per the rules outlined by
48
+ * S3. Length, capitaization, and leading dot restrictions are enforced by the
49
+ * DOMAIN_PATTERN regular expression.
50
+ * @internal
51
+ *
52
+ * @see https://github.com/aws/aws-sdk-js-v3/blob/f2da6182298d4d6b02e84fb723492c07c27469a8/packages/middleware-bucket-endpoint/src/bucketHostnameUtils.ts#L39-L48
53
+ * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
54
+ */
55
+ export var isDnsCompatibleBucketName = function (bucketName) {
56
+ return DOMAIN_PATTERN.test(bucketName) &&
57
+ !IP_ADDRESS_PATTERN.test(bucketName) &&
58
+ !DOTS_PATTERN.test(bucketName);
59
+ };
60
+ /**
61
+ * @internal
62
+ */
63
+ export var defaultConfig = {
64
+ service: SERVICE_NAME,
65
+ endpointResolver: endpointResolver,
66
+ retryDecider: getRetryDecider(parseXmlError),
67
+ computeDelay: jitteredBackoff,
68
+ userAgentValue: getAmplifyUserAgent(),
69
+ useAccelerateEndpoint: false,
70
+ uriEscapePath: false, // Required by S3. See https://github.com/aws/aws-sdk-js-v3/blob/9ba012dfa3a3429aa2db0f90b3b0b3a7a31f9bc3/packages/signature-v4/src/SignatureV4.ts#L76-L83
71
+ };
@@ -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,159 @@
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, parseXmlBody, parseXmlError, s3TransferHandler, serializePathnameObjectKey, serializeObjectSsecOptionsToHeaders, } from './utils';
54
+ var INVALID_PARAMETER_ERROR_MSG = 'Invalid parameter for ComplteMultipartUpload API';
55
+ var completeMultipartUploadSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
56
+ var headers, url;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0: return [4 /*yield*/, serializeObjectSsecOptionsToHeaders(input)];
60
+ case 1:
61
+ headers = _a.sent();
62
+ headers['content-type'] = 'application/xml';
63
+ url = new URL(endpoint.url.toString());
64
+ url.pathname = serializePathnameObjectKey(url, input.Key);
65
+ url.search = new URLSearchParams({ uploadId: input.UploadId }).toString();
66
+ return [2 /*return*/, {
67
+ method: 'POST',
68
+ headers: headers,
69
+ url: url,
70
+ body: '<?xml version="1.0" encoding="UTF-8"?>' +
71
+ serializeCompletedMultipartUpload(input.MultipartUpload),
72
+ }];
73
+ }
74
+ });
75
+ }); };
76
+ var serializeCompletedMultipartUpload = function (input) {
77
+ var _a;
78
+ if (!((_a = input.Parts) === null || _a === void 0 ? void 0 : _a.length)) {
79
+ throw new Error("".concat(INVALID_PARAMETER_ERROR_MSG, ": ").concat(input));
80
+ }
81
+ return "<CompleteMultipartUpload xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">".concat(input.Parts.map(serializeCompletedPartList).join(''), "</CompleteMultipartUpload>");
82
+ };
83
+ var serializeCompletedPartList = function (input) {
84
+ if (!input.ETag || input.PartNumber == null) {
85
+ throw new Error("".concat(INVALID_PARAMETER_ERROR_MSG, ": ").concat(input));
86
+ }
87
+ return "<Part><ETag>".concat(input.ETag, "</ETag><PartNumber>").concat(input.PartNumber, "</PartNumber></Part>");
88
+ };
89
+ /**
90
+ * Parse CompleteMultipartUpload API response payload, which may be empty or error indicating internal
91
+ * server error, even when the status code is 200.
92
+ *
93
+ * Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4
94
+ */
95
+ var parseXmlBodyOrThrow = function (response) { return __awaiter(void 0, void 0, void 0, function () {
96
+ var parsed, error;
97
+ return __generator(this, function (_a) {
98
+ switch (_a.label) {
99
+ case 0: return [4 /*yield*/, parseXmlBody(response)];
100
+ case 1:
101
+ parsed = _a.sent();
102
+ if (!(parsed.Code !== undefined && parsed.Message !== undefined)) return [3 /*break*/, 3];
103
+ return [4 /*yield*/, parseXmlError(__assign(__assign({}, response), { statusCode: 500 }))];
104
+ case 2:
105
+ error = _a.sent();
106
+ error.$metadata.httpStatusCode = response.statusCode;
107
+ throw error;
108
+ case 3: return [2 /*return*/, parsed];
109
+ }
110
+ });
111
+ }); };
112
+ var completeMultipartUploadDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var error, parsed, contents;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
118
+ return [4 /*yield*/, parseXmlError(response)];
119
+ case 1:
120
+ error = _a.sent();
121
+ throw error;
122
+ case 2: return [4 /*yield*/, parseXmlBodyOrThrow(response)];
123
+ case 3:
124
+ parsed = _a.sent();
125
+ contents = map(parsed, {
126
+ ETag: 'ETag',
127
+ Key: 'Key',
128
+ Location: 'Location',
129
+ });
130
+ return [2 /*return*/, __assign({ $metadata: parseMetadata(response) }, contents)];
131
+ }
132
+ });
133
+ }); };
134
+ // CompleteMultiPartUpload API returns 200 status code with empty body or error message.
135
+ // This indicates internal server error after the response has been sent to the client.
136
+ // Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html#API_CompleteMultipartUpload_Example_4
137
+ var retryWhenErrorWith200StatusCode = function (response, error) { return __awaiter(void 0, void 0, void 0, function () {
138
+ var parsed, defaultRetryDecider;
139
+ return __generator(this, function (_a) {
140
+ switch (_a.label) {
141
+ case 0:
142
+ if (!(response.statusCode === 200)) return [3 /*break*/, 2];
143
+ if (!response.body) {
144
+ return [2 /*return*/, true];
145
+ }
146
+ return [4 /*yield*/, parseXmlBody(response)];
147
+ case 1:
148
+ parsed = _a.sent();
149
+ if (parsed.Code !== undefined && parsed.Message !== undefined) {
150
+ return [2 /*return*/, true];
151
+ }
152
+ return [2 /*return*/, false];
153
+ case 2:
154
+ defaultRetryDecider = defaultConfig.retryDecider;
155
+ return [2 /*return*/, defaultRetryDecider(response, error)];
156
+ }
157
+ });
158
+ }); };
159
+ export var completeMultipartUpload = composeServiceApi(s3TransferHandler, completeMultipartUploadSerializer, completeMultipartUploadDeserializer, __assign(__assign({}, 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,95 @@
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 { assignStringVariables, parseXmlBody, parseXmlError, s3TransferHandler, serializeObjectConfigsToHeaders, serializePathnameObjectKey, } from './utils';
54
+ var copyObjectSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var headers, _a, url;
56
+ return __generator(this, function (_b) {
57
+ switch (_b.label) {
58
+ case 0:
59
+ _a = [{}];
60
+ return [4 /*yield*/, serializeObjectConfigsToHeaders(input)];
61
+ case 1:
62
+ headers = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), assignStringVariables({
63
+ 'x-amz-copy-source': input.CopySource,
64
+ 'x-amz-metadata-directive': input.MetadataDirective,
65
+ })]);
66
+ url = new URL(endpoint.url.toString());
67
+ url.pathname = serializePathnameObjectKey(url, input.Key);
68
+ return [2 /*return*/, {
69
+ method: 'PUT',
70
+ headers: headers,
71
+ url: url,
72
+ }];
73
+ }
74
+ });
75
+ }); };
76
+ var copyObjectDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
77
+ var error;
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
82
+ return [4 /*yield*/, parseXmlError(response)];
83
+ case 1:
84
+ error = _a.sent();
85
+ throw error;
86
+ case 2: return [4 /*yield*/, parseXmlBody(response)];
87
+ case 3:
88
+ _a.sent();
89
+ return [2 /*return*/, {
90
+ $metadata: parseMetadata(response),
91
+ }];
92
+ }
93
+ });
94
+ }); };
95
+ export var copyObject = composeServiceApi(s3TransferHandler, copyObjectSerializer, copyObjectDeserializer, __assign(__assign({}, 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>;
@@ -0,0 +1,92 @@
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, parseXmlBody, parseXmlError, s3TransferHandler, serializeObjectConfigsToHeaders, serializePathnameObjectKey, } from './utils';
54
+ var createMultipartUploadSerializer = 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*/, serializeObjectConfigsToHeaders(input)];
59
+ case 1:
60
+ headers = _a.sent();
61
+ url = new URL(endpoint.url.toString());
62
+ url.pathname = serializePathnameObjectKey(url, input.Key);
63
+ url.search = 'uploads';
64
+ return [2 /*return*/, {
65
+ method: 'POST',
66
+ headers: headers,
67
+ url: url,
68
+ }];
69
+ }
70
+ });
71
+ }); };
72
+ var createMultipartUploadDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
73
+ var error, parsed, contents;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0:
77
+ if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
78
+ return [4 /*yield*/, parseXmlError(response)];
79
+ case 1:
80
+ error = _a.sent();
81
+ throw error;
82
+ case 2: return [4 /*yield*/, parseXmlBody(response)];
83
+ case 3:
84
+ parsed = _a.sent();
85
+ contents = map(parsed, {
86
+ UploadId: 'UploadId',
87
+ });
88
+ return [2 /*return*/, __assign({ $metadata: parseMetadata(response) }, contents)];
89
+ }
90
+ });
91
+ }); };
92
+ export var createMultipartUpload = composeServiceApi(s3TransferHandler, createMultipartUploadSerializer, createMultipartUploadDeserializer, __assign(__assign({}, defaultConfig), { responseType: 'text' }));
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
3
+ import type { DeleteObjectCommandInput, DeleteObjectCommandOutput } from './types';
4
+ export type DeleteObjectInput = Pick<DeleteObjectCommandInput, 'Bucket' | 'Key'>;
5
+ export type DeleteObjectOutput = DeleteObjectCommandOutput;
6
+ export declare const deleteObject: (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: DeleteObjectInput) => Promise<DeleteObjectCommandOutput>;