@aws-sdk/lib-storage 3.170.0 → 3.178.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/CHANGELOG.md +22 -0
- package/dist-cjs/Upload.js +15 -5
- package/dist-es/Upload.js +22 -10
- package/dist-types/ts3.4/runtimeConfig.d.ts +0 -1
- package/dist-types/ts3.4/types.d.ts +0 -5
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **endpoint:** endpoints 2.0 existing package changes ([#3947](https://github.com/aws/aws-sdk-js-v3/issues/3947)) ([df99fc3](https://github.com/aws/aws-sdk-js-v3/commit/df99fc33a43982e1c59000721a535f6fe77a3c23))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.171.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.170.0...v3.171.0) (2022-09-14)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **endpoint:** endpoints v2 codegen ([#3942](https://github.com/aws/aws-sdk-js-v3/issues/3942)) ([4b32da4](https://github.com/aws/aws-sdk-js-v3/commit/4b32da42011194d4eefe32eb6f7035872fb163c2))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.170.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.169.0...v3.170.0) (2022-09-13)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @aws-sdk/lib-storage
|
package/dist-cjs/Upload.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Upload = void 0;
|
|
4
4
|
const abort_controller_1 = require("@aws-sdk/abort-controller");
|
|
5
5
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
6
|
+
const middleware_endpoint_1 = require("@aws-sdk/middleware-endpoint");
|
|
6
7
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
7
8
|
const events_1 = require("events");
|
|
8
9
|
const bytelength_1 = require("./bytelength");
|
|
@@ -41,9 +42,11 @@ class Upload extends events_1.EventEmitter {
|
|
|
41
42
|
return super.on(event, listener);
|
|
42
43
|
}
|
|
43
44
|
async __uploadUsingPut(dataPart) {
|
|
45
|
+
var _a;
|
|
44
46
|
this.isMultiPart = false;
|
|
45
47
|
const params = { ...this.params, Body: dataPart.data };
|
|
46
|
-
const
|
|
48
|
+
const clientConfig = this.client.config;
|
|
49
|
+
const requestHandler = clientConfig.requestHandler;
|
|
47
50
|
const eventEmitter = requestHandler instanceof events_1.EventEmitter ? requestHandler : null;
|
|
48
51
|
const uploadEventListener = (event) => {
|
|
49
52
|
this.bytesUploadedSoFar = event.loaded;
|
|
@@ -59,10 +62,17 @@ class Upload extends events_1.EventEmitter {
|
|
|
59
62
|
if (eventEmitter !== null) {
|
|
60
63
|
eventEmitter.on("xhr.upload.progress", uploadEventListener);
|
|
61
64
|
}
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
const resolved = await Promise.all([this.client.send(new client_s3_1.PutObjectCommand(params)), (_a = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.endpoint) === null || _a === void 0 ? void 0 : _a.call(clientConfig)]);
|
|
66
|
+
const putResult = resolved[0];
|
|
67
|
+
let endpoint = resolved[1];
|
|
68
|
+
if (!endpoint) {
|
|
69
|
+
endpoint = (0, middleware_endpoint_1.toEndpointV1)(await (0, middleware_endpoint_1.getEndpointFromInstructions)(params, client_s3_1.PutObjectCommand, {
|
|
70
|
+
...clientConfig,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
if (!endpoint) {
|
|
74
|
+
throw new Error('Could not resolve endpoint from S3 "client.config.endpoint()" nor EndpointsV2.');
|
|
75
|
+
}
|
|
66
76
|
if (eventEmitter !== null) {
|
|
67
77
|
eventEmitter.off("xhr.upload.progress", uploadEventListener);
|
|
68
78
|
}
|
package/dist-es/Upload.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { __assign, __asyncValues, __awaiter, __extends, __generator
|
|
1
|
+
import { __assign, __asyncValues, __awaiter, __extends, __generator } from "tslib";
|
|
2
2
|
import { AbortController } from "@aws-sdk/abort-controller";
|
|
3
3
|
import { CompleteMultipartUploadCommand, CreateMultipartUploadCommand, PutObjectCommand, PutObjectTaggingCommand, UploadPartCommand, } from "@aws-sdk/client-s3";
|
|
4
|
+
import { getEndpointFromInstructions, toEndpointV1, } from "@aws-sdk/middleware-endpoint";
|
|
4
5
|
import { extendedEncodeURIComponent } from "@aws-sdk/smithy-client";
|
|
5
6
|
import { EventEmitter } from "events";
|
|
6
7
|
import { byteLength } from "./bytelength";
|
|
@@ -53,15 +54,17 @@ var Upload = (function (_super) {
|
|
|
53
54
|
return _super.prototype.on.call(this, event, listener);
|
|
54
55
|
};
|
|
55
56
|
Upload.prototype.__uploadUsingPut = function (dataPart) {
|
|
57
|
+
var _a;
|
|
56
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var params, requestHandler, eventEmitter, uploadEventListener,
|
|
59
|
+
var params, clientConfig, requestHandler, eventEmitter, uploadEventListener, resolved, putResult, endpoint, _b, locationKey, locationBucket, Location, totalSize;
|
|
58
60
|
var _this = this;
|
|
59
|
-
return __generator(this, function (
|
|
60
|
-
switch (
|
|
61
|
+
return __generator(this, function (_c) {
|
|
62
|
+
switch (_c.label) {
|
|
61
63
|
case 0:
|
|
62
64
|
this.isMultiPart = false;
|
|
63
65
|
params = __assign(__assign({}, this.params), { Body: dataPart.data });
|
|
64
|
-
|
|
66
|
+
clientConfig = this.client.config;
|
|
67
|
+
requestHandler = clientConfig.requestHandler;
|
|
65
68
|
eventEmitter = requestHandler instanceof EventEmitter ? requestHandler : null;
|
|
66
69
|
uploadEventListener = function (event) {
|
|
67
70
|
_this.bytesUploadedSoFar = event.loaded;
|
|
@@ -77,12 +80,21 @@ var Upload = (function (_super) {
|
|
|
77
80
|
if (eventEmitter !== null) {
|
|
78
81
|
eventEmitter.on("xhr.upload.progress", uploadEventListener);
|
|
79
82
|
}
|
|
80
|
-
return [4, Promise.all([
|
|
81
|
-
this.client.send(new PutObjectCommand(params)),
|
|
82
|
-
this.client.config.endpoint(),
|
|
83
|
-
])];
|
|
83
|
+
return [4, Promise.all([this.client.send(new PutObjectCommand(params)), (_a = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.endpoint) === null || _a === void 0 ? void 0 : _a.call(clientConfig)])];
|
|
84
84
|
case 1:
|
|
85
|
-
|
|
85
|
+
resolved = _c.sent();
|
|
86
|
+
putResult = resolved[0];
|
|
87
|
+
endpoint = resolved[1];
|
|
88
|
+
if (!!endpoint) return [3, 3];
|
|
89
|
+
_b = toEndpointV1;
|
|
90
|
+
return [4, getEndpointFromInstructions(params, PutObjectCommand, __assign({}, clientConfig))];
|
|
91
|
+
case 2:
|
|
92
|
+
endpoint = _b.apply(void 0, [_c.sent()]);
|
|
93
|
+
_c.label = 3;
|
|
94
|
+
case 3:
|
|
95
|
+
if (!endpoint) {
|
|
96
|
+
throw new Error('Could not resolve endpoint from S3 "client.config.endpoint()" nor EndpointsV2.');
|
|
97
|
+
}
|
|
86
98
|
if (eventEmitter !== null) {
|
|
87
99
|
eventEmitter.off("xhr.upload.progress", uploadEventListener);
|
|
88
100
|
}
|
|
@@ -7,19 +7,14 @@ export interface Progress {
|
|
|
7
7
|
Bucket?: string;
|
|
8
8
|
}
|
|
9
9
|
export declare type BodyDataTypes = PutObjectCommandInput["Body"];
|
|
10
|
-
|
|
11
10
|
export declare type ServiceClients = S3Client;
|
|
12
11
|
export interface Configuration {
|
|
13
12
|
queueSize: number;
|
|
14
|
-
|
|
15
13
|
partSize: number;
|
|
16
|
-
|
|
17
14
|
leavePartsOnError: boolean;
|
|
18
|
-
|
|
19
15
|
tags: Tag[];
|
|
20
16
|
}
|
|
21
17
|
export interface Options extends Partial<Configuration> {
|
|
22
18
|
params: PutObjectCommandInput;
|
|
23
|
-
|
|
24
19
|
client: S3Client;
|
|
25
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/lib-storage",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.178.0",
|
|
4
4
|
"description": "Storage higher order operation",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/
|
|
27
|
+
"@aws-sdk/middleware-endpoint": "3.178.0",
|
|
28
|
+
"@aws-sdk/smithy-client": "3.178.0",
|
|
28
29
|
"buffer": "5.6.0",
|
|
29
30
|
"events": "3.3.0",
|
|
30
31
|
"stream-browserify": "3.0.0",
|
|
@@ -35,8 +36,9 @@
|
|
|
35
36
|
"@aws-sdk/client-s3": "^3.0.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@aws-sdk/abort-controller": "3.
|
|
39
|
-
"@aws-sdk/client-s3": "3.
|
|
39
|
+
"@aws-sdk/abort-controller": "3.178.0",
|
|
40
|
+
"@aws-sdk/client-s3": "3.178.0",
|
|
41
|
+
"@aws-sdk/types": "3.178.0",
|
|
40
42
|
"@tsconfig/recommended": "1.0.1",
|
|
41
43
|
"@types/node": "^14.11.2",
|
|
42
44
|
"concurrently": "7.0.0",
|