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