@aws-sdk/nested-clients 3.919.0 → 3.921.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.
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ruleSet = void 0;
4
4
  const u = "required", v = "fn", w = "argv", x = "ref";
5
- const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "String" }, j = { [u]: true, "default": false, "type": "Boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
5
+ const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "string" }, j = { [u]: true, "default": false, "type": "boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
6
6
  const _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] };
7
7
  exports.ruleSet = _data;
@@ -8,6 +8,7 @@ var EndpointParameters = require('./endpoint/EndpointParameters');
8
8
  var core = require('@aws-sdk/core');
9
9
  var protocolHttp = require('@smithy/protocol-http');
10
10
  var client = require('@aws-sdk/core/client');
11
+ var regionConfigResolver = require('@aws-sdk/region-config-resolver');
11
12
 
12
13
  class STSServiceException extends smithyClient.ServiceException {
13
14
  constructor(options) {
@@ -679,7 +680,6 @@ class STS extends STSClient.STSClient {
679
680
  }
680
681
  smithyClient.createAggregatedClient(commands, STS);
681
682
 
682
- const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
683
683
  const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
684
684
  if (typeof assumedRoleUser?.Arn === "string") {
685
685
  const arnComponents = assumedRoleUser.Arn.split(":");
@@ -689,11 +689,12 @@ const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
689
689
  }
690
690
  return undefined;
691
691
  };
692
- const resolveRegion = async (_region, _parentRegion, credentialProviderLogger) => {
692
+ const resolveRegion = async (_region, _parentRegion, credentialProviderLogger, loaderConfig = {}) => {
693
693
  const region = typeof _region === "function" ? await _region() : _region;
694
694
  const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion;
695
- credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (provider)`, `${parentRegion} (parent client)`, `${ASSUME_ROLE_DEFAULT_REGION} (STS default)`);
696
- return region ?? parentRegion ?? ASSUME_ROLE_DEFAULT_REGION;
695
+ const stsDefaultRegion = await regionConfigResolver.stsRegionDefaultResolver(loaderConfig)();
696
+ credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (credential provider clientConfig)`, `${parentRegion} (contextual client)`, `${stsDefaultRegion} (STS default: AWS_REGION, profile region, or us-east-1)`);
697
+ return region ?? parentRegion ?? stsDefaultRegion;
697
698
  };
698
699
  const getDefaultRoleAssumer$1 = (stsOptions, STSClient) => {
699
700
  let stsClient;
@@ -702,7 +703,10 @@ const getDefaultRoleAssumer$1 = (stsOptions, STSClient) => {
702
703
  closureSourceCreds = sourceCreds;
703
704
  if (!stsClient) {
704
705
  const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, } = stsOptions;
705
- const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger);
706
+ const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
707
+ logger,
708
+ profile,
709
+ });
706
710
  const isCompatibleRequestHandler = !isH2(requestHandler);
707
711
  stsClient = new STSClient({
708
712
  ...stsOptions,
@@ -735,7 +739,10 @@ const getDefaultRoleAssumerWithWebIdentity$1 = (stsOptions, STSClient) => {
735
739
  return async (params) => {
736
740
  if (!stsClient) {
737
741
  const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, } = stsOptions;
738
- const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger);
742
+ const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
743
+ logger,
744
+ profile,
745
+ });
739
746
  const isCompatibleRequestHandler = !isH2(requestHandler);
740
747
  stsClient = new STSClient({
741
748
  ...stsOptions,
@@ -1,4 +1,4 @@
1
1
  const u = "required", v = "fn", w = "argv", x = "ref";
2
- const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "String" }, j = { [u]: true, "default": false, "type": "Boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
2
+ const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "string" }, j = { [u]: true, "default": false, "type": "boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
3
3
  const _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] };
4
4
  export const ruleSet = _data;
@@ -1,7 +1,7 @@
1
1
  import { setCredentialFeature } from "@aws-sdk/core/client";
2
+ import { stsRegionDefaultResolver } from "@aws-sdk/region-config-resolver";
2
3
  import { AssumeRoleCommand } from "./commands/AssumeRoleCommand";
3
4
  import { AssumeRoleWithWebIdentityCommand, } from "./commands/AssumeRoleWithWebIdentityCommand";
4
- const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
5
5
  const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
6
6
  if (typeof assumedRoleUser?.Arn === "string") {
7
7
  const arnComponents = assumedRoleUser.Arn.split(":");
@@ -11,11 +11,12 @@ const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
11
11
  }
12
12
  return undefined;
13
13
  };
14
- const resolveRegion = async (_region, _parentRegion, credentialProviderLogger) => {
14
+ const resolveRegion = async (_region, _parentRegion, credentialProviderLogger, loaderConfig = {}) => {
15
15
  const region = typeof _region === "function" ? await _region() : _region;
16
16
  const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion;
17
- credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (provider)`, `${parentRegion} (parent client)`, `${ASSUME_ROLE_DEFAULT_REGION} (STS default)`);
18
- return region ?? parentRegion ?? ASSUME_ROLE_DEFAULT_REGION;
17
+ const stsDefaultRegion = await stsRegionDefaultResolver(loaderConfig)();
18
+ credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (credential provider clientConfig)`, `${parentRegion} (contextual client)`, `${stsDefaultRegion} (STS default: AWS_REGION, profile region, or us-east-1)`);
19
+ return region ?? parentRegion ?? stsDefaultRegion;
19
20
  };
20
21
  export const getDefaultRoleAssumer = (stsOptions, STSClient) => {
21
22
  let stsClient;
@@ -24,7 +25,10 @@ export const getDefaultRoleAssumer = (stsOptions, STSClient) => {
24
25
  closureSourceCreds = sourceCreds;
25
26
  if (!stsClient) {
26
27
  const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, } = stsOptions;
27
- const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger);
28
+ const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
29
+ logger,
30
+ profile,
31
+ });
28
32
  const isCompatibleRequestHandler = !isH2(requestHandler);
29
33
  stsClient = new STSClient({
30
34
  ...stsOptions,
@@ -57,7 +61,10 @@ export const getDefaultRoleAssumerWithWebIdentity = (stsOptions, STSClient) => {
57
61
  return async (params) => {
58
62
  if (!stsClient) {
59
63
  const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, } = stsOptions;
60
- const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger);
64
+ const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
65
+ logger,
66
+ profile,
67
+ });
61
68
  const isCompatibleRequestHandler = !isH2(requestHandler);
62
69
  stsClient = new STSClient({
63
70
  ...stsOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/nested-clients",
3
- "version": "3.919.0",
3
+ "version": "3.921.0",
4
4
  "description": "Nested clients for AWS SDK packages.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -29,40 +29,40 @@
29
29
  "dependencies": {
30
30
  "@aws-crypto/sha256-browser": "5.2.0",
31
31
  "@aws-crypto/sha256-js": "5.2.0",
32
- "@aws-sdk/core": "3.916.0",
33
- "@aws-sdk/middleware-host-header": "3.914.0",
34
- "@aws-sdk/middleware-logger": "3.914.0",
35
- "@aws-sdk/middleware-recursion-detection": "3.919.0",
36
- "@aws-sdk/middleware-user-agent": "3.916.0",
37
- "@aws-sdk/region-config-resolver": "3.914.0",
38
- "@aws-sdk/types": "3.914.0",
39
- "@aws-sdk/util-endpoints": "3.916.0",
40
- "@aws-sdk/util-user-agent-browser": "3.914.0",
41
- "@aws-sdk/util-user-agent-node": "3.916.0",
42
- "@smithy/config-resolver": "^4.4.0",
43
- "@smithy/core": "^3.17.1",
44
- "@smithy/fetch-http-handler": "^5.3.4",
45
- "@smithy/hash-node": "^4.2.3",
46
- "@smithy/invalid-dependency": "^4.2.3",
47
- "@smithy/middleware-content-length": "^4.2.3",
48
- "@smithy/middleware-endpoint": "^4.3.5",
49
- "@smithy/middleware-retry": "^4.4.5",
50
- "@smithy/middleware-serde": "^4.2.3",
51
- "@smithy/middleware-stack": "^4.2.3",
52
- "@smithy/node-config-provider": "^4.3.3",
53
- "@smithy/node-http-handler": "^4.4.3",
54
- "@smithy/protocol-http": "^5.3.3",
55
- "@smithy/smithy-client": "^4.9.1",
56
- "@smithy/types": "^4.8.0",
57
- "@smithy/url-parser": "^4.2.3",
32
+ "@aws-sdk/core": "3.921.0",
33
+ "@aws-sdk/middleware-host-header": "3.921.0",
34
+ "@aws-sdk/middleware-logger": "3.921.0",
35
+ "@aws-sdk/middleware-recursion-detection": "3.921.0",
36
+ "@aws-sdk/middleware-user-agent": "3.921.0",
37
+ "@aws-sdk/region-config-resolver": "3.921.0",
38
+ "@aws-sdk/types": "3.921.0",
39
+ "@aws-sdk/util-endpoints": "3.921.0",
40
+ "@aws-sdk/util-user-agent-browser": "3.921.0",
41
+ "@aws-sdk/util-user-agent-node": "3.921.0",
42
+ "@smithy/config-resolver": "^4.4.1",
43
+ "@smithy/core": "^3.17.2",
44
+ "@smithy/fetch-http-handler": "^5.3.5",
45
+ "@smithy/hash-node": "^4.2.4",
46
+ "@smithy/invalid-dependency": "^4.2.4",
47
+ "@smithy/middleware-content-length": "^4.2.4",
48
+ "@smithy/middleware-endpoint": "^4.3.6",
49
+ "@smithy/middleware-retry": "^4.4.6",
50
+ "@smithy/middleware-serde": "^4.2.4",
51
+ "@smithy/middleware-stack": "^4.2.4",
52
+ "@smithy/node-config-provider": "^4.3.4",
53
+ "@smithy/node-http-handler": "^4.4.4",
54
+ "@smithy/protocol-http": "^5.3.4",
55
+ "@smithy/smithy-client": "^4.9.2",
56
+ "@smithy/types": "^4.8.1",
57
+ "@smithy/url-parser": "^4.2.4",
58
58
  "@smithy/util-base64": "^4.3.0",
59
59
  "@smithy/util-body-length-browser": "^4.2.0",
60
60
  "@smithy/util-body-length-node": "^4.2.1",
61
- "@smithy/util-defaults-mode-browser": "^4.3.4",
62
- "@smithy/util-defaults-mode-node": "^4.2.6",
63
- "@smithy/util-endpoints": "^3.2.3",
64
- "@smithy/util-middleware": "^4.2.3",
65
- "@smithy/util-retry": "^4.2.3",
61
+ "@smithy/util-defaults-mode-browser": "^4.3.5",
62
+ "@smithy/util-defaults-mode-node": "^4.2.7",
63
+ "@smithy/util-endpoints": "^3.2.4",
64
+ "@smithy/util-middleware": "^4.2.4",
65
+ "@smithy/util-retry": "^4.2.4",
66
66
  "@smithy/util-utf8": "^4.2.0",
67
67
  "tslib": "^2.6.2"
68
68
  },