@aws-amplify/storage 5.6.3 → 5.6.4-api-v6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2 -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 +3 -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/src/types/Provider.ts +7 -2
- 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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteObject = exports.headObject = exports.copyObject = exports.abortMultipartUpload = exports.listParts = exports.completeMultipartUpload = exports.uploadPart = exports.createMultipartUpload = exports.putObject = exports.listObjectsV2 = exports.getPresignedGetObjectUrl = exports.getObject = exports.SERVICE_NAME = void 0;
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
require("@aws-amplify/core/polyfills/URL"); // TODO: [v6] install react-native-url-polyfill separately
|
|
7
|
+
var base_1 = require("./base");
|
|
8
|
+
Object.defineProperty(exports, "SERVICE_NAME", { enumerable: true, get: function () { return base_1.SERVICE_NAME; } });
|
|
9
|
+
var getObject_1 = require("./getObject");
|
|
10
|
+
Object.defineProperty(exports, "getObject", { enumerable: true, get: function () { return getObject_1.getObject; } });
|
|
11
|
+
Object.defineProperty(exports, "getPresignedGetObjectUrl", { enumerable: true, get: function () { return getObject_1.getPresignedGetObjectUrl; } });
|
|
12
|
+
var listObjectsV2_1 = require("./listObjectsV2");
|
|
13
|
+
Object.defineProperty(exports, "listObjectsV2", { enumerable: true, get: function () { return listObjectsV2_1.listObjectsV2; } });
|
|
14
|
+
var putObject_1 = require("./putObject");
|
|
15
|
+
Object.defineProperty(exports, "putObject", { enumerable: true, get: function () { return putObject_1.putObject; } });
|
|
16
|
+
var createMultipartUpload_1 = require("./createMultipartUpload");
|
|
17
|
+
Object.defineProperty(exports, "createMultipartUpload", { enumerable: true, get: function () { return createMultipartUpload_1.createMultipartUpload; } });
|
|
18
|
+
var uploadPart_1 = require("./uploadPart");
|
|
19
|
+
Object.defineProperty(exports, "uploadPart", { enumerable: true, get: function () { return uploadPart_1.uploadPart; } });
|
|
20
|
+
var completeMultipartUpload_1 = require("./completeMultipartUpload");
|
|
21
|
+
Object.defineProperty(exports, "completeMultipartUpload", { enumerable: true, get: function () { return completeMultipartUpload_1.completeMultipartUpload; } });
|
|
22
|
+
var listParts_1 = require("./listParts");
|
|
23
|
+
Object.defineProperty(exports, "listParts", { enumerable: true, get: function () { return listParts_1.listParts; } });
|
|
24
|
+
var abortMultipartUpload_1 = require("./abortMultipartUpload");
|
|
25
|
+
Object.defineProperty(exports, "abortMultipartUpload", { enumerable: true, get: function () { return abortMultipartUpload_1.abortMultipartUpload; } });
|
|
26
|
+
var copyObject_1 = require("./copyObject");
|
|
27
|
+
Object.defineProperty(exports, "copyObject", { enumerable: true, get: function () { return copyObject_1.copyObject; } });
|
|
28
|
+
var headObject_1 = require("./headObject");
|
|
29
|
+
Object.defineProperty(exports, "headObject", { enumerable: true, get: function () { return headObject_1.headObject; } });
|
|
30
|
+
var deleteObject_1 = require("./deleteObject");
|
|
31
|
+
Object.defineProperty(exports, "deleteObject", { enumerable: true, get: function () { return deleteObject_1.deleteObject; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
|
|
3
|
+
import type { ListObjectsV2CommandInput, ListObjectsV2CommandOutput } from './types';
|
|
4
|
+
export type ListObjectsV2Input = ListObjectsV2CommandInput;
|
|
5
|
+
export type ListObjectsV2Output = ListObjectsV2CommandOutput;
|
|
6
|
+
export declare const listObjectsV2: (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: ListObjectsV2CommandInput) => Promise<ListObjectsV2CommandOutput>;
|
|
@@ -0,0 +1,146 @@
|
|
|
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.listObjectsV2 = 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 listObjectsV2Serializer = function (input, endpoint) {
|
|
58
|
+
var headers = (0, utils_1.assignStringVariables)({
|
|
59
|
+
'x-amz-request-payer': input.RequestPayer,
|
|
60
|
+
'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,
|
|
61
|
+
});
|
|
62
|
+
var query = (0, utils_1.assignStringVariables)({
|
|
63
|
+
'list-type': '2',
|
|
64
|
+
'continuation-token': input.ContinuationToken,
|
|
65
|
+
delimiter: input.Delimiter,
|
|
66
|
+
'encoding-type': input.EncodingType,
|
|
67
|
+
'fetch-owner': input.FetchOwner,
|
|
68
|
+
'max-keys': input.MaxKeys,
|
|
69
|
+
prefix: input.Prefix,
|
|
70
|
+
'start-after': input.StartAfter,
|
|
71
|
+
});
|
|
72
|
+
var url = new URL(endpoint.url.toString());
|
|
73
|
+
url.search = new URLSearchParams(query).toString();
|
|
74
|
+
return {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
headers: headers,
|
|
77
|
+
url: url,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
var listObjectsV2Deserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
+
var error, parsed, contents;
|
|
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 [4 /*yield*/, (0, utils_1.parseXmlBody)(response)];
|
|
91
|
+
case 3:
|
|
92
|
+
parsed = _a.sent();
|
|
93
|
+
contents = (0, utils_1.map)(parsed, {
|
|
94
|
+
CommonPrefixes: [
|
|
95
|
+
'CommonPrefixes',
|
|
96
|
+
function (value) { return (0, utils_1.emptyArrayGuard)(value, deserializeCommonPrefixList); },
|
|
97
|
+
],
|
|
98
|
+
Contents: [
|
|
99
|
+
'Contents',
|
|
100
|
+
function (value) { return (0, utils_1.emptyArrayGuard)(value, deserializeObjectList); },
|
|
101
|
+
],
|
|
102
|
+
ContinuationToken: 'ContinuationToken',
|
|
103
|
+
Delimiter: 'Delimiter',
|
|
104
|
+
EncodingType: 'EncodingType',
|
|
105
|
+
IsTruncated: ['IsTruncated', utils_1.deserializeBoolean],
|
|
106
|
+
KeyCount: ['KeyCount', utils_1.deserializeNumber],
|
|
107
|
+
MaxKeys: ['MaxKeys', utils_1.deserializeNumber],
|
|
108
|
+
Name: 'Name',
|
|
109
|
+
NextContinuationToken: 'NextContinuationToken',
|
|
110
|
+
Prefix: 'Prefix',
|
|
111
|
+
StartAfter: 'StartAfter',
|
|
112
|
+
});
|
|
113
|
+
return [2 /*return*/, __assign({ $metadata: (0, aws_client_utils_1.parseMetadata)(response) }, contents)];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); };
|
|
117
|
+
var deserializeCommonPrefixList = function (output) {
|
|
118
|
+
return output.map(deserializeCommonPrefix);
|
|
119
|
+
};
|
|
120
|
+
var deserializeCommonPrefix = function (output) {
|
|
121
|
+
return (0, utils_1.map)(output, {
|
|
122
|
+
Prefix: 'Prefix',
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
var deserializeObjectList = function (output) { return output.map(deserializeObject); };
|
|
126
|
+
var deserializeObject = function (output) {
|
|
127
|
+
return (0, utils_1.map)(output, {
|
|
128
|
+
Key: 'Key',
|
|
129
|
+
LastModified: ['LastModified', utils_1.deserializeTimestamp],
|
|
130
|
+
ETag: 'ETag',
|
|
131
|
+
ChecksumAlgorithm: [
|
|
132
|
+
'ChecksumAlgorithm',
|
|
133
|
+
function (value) { return (0, utils_1.emptyArrayGuard)(value, deserializeChecksumAlgorithmList); },
|
|
134
|
+
],
|
|
135
|
+
Size: ['Size', utils_1.deserializeNumber],
|
|
136
|
+
StorageClass: 'StorageClass',
|
|
137
|
+
Owner: ['Owner', deserializeOwner],
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
var deserializeChecksumAlgorithmList = function (output) {
|
|
141
|
+
return output.map(function (entry) { return String(entry); });
|
|
142
|
+
};
|
|
143
|
+
var deserializeOwner = function (output) {
|
|
144
|
+
return (0, utils_1.map)(output, { DisplayName: 'DisplayName', ID: 'ID' });
|
|
145
|
+
};
|
|
146
|
+
exports.listObjectsV2 = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, listObjectsV2Serializer, listObjectsV2Deserializer, __assign(__assign({}, base_1.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 { ListPartsCommandInput, ListPartsCommandOutput } from './types';
|
|
4
|
+
export type ListPartsInput = Pick<ListPartsCommandInput, 'Bucket' | 'Key' | 'UploadId' | 'SSECustomerAlgorithm' | 'SSECustomerKey' | 'SSECustomerKeyMD5'>;
|
|
5
|
+
export type ListPartsOutput = Pick<ListPartsCommandOutput, 'Parts' | 'UploadId' | '$metadata'>;
|
|
6
|
+
export declare const listParts: (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: ListPartsInput) => Promise<ListPartsOutput>;
|
|
@@ -0,0 +1,110 @@
|
|
|
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.listParts = 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 listPartsSerializer = 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
|
+
url = new URL(endpoint.url.toString());
|
|
65
|
+
url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
|
|
66
|
+
url.search = new URLSearchParams({
|
|
67
|
+
uploadId: input.UploadId,
|
|
68
|
+
}).toString();
|
|
69
|
+
return [2 /*return*/, {
|
|
70
|
+
method: 'GET',
|
|
71
|
+
headers: headers,
|
|
72
|
+
url: url,
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}); };
|
|
77
|
+
var listPartsDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
+
var error, parsed, contents;
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
switch (_a.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
83
|
+
return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
|
|
84
|
+
case 1:
|
|
85
|
+
error = _a.sent();
|
|
86
|
+
throw error;
|
|
87
|
+
case 2: return [4 /*yield*/, (0, utils_1.parseXmlBody)(response)];
|
|
88
|
+
case 3:
|
|
89
|
+
parsed = _a.sent();
|
|
90
|
+
contents = (0, utils_1.map)(parsed, {
|
|
91
|
+
UploadId: 'UploadId',
|
|
92
|
+
Parts: [
|
|
93
|
+
'Part',
|
|
94
|
+
function (value) { return (0, utils_1.emptyArrayGuard)(value, deserializeCompletedPartList); },
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
return [2 /*return*/, __assign({ $metadata: (0, aws_client_utils_1.parseMetadata)(response) }, contents)];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
var deserializeCompletedPartList = function (input) {
|
|
102
|
+
return input.map(function (item) {
|
|
103
|
+
return (0, utils_1.map)(item, {
|
|
104
|
+
PartNumber: ['PartNumber', utils_1.deserializeNumber],
|
|
105
|
+
ETag: 'ETag',
|
|
106
|
+
Size: ['Size', utils_1.deserializeNumber],
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
exports.listParts = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, listPartsSerializer, listPartsDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text' }));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Endpoint, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
|
|
3
|
+
import type { PutObjectCommandInput, PutObjectCommandOutput } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Reference: {@link S3ProviderPutConfig}
|
|
6
|
+
*/
|
|
7
|
+
export type PutObjectInput = Pick<PutObjectCommandInput, 'Bucket' | 'Key' | 'Body' | 'ServerSideEncryption' | 'SSECustomerAlgorithm' | 'SSECustomerKey' | 'SSECustomerKeyMD5' | 'SSEKMSKeyId' | 'ACL' | 'CacheControl' | 'ContentDisposition' | 'ContentEncoding' | 'ContentType' | 'Expires' | 'Metadata' | 'Tagging'>;
|
|
8
|
+
export type PutObjectOutput = Pick<PutObjectCommandOutput, '$metadata' | 'ETag' | 'VersionId'>;
|
|
9
|
+
export declare const putObject: (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"> & {
|
|
10
|
+
region?: string;
|
|
11
|
+
maxAttempts?: number;
|
|
12
|
+
credentials?: import("@aws-sdk/types/types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/types/credentials").Credentials>);
|
|
13
|
+
retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
|
|
14
|
+
computeDelay?: (attempt: number) => number;
|
|
15
|
+
abortSignal?: AbortSignal;
|
|
16
|
+
service?: string;
|
|
17
|
+
uriEscapePath?: boolean;
|
|
18
|
+
endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
|
|
19
|
+
emitter?: import("events").EventEmitter;
|
|
20
|
+
responseType?: "blob" | "text";
|
|
21
|
+
userAgentHeader?: string;
|
|
22
|
+
userAgentValue?: string;
|
|
23
|
+
}, input: PutObjectInput) => Promise<PutObjectOutput>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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.putObject = 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 putObjectSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
var headers, url;
|
|
59
|
+
var _a;
|
|
60
|
+
return __generator(this, function (_b) {
|
|
61
|
+
switch (_b.label) {
|
|
62
|
+
case 0: return [4 /*yield*/, (0, utils_1.serializeObjectConfigsToHeaders)(__assign(__assign({}, input), { ContentType: (_a = input.ContentType) !== null && _a !== void 0 ? _a : 'application/octet-stream' }))];
|
|
63
|
+
case 1:
|
|
64
|
+
headers = _b.sent();
|
|
65
|
+
url = new URL(endpoint.url.toString());
|
|
66
|
+
url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
|
|
67
|
+
return [2 /*return*/, {
|
|
68
|
+
method: 'PUT',
|
|
69
|
+
headers: headers,
|
|
70
|
+
url: url,
|
|
71
|
+
body: input.Body,
|
|
72
|
+
}];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
var putObjectDeserializer = 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*/, (0, utils_1.parseXmlError)(response)];
|
|
83
|
+
case 1:
|
|
84
|
+
error = _a.sent();
|
|
85
|
+
throw error;
|
|
86
|
+
case 2: return [2 /*return*/, __assign(__assign({}, (0, utils_1.map)(response.headers, {
|
|
87
|
+
ETag: 'etag',
|
|
88
|
+
VersionId: 'x-amz-version-id',
|
|
89
|
+
})), { $metadata: (0, aws_client_utils_1.parseMetadata)(response) })];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}); };
|
|
93
|
+
exports.putObject = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, putObjectSerializer, putObjectDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text' }));
|
|
@@ -0,0 +1,20 @@
|
|
|
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.toBase64 = exports.utf8Encode = void 0;
|
|
6
|
+
function bytesToBase64(bytes) {
|
|
7
|
+
var base64Str = Array.from(bytes, function (x) { return String.fromCodePoint(x); }).join('');
|
|
8
|
+
return btoa(base64Str);
|
|
9
|
+
}
|
|
10
|
+
function utf8Encode(input) {
|
|
11
|
+
return new TextEncoder().encode(input);
|
|
12
|
+
}
|
|
13
|
+
exports.utf8Encode = utf8Encode;
|
|
14
|
+
function toBase64(input) {
|
|
15
|
+
if (typeof input === 'string') {
|
|
16
|
+
return bytesToBase64(utf8Encode(input));
|
|
17
|
+
}
|
|
18
|
+
return bytesToBase64(new Uint8Array(input.buffer, input.byteOffset, input.byteLength));
|
|
19
|
+
}
|
|
20
|
+
exports.toBase64 = toBase64;
|
|
@@ -0,0 +1,17 @@
|
|
|
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.toBase64 = exports.utf8Encode = void 0;
|
|
6
|
+
var buffer_1 = require("buffer");
|
|
7
|
+
function utf8Encode(input) {
|
|
8
|
+
return buffer_1.Buffer.from(input, 'utf-8');
|
|
9
|
+
}
|
|
10
|
+
exports.utf8Encode = utf8Encode;
|
|
11
|
+
function toBase64(input) {
|
|
12
|
+
if (typeof input === 'string') {
|
|
13
|
+
return buffer_1.Buffer.from(input, 'utf-8').toString('base64');
|
|
14
|
+
}
|
|
15
|
+
return new buffer_1.Buffer(input.buffer).toString('base64');
|
|
16
|
+
}
|
|
17
|
+
exports.toBase64 = toBase64;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const SEND_UPLOAD_PROGRESS_EVENT = "sendUploadProgress";
|
|
2
|
+
export declare const SEND_DOWNLOAD_PROGRESS_EVENT = "sendDownloadProgress";
|
|
3
|
+
export declare const NETWORK_ERROR_MESSAGE = "Network Error";
|
|
4
|
+
export declare const NETWORK_ERROR_CODE = "ECONNABORTED";
|
|
5
|
+
export declare const ABORT_ERROR_MESSAGE = "Request aborted";
|
|
6
|
+
export declare const ABORT_ERROR_CODE = "ERR_ABORTED";
|
|
7
|
+
export declare const CANCELED_ERROR_MESSAGE = "canceled";
|
|
8
|
+
export declare const CANCELED_ERROR_CODE = "ERR_CANCELED";
|
|
9
|
+
export declare const CONTENT_SHA256_HEADER = "x-amz-content-sha256";
|
|
@@ -0,0 +1,14 @@
|
|
|
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.CONTENT_SHA256_HEADER = exports.CANCELED_ERROR_CODE = exports.CANCELED_ERROR_MESSAGE = exports.ABORT_ERROR_CODE = exports.ABORT_ERROR_MESSAGE = exports.NETWORK_ERROR_CODE = exports.NETWORK_ERROR_MESSAGE = exports.SEND_DOWNLOAD_PROGRESS_EVENT = exports.SEND_UPLOAD_PROGRESS_EVENT = void 0;
|
|
6
|
+
exports.SEND_UPLOAD_PROGRESS_EVENT = 'sendUploadProgress';
|
|
7
|
+
exports.SEND_DOWNLOAD_PROGRESS_EVENT = 'sendDownloadProgress';
|
|
8
|
+
exports.NETWORK_ERROR_MESSAGE = 'Network Error';
|
|
9
|
+
exports.NETWORK_ERROR_CODE = 'ECONNABORTED';
|
|
10
|
+
exports.ABORT_ERROR_MESSAGE = 'Request aborted';
|
|
11
|
+
exports.ABORT_ERROR_CODE = 'ERR_ABORTED';
|
|
12
|
+
exports.CANCELED_ERROR_MESSAGE = 'canceled';
|
|
13
|
+
exports.CANCELED_ERROR_CODE = 'ERR_CANCELED';
|
|
14
|
+
exports.CONTENT_SHA256_HEADER = 'x-amz-content-sha256';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpRequest, MiddlewareHandler, HttpResponse } from '@aws-amplify/core/internals/aws-client-utils';
|
|
2
|
+
/**
|
|
3
|
+
* A middleware that adds the x-amz-content-sha256 header to the request if it is not already present.
|
|
4
|
+
* It's required for S3 requests in browsers where the request body is sent in 1 chunk.
|
|
5
|
+
* @see https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const contentSha256Middleware: (options: {}) => (next: MiddlewareHandler<HttpRequest, HttpResponse>) => (request: HttpRequest) => Promise<HttpResponse>;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.contentSha256Middleware = void 0;
|
|
42
|
+
var aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
|
|
43
|
+
var constants_1 = require("./constants");
|
|
44
|
+
/**
|
|
45
|
+
* A middleware that adds the x-amz-content-sha256 header to the request if it is not already present.
|
|
46
|
+
* It's required for S3 requests in browsers where the request body is sent in 1 chunk.
|
|
47
|
+
* @see https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
var contentSha256Middleware = function (options) { return function (next) {
|
|
52
|
+
return function contentSha256Middleware(request) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var hash;
|
|
55
|
+
return __generator(this, function (_a) {
|
|
56
|
+
switch (_a.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
if (!request.headers[constants_1.CONTENT_SHA256_HEADER]) return [3 /*break*/, 1];
|
|
59
|
+
return [2 /*return*/, next(request)];
|
|
60
|
+
case 1: return [4 /*yield*/, (0, aws_client_utils_1.getHashedPayload)(request.body)];
|
|
61
|
+
case 2:
|
|
62
|
+
hash = _a.sent();
|
|
63
|
+
request.headers[constants_1.CONTENT_SHA256_HEADER] = hash;
|
|
64
|
+
return [2 /*return*/, next(request)];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}; };
|
|
70
|
+
exports.contentSha256Middleware = contentSha256Middleware;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SEND_DOWNLOAD_PROGRESS_EVENT, SEND_UPLOAD_PROGRESS_EVENT, CANCELED_ERROR_MESSAGE, CONTENT_SHA256_HEADER, } from './constants';
|
|
2
|
+
export { s3TransferHandler } from './s3TransferHandler/xhr';
|
|
3
|
+
export { parser } from './xmlParser/dom';
|
|
4
|
+
export { isCancelError } from './xhrTransferHandler';
|
|
5
|
+
export { toBase64, utf8Encode } from './base64/index.browser';
|