@aws-sdk/s3-request-presigner 3.503.0 → 3.504.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 CHANGED
@@ -93,8 +93,9 @@ var S3RequestPresigner = _S3RequestPresigner;
93
93
 
94
94
  // src/getSignedUrl.ts
95
95
  var getSignedUrl = /* @__PURE__ */ __name(async (client, command, options = {}) => {
96
- var _a, _b;
96
+ var _a, _b, _c;
97
97
  let s3Presigner;
98
+ let region;
98
99
  if (typeof client.config.endpointProvider === "function") {
99
100
  const endpointV2 = await (0, import_middleware_endpoint.getEndpointFromInstructions)(
100
101
  command.input,
@@ -102,10 +103,15 @@ var getSignedUrl = /* @__PURE__ */ __name(async (client, command, options = {})
102
103
  client.config
103
104
  );
104
105
  const authScheme = (_b = (_a = endpointV2.properties) == null ? void 0 : _a.authSchemes) == null ? void 0 : _b[0];
106
+ if ((authScheme == null ? void 0 : authScheme.name) === "sigv4a") {
107
+ region = (_c = authScheme == null ? void 0 : authScheme.signingRegionSet) == null ? void 0 : _c.join(",");
108
+ } else {
109
+ region = authScheme == null ? void 0 : authScheme.signingRegion;
110
+ }
105
111
  s3Presigner = new S3RequestPresigner({
106
112
  ...client.config,
107
113
  signingName: authScheme == null ? void 0 : authScheme.signingName,
108
- region: async () => authScheme == null ? void 0 : authScheme.signingRegion
114
+ region: async () => region
109
115
  });
110
116
  } else {
111
117
  s3Presigner = new S3RequestPresigner(client.config);
@@ -121,7 +127,7 @@ var getSignedUrl = /* @__PURE__ */ __name(async (client, command, options = {})
121
127
  let presigned2;
122
128
  const presignerOptions = {
123
129
  ...options,
124
- signingRegion: options.signingRegion ?? context["signing_region"],
130
+ signingRegion: options.signingRegion ?? context["signing_region"] ?? region,
125
131
  signingService: options.signingService ?? context["signing_service"]
126
132
  };
127
133
  if (context.s3ExpressIdentity) {
@@ -4,13 +4,20 @@ import { HttpRequest } from "@smithy/protocol-http";
4
4
  import { S3RequestPresigner } from "./presigner";
5
5
  export const getSignedUrl = async (client, command, options = {}) => {
6
6
  let s3Presigner;
7
+ let region;
7
8
  if (typeof client.config.endpointProvider === "function") {
8
9
  const endpointV2 = await getEndpointFromInstructions(command.input, command.constructor, client.config);
9
10
  const authScheme = endpointV2.properties?.authSchemes?.[0];
11
+ if (authScheme?.name === "sigv4a") {
12
+ region = authScheme?.signingRegionSet?.join(",");
13
+ }
14
+ else {
15
+ region = authScheme?.signingRegion;
16
+ }
10
17
  s3Presigner = new S3RequestPresigner({
11
18
  ...client.config,
12
19
  signingName: authScheme?.signingName,
13
- region: async () => authScheme?.signingRegion,
20
+ region: async () => region,
14
21
  });
15
22
  }
16
23
  else {
@@ -27,7 +34,7 @@ export const getSignedUrl = async (client, command, options = {}) => {
27
34
  let presigned;
28
35
  const presignerOptions = {
29
36
  ...options,
30
- signingRegion: options.signingRegion ?? context["signing_region"],
37
+ signingRegion: options.signingRegion ?? context["signing_region"] ?? region,
31
38
  signingService: options.signingService ?? context["signing_service"],
32
39
  };
33
40
  if (context.s3ExpressIdentity) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/s3-request-presigner",
3
- "version": "3.503.0",
3
+ "version": "3.504.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline s3-request-presigner",
@@ -31,7 +31,7 @@
31
31
  "tslib": "^2.5.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@aws-sdk/client-s3": "3.503.0",
34
+ "@aws-sdk/client-s3": "3.504.0",
35
35
  "@smithy/hash-node": "^2.1.1",
36
36
  "@tsconfig/recommended": "1.0.1",
37
37
  "@types/node": "^14.14.31",