@aws-sdk/s3-request-presigner 3.173.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,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.179.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.178.0...v3.179.0) (2022-09-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **endpoint:** add package dependencies for middleware-endpoint ([#3988](https://github.com/aws/aws-sdk-js-v3/issues/3988)) ([4877469](https://github.com/aws/aws-sdk-js-v3/commit/4877469dea3ad91c2cbd7e7697bd8ba9b430a2b1))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)
18
+
19
+
20
+ ### Features
21
+
22
+ * **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))
23
+
24
+
25
+
26
+
27
+
6
28
  # [3.173.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.172.0...v3.173.0) (2022-09-16)
7
29
 
8
30
 
@@ -1,11 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSignedUrl = void 0;
4
+ const middleware_endpoint_1 = require("@aws-sdk/middleware-endpoint");
4
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
6
  const util_format_url_1 = require("@aws-sdk/util-format-url");
6
7
  const presigner_1 = require("./presigner");
7
8
  const getSignedUrl = async (client, command, options = {}) => {
8
- const s3Presigner = new presigner_1.S3RequestPresigner({ ...client.config });
9
+ var _a, _b;
10
+ let s3Presigner;
11
+ if (typeof client.config.endpointProvider === "function") {
12
+ const endpointV2 = await (0, middleware_endpoint_1.getEndpointFromInstructions)(command.input, command.constructor, client.config);
13
+ const authScheme = (_b = (_a = endpointV2.properties) === null || _a === void 0 ? void 0 : _a.authSchemes) === null || _b === void 0 ? void 0 : _b[0];
14
+ s3Presigner = new presigner_1.S3RequestPresigner({
15
+ ...client.config,
16
+ signingName: authScheme === null || authScheme === void 0 ? void 0 : authScheme.signingName,
17
+ region: async () => authScheme === null || authScheme === void 0 ? void 0 : authScheme.signingScope,
18
+ });
19
+ }
20
+ else {
21
+ s3Presigner = new presigner_1.S3RequestPresigner(client.config);
22
+ }
9
23
  const presignInterceptMiddleware = (next, context) => async (args) => {
10
24
  var _a, _b;
11
25
  const { request } = args;
@@ -1,15 +1,29 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
+ import { getEndpointFromInstructions } from "@aws-sdk/middleware-endpoint";
2
3
  import { HttpRequest } from "@aws-sdk/protocol-http";
3
4
  import { formatUrl } from "@aws-sdk/util-format-url";
4
5
  import { S3RequestPresigner } from "./presigner";
5
6
  export var getSignedUrl = function (client, command, options) {
6
7
  if (options === void 0) { options = {}; }
7
8
  return __awaiter(void 0, void 0, void 0, function () {
8
- var s3Presigner, presignInterceptMiddleware, middlewareName, clientStack, handler, output, presigned;
9
- return __generator(this, function (_a) {
10
- switch (_a.label) {
9
+ var s3Presigner, endpointV2, authScheme_1, presignInterceptMiddleware, middlewareName, clientStack, handler, output, presigned;
10
+ var _a, _b;
11
+ return __generator(this, function (_c) {
12
+ switch (_c.label) {
11
13
  case 0:
12
- s3Presigner = new S3RequestPresigner(__assign({}, client.config));
14
+ if (!(typeof client.config.endpointProvider === "function")) return [3, 2];
15
+ return [4, getEndpointFromInstructions(command.input, command.constructor, client.config)];
16
+ case 1:
17
+ endpointV2 = _c.sent();
18
+ authScheme_1 = (_b = (_a = endpointV2.properties) === null || _a === void 0 ? void 0 : _a.authSchemes) === null || _b === void 0 ? void 0 : _b[0];
19
+ s3Presigner = new S3RequestPresigner(__assign(__assign({}, client.config), { signingName: authScheme_1 === null || authScheme_1 === void 0 ? void 0 : authScheme_1.signingName, region: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
20
+ return [2, authScheme_1 === null || authScheme_1 === void 0 ? void 0 : authScheme_1.signingScope];
21
+ }); }); } }));
22
+ return [3, 3];
23
+ case 2:
24
+ s3Presigner = new S3RequestPresigner(client.config);
25
+ _c.label = 3;
26
+ case 3:
13
27
  presignInterceptMiddleware = function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {
14
28
  var request, presigned;
15
29
  var _a, _b;
@@ -46,8 +60,8 @@ export var getSignedUrl = function (client, command, options) {
46
60
  });
47
61
  handler = command.resolveMiddleware(clientStack, client.config, {});
48
62
  return [4, handler({ input: command.input })];
49
- case 1:
50
- output = (_a.sent()).output;
63
+ case 4:
64
+ output = (_c.sent()).output;
51
65
  presigned = output.presigned;
52
66
  return [2, formatUrl(presigned)];
53
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/s3-request-presigner",
3
- "version": "3.173.0",
3
+ "version": "3.179.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,18 +20,19 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/middleware-sdk-s3": "3.171.0",
24
- "@aws-sdk/protocol-http": "3.171.0",
25
- "@aws-sdk/signature-v4-multi-region": "3.171.0",
26
- "@aws-sdk/smithy-client": "3.171.0",
27
- "@aws-sdk/types": "3.171.0",
28
- "@aws-sdk/util-create-request": "3.171.0",
29
- "@aws-sdk/util-format-url": "3.171.0",
23
+ "@aws-sdk/middleware-endpoint": "3.179.0",
24
+ "@aws-sdk/middleware-sdk-s3": "3.178.0",
25
+ "@aws-sdk/protocol-http": "3.178.0",
26
+ "@aws-sdk/signature-v4-multi-region": "3.178.0",
27
+ "@aws-sdk/smithy-client": "3.178.0",
28
+ "@aws-sdk/types": "3.178.0",
29
+ "@aws-sdk/util-create-request": "3.178.0",
30
+ "@aws-sdk/util-format-url": "3.178.0",
30
31
  "tslib": "^2.3.1"
31
32
  },
32
33
  "devDependencies": {
33
- "@aws-sdk/client-s3": "3.171.0",
34
- "@aws-sdk/hash-node": "3.171.0",
34
+ "@aws-sdk/client-s3": "3.179.0",
35
+ "@aws-sdk/hash-node": "3.178.0",
35
36
  "@tsconfig/recommended": "1.0.1",
36
37
  "@types/node": "^12.0.2",
37
38
  "concurrently": "7.0.0",