@aws-sdk/lib-storage 3.171.0 → 3.179.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 CHANGED
@@ -3,6 +3,25 @@
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.179.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.178.0...v3.179.0) (2022-09-26)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/lib-storage
9
+
10
+
11
+
12
+
13
+
14
+ # [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)
15
+
16
+
17
+ ### Features
18
+
19
+ * **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))
20
+
21
+
22
+
23
+
24
+
6
25
  # [3.171.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.170.0...v3.171.0) (2022-09-14)
7
26
 
8
27
 
@@ -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,10 +42,11 @@ class Upload extends events_1.EventEmitter {
41
42
  return super.on(event, listener);
42
43
  }
43
44
  async __uploadUsingPut(dataPart) {
44
- var _a, _b;
45
+ var _a;
45
46
  this.isMultiPart = false;
46
47
  const params = { ...this.params, Body: dataPart.data };
47
- const requestHandler = this.client.config.requestHandler;
48
+ const clientConfig = this.client.config;
49
+ const requestHandler = clientConfig.requestHandler;
48
50
  const eventEmitter = requestHandler instanceof events_1.EventEmitter ? requestHandler : null;
49
51
  const uploadEventListener = (event) => {
50
52
  this.bytesUploadedSoFar = event.loaded;
@@ -60,12 +62,16 @@ class Upload extends events_1.EventEmitter {
60
62
  if (eventEmitter !== null) {
61
63
  eventEmitter.on("xhr.upload.progress", uploadEventListener);
62
64
  }
63
- const [putResult, endpoint] = await Promise.all([
64
- this.client.send(new client_s3_1.PutObjectCommand(params)),
65
- (_b = (_a = this.client.config) === null || _a === void 0 ? void 0 : _a.endpoint) === null || _b === void 0 ? void 0 : _b.call(_a),
66
- ]);
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];
67
68
  if (!endpoint) {
68
- throw new Error('Could not resolve endpoint from S3 "client.config.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.');
69
75
  }
70
76
  if (eventEmitter !== null) {
71
77
  eventEmitter.off("xhr.upload.progress", uploadEventListener);
package/dist-es/Upload.js CHANGED
@@ -1,6 +1,7 @@
1
- import { __assign, __asyncValues, __awaiter, __extends, __generator, __read } from "tslib";
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,16 +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) {
56
- var _a, _b;
57
+ var _a;
57
58
  return __awaiter(this, void 0, void 0, function () {
58
- var params, requestHandler, eventEmitter, uploadEventListener, _c, putResult, endpoint, locationKey, locationBucket, Location, totalSize;
59
+ var params, clientConfig, requestHandler, eventEmitter, uploadEventListener, resolved, putResult, endpoint, _b, locationKey, locationBucket, Location, totalSize;
59
60
  var _this = this;
60
- return __generator(this, function (_d) {
61
- switch (_d.label) {
61
+ return __generator(this, function (_c) {
62
+ switch (_c.label) {
62
63
  case 0:
63
64
  this.isMultiPart = false;
64
65
  params = __assign(__assign({}, this.params), { Body: dataPart.data });
65
- requestHandler = this.client.config.requestHandler;
66
+ clientConfig = this.client.config;
67
+ requestHandler = clientConfig.requestHandler;
66
68
  eventEmitter = requestHandler instanceof EventEmitter ? requestHandler : null;
67
69
  uploadEventListener = function (event) {
68
70
  _this.bytesUploadedSoFar = event.loaded;
@@ -78,14 +80,20 @@ var Upload = (function (_super) {
78
80
  if (eventEmitter !== null) {
79
81
  eventEmitter.on("xhr.upload.progress", uploadEventListener);
80
82
  }
81
- return [4, Promise.all([
82
- this.client.send(new PutObjectCommand(params)),
83
- (_b = (_a = this.client.config) === null || _a === void 0 ? void 0 : _a.endpoint) === null || _b === void 0 ? void 0 : _b.call(_a),
84
- ])];
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)])];
85
84
  case 1:
86
- _c = __read.apply(void 0, [_d.sent(), 2]), putResult = _c[0], endpoint = _c[1];
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:
87
95
  if (!endpoint) {
88
- throw new Error('Could not resolve endpoint from S3 "client.config.endpoint()".');
96
+ throw new Error('Could not resolve endpoint from S3 "client.config.endpoint()" nor EndpointsV2.');
89
97
  }
90
98
  if (eventEmitter !== null) {
91
99
  eventEmitter.off("xhr.upload.progress", uploadEventListener);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/lib-storage",
3
- "version": "3.171.0",
3
+ "version": "3.179.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/smithy-client": "3.171.0",
27
+ "@aws-sdk/middleware-endpoint": "3.179.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.171.0",
39
- "@aws-sdk/client-s3": "3.171.0",
39
+ "@aws-sdk/abort-controller": "3.178.0",
40
+ "@aws-sdk/client-s3": "3.179.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",