@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,95 @@
|
|
|
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.createMultipartUpload = 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 createMultipartUploadSerializer = 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.serializeObjectConfigsToHeaders)(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 = 'uploads';
|
|
67
|
+
return [2 /*return*/, {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
headers: headers,
|
|
70
|
+
url: url,
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}); };
|
|
75
|
+
var createMultipartUploadDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
|
+
var error, parsed, contents;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
81
|
+
return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
|
|
82
|
+
case 1:
|
|
83
|
+
error = _a.sent();
|
|
84
|
+
throw error;
|
|
85
|
+
case 2: return [4 /*yield*/, (0, utils_1.parseXmlBody)(response)];
|
|
86
|
+
case 3:
|
|
87
|
+
parsed = _a.sent();
|
|
88
|
+
contents = (0, utils_1.map)(parsed, {
|
|
89
|
+
UploadId: 'UploadId',
|
|
90
|
+
});
|
|
91
|
+
return [2 /*return*/, __assign({ $metadata: (0, aws_client_utils_1.parseMetadata)(response) }, contents)];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); };
|
|
95
|
+
exports.createMultipartUpload = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, createMultipartUploadSerializer, createMultipartUploadDeserializer, __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 { DeleteObjectCommandInput, DeleteObjectCommandOutput } from './types';
|
|
4
|
+
export type DeleteObjectInput = Pick<DeleteObjectCommandInput, 'Bucket' | 'Key'>;
|
|
5
|
+
export type DeleteObjectOutput = DeleteObjectCommandOutput;
|
|
6
|
+
export declare const deleteObject: (config: Omit<import("@aws-amplify/core/internals/aws-client-utils").UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<HttpResponse> & import("@aws-amplify/core/internals/aws-client-utils").SigningOptions & import("./runtime/xhrTransferHandler").XhrTransferHandlerOptions & import("@aws-amplify/core/internals/aws-client-utils").ServiceClientOptions & Partial<import("@aws-amplify/core/internals/aws-client-utils").UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<HttpResponse> & import("@aws-amplify/core/internals/aws-client-utils").SigningOptions & import("./runtime/xhrTransferHandler").XhrTransferHandlerOptions & import("@aws-amplify/core/internals/aws-client-utils").ServiceClientOptions>, "region" | "maxAttempts" | "credentials" | "retryDecider" | "computeDelay" | "abortSignal" | "service" | "uriEscapePath" | "endpointResolver" | "emitter" | "responseType" | "userAgentHeader" | "userAgentValue"> & {
|
|
7
|
+
region?: string;
|
|
8
|
+
maxAttempts?: number;
|
|
9
|
+
credentials?: import("@aws-sdk/types/types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/types/credentials").Credentials>);
|
|
10
|
+
retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
|
|
11
|
+
computeDelay?: (attempt: number) => number;
|
|
12
|
+
abortSignal?: AbortSignal;
|
|
13
|
+
service?: string;
|
|
14
|
+
uriEscapePath?: boolean;
|
|
15
|
+
endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
|
|
16
|
+
emitter?: import("events").EventEmitter;
|
|
17
|
+
responseType?: "blob" | "text";
|
|
18
|
+
userAgentHeader?: string;
|
|
19
|
+
userAgentValue?: string;
|
|
20
|
+
}, input: DeleteObjectInput) => Promise<DeleteObjectCommandOutput>;
|
|
@@ -0,0 +1,86 @@
|
|
|
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.deleteObject = 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 deleteObjectSerializer = function (input, endpoint) {
|
|
58
|
+
var url = new URL(endpoint.url.toString());
|
|
59
|
+
url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
|
|
60
|
+
return {
|
|
61
|
+
method: 'DELETE',
|
|
62
|
+
headers: {},
|
|
63
|
+
url: url,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
var deleteObjectDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var error, content;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
72
|
+
return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
|
|
73
|
+
case 1:
|
|
74
|
+
error = _a.sent();
|
|
75
|
+
throw error;
|
|
76
|
+
case 2:
|
|
77
|
+
content = (0, utils_1.map)(response.headers, {
|
|
78
|
+
DeleteMarker: ['x-amz-delete-marker', utils_1.deserializeBoolean],
|
|
79
|
+
VersionId: 'x-amz-version-id',
|
|
80
|
+
RequestCharged: 'x-amz-request-charged',
|
|
81
|
+
});
|
|
82
|
+
return [2 /*return*/, __assign(__assign({}, content), { $metadata: (0, aws_client_utils_1.parseMetadata)(response) })];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}); };
|
|
86
|
+
exports.deleteObject = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, deleteObjectSerializer, deleteObjectDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text' }));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Endpoint, UserAgentOptions, PresignUrlOptions } from '@aws-amplify/core/internals/aws-client-utils';
|
|
3
|
+
import { S3EndpointResolverOptions } from './base';
|
|
4
|
+
import type { GetObjectCommandInput, GetObjectCommandOutput } from './types';
|
|
5
|
+
export type GetObjectInput = Pick<GetObjectCommandInput, 'Bucket' | 'Key' | 'ResponseCacheControl' | 'ResponseContentDisposition' | 'ResponseContentEncoding' | 'ResponseContentLanguage' | 'ResponseContentType' | 'SSECustomerAlgorithm' | 'SSECustomerKey' | 'SSECustomerKeyMD5'>;
|
|
6
|
+
export type GetObjectOutput = GetObjectCommandOutput;
|
|
7
|
+
export declare const getObject: (config: Omit<UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<import("@aws-amplify/core/internals/aws-client-utils").HttpResponse> & import("@aws-amplify/core/internals/aws-client-utils").SigningOptions & import("./runtime/xhrTransferHandler").XhrTransferHandlerOptions & import("@aws-amplify/core/internals/aws-client-utils").ServiceClientOptions & Partial<UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<import("@aws-amplify/core/internals/aws-client-utils").HttpResponse> & import("@aws-amplify/core/internals/aws-client-utils").SigningOptions & import("./runtime/xhrTransferHandler").XhrTransferHandlerOptions & import("@aws-amplify/core/internals/aws-client-utils").ServiceClientOptions>, "region" | "maxAttempts" | "credentials" | "retryDecider" | "computeDelay" | "abortSignal" | "service" | "uriEscapePath" | "endpointResolver" | "emitter" | "responseType" | "userAgentHeader" | "userAgentValue"> & {
|
|
8
|
+
region?: string;
|
|
9
|
+
maxAttempts?: number;
|
|
10
|
+
credentials?: import("@aws-sdk/types/types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/types/credentials").Credentials>);
|
|
11
|
+
retryDecider?: (response?: import("@aws-amplify/core/internals/aws-client-utils").HttpResponse, error?: unknown) => Promise<boolean>;
|
|
12
|
+
computeDelay?: (attempt: number) => number;
|
|
13
|
+
abortSignal?: AbortSignal;
|
|
14
|
+
service?: string;
|
|
15
|
+
uriEscapePath?: boolean;
|
|
16
|
+
endpointResolver?: (options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint;
|
|
17
|
+
emitter?: import("events").EventEmitter;
|
|
18
|
+
responseType?: "blob" | "text";
|
|
19
|
+
userAgentHeader?: string;
|
|
20
|
+
userAgentValue?: string;
|
|
21
|
+
}, input: GetObjectInput) => Promise<GetObjectCommandOutput>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a presigned URL for the `getObject` API.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare const getPresignedGetObjectUrl: (config: UserAgentOptions & PresignUrlOptions & S3EndpointResolverOptions, input: GetObjectInput) => Promise<string>;
|
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
52
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
53
|
+
if (!m) return o;
|
|
54
|
+
var i = m.call(o), r, ar = [], e;
|
|
55
|
+
try {
|
|
56
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
57
|
+
}
|
|
58
|
+
catch (error) { e = { error: error }; }
|
|
59
|
+
finally {
|
|
60
|
+
try {
|
|
61
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
62
|
+
}
|
|
63
|
+
finally { if (e) throw e.error; }
|
|
64
|
+
}
|
|
65
|
+
return ar;
|
|
66
|
+
};
|
|
67
|
+
var __values = (this && this.__values) || function(o) {
|
|
68
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
69
|
+
if (m) return m.call(o);
|
|
70
|
+
if (o && typeof o.length === "number") return {
|
|
71
|
+
next: function () {
|
|
72
|
+
if (o && i >= o.length) o = void 0;
|
|
73
|
+
return { value: o && o[i++], done: !o };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
77
|
+
};
|
|
78
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
+
exports.getPresignedGetObjectUrl = exports.getObject = void 0;
|
|
80
|
+
var aws_client_utils_1 = require("@aws-amplify/core/internals/aws-client-utils");
|
|
81
|
+
var composers_1 = require("@aws-amplify/core/internals/aws-client-utils/composers");
|
|
82
|
+
var core_1 = require("@aws-amplify/core");
|
|
83
|
+
var base_1 = require("./base");
|
|
84
|
+
var utils_1 = require("./utils");
|
|
85
|
+
var getObjectSerializer = function (input, endpoint) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var headers, query, url;
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
switch (_a.label) {
|
|
89
|
+
case 0: return [4 /*yield*/, (0, utils_1.serializeObjectSsecOptionsToHeaders)(input)];
|
|
90
|
+
case 1:
|
|
91
|
+
headers = _a.sent();
|
|
92
|
+
query = (0, utils_1.map)(input, {
|
|
93
|
+
'response-cache-control': 'ResponseCacheControl',
|
|
94
|
+
'response-content-disposition': 'ResponseContentDisposition',
|
|
95
|
+
'response-content-encoding': 'ResponseContentEncoding',
|
|
96
|
+
'response-content-language': 'ResponseContentLanguage',
|
|
97
|
+
'response-content-type': 'ResponseContentType',
|
|
98
|
+
});
|
|
99
|
+
url = new URL(endpoint.url.toString());
|
|
100
|
+
url.pathname = (0, utils_1.serializePathnameObjectKey)(url, input.Key);
|
|
101
|
+
url.search = new URLSearchParams(query).toString();
|
|
102
|
+
return [2 /*return*/, {
|
|
103
|
+
method: 'GET',
|
|
104
|
+
headers: headers,
|
|
105
|
+
url: url,
|
|
106
|
+
}];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); };
|
|
110
|
+
var getObjectDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
+
var error;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
116
|
+
return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
|
|
117
|
+
case 1:
|
|
118
|
+
error = _a.sent();
|
|
119
|
+
throw error;
|
|
120
|
+
case 2:
|
|
121
|
+
if (!response.body) {
|
|
122
|
+
throw new Error('Got empty response body.');
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return [2 /*return*/, __assign(__assign({}, (0, utils_1.map)(response.headers, {
|
|
126
|
+
DeleteMarker: ['x-amz-delete-marker', utils_1.deserializeBoolean],
|
|
127
|
+
AcceptRanges: 'accept-ranges',
|
|
128
|
+
Expiration: 'x-amz-expiration',
|
|
129
|
+
Restore: 'x-amz-restore',
|
|
130
|
+
LastModified: ['last-modified', utils_1.deserializeTimestamp],
|
|
131
|
+
ContentLength: ['content-length', utils_1.deserializeNumber],
|
|
132
|
+
ETag: 'etag',
|
|
133
|
+
ChecksumCRC32: 'x-amz-checksum-crc32',
|
|
134
|
+
ChecksumCRC32C: 'x-amz-checksum-crc32c',
|
|
135
|
+
ChecksumSHA1: 'x-amz-checksum-sha1',
|
|
136
|
+
ChecksumSHA256: 'x-amz-checksum-sha256',
|
|
137
|
+
MissingMeta: ['x-amz-missing-meta', utils_1.deserializeNumber],
|
|
138
|
+
VersionId: 'x-amz-version-id',
|
|
139
|
+
CacheControl: 'cache-control',
|
|
140
|
+
ContentDisposition: 'content-disposition',
|
|
141
|
+
ContentEncoding: 'content-encoding',
|
|
142
|
+
ContentLanguage: 'content-language',
|
|
143
|
+
ContentRange: 'content-range',
|
|
144
|
+
ContentType: 'content-type',
|
|
145
|
+
Expires: ['expires', utils_1.deserializeTimestamp],
|
|
146
|
+
WebsiteRedirectLocation: 'x-amz-website-redirect-location',
|
|
147
|
+
ServerSideEncryption: 'x-amz-server-side-encryption',
|
|
148
|
+
SSECustomerAlgorithm: 'x-amz-server-side-encryption-customer-algorithm',
|
|
149
|
+
SSECustomerKeyMD5: 'x-amz-server-side-encryption-customer-key-md5',
|
|
150
|
+
SSEKMSKeyId: 'x-amz-server-side-encryption-aws-kms-key-id',
|
|
151
|
+
BucketKeyEnabled: [
|
|
152
|
+
'x-amz-server-side-encryption-bucket-key-enabled',
|
|
153
|
+
utils_1.deserializeBoolean,
|
|
154
|
+
],
|
|
155
|
+
StorageClass: 'x-amz-storage-class',
|
|
156
|
+
RequestCharged: 'x-amz-request-charged',
|
|
157
|
+
ReplicationStatus: 'x-amz-replication-status',
|
|
158
|
+
PartsCount: ['x-amz-mp-parts-count', utils_1.deserializeNumber],
|
|
159
|
+
TagCount: ['x-amz-tagging-count', utils_1.deserializeNumber],
|
|
160
|
+
ObjectLockMode: 'x-amz-object-lock-mode',
|
|
161
|
+
ObjectLockRetainUntilDate: [
|
|
162
|
+
'x-amz-object-lock-retain-until-date',
|
|
163
|
+
utils_1.deserializeTimestamp,
|
|
164
|
+
],
|
|
165
|
+
ObjectLockLegalHoldStatus: 'x-amz-object-lock-legal-hold',
|
|
166
|
+
})), { Metadata: (0, utils_1.deserializeMetadata)(response.headers), $metadata: (0, aws_client_utils_1.parseMetadata)(response), Body: response.body })];
|
|
167
|
+
}
|
|
168
|
+
_a.label = 3;
|
|
169
|
+
case 3: return [2 /*return*/];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}); };
|
|
173
|
+
exports.getObject = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, getObjectSerializer, getObjectDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'blob' }));
|
|
174
|
+
/**
|
|
175
|
+
* Get a presigned URL for the `getObject` API.
|
|
176
|
+
*
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
var getPresignedGetObjectUrl = function (config, input) { return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
+
var endpoint, _a, url, headers, method, _b, _c, _d, headerName, value;
|
|
181
|
+
var e_1, _e;
|
|
182
|
+
var _f;
|
|
183
|
+
return __generator(this, function (_g) {
|
|
184
|
+
switch (_g.label) {
|
|
185
|
+
case 0:
|
|
186
|
+
endpoint = base_1.defaultConfig.endpointResolver(config, input);
|
|
187
|
+
return [4 /*yield*/, getObjectSerializer(input, endpoint)];
|
|
188
|
+
case 1:
|
|
189
|
+
_a = _g.sent(), url = _a.url, headers = _a.headers, method = _a.method;
|
|
190
|
+
// TODO: set content sha256 query parameter with value of UNSIGNED-PAYLOAD.
|
|
191
|
+
// It requires changes in presignUrl. Without this change, the generated url still works,
|
|
192
|
+
// but not the same as other tools like AWS SDK and CLI.
|
|
193
|
+
url.searchParams.append(utils_1.CONTENT_SHA256_HEADER, aws_client_utils_1.EMPTY_SHA256_HASH);
|
|
194
|
+
url.searchParams.append((_f = config.userAgentHeader) !== null && _f !== void 0 ? _f : core_1.USER_AGENT_HEADER, config.userAgentValue);
|
|
195
|
+
try {
|
|
196
|
+
for (_b = __values(Object.entries(headers).sort(function (_a, _b) {
|
|
197
|
+
var _c = __read(_a, 1), key1 = _c[0];
|
|
198
|
+
var _d = __read(_b, 1), key2 = _d[0];
|
|
199
|
+
return key1.localeCompare(key2);
|
|
200
|
+
})), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
201
|
+
_d = __read(_c.value, 2), headerName = _d[0], value = _d[1];
|
|
202
|
+
url.searchParams.append(headerName, value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
206
|
+
finally {
|
|
207
|
+
try {
|
|
208
|
+
if (_c && !_c.done && (_e = _b.return)) _e.call(_b);
|
|
209
|
+
}
|
|
210
|
+
finally { if (e_1) throw e_1.error; }
|
|
211
|
+
}
|
|
212
|
+
return [2 /*return*/, (0, aws_client_utils_1.presignUrl)({ method: method, url: url, body: null }, __assign(__assign({}, base_1.defaultConfig), config)).toString()];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}); };
|
|
216
|
+
exports.getPresignedGetObjectUrl = getPresignedGetObjectUrl;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Endpoint } from '@aws-amplify/core/internals/aws-client-utils';
|
|
3
|
+
import type { HeadObjectCommandInput, HeadObjectCommandOutput } from './types';
|
|
4
|
+
export type HeadObjectInput = Pick<HeadObjectCommandInput, 'Bucket' | 'Key' | 'SSECustomerKey' | 'SSECustomerKeyMD5' | 'SSECustomerAlgorithm'>;
|
|
5
|
+
export type HeadObjectOutput = Pick<HeadObjectCommandOutput, '$metadata' | 'ContentLength' | 'ContentType' | 'ETag' | 'LastModified' | 'Metadata' | 'VersionId'>;
|
|
6
|
+
export declare const headObject: (config: Omit<import("@aws-amplify/core/internals/aws-client-utils").UserAgentOptions & import("@aws-amplify/core/internals/aws-client-utils").RetryOptions<import("@aws-amplify/core/internals/aws-client-utils").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<import("@aws-amplify/core/internals/aws-client-utils").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?: import("@aws-amplify/core/internals/aws-client-utils").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: HeadObjectInput) => Promise<HeadObjectOutput>;
|
|
@@ -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.headObject = 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 headObjectSerializer = 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
|
+
return [2 /*return*/, {
|
|
67
|
+
method: 'HEAD',
|
|
68
|
+
headers: headers,
|
|
69
|
+
url: url,
|
|
70
|
+
}];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); };
|
|
74
|
+
var headObjectDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var error, contents;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
80
|
+
return [4 /*yield*/, (0, utils_1.parseXmlError)(response)];
|
|
81
|
+
case 1:
|
|
82
|
+
error = _a.sent();
|
|
83
|
+
throw error;
|
|
84
|
+
case 2:
|
|
85
|
+
contents = __assign(__assign({}, (0, utils_1.map)(response.headers, {
|
|
86
|
+
ContentLength: ['content-length', utils_1.deserializeNumber],
|
|
87
|
+
ContentType: 'content-type',
|
|
88
|
+
ETag: 'etag',
|
|
89
|
+
LastModified: ['last-modified', utils_1.deserializeTimestamp],
|
|
90
|
+
VersionId: 'x-amz-version-id',
|
|
91
|
+
})), { Metadata: (0, utils_1.deserializeMetadata)(response.headers) });
|
|
92
|
+
return [2 /*return*/, __assign({ $metadata: (0, aws_client_utils_1.parseMetadata)(response) }, contents)];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}); };
|
|
96
|
+
exports.headObject = (0, composers_1.composeServiceApi)(utils_1.s3TransferHandler, headObjectSerializer, headObjectDeserializer, __assign(__assign({}, base_1.defaultConfig), { responseType: 'text' }));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { SERVICE_NAME } from './base';
|
|
2
|
+
export { getObject, GetObjectInput, GetObjectOutput, getPresignedGetObjectUrl, } from './getObject';
|
|
3
|
+
export { listObjectsV2, ListObjectsV2Input, ListObjectsV2Output, } from './listObjectsV2';
|
|
4
|
+
export { putObject, PutObjectInput, PutObjectOutput } from './putObject';
|
|
5
|
+
export { createMultipartUpload, CreateMultipartUploadInput, CreateMultipartUploadOutput, } from './createMultipartUpload';
|
|
6
|
+
export { uploadPart, UploadPartInput, UploadPartOutput } from './uploadPart';
|
|
7
|
+
export { completeMultipartUpload, CompleteMultipartUploadInput, CompleteMultipartUploadOutput, } from './completeMultipartUpload';
|
|
8
|
+
export { listParts, ListPartsInput, ListPartsOutput } from './listParts';
|
|
9
|
+
export { abortMultipartUpload, AbortMultipartUploadInput, AbortMultipartUploadOutput, } from './abortMultipartUpload';
|
|
10
|
+
export { copyObject, CopyObjectInput, CopyObjectOutput } from './copyObject';
|
|
11
|
+
export { headObject, HeadObjectInput, HeadObjectOutput } from './headObject';
|
|
12
|
+
export { deleteObject, DeleteObjectInput, DeleteObjectOutput, } from './deleteObject';
|
|
13
|
+
export { CompletedPart, Part, _Object } from './types';
|
|
@@ -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.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;
|
|
6
|
+
var base_1 = require("./base");
|
|
7
|
+
Object.defineProperty(exports, "SERVICE_NAME", { enumerable: true, get: function () { return base_1.SERVICE_NAME; } });
|
|
8
|
+
var getObject_1 = require("./getObject");
|
|
9
|
+
Object.defineProperty(exports, "getObject", { enumerable: true, get: function () { return getObject_1.getObject; } });
|
|
10
|
+
Object.defineProperty(exports, "getPresignedGetObjectUrl", { enumerable: true, get: function () { return getObject_1.getPresignedGetObjectUrl; } });
|
|
11
|
+
var listObjectsV2_1 = require("./listObjectsV2");
|
|
12
|
+
Object.defineProperty(exports, "listObjectsV2", { enumerable: true, get: function () { return listObjectsV2_1.listObjectsV2; } });
|
|
13
|
+
var putObject_1 = require("./putObject");
|
|
14
|
+
Object.defineProperty(exports, "putObject", { enumerable: true, get: function () { return putObject_1.putObject; } });
|
|
15
|
+
var createMultipartUpload_1 = require("./createMultipartUpload");
|
|
16
|
+
Object.defineProperty(exports, "createMultipartUpload", { enumerable: true, get: function () { return createMultipartUpload_1.createMultipartUpload; } });
|
|
17
|
+
var uploadPart_1 = require("./uploadPart");
|
|
18
|
+
Object.defineProperty(exports, "uploadPart", { enumerable: true, get: function () { return uploadPart_1.uploadPart; } });
|
|
19
|
+
var completeMultipartUpload_1 = require("./completeMultipartUpload");
|
|
20
|
+
Object.defineProperty(exports, "completeMultipartUpload", { enumerable: true, get: function () { return completeMultipartUpload_1.completeMultipartUpload; } });
|
|
21
|
+
var listParts_1 = require("./listParts");
|
|
22
|
+
Object.defineProperty(exports, "listParts", { enumerable: true, get: function () { return listParts_1.listParts; } });
|
|
23
|
+
var abortMultipartUpload_1 = require("./abortMultipartUpload");
|
|
24
|
+
Object.defineProperty(exports, "abortMultipartUpload", { enumerable: true, get: function () { return abortMultipartUpload_1.abortMultipartUpload; } });
|
|
25
|
+
var copyObject_1 = require("./copyObject");
|
|
26
|
+
Object.defineProperty(exports, "copyObject", { enumerable: true, get: function () { return copyObject_1.copyObject; } });
|
|
27
|
+
var headObject_1 = require("./headObject");
|
|
28
|
+
Object.defineProperty(exports, "headObject", { enumerable: true, get: function () { return headObject_1.headObject; } });
|
|
29
|
+
var deleteObject_1 = require("./deleteObject");
|
|
30
|
+
Object.defineProperty(exports, "deleteObject", { enumerable: true, get: function () { return deleteObject_1.deleteObject; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '@aws-amplify/core/polyfills/URL';
|
|
2
|
+
export { SERVICE_NAME } from './base';
|
|
3
|
+
export { getObject, GetObjectInput, GetObjectOutput, getPresignedGetObjectUrl, } from './getObject';
|
|
4
|
+
export { listObjectsV2, ListObjectsV2Input, ListObjectsV2Output, } from './listObjectsV2';
|
|
5
|
+
export { putObject, PutObjectInput, PutObjectOutput } from './putObject';
|
|
6
|
+
export { createMultipartUpload, CreateMultipartUploadInput, CreateMultipartUploadOutput, } from './createMultipartUpload';
|
|
7
|
+
export { uploadPart, UploadPartInput, UploadPartOutput } from './uploadPart';
|
|
8
|
+
export { completeMultipartUpload, CompleteMultipartUploadInput, CompleteMultipartUploadOutput, } from './completeMultipartUpload';
|
|
9
|
+
export { listParts, ListPartsInput, ListPartsOutput } from './listParts';
|
|
10
|
+
export { abortMultipartUpload, AbortMultipartUploadInput, AbortMultipartUploadOutput, } from './abortMultipartUpload';
|
|
11
|
+
export { copyObject, CopyObjectInput, CopyObjectOutput } from './copyObject';
|
|
12
|
+
export { headObject, HeadObjectInput, HeadObjectOutput } from './headObject';
|
|
13
|
+
export { deleteObject, DeleteObjectInput, DeleteObjectOutput, } from './deleteObject';
|
|
14
|
+
export { CompletedPart, Part, _Object } from './types';
|