@aws-sdk/lib-storage 3.722.0 → 3.723.0
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/dist-cjs/index.js +40 -26
- package/dist-es/Upload.js +21 -12
- package/package.json +10 -10
package/dist-cjs/index.js
CHANGED
|
@@ -170,24 +170,46 @@ var getChunk = /* @__PURE__ */ __name((data, partSize) => {
|
|
|
170
170
|
}, "getChunk");
|
|
171
171
|
|
|
172
172
|
// src/Upload.ts
|
|
173
|
-
var
|
|
173
|
+
var Upload = class _Upload extends import_events.EventEmitter {
|
|
174
|
+
static {
|
|
175
|
+
__name(this, "Upload");
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @internal
|
|
179
|
+
* modified in testing only.
|
|
180
|
+
*/
|
|
181
|
+
static MIN_PART_SIZE = 1024 * 1024 * 5;
|
|
182
|
+
/**
|
|
183
|
+
* S3 multipart upload does not allow more than 10,000 parts.
|
|
184
|
+
*/
|
|
185
|
+
MAX_PARTS = 1e4;
|
|
186
|
+
// Defaults.
|
|
187
|
+
queueSize = 4;
|
|
188
|
+
partSize = _Upload.MIN_PART_SIZE;
|
|
189
|
+
leavePartsOnError = false;
|
|
190
|
+
tags = [];
|
|
191
|
+
client;
|
|
192
|
+
params;
|
|
193
|
+
// used for reporting progress.
|
|
194
|
+
totalBytes;
|
|
195
|
+
bytesUploadedSoFar;
|
|
196
|
+
// used in the upload.
|
|
197
|
+
abortController;
|
|
198
|
+
concurrentUploaders = [];
|
|
199
|
+
createMultiPartPromise;
|
|
200
|
+
abortMultipartUploadCommand = null;
|
|
201
|
+
uploadedParts = [];
|
|
202
|
+
uploadEnqueuedPartsCount = 0;
|
|
203
|
+
/**
|
|
204
|
+
* Last UploadId if the upload was done with MultipartUpload and not PutObject.
|
|
205
|
+
*/
|
|
206
|
+
uploadId;
|
|
207
|
+
uploadEvent;
|
|
208
|
+
isMultiPart = true;
|
|
209
|
+
singleUploadResult;
|
|
210
|
+
sent = false;
|
|
174
211
|
constructor(options) {
|
|
175
212
|
super();
|
|
176
|
-
/**
|
|
177
|
-
* S3 multipart upload does not allow more than 10,000 parts.
|
|
178
|
-
*/
|
|
179
|
-
this.MAX_PARTS = 1e4;
|
|
180
|
-
// Defaults.
|
|
181
|
-
this.queueSize = 4;
|
|
182
|
-
this.partSize = _Upload.MIN_PART_SIZE;
|
|
183
|
-
this.leavePartsOnError = false;
|
|
184
|
-
this.tags = [];
|
|
185
|
-
this.concurrentUploaders = [];
|
|
186
|
-
this.abortMultipartUploadCommand = null;
|
|
187
|
-
this.uploadedParts = [];
|
|
188
|
-
this.uploadEnqueuedPartsCount = 0;
|
|
189
|
-
this.isMultiPart = true;
|
|
190
|
-
this.sent = false;
|
|
191
213
|
this.queueSize = options.queueSize || this.queueSize;
|
|
192
214
|
this.partSize = options.partSize || this.partSize;
|
|
193
215
|
this.leavePartsOnError = options.leavePartsOnError || this.leavePartsOnError;
|
|
@@ -216,7 +238,6 @@ var _Upload = class _Upload extends import_events.EventEmitter {
|
|
|
216
238
|
return super.on(event, listener);
|
|
217
239
|
}
|
|
218
240
|
async __uploadUsingPut(dataPart) {
|
|
219
|
-
var _a;
|
|
220
241
|
this.isMultiPart = false;
|
|
221
242
|
const params = { ...this.params, Body: dataPart.data };
|
|
222
243
|
const clientConfig = this.client.config;
|
|
@@ -236,7 +257,7 @@ var _Upload = class _Upload extends import_events.EventEmitter {
|
|
|
236
257
|
if (eventEmitter !== null) {
|
|
237
258
|
eventEmitter.on("xhr.upload.progress", uploadEventListener);
|
|
238
259
|
}
|
|
239
|
-
const resolved = await Promise.all([this.client.send(new import_client_s3.PutObjectCommand(params)),
|
|
260
|
+
const resolved = await Promise.all([this.client.send(new import_client_s3.PutObjectCommand(params)), clientConfig?.endpoint?.()]);
|
|
240
261
|
const putResult = resolved[0];
|
|
241
262
|
let endpoint = resolved[1];
|
|
242
263
|
if (!endpoint) {
|
|
@@ -412,7 +433,7 @@ var _Upload = class _Upload extends import_events.EventEmitter {
|
|
|
412
433
|
}
|
|
413
434
|
};
|
|
414
435
|
result = await this.client.send(new import_client_s3.CompleteMultipartUploadCommand(uploadCompleteParams));
|
|
415
|
-
if (typeof
|
|
436
|
+
if (typeof result?.Location === "string" && result.Location.includes("%2F")) {
|
|
416
437
|
result.Location = result.Location.replace(/%2F/g, "/");
|
|
417
438
|
}
|
|
418
439
|
} else {
|
|
@@ -473,13 +494,6 @@ var _Upload = class _Upload extends import_events.EventEmitter {
|
|
|
473
494
|
}
|
|
474
495
|
}
|
|
475
496
|
};
|
|
476
|
-
__name(_Upload, "Upload");
|
|
477
|
-
/**
|
|
478
|
-
* @internal
|
|
479
|
-
* modified in testing only.
|
|
480
|
-
*/
|
|
481
|
-
_Upload.MIN_PART_SIZE = 1024 * 1024 * 5;
|
|
482
|
-
var Upload = _Upload;
|
|
483
497
|
// Annotate the CommonJS export names for ESM import in node:
|
|
484
498
|
|
|
485
499
|
0 && (module.exports = {
|
package/dist-es/Upload.js
CHANGED
|
@@ -6,19 +6,29 @@ import { EventEmitter } from "events";
|
|
|
6
6
|
import { byteLength } from "./bytelength";
|
|
7
7
|
import { getChunk } from "./chunker";
|
|
8
8
|
export class Upload extends EventEmitter {
|
|
9
|
+
static MIN_PART_SIZE = 1024 * 1024 * 5;
|
|
10
|
+
MAX_PARTS = 10000;
|
|
11
|
+
queueSize = 4;
|
|
12
|
+
partSize = Upload.MIN_PART_SIZE;
|
|
13
|
+
leavePartsOnError = false;
|
|
14
|
+
tags = [];
|
|
15
|
+
client;
|
|
16
|
+
params;
|
|
17
|
+
totalBytes;
|
|
18
|
+
bytesUploadedSoFar;
|
|
19
|
+
abortController;
|
|
20
|
+
concurrentUploaders = [];
|
|
21
|
+
createMultiPartPromise;
|
|
22
|
+
abortMultipartUploadCommand = null;
|
|
23
|
+
uploadedParts = [];
|
|
24
|
+
uploadEnqueuedPartsCount = 0;
|
|
25
|
+
uploadId;
|
|
26
|
+
uploadEvent;
|
|
27
|
+
isMultiPart = true;
|
|
28
|
+
singleUploadResult;
|
|
29
|
+
sent = false;
|
|
9
30
|
constructor(options) {
|
|
10
31
|
super();
|
|
11
|
-
this.MAX_PARTS = 10000;
|
|
12
|
-
this.queueSize = 4;
|
|
13
|
-
this.partSize = Upload.MIN_PART_SIZE;
|
|
14
|
-
this.leavePartsOnError = false;
|
|
15
|
-
this.tags = [];
|
|
16
|
-
this.concurrentUploaders = [];
|
|
17
|
-
this.abortMultipartUploadCommand = null;
|
|
18
|
-
this.uploadedParts = [];
|
|
19
|
-
this.uploadEnqueuedPartsCount = 0;
|
|
20
|
-
this.isMultiPart = true;
|
|
21
|
-
this.sent = false;
|
|
22
32
|
this.queueSize = options.queueSize || this.queueSize;
|
|
23
33
|
this.partSize = options.partSize || this.partSize;
|
|
24
34
|
this.leavePartsOnError = options.leavePartsOnError || this.leavePartsOnError;
|
|
@@ -288,4 +298,3 @@ export class Upload extends EventEmitter {
|
|
|
288
298
|
}
|
|
289
299
|
}
|
|
290
300
|
}
|
|
291
|
-
Upload.MIN_PART_SIZE = 1024 * 1024 * 5;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/lib-storage",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.723.0",
|
|
4
4
|
"description": "Storage higher order operation",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.ts"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=18.0.0"
|
|
24
24
|
},
|
|
25
25
|
"author": {
|
|
26
26
|
"name": "AWS SDK for JavaScript Team",
|
|
@@ -28,26 +28,26 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@smithy/abort-controller": "^
|
|
32
|
-
"@smithy/middleware-endpoint": "^
|
|
33
|
-
"@smithy/smithy-client": "^
|
|
31
|
+
"@smithy/abort-controller": "^4.0.0",
|
|
32
|
+
"@smithy/middleware-endpoint": "^4.0.0",
|
|
33
|
+
"@smithy/smithy-client": "^4.0.0",
|
|
34
34
|
"buffer": "5.6.0",
|
|
35
35
|
"events": "3.3.0",
|
|
36
36
|
"stream-browserify": "3.0.0",
|
|
37
37
|
"tslib": "^2.6.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@aws-sdk/client-s3": "^3.
|
|
40
|
+
"@aws-sdk/client-s3": "^3.723.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@aws-sdk/client-s3": "3.
|
|
44
|
-
"@smithy/types": "^
|
|
43
|
+
"@aws-sdk/client-s3": "3.723.0",
|
|
44
|
+
"@smithy/types": "^4.0.0",
|
|
45
45
|
"@tsconfig/recommended": "1.0.1",
|
|
46
|
-
"@types/node": "^
|
|
46
|
+
"@types/node": "^18.19.69",
|
|
47
47
|
"concurrently": "7.0.0",
|
|
48
48
|
"downlevel-dts": "0.10.1",
|
|
49
49
|
"rimraf": "3.0.2",
|
|
50
|
-
"typescript": "~
|
|
50
|
+
"typescript": "~5.2.2",
|
|
51
51
|
"web-streams-polyfill": "3.2.1"
|
|
52
52
|
},
|
|
53
53
|
"typesVersions": {
|