@aws-amplify/storage 4.4.12 → 4.4.13-custom-pk.86
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/CHANGELOG.md +146 -0
- package/dist/aws-amplify-storage.js +316 -248
- package/dist/aws-amplify-storage.js.map +1 -1
- package/dist/aws-amplify-storage.min.js +4 -18
- package/dist/aws-amplify-storage.min.js.map +1 -1
- package/lib/providers/AWSS3ProviderManagedUpload.d.ts +1 -3
- package/lib/providers/AWSS3ProviderManagedUpload.js +66 -86
- package/lib/providers/AWSS3ProviderManagedUpload.js.map +1 -1
- package/lib/providers/axios-http-handler.d.ts +18 -1
- package/lib/providers/axios-http-handler.js +20 -7
- package/lib/providers/axios-http-handler.js.map +1 -1
- package/lib-esm/providers/AWSS3ProviderManagedUpload.d.ts +1 -3
- package/lib-esm/providers/AWSS3ProviderManagedUpload.js +66 -86
- package/lib-esm/providers/AWSS3ProviderManagedUpload.js.map +1 -1
- package/lib-esm/providers/axios-http-handler.d.ts +18 -1
- package/lib-esm/providers/axios-http-handler.js +20 -7
- package/lib-esm/providers/axios-http-handler.js.map +1 -1
- package/package.json +5 -6
- package/src/providers/AWSS3ProviderManagedUpload.ts +75 -89
- package/src/providers/axios-http-handler.ts +38 -7
|
@@ -15,8 +15,8 @@ export declare class AWSS3ProviderManagedUpload {
|
|
|
15
15
|
private params;
|
|
16
16
|
private opts;
|
|
17
17
|
private completedParts;
|
|
18
|
-
private cancel;
|
|
19
18
|
private s3client;
|
|
19
|
+
private uploadId;
|
|
20
20
|
private bytesUploaded;
|
|
21
21
|
private totalBytesToUpload;
|
|
22
22
|
private emitter;
|
|
@@ -30,8 +30,6 @@ export declare class AWSS3ProviderManagedUpload {
|
|
|
30
30
|
*/
|
|
31
31
|
protected uploadParts(uploadId: string, parts: Part[]): Promise<void>;
|
|
32
32
|
private finishMultiPartUpload;
|
|
33
|
-
private checkIfUploadCancelled;
|
|
34
|
-
cancelUpload(): void;
|
|
35
33
|
private cleanup;
|
|
36
34
|
private removeEventListener;
|
|
37
35
|
private setupEventListener;
|
|
@@ -82,7 +82,7 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
82
82
|
this.params = null;
|
|
83
83
|
this.opts = null;
|
|
84
84
|
this.completedParts = [];
|
|
85
|
-
this.
|
|
85
|
+
this.uploadId = null;
|
|
86
86
|
// Progress reporting
|
|
87
87
|
this.bytesUploaded = 0;
|
|
88
88
|
this.totalBytesToUpload = 0;
|
|
@@ -94,95 +94,105 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
94
94
|
}
|
|
95
95
|
AWSS3ProviderManagedUpload.prototype.upload = function () {
|
|
96
96
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
var _a, putObjectCommand,
|
|
97
|
+
var _a, putObjectCommand, _b, numberOfPartsToUpload, parts, start, error_1;
|
|
98
98
|
var _this = this;
|
|
99
|
-
return __generator(this, function (
|
|
100
|
-
switch (
|
|
99
|
+
return __generator(this, function (_c) {
|
|
100
|
+
switch (_c.label) {
|
|
101
101
|
case 0:
|
|
102
|
+
_c.trys.push([0, 10, , 12]);
|
|
102
103
|
_a = this;
|
|
103
104
|
return [4 /*yield*/, this.validateAndSanitizeBody(this.params.Body)];
|
|
104
105
|
case 1:
|
|
105
|
-
_a.body =
|
|
106
|
+
_a.body = _c.sent();
|
|
106
107
|
this.totalBytesToUpload = this.byteLength(this.body);
|
|
107
108
|
if (!(this.totalBytesToUpload <= this.minPartSize)) return [3 /*break*/, 2];
|
|
108
109
|
// Multipart upload is not required. Upload the sanitized body as is
|
|
109
110
|
this.params.Body = this.body;
|
|
110
111
|
putObjectCommand = new client_s3_1.PutObjectCommand(this.params);
|
|
111
112
|
return [2 /*return*/, this.s3client.send(putObjectCommand)];
|
|
112
|
-
case 2:
|
|
113
|
+
case 2:
|
|
114
|
+
// Step 1: Initiate the multi part upload
|
|
115
|
+
_b = this;
|
|
116
|
+
return [4 /*yield*/, this.createMultiPartUpload()];
|
|
113
117
|
case 3:
|
|
114
|
-
|
|
118
|
+
// Step 1: Initiate the multi part upload
|
|
119
|
+
_b.uploadId = _c.sent();
|
|
115
120
|
numberOfPartsToUpload = Math.ceil(this.totalBytesToUpload / this.minPartSize);
|
|
116
121
|
parts = this.createParts();
|
|
117
122
|
start = 0;
|
|
118
|
-
|
|
123
|
+
_c.label = 4;
|
|
119
124
|
case 4:
|
|
120
|
-
if (!(start < numberOfPartsToUpload)) return [3 /*break*/,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
**/
|
|
124
|
-
return [4 /*yield*/, this.checkIfUploadCancelled(uploadId)];
|
|
125
|
+
if (!(start < numberOfPartsToUpload)) return [3 /*break*/, 7];
|
|
126
|
+
// Upload as many as `queueSize` parts simultaneously
|
|
127
|
+
return [4 /*yield*/, this.uploadParts(this.uploadId, parts.slice(start, start + this.queueSize))];
|
|
125
128
|
case 5:
|
|
126
|
-
/** This first block will try to cancel the upload if the cancel
|
|
127
|
-
* request came before any parts uploads have started.
|
|
128
|
-
**/
|
|
129
|
-
_b.sent();
|
|
130
129
|
// Upload as many as `queueSize` parts simultaneously
|
|
131
|
-
|
|
130
|
+
_c.sent();
|
|
131
|
+
_c.label = 6;
|
|
132
132
|
case 6:
|
|
133
|
-
// Upload as many as `queueSize` parts simultaneously
|
|
134
|
-
_b.sent();
|
|
135
|
-
/** Call cleanup a second time in case there were part upload requests
|
|
136
|
-
* in flight. This is to ensure that all parts are cleaned up.
|
|
137
|
-
*/
|
|
138
|
-
return [4 /*yield*/, this.checkIfUploadCancelled(uploadId)];
|
|
139
|
-
case 7:
|
|
140
|
-
/** Call cleanup a second time in case there were part upload requests
|
|
141
|
-
* in flight. This is to ensure that all parts are cleaned up.
|
|
142
|
-
*/
|
|
143
|
-
_b.sent();
|
|
144
|
-
_b.label = 8;
|
|
145
|
-
case 8:
|
|
146
133
|
start += this.queueSize;
|
|
147
134
|
return [3 /*break*/, 4];
|
|
148
|
-
case
|
|
135
|
+
case 7:
|
|
149
136
|
parts.map(function (part) {
|
|
150
137
|
_this.removeEventListener(part);
|
|
151
138
|
});
|
|
152
|
-
return [4 /*yield*/, this.finishMultiPartUpload(uploadId)];
|
|
153
|
-
case
|
|
139
|
+
return [4 /*yield*/, this.finishMultiPartUpload(this.uploadId)];
|
|
140
|
+
case 8:
|
|
154
141
|
// Step 3: Finalize the upload such that S3 can recreate the file
|
|
155
|
-
return [2 /*return*/,
|
|
142
|
+
return [2 /*return*/, _c.sent()];
|
|
143
|
+
case 9: return [3 /*break*/, 12];
|
|
144
|
+
case 10:
|
|
145
|
+
error_1 = _c.sent();
|
|
146
|
+
// if any error is thrown, call cleanup
|
|
147
|
+
return [4 /*yield*/, this.cleanup(this.uploadId)];
|
|
148
|
+
case 11:
|
|
149
|
+
// if any error is thrown, call cleanup
|
|
150
|
+
_c.sent();
|
|
151
|
+
logger.error('Error. Cancelling the multipart upload.');
|
|
152
|
+
throw error_1;
|
|
153
|
+
case 12: return [2 /*return*/];
|
|
156
154
|
}
|
|
157
155
|
});
|
|
158
156
|
});
|
|
159
157
|
};
|
|
160
158
|
AWSS3ProviderManagedUpload.prototype.createParts = function () {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
159
|
+
try {
|
|
160
|
+
var parts = [];
|
|
161
|
+
for (var bodyStart = 0; bodyStart < this.totalBytesToUpload;) {
|
|
162
|
+
var bodyEnd = Math.min(bodyStart + this.minPartSize, this.totalBytesToUpload);
|
|
163
|
+
parts.push({
|
|
164
|
+
bodyPart: this.body.slice(bodyStart, bodyEnd),
|
|
165
|
+
partNumber: parts.length + 1,
|
|
166
|
+
emitter: new events.EventEmitter(),
|
|
167
|
+
_lastUploadedBytes: 0,
|
|
168
|
+
});
|
|
169
|
+
bodyStart += this.minPartSize;
|
|
170
|
+
}
|
|
171
|
+
return parts;
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
logger.error(error);
|
|
175
|
+
throw error;
|
|
171
176
|
}
|
|
172
|
-
return parts;
|
|
173
177
|
};
|
|
174
178
|
AWSS3ProviderManagedUpload.prototype.createMultiPartUpload = function () {
|
|
175
179
|
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
-
var createMultiPartUploadCommand, response;
|
|
180
|
+
var createMultiPartUploadCommand, response, error_2;
|
|
177
181
|
return __generator(this, function (_a) {
|
|
178
182
|
switch (_a.label) {
|
|
179
183
|
case 0:
|
|
184
|
+
_a.trys.push([0, 2, , 3]);
|
|
180
185
|
createMultiPartUploadCommand = new client_s3_1.CreateMultipartUploadCommand(this.params);
|
|
181
186
|
return [4 /*yield*/, this.s3client.send(createMultiPartUploadCommand)];
|
|
182
187
|
case 1:
|
|
183
188
|
response = _a.sent();
|
|
184
189
|
logger.debug(response.UploadId);
|
|
185
190
|
return [2 /*return*/, response.UploadId];
|
|
191
|
+
case 2:
|
|
192
|
+
error_2 = _a.sent();
|
|
193
|
+
logger.error(error_2);
|
|
194
|
+
throw error_2;
|
|
195
|
+
case 3: return [2 /*return*/];
|
|
186
196
|
}
|
|
187
197
|
});
|
|
188
198
|
});
|
|
@@ -193,7 +203,7 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
193
203
|
*/
|
|
194
204
|
AWSS3ProviderManagedUpload.prototype.uploadParts = function (uploadId, parts) {
|
|
195
205
|
return __awaiter(this, void 0, void 0, function () {
|
|
196
|
-
var allResults, i,
|
|
206
|
+
var allResults, i, error_3;
|
|
197
207
|
var _this = this;
|
|
198
208
|
return __generator(this, function (_a) {
|
|
199
209
|
switch (_a.label) {
|
|
@@ -226,10 +236,9 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
226
236
|
}
|
|
227
237
|
return [3 /*break*/, 3];
|
|
228
238
|
case 2:
|
|
229
|
-
|
|
230
|
-
logger.error('
|
|
231
|
-
|
|
232
|
-
return [2 /*return*/];
|
|
239
|
+
error_3 = _a.sent();
|
|
240
|
+
logger.error('Error happened while uploading a part. Cancelling the multipart upload');
|
|
241
|
+
throw error_3;
|
|
233
242
|
case 3: return [2 /*return*/];
|
|
234
243
|
}
|
|
235
244
|
});
|
|
@@ -237,7 +246,7 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
237
246
|
};
|
|
238
247
|
AWSS3ProviderManagedUpload.prototype.finishMultiPartUpload = function (uploadId) {
|
|
239
248
|
return __awaiter(this, void 0, void 0, function () {
|
|
240
|
-
var input, completeUploadCommand, data,
|
|
249
|
+
var input, completeUploadCommand, data, error_4;
|
|
241
250
|
return __generator(this, function (_a) {
|
|
242
251
|
switch (_a.label) {
|
|
243
252
|
case 0:
|
|
@@ -256,43 +265,14 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
256
265
|
data = _a.sent();
|
|
257
266
|
return [2 /*return*/, data.Key];
|
|
258
267
|
case 3:
|
|
259
|
-
|
|
260
|
-
logger.error('
|
|
261
|
-
|
|
262
|
-
return [2 /*return*/];
|
|
268
|
+
error_4 = _a.sent();
|
|
269
|
+
logger.error('Error happened while finishing the upload.');
|
|
270
|
+
throw error_4;
|
|
263
271
|
case 4: return [2 /*return*/];
|
|
264
272
|
}
|
|
265
273
|
});
|
|
266
274
|
});
|
|
267
275
|
};
|
|
268
|
-
AWSS3ProviderManagedUpload.prototype.checkIfUploadCancelled = function (uploadId) {
|
|
269
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
270
|
-
var errorMessage, error_3;
|
|
271
|
-
return __generator(this, function (_a) {
|
|
272
|
-
switch (_a.label) {
|
|
273
|
-
case 0:
|
|
274
|
-
if (!this.cancel) return [3 /*break*/, 5];
|
|
275
|
-
errorMessage = 'Upload was cancelled.';
|
|
276
|
-
_a.label = 1;
|
|
277
|
-
case 1:
|
|
278
|
-
_a.trys.push([1, 3, , 4]);
|
|
279
|
-
return [4 /*yield*/, this.cleanup(uploadId)];
|
|
280
|
-
case 2:
|
|
281
|
-
_a.sent();
|
|
282
|
-
return [3 /*break*/, 4];
|
|
283
|
-
case 3:
|
|
284
|
-
error_3 = _a.sent();
|
|
285
|
-
errorMessage += " " + error_3.message;
|
|
286
|
-
return [3 /*break*/, 4];
|
|
287
|
-
case 4: throw new Error(errorMessage);
|
|
288
|
-
case 5: return [2 /*return*/];
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
AWSS3ProviderManagedUpload.prototype.cancelUpload = function () {
|
|
294
|
-
this.cancel = true;
|
|
295
|
-
};
|
|
296
276
|
AWSS3ProviderManagedUpload.prototype.cleanup = function (uploadId) {
|
|
297
277
|
return __awaiter(this, void 0, void 0, function () {
|
|
298
278
|
var input, data;
|
|
@@ -316,7 +296,7 @@ var AWSS3ProviderManagedUpload = /** @class */ (function () {
|
|
|
316
296
|
case 2:
|
|
317
297
|
data = _a.sent();
|
|
318
298
|
if (data && data.Parts && data.Parts.length > 0) {
|
|
319
|
-
throw new Error('
|
|
299
|
+
throw new Error('Multipart upload clean up failed.');
|
|
320
300
|
}
|
|
321
301
|
return [2 /*return*/];
|
|
322
302
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWSS3ProviderManagedUpload.js","sourceRoot":"","sources":["../../src/providers/AWSS3ProviderManagedUpload.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0CAA4D;AAC5D,gDAW4B;AAC5B,2DAI8B;AAC9B,6CAAiC;AACjC,yDAMiC;AAEjC,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,4BAA4B,CAAC,CAAC;AAUxD;IAkBC,oCAAY,MAAwB,EAAE,IAAI,EAAE,OAA4B;QAjBxE,WAAW;QACD,gBAAW,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,Q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AM,QAAQ,GAAG,8BAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,QAAQ,CAAC,eAAe,CAAC,GAAG,CAC3B,sCAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAClD,uCAAuB,CACvB,CAAC;QACF,QAAQ,CAAC,eAAe,CAAC,GAAG,CAC3B,6CAA6B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC9C,oDAAoC,CACpC,CAAC;QACF,OAAO,QAAQ,CAAC;IACjB,CAAC;IACF,iCAAC;AAAD,CAAC,AAzRD,IAyRC;AAzRY,gEAA0B"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { HttpHandlerOptions } from '@aws-sdk/types';
|
|
3
3
|
import { HttpHandler, HttpRequest, HttpResponse } from '@aws-sdk/protocol-http';
|
|
4
|
-
import { CancelTokenSource,
|
|
4
|
+
import { CancelTokenSource, AxiosRequestHeaders, AxiosRequestTransformer } from 'axios';
|
|
5
5
|
import { FetchHttpHandlerOptions } from '@aws-sdk/fetch-http-handler';
|
|
6
6
|
import * as events from 'events';
|
|
7
|
+
/**
|
|
8
|
+
Extending the axios interface here to make headers required, (previously,
|
|
9
|
+
they were not required on the type we were using, but our implementation
|
|
10
|
+
does not currently account for missing headers. This worked previously,
|
|
11
|
+
because the previous `headers` type was `any`.
|
|
12
|
+
*/
|
|
13
|
+
interface AxiosTransformer extends Partial<AxiosRequestTransformer> {
|
|
14
|
+
(data: any, headers: AxiosRequestHeaders): any;
|
|
15
|
+
}
|
|
7
16
|
export declare const SEND_UPLOAD_PROGRESS_EVENT = "sendUploadProgress";
|
|
8
17
|
export declare const SEND_DOWNLOAD_PROGRESS_EVENT = "sendDownloadProgress";
|
|
18
|
+
export declare type ErrorWithResponse = {
|
|
19
|
+
response: {
|
|
20
|
+
status: number;
|
|
21
|
+
} & {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
9
25
|
export declare const reactNativeRequestTransformer: AxiosTransformer[];
|
|
10
26
|
export declare type AxiosHttpHandlerOptions = HttpHandlerOptions & {
|
|
11
27
|
cancelTokenSource?: CancelTokenSource;
|
|
@@ -21,3 +37,4 @@ export declare class AxiosHttpHandler implements HttpHandler {
|
|
|
21
37
|
response: HttpResponse;
|
|
22
38
|
}>;
|
|
23
39
|
}
|
|
40
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -53,6 +53,13 @@ exports.SEND_DOWNLOAD_PROGRESS_EVENT = 'sendDownloadProgress';
|
|
|
53
53
|
function isBlob(body) {
|
|
54
54
|
return typeof Blob !== 'undefined' && body instanceof Blob;
|
|
55
55
|
}
|
|
56
|
+
function hasErrorResponse(error) {
|
|
57
|
+
return (typeof error !== 'undefined' &&
|
|
58
|
+
Object.prototype.hasOwnProperty.call(error, 'response') &&
|
|
59
|
+
typeof error.response !== 'undefined' &&
|
|
60
|
+
Object.prototype.hasOwnProperty.call(error.response, 'status') &&
|
|
61
|
+
typeof error.response.status === 'number');
|
|
62
|
+
}
|
|
56
63
|
var normalizeHeaders = function (headers, normalizedName) {
|
|
57
64
|
var e_1, _a;
|
|
58
65
|
try {
|
|
@@ -138,10 +145,12 @@ var AxiosHttpHandler = /** @class */ (function () {
|
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
if (emitter) {
|
|
148
|
+
// TODO: Unify linting rules across JS repo
|
|
141
149
|
axiosRequest.onUploadProgress = function (event) {
|
|
142
150
|
emitter.emit(exports.SEND_UPLOAD_PROGRESS_EVENT, event);
|
|
143
151
|
logger.debug(event);
|
|
144
152
|
};
|
|
153
|
+
// TODO: Unify linting rules across JS repo
|
|
145
154
|
axiosRequest.onDownloadProgress = function (event) {
|
|
146
155
|
emitter.emit(exports.SEND_DOWNLOAD_PROGRESS_EVENT, event);
|
|
147
156
|
logger.debug(event);
|
|
@@ -176,24 +185,28 @@ var AxiosHttpHandler = /** @class */ (function () {
|
|
|
176
185
|
};
|
|
177
186
|
})
|
|
178
187
|
.catch(function (error) {
|
|
179
|
-
var _a, _b
|
|
188
|
+
var _a, _b;
|
|
180
189
|
// Error
|
|
181
190
|
if (error.message !==
|
|
182
191
|
StorageErrorStrings_1.AWSS3ProviderUploadErrorStrings.UPLOAD_PAUSED_MESSAGE) {
|
|
183
192
|
logger.error(error.message);
|
|
184
193
|
}
|
|
185
194
|
// for axios' cancel error, we should re-throw it back so it's not considered an s3client error
|
|
186
|
-
// if we return empty, or an abitrary error HttpResponse, it will be hard to debug down the line
|
|
187
|
-
|
|
195
|
+
// if we return empty, or an abitrary error HttpResponse, it will be hard to debug down the line.
|
|
196
|
+
//
|
|
197
|
+
// for errors that does not have a 'response' object, it's very likely that it is an unexpected error for
|
|
198
|
+
// example a disconnect. Without it we cannot meaningfully reconstruct a HttpResponse, and the AWS SDK might
|
|
199
|
+
// consider the request successful by mistake. In this case we should also re-throw the error.
|
|
200
|
+
if (axios_1.default.isCancel(error) || !hasErrorResponse(error)) {
|
|
188
201
|
throw error;
|
|
189
202
|
}
|
|
190
203
|
// otherwise, we should re-construct an HttpResponse from the error, so that it can be passed down to other
|
|
191
204
|
// aws sdk middleware (e.g retry, clock skew correction, error message serializing)
|
|
192
205
|
return {
|
|
193
206
|
response: new protocol_http_1.HttpResponse({
|
|
194
|
-
statusCode:
|
|
195
|
-
body: (
|
|
196
|
-
headers: (
|
|
207
|
+
statusCode: error.response.status,
|
|
208
|
+
body: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
209
|
+
headers: (_b = error.response) === null || _b === void 0 ? void 0 : _b.headers,
|
|
197
210
|
}),
|
|
198
211
|
};
|
|
199
212
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios-http-handler.js","sourceRoot":"","sources":["../../src/providers/axios-http-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,wDAAgF;AAChF,oEAAgE;AAChE,
|
|
1
|
+
{"version":3,"file":"axios-http-handler.js","sourceRoot":"","sources":["../../src/providers/axios-http-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,wDAAgF;AAChF,oEAAgE;AAChE,gDAMe;AACf,0CAAsE;AAGtE,qEAAgF;AAYhF,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,oBAAoB,CAAC,CAAC;AACnC,QAAA,0BAA0B,GAAG,oBAAoB,CAAC;AAClD,QAAA,4BAA4B,GAAG,sBAAsB,CAAC;AAMnE,SAAS,MAAM,CAAC,IAAS;IACxB,OAAO,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,YAAY,IAAI,CAAC;AAC5D,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAU;IACnC,OAAO,CACN,OAAO,KAAK,KAAK,WAAW;QAC5B,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC;QACvD,OAAO,KAAK,CAAC,QAAQ,KAAK,WAAW;QACrC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC9D,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CACzC,CAAC;AACH,CAAC;AAED,IAAM,gBAAgB,GAAG,UACxB,OAA4B,EAC5B,cAAsB;;;QAEtB,KAAqB,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CA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CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;iBAC5B;gBACD,+FAA+F;gBAC/F,iGAAiG;gBACjG,EAAE;gBACF,yGAAyG;gBACzG,4GAA4G;gBAC5G,8FAA8F;gBAC9F,IAAI,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBACtD,MAAM,KAAK,CAAC;iBACZ;gBACD,2GAA2G;gBAC3G,mFAAmF;gBACnF,OAAO;oBACN,QAAQ,EAAE,IAAI,4BAAY,CAAC;wBAC1B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM;wBACjC,IAAI,QAAE,KAAK,CAAC,QAAQ,0CAAE,IAAI;wBAC1B,OAAO,QAAE,KAAK,CAAC,QAAQ,0CAAE,OAAO;qBAChC,CAAC;iBACF,CAAC;YACH,CAAC,CAAC;YACH,cAAc,CAAC,kBAAkB,CAAC;SAClC,CAAC;QACF,OAAO,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IACF,uBAAC;AAAD,CAAC,AAjJD,IAiJC;AAjJY,4CAAgB;AAmJ7B,SAAS,cAAc,CAAC,WAAuB;IAAvB,4BAAA,EAAA,eAAuB;IAC9C,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAClC,IAAI,WAAW,EAAE;YAChB,UAAU,CAAC;gBACV,IAAM,YAAY,GAAG,IAAI,KAAK,CAC7B,qCAAmC,WAAW,QAAK,CACnD,CAAC;gBACF,YAAY,CAAC,IAAI,GAAG,cAAc,CAAC;gBACnC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtB,CAAC,EAAE,WAAW,CAAC,CAAC;SAChB;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -15,8 +15,8 @@ export declare class AWSS3ProviderManagedUpload {
|
|
|
15
15
|
private params;
|
|
16
16
|
private opts;
|
|
17
17
|
private completedParts;
|
|
18
|
-
private cancel;
|
|
19
18
|
private s3client;
|
|
19
|
+
private uploadId;
|
|
20
20
|
private bytesUploaded;
|
|
21
21
|
private totalBytesToUpload;
|
|
22
22
|
private emitter;
|
|
@@ -30,8 +30,6 @@ export declare class AWSS3ProviderManagedUpload {
|
|
|
30
30
|
*/
|
|
31
31
|
protected uploadParts(uploadId: string, parts: Part[]): Promise<void>;
|
|
32
32
|
private finishMultiPartUpload;
|
|
33
|
-
private checkIfUploadCancelled;
|
|
34
|
-
cancelUpload(): void;
|
|
35
33
|
private cleanup;
|
|
36
34
|
private removeEventListener;
|
|
37
35
|
private setupEventListener;
|