@aws-sdk/middleware-user-agent 3.972.18 → 3.972.19

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
@@ -4,6 +4,7 @@ var core = require('@smithy/core');
4
4
  var utilEndpoints = require('@aws-sdk/util-endpoints');
5
5
  var protocolHttp = require('@smithy/protocol-http');
6
6
  var core$1 = require('@aws-sdk/core');
7
+ var utilRetry = require('@smithy/util-retry');
7
8
 
8
9
  const DEFAULT_UA_APP_ID = undefined;
9
10
  function isValidUserAgentAppId(appId) {
@@ -41,16 +42,15 @@ async function checkFeatures(context, config, args) {
41
42
  }
42
43
  if (typeof config.retryStrategy === "function") {
43
44
  const retryStrategy = await config.retryStrategy();
44
- if (typeof retryStrategy.acquireInitialRetryToken === "function") {
45
- if (retryStrategy.constructor?.name?.includes("Adaptive")) {
46
- core$1.setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
45
+ if (typeof retryStrategy.mode === "string") {
46
+ switch (retryStrategy.mode) {
47
+ case utilRetry.RETRY_MODES.ADAPTIVE:
48
+ core$1.setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
49
+ break;
50
+ case utilRetry.RETRY_MODES.STANDARD:
51
+ core$1.setFeature(context, "RETRY_MODE_STANDARD", "E");
52
+ break;
47
53
  }
48
- else {
49
- core$1.setFeature(context, "RETRY_MODE_STANDARD", "E");
50
- }
51
- }
52
- else {
53
- core$1.setFeature(context, "RETRY_MODE_LEGACY", "D");
54
54
  }
55
55
  }
56
56
  if (typeof config.accountIdEndpointMode === "function") {
@@ -1,4 +1,5 @@
1
1
  import { setFeature } from "@aws-sdk/core";
2
+ import { RETRY_MODES } from "@smithy/util-retry";
2
3
  const ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
3
4
  export async function checkFeatures(context, config, args) {
4
5
  const request = args.request;
@@ -7,16 +8,15 @@ export async function checkFeatures(context, config, args) {
7
8
  }
8
9
  if (typeof config.retryStrategy === "function") {
9
10
  const retryStrategy = await config.retryStrategy();
10
- if (typeof retryStrategy.acquireInitialRetryToken === "function") {
11
- if (retryStrategy.constructor?.name?.includes("Adaptive")) {
12
- setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
11
+ if (typeof retryStrategy.mode === "string") {
12
+ switch (retryStrategy.mode) {
13
+ case RETRY_MODES.ADAPTIVE:
14
+ setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
15
+ break;
16
+ case RETRY_MODES.STANDARD:
17
+ setFeature(context, "RETRY_MODE_STANDARD", "E");
18
+ break;
13
19
  }
14
- else {
15
- setFeature(context, "RETRY_MODE_STANDARD", "E");
16
- }
17
- }
18
- else {
19
- setFeature(context, "RETRY_MODE_LEGACY", "D");
20
20
  }
21
21
  }
22
22
  if (typeof config.accountIdEndpointMode === "function") {
@@ -1,13 +1,15 @@
1
1
  import type { AccountIdEndpointMode } from "@aws-sdk/core/account-id-endpoint";
2
2
  import type { AwsHandlerExecutionContext } from "@aws-sdk/types";
3
- import type { AwsCredentialIdentityProvider, BuildHandlerArguments, Provider, RetryStrategy, RetryStrategyV2 } from "@smithy/types";
3
+ import type { AwsCredentialIdentityProvider, BuildHandlerArguments, Provider } from "@smithy/types";
4
4
  /**
5
5
  * @internal
6
6
  */
7
7
  type PreviouslyResolved = Partial<{
8
8
  credentials?: AwsCredentialIdentityProvider;
9
9
  accountIdEndpointMode?: Provider<AccountIdEndpointMode>;
10
- retryStrategy?: Provider<RetryStrategy | RetryStrategyV2>;
10
+ retryStrategy?: Provider<{
11
+ mode?: string;
12
+ }>;
11
13
  }>;
12
14
  /**
13
15
  * @internal
@@ -4,13 +4,13 @@ import {
4
4
  AwsCredentialIdentityProvider,
5
5
  BuildHandlerArguments,
6
6
  Provider,
7
- RetryStrategy,
8
- RetryStrategyV2,
9
7
  } from "@smithy/types";
10
8
  type PreviouslyResolved = Partial<{
11
9
  credentials?: AwsCredentialIdentityProvider;
12
10
  accountIdEndpointMode?: Provider<AccountIdEndpointMode>;
13
- retryStrategy?: Provider<RetryStrategy | RetryStrategyV2>;
11
+ retryStrategy?: Provider<{
12
+ mode?: string;
13
+ }>;
14
14
  }>;
15
15
  export declare function checkFeatures(
16
16
  context: AwsHandlerExecutionContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-user-agent",
3
- "version": "3.972.18",
3
+ "version": "3.972.19",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-user-agent",
@@ -31,6 +31,7 @@
31
31
  "@smithy/core": "^3.23.8",
32
32
  "@smithy/protocol-http": "^5.3.11",
33
33
  "@smithy/types": "^4.13.0",
34
+ "@smithy/util-retry": "^4.2.11",
34
35
  "tslib": "^2.6.2"
35
36
  },
36
37
  "devDependencies": {