@aws-amplify/storage 5.6.4-api-v6.2 → 5.6.4-api-v6.23
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 +95 -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 +98 -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 +61 -31
- package/lib/common/MD5utils.d.ts +1 -0
- package/lib/common/MD5utils.js +79 -0
- package/lib/common/MD5utils.native.d.ts +1 -0
- package/lib/common/MD5utils.native.js +83 -0
- 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 +205 -99
- package/lib/providers/AWSS3UploadTask.d.ts +8 -8
- package/lib/providers/AWSS3UploadTask.js +226 -129
- package/lib/providers/index.js +4 -2
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/AWSS3Provider.d.ts +62 -62
- package/lib/types/AWSS3Provider.js +0 -1
- package/lib/types/Provider.d.ts +1 -1
- package/lib/types/Provider.js +0 -1
- package/lib/types/Storage.d.ts +23 -23
- package/lib/types/Storage.js +0 -1
- package/lib/types/index.js +17 -1
- package/lib-esm/AwsClients/S3/abortMultipartUpload.d.ts +21 -0
- package/lib-esm/AwsClients/S3/abortMultipartUpload.js +82 -0
- package/lib-esm/AwsClients/S3/base.d.ts +54 -0
- package/lib-esm/AwsClients/S3/base.js +71 -0
- package/lib-esm/AwsClients/S3/completeMultipartUpload.d.ts +20 -0
- package/lib-esm/AwsClients/S3/completeMultipartUpload.js +159 -0
- package/lib-esm/AwsClients/S3/copyObject.d.ts +24 -0
- package/lib-esm/AwsClients/S3/copyObject.js +95 -0
- package/lib-esm/AwsClients/S3/createMultipartUpload.d.ts +21 -0
- package/lib-esm/AwsClients/S3/createMultipartUpload.js +92 -0
- package/lib-esm/AwsClients/S3/deleteObject.d.ts +20 -0
- package/lib-esm/AwsClients/S3/deleteObject.js +83 -0
- package/lib-esm/AwsClients/S3/getObject.d.ts +27 -0
- package/lib-esm/AwsClients/S3/getObject.js +212 -0
- package/lib-esm/AwsClients/S3/headObject.d.ts +20 -0
- package/lib-esm/AwsClients/S3/headObject.js +93 -0
- package/lib-esm/AwsClients/S3/index.d.ts +13 -0
- package/lib-esm/AwsClients/S3/index.js +14 -0
- package/lib-esm/AwsClients/S3/index.native.d.ts +14 -0
- package/lib-esm/AwsClients/S3/index.native.js +15 -0
- package/lib-esm/AwsClients/S3/listObjectsV2.d.ts +20 -0
- package/lib-esm/AwsClients/S3/listObjectsV2.js +143 -0
- package/lib-esm/AwsClients/S3/listParts.d.ts +20 -0
- package/lib-esm/AwsClients/S3/listParts.js +107 -0
- package/lib-esm/AwsClients/S3/putObject.d.ts +23 -0
- package/lib-esm/AwsClients/S3/putObject.js +92 -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 +95 -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 +54 -25
- package/lib-esm/common/MD5utils.d.ts +1 -0
- package/lib-esm/common/MD5utils.js +75 -0
- package/lib-esm/common/MD5utils.native.d.ts +1 -0
- package/lib-esm/common/MD5utils.native.js +79 -0
- 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 +193 -88
- package/lib-esm/providers/AWSS3UploadTask.d.ts +8 -8
- package/lib-esm/providers/AWSS3UploadTask.js +202 -106
- package/lib-esm/providers/index.js +2 -1
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/types/AWSS3Provider.d.ts +62 -62
- package/lib-esm/types/AWSS3Provider.js +1 -1
- package/lib-esm/types/Provider.d.ts +1 -1
- package/lib-esm/types/Provider.js +1 -1
- package/lib-esm/types/Storage.d.ts +23 -23
- package/lib-esm/types/Storage.js +1 -1
- package/lib-esm/types/index.js +3 -1
- package/package.json +21 -26
- package/src/AwsClients/S3/abortMultipartUpload.ts +62 -0
- package/src/AwsClients/S3/base.ts +109 -0
- package/src/AwsClients/S3/completeMultipartUpload.ts +154 -0
- package/src/AwsClients/S3/copyObject.ts +90 -0
- package/src/AwsClients/S3/createMultipartUpload.ts +75 -0
- package/src/AwsClients/S3/deleteObject.ts +69 -0
- package/src/AwsClients/S3/getObject.ts +173 -0
- package/src/AwsClients/S3/headObject.ts +91 -0
- package/src/AwsClients/S3/index.native.ts +42 -0
- package/src/AwsClients/S3/index.ts +41 -0
- package/src/AwsClients/S3/listObjectsV2.ts +130 -0
- package/src/AwsClients/S3/listParts.ts +97 -0
- package/src/AwsClients/S3/putObject.ts +99 -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 +88 -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 +31 -27
- package/src/common/MD5utils.native.ts +38 -0
- package/src/common/MD5utils.ts +33 -0
- 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 +74 -64
- package/src/providers/AWSS3UploadTask.ts +86 -87
- package/src/providers/index.ts +2 -0
- package/src/types/AWSS3Provider.ts +55 -49
- package/lib/.tsbuildinfo +0 -3
- package/lib/Storage.js.map +0 -1
- package/lib/common/S3ClientUtils.js.map +0 -1
- package/lib/common/StorageConstants.js.map +0 -1
- package/lib/common/StorageErrorStrings.js.map +0 -1
- package/lib/common/StorageUtils.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/providers/AWSS3Provider.js.map +0 -1
- package/lib/providers/AWSS3ProviderManagedUpload.js.map +0 -1
- package/lib/providers/AWSS3UploadTask.js.map +0 -1
- package/lib/providers/axios-http-handler.d.ts +0 -40
- package/lib/providers/axios-http-handler.js +0 -193
- package/lib/providers/axios-http-handler.js.map +0 -1
- package/lib/providers/index.js.map +0 -1
- package/lib/types/AWSS3Provider.js.map +0 -1
- package/lib/types/Provider.js.map +0 -1
- package/lib/types/Storage.js.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/Storage.js.map +0 -1
- package/lib-esm/common/S3ClientUtils.js.map +0 -1
- package/lib-esm/common/StorageConstants.js.map +0 -1
- package/lib-esm/common/StorageErrorStrings.js.map +0 -1
- package/lib-esm/common/StorageUtils.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/providers/AWSS3Provider.js.map +0 -1
- package/lib-esm/providers/AWSS3ProviderManagedUpload.js.map +0 -1
- package/lib-esm/providers/AWSS3UploadTask.js.map +0 -1
- package/lib-esm/providers/axios-http-handler.d.ts +0 -40
- package/lib-esm/providers/axios-http-handler.js +0 -191
- package/lib-esm/providers/axios-http-handler.js.map +0 -1
- package/lib-esm/providers/index.js.map +0 -1
- package/lib-esm/types/AWSS3Provider.js.map +0 -1
- package/lib-esm/types/Provider.js.map +0 -1
- package/lib-esm/types/Storage.js.map +0 -1
- package/lib-esm/types/index.js.map +0 -1
- package/src/providers/axios-http-handler.ts +0 -242
|
@@ -1,8 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
49
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
50
|
+
import { Category, Credentials, Logger, getAmplifyUserAgent, } from '@aws-amplify/core';
|
|
51
|
+
import { localTestingStorageEndpoint } from './StorageConstants';
|
|
6
52
|
var logger = new Logger('S3ClientUtils');
|
|
7
53
|
// placeholder credentials in order to satisfy type requirement, always results in 403 when used
|
|
8
54
|
var INVALID_CRED = { accessKeyId: '', secretAccessKey: '' };
|
|
@@ -32,70 +78,6 @@ export var getPrefix = function (config) {
|
|
|
32
78
|
return publicPath;
|
|
33
79
|
}
|
|
34
80
|
};
|
|
35
|
-
export var createPrefixMiddleware = function (opt, key) {
|
|
36
|
-
return function (next, _context) {
|
|
37
|
-
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38
|
-
var credentials, cred, prefix, clonedInput, result;
|
|
39
|
-
return __generator(this, function (_a) {
|
|
40
|
-
switch (_a.label) {
|
|
41
|
-
case 0: return [4 /*yield*/, Credentials.get()];
|
|
42
|
-
case 1:
|
|
43
|
-
credentials = _a.sent();
|
|
44
|
-
cred = Credentials.shear(credentials);
|
|
45
|
-
prefix = getPrefix(__assign(__assign({}, opt), { credentials: cred }));
|
|
46
|
-
clonedInput = Object.assign({}, args.input);
|
|
47
|
-
if (Object.prototype.hasOwnProperty.call(args.input, 'Key')) {
|
|
48
|
-
clonedInput.Key = prefix + key;
|
|
49
|
-
args.input = clonedInput;
|
|
50
|
-
}
|
|
51
|
-
else if (Object.prototype.hasOwnProperty.call(args.input, 'Prefix')) {
|
|
52
|
-
clonedInput.Prefix = prefix + key;
|
|
53
|
-
args.input = clonedInput;
|
|
54
|
-
}
|
|
55
|
-
result = next(args);
|
|
56
|
-
return [2 /*return*/, result];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}); };
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
var isTimeSkewedError = function (err) {
|
|
63
|
-
return err.ServerTime &&
|
|
64
|
-
typeof err.Code === 'string' &&
|
|
65
|
-
err.Code === 'RequestTimeTooSkewed';
|
|
66
|
-
};
|
|
67
|
-
// we want to take the S3Client config in parameter so we can modify it's systemClockOffset
|
|
68
|
-
export var autoAdjustClockskewMiddleware = function (config) {
|
|
69
|
-
return function (next, _context) {
|
|
70
|
-
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
-
var err_1, serverDate;
|
|
72
|
-
return __generator(this, function (_a) {
|
|
73
|
-
switch (_a.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
_a.trys.push([0, 2, , 3]);
|
|
76
|
-
return [4 /*yield*/, next(args)];
|
|
77
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
78
|
-
case 2:
|
|
79
|
-
err_1 = _a.sent();
|
|
80
|
-
if (isTimeSkewedError(err_1)) {
|
|
81
|
-
serverDate = new Date(err_1.ServerTime);
|
|
82
|
-
config.systemClockOffset = serverDate.getTime() - Date.now();
|
|
83
|
-
}
|
|
84
|
-
throw err_1;
|
|
85
|
-
case 3: return [2 /*return*/];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}); };
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
export var autoAdjustClockskewMiddlewareOptions = {
|
|
92
|
-
step: 'finalizeRequest',
|
|
93
|
-
name: 'autoAdjustClockskewMiddleware',
|
|
94
|
-
};
|
|
95
|
-
export var prefixMiddlewareOptions = {
|
|
96
|
-
step: 'initialize',
|
|
97
|
-
name: 'addPrefixMiddleware',
|
|
98
|
-
};
|
|
99
81
|
export var credentialsProvider = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
82
|
var credentials, cred, error_1;
|
|
101
83
|
return __generator(this, function (_a) {
|
|
@@ -118,32 +100,34 @@ export var credentialsProvider = function () { return __awaiter(void 0, void 0,
|
|
|
118
100
|
}
|
|
119
101
|
});
|
|
120
102
|
}); };
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
103
|
+
/**
|
|
104
|
+
* A function that persists the s3 configs, so we don't need to
|
|
105
|
+
* assign each config parameter for every s3 API call.
|
|
106
|
+
*
|
|
107
|
+
* @inernal
|
|
108
|
+
*/
|
|
109
|
+
export var loadS3Config = function (config) {
|
|
110
|
+
if (!config.region) {
|
|
111
|
+
// Same error thrown by aws-sdk
|
|
112
|
+
throw new Error('Region is missing.');
|
|
131
113
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
credentials: credentialsProvider, customUserAgent: getAmplifyUserAgentObject({
|
|
114
|
+
return __assign(__assign(__assign({}, config), { region: config.region, credentials: config.credentials
|
|
115
|
+
? function () { return Promise.resolve(config.credentials); }
|
|
116
|
+
: credentialsProvider, userAgentValue: getAmplifyUserAgent({
|
|
136
117
|
category: Category.Storage,
|
|
137
|
-
action: storageAction,
|
|
138
|
-
}) }
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
action: config.storageAction,
|
|
119
|
+
}) }), (config.dangerouslyConnectToHttpEndpointForTesting
|
|
120
|
+
? {
|
|
121
|
+
customEndpoint: localTestingStorageEndpoint,
|
|
122
|
+
forcePathStyle: true,
|
|
123
|
+
}
|
|
124
|
+
: {}));
|
|
141
125
|
};
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
export var DEFAULT_PART_SIZE = 5 *
|
|
146
|
-
export var MAX_OBJECT_SIZE = 5 *
|
|
126
|
+
var MiB = 1024 * 1024;
|
|
127
|
+
var GiB = 1024 * MiB;
|
|
128
|
+
var TiB = 1024 * GiB;
|
|
129
|
+
export var DEFAULT_PART_SIZE = 5 * MiB;
|
|
130
|
+
export var MAX_OBJECT_SIZE = 5 * TiB;
|
|
147
131
|
export var MAX_PARTS_COUNT = 10000;
|
|
148
132
|
export var DEFAULT_QUEUE_SIZE = 4;
|
|
149
133
|
export var calculatePartSize = function (totalSize) {
|
|
@@ -155,4 +139,3 @@ export var calculatePartSize = function (totalSize) {
|
|
|
155
139
|
}
|
|
156
140
|
return partSize;
|
|
157
141
|
};
|
|
158
|
-
//# sourceMappingURL=S3ClientUtils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export var AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
|
|
2
4
|
? Symbol.for('amplify_default')
|
|
3
5
|
: '@@amplify_default');
|
|
4
|
-
export var SET_CONTENT_LENGTH_HEADER = 'contentLengthMiddleware';
|
|
5
6
|
export var localTestingStorageEndpoint = 'http://localhost:20005';
|
|
6
7
|
export var UPLOADS_STORAGE_KEY = '__uploadInProgress';
|
|
7
|
-
//# sourceMappingURL=StorageConstants.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export var StorageErrorStrings;
|
|
2
4
|
(function (StorageErrorStrings) {
|
|
3
5
|
StorageErrorStrings["NO_CREDENTIALS"] = "No credentials";
|
|
@@ -17,4 +19,3 @@ export var AWSS3ProviderUploadErrorStrings;
|
|
|
17
19
|
(function (AWSS3ProviderUploadErrorStrings) {
|
|
18
20
|
AWSS3ProviderUploadErrorStrings["UPLOAD_PAUSED_MESSAGE"] = "paused";
|
|
19
21
|
})(AWSS3ProviderUploadErrorStrings || (AWSS3ProviderUploadErrorStrings = {}));
|
|
20
|
-
//# sourceMappingURL=StorageErrorStrings.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
import { Hub } from '@aws-amplify/core';
|
|
2
4
|
import { AMPLIFY_SYMBOL } from './StorageConstants';
|
|
3
5
|
export var byteLength = function (x) {
|
|
@@ -36,4 +38,3 @@ export var isBlob = function (x) {
|
|
|
36
38
|
var isArrayBuffer = function (x) {
|
|
37
39
|
return typeof x !== 'undefined' && x instanceof ArrayBuffer;
|
|
38
40
|
};
|
|
39
|
-
//# sourceMappingURL=StorageUtils.js.map
|
package/lib-esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StorageOptions, StorageProvider, S3ProviderGetConfig, S3ProviderGetOuput, S3ProviderPutConfig, S3ProviderRemoveConfig, S3ProviderListConfig, S3ProviderCopyConfig, S3ProviderCopyOutput, S3CopySource, S3CopyDestination, S3ProviderRemoveOutput, S3ProviderPutOutput, S3ProviderListOutput,
|
|
1
|
+
import { PutObjectInput } from '../AwsClients/S3';
|
|
2
|
+
import { StorageOptions, StorageProvider, S3ProviderGetConfig, S3ProviderGetOuput, S3ProviderPutConfig, S3ProviderRemoveConfig, S3ProviderListConfig, S3ProviderCopyConfig, S3ProviderCopyOutput, S3CopySource, S3CopyDestination, S3ProviderRemoveOutput, S3ProviderPutOutput, S3ProviderListOutput, S3ProviderGetPropertiesConfig, S3ProviderGetPropertiesOutput } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Provide storage methods to use AWS S3
|
|
5
5
|
*/
|
|
@@ -44,7 +44,7 @@ export declare class AWSS3Provider implements StorageProvider {
|
|
|
44
44
|
*
|
|
45
45
|
* @param {string} key - key of the object
|
|
46
46
|
* @param {S3ProviderGetConfig} [config] - Optional configuration for the underlying S3 command
|
|
47
|
-
* @return {Promise<string |
|
|
47
|
+
* @return {Promise<string | GetObjectOutput>} - A promise resolves to Amazon S3 presigned URL or the
|
|
48
48
|
* GetObjectCommandOutput if download is set to true on success
|
|
49
49
|
*/
|
|
50
50
|
get<T extends S3ProviderGetConfig & StorageOptions>(key: string, config?: T): Promise<S3ProviderGetOuput<T>>;
|
|
@@ -65,7 +65,7 @@ export declare class AWSS3Provider implements StorageProvider {
|
|
|
65
65
|
* @return an instance of AWSS3UploadTask or a promise that resolves to an object with the new object's key on
|
|
66
66
|
* success.
|
|
67
67
|
*/
|
|
68
|
-
put<T extends S3ProviderPutConfig>(key: string, object:
|
|
68
|
+
put<T extends S3ProviderPutConfig>(key: string, object: PutObjectInput['Body'], config?: T): S3ProviderPutOutput<T>;
|
|
69
69
|
/**
|
|
70
70
|
* Remove the object for specified key
|
|
71
71
|
* @param {string} key - key of the object
|
|
@@ -85,8 +85,4 @@ export declare class AWSS3Provider implements StorageProvider {
|
|
|
85
85
|
private _ensureCredentials;
|
|
86
86
|
private _isWithCredentials;
|
|
87
87
|
private _prefix;
|
|
88
|
-
/**
|
|
89
|
-
* Creates an S3 client with new V3 aws sdk
|
|
90
|
-
*/
|
|
91
|
-
private _createNewS3Client;
|
|
92
88
|
}
|