@aws-sdk/middleware-user-agent 3.667.0 → 3.668.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
@@ -68,7 +68,7 @@ var import_protocol_http = require("@smithy/protocol-http");
68
68
  // src/check-features.ts
69
69
  var import_core2 = require("@aws-sdk/core");
70
70
  async function checkFeatures(context, config, args) {
71
- var _a, _b;
71
+ var _a, _b, _c;
72
72
  const request = args.request;
73
73
  if (typeof config.accountIdEndpointMode === "function") {
74
74
  switch (await ((_a = config.accountIdEndpointMode) == null ? void 0 : _a.call(config))) {
@@ -83,16 +83,14 @@ async function checkFeatures(context, config, args) {
83
83
  break;
84
84
  }
85
85
  }
86
- if (typeof config.credentials === "function") {
87
- try {
88
- const credentials = await ((_b = config.credentials) == null ? void 0 : _b.call(config));
89
- if (credentials.accountId) {
90
- (0, import_core2.setFeature)(context, "RESOLVED_ACCOUNT_ID", "T");
91
- }
92
- for (const [key, value] of Object.entries(credentials.$source ?? {})) {
93
- (0, import_core2.setFeature)(context, key, value);
94
- }
95
- } catch (e) {
86
+ const identity = (_c = (_b = context.__smithy_context) == null ? void 0 : _b.selectedHttpAuthScheme) == null ? void 0 : _c.identity;
87
+ if (identity == null ? void 0 : identity.$source) {
88
+ const credentials = identity;
89
+ if (credentials.accountId) {
90
+ (0, import_core2.setFeature)(context, "RESOLVED_ACCOUNT_ID", "T");
91
+ }
92
+ for (const [key, value] of Object.entries(credentials.$source ?? {})) {
93
+ (0, import_core2.setFeature)(context, key, value);
96
94
  }
97
95
  }
98
96
  }
@@ -14,17 +14,14 @@ export async function checkFeatures(context, config, args) {
14
14
  break;
15
15
  }
16
16
  }
17
- if (typeof config.credentials === "function") {
18
- try {
19
- const credentials = await config.credentials?.();
20
- if (credentials.accountId) {
21
- setFeature(context, "RESOLVED_ACCOUNT_ID", "T");
22
- }
23
- for (const [key, value] of Object.entries(credentials.$source ?? {})) {
24
- setFeature(context, key, value);
25
- }
17
+ const identity = context.__smithy_context?.selectedHttpAuthScheme?.identity;
18
+ if (identity?.$source) {
19
+ const credentials = identity;
20
+ if (credentials.accountId) {
21
+ setFeature(context, "RESOLVED_ACCOUNT_ID", "T");
26
22
  }
27
- catch (e) {
23
+ for (const [key, value] of Object.entries(credentials.$source ?? {})) {
24
+ setFeature(context, key, value);
28
25
  }
29
26
  }
30
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-user-agent",
3
- "version": "3.667.0",
3
+ "version": "3.668.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 middleware-user-agent",