@cdk8s/awscdk-resolver 0.0.284 → 0.0.286

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.
Files changed (63) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.js +1 -0
  4. package/node_modules/@aws-sdk/client-cloudformation/dist-es/runtimeConfig.js +2 -1
  5. package/node_modules/@aws-sdk/client-cloudformation/dist-types/runtimeConfig.d.ts +1 -1
  6. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/runtimeConfig.d.ts +1 -4
  7. package/node_modules/@aws-sdk/client-cloudformation/package.json +11 -11
  8. package/node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js +1 -0
  9. package/node_modules/@aws-sdk/client-sso/dist-es/runtimeConfig.js +2 -1
  10. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.d.ts +1 -1
  11. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.d.ts +1 -4
  12. package/node_modules/@aws-sdk/client-sso/package.json +10 -10
  13. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +33 -0
  14. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.js +16 -0
  15. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js +1 -0
  16. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.js +1 -0
  17. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +5 -0
  18. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/index.d.ts +1 -0
  19. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.d.ts +8 -0
  20. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +4 -0
  21. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/index.d.ts +1 -0
  22. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.d.ts +1 -0
  23. package/node_modules/@aws-sdk/core/package.json +3 -3
  24. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  25. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
  26. package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
  27. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  28. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  29. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  30. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  31. package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
  32. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/runtimeConfig.js +1 -0
  33. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.js +1 -0
  34. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +2 -1
  35. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +2 -1
  36. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.d.ts +1 -1
  37. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +1 -1
  38. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.d.ts +1 -4
  39. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +1 -4
  40. package/node_modules/@aws-sdk/nested-clients/package.json +10 -10
  41. package/node_modules/@aws-sdk/token-providers/package.json +2 -2
  42. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  43. package/node_modules/@smithy/core/dist-cjs/index.js +27 -1
  44. package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/resolveAuthOptions.js +1 -0
  45. package/node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +4 -1
  46. package/node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/resolveAuthOptions.js +20 -0
  47. package/node_modules/@smithy/core/dist-types/middleware-http-auth-scheme/httpAuthSchemeMiddleware.d.ts +2 -1
  48. package/node_modules/@smithy/core/dist-types/middleware-http-auth-scheme/resolveAuthOptions.d.ts +10 -0
  49. package/node_modules/@smithy/core/dist-types/ts3.4/middleware-http-auth-scheme/httpAuthSchemeMiddleware.d.ts +2 -1
  50. package/node_modules/@smithy/core/dist-types/ts3.4/middleware-http-auth-scheme/resolveAuthOptions.d.ts +10 -0
  51. package/node_modules/@smithy/core/package.json +1 -1
  52. package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
  53. package/node_modules/@smithy/middleware-retry/package.json +4 -4
  54. package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +22 -1
  55. package/node_modules/@smithy/service-error-classification/dist-es/index.js +15 -0
  56. package/node_modules/@smithy/service-error-classification/dist-types/index.d.ts +5 -0
  57. package/node_modules/@smithy/service-error-classification/dist-types/ts3.4/index.d.ts +5 -0
  58. package/node_modules/@smithy/service-error-classification/package.json +1 -1
  59. package/node_modules/@smithy/smithy-client/package.json +3 -3
  60. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  61. package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
  62. package/node_modules/@smithy/util-retry/package.json +2 -2
  63. package/package.json +6 -6
@@ -29,6 +29,7 @@ const getRuntimeConfig = (config) => {
29
29
  ...config,
30
30
  runtime: "node",
31
31
  defaultsMode,
32
+ authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(core_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, profileConfig),
32
33
  bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
33
34
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
34
35
  (0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
@@ -1,5 +1,5 @@
1
1
  import packageInfo from "../../../package.json";
2
- import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
2
+ import { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
3
3
  import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
4
4
  import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
5
5
  import { Hash } from "@smithy/hash-node";
@@ -24,6 +24,7 @@ export const getRuntimeConfig = (config) => {
24
24
  ...config,
25
25
  runtime: "node",
26
26
  defaultsMode,
27
+ authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, profileConfig),
27
28
  bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
28
29
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
29
30
  createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
@@ -1,5 +1,5 @@
1
1
  import packageInfo from "../../../package.json";
2
- import { AwsSdkSigV4Signer, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
2
+ import { AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion, } from "@aws-sdk/core";
3
3
  import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
4
4
  import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
5
5
  import { NoAuthSigner } from "@smithy/core";
@@ -25,6 +25,7 @@ export const getRuntimeConfig = (config) => {
25
25
  ...config,
26
26
  runtime: "node",
27
27
  defaultsMode,
28
+ authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, profileConfig),
28
29
  bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
29
30
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
30
31
  createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
@@ -6,6 +6,7 @@ import { SSOOIDCClientConfig } from "./SSOOIDCClient";
6
6
  export declare const getRuntimeConfig: (config: SSOOIDCClientConfig) => {
7
7
  runtime: string;
8
8
  defaultsMode: import("@smithy/types").Provider<import("@smithy/smithy-client").ResolvedDefaultsMode>;
9
+ authSchemePreference: string[] | import("@smithy/types").Provider<string[]>;
9
10
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
10
11
  defaultUserAgentProvider: (config?: import("@aws-sdk/util-user-agent-node").PreviouslyResolved | undefined) => Promise<import("@smithy/types").UserAgent>;
11
12
  maxAttempts: number | import("@smithy/types").Provider<number>;
@@ -37,7 +38,6 @@ export declare const getRuntimeConfig: (config: SSOOIDCClientConfig) => {
37
38
  }) => import("@smithy/types").EndpointV2;
38
39
  tls?: boolean | undefined;
39
40
  serviceConfiguredEndpoint?: undefined;
40
- authSchemePreference?: string[] | import("@smithy/types").Provider<string[]> | undefined;
41
41
  httpAuthSchemes: import("@smithy/types").HttpAuthScheme[] | ({
42
42
  schemeId: string;
43
43
  identityProvider: (ipc: import("@smithy/types").IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
@@ -8,6 +8,7 @@ import { STSClientConfig } from "./STSClient";
8
8
  export declare const getRuntimeConfig: (config: STSClientConfig) => {
9
9
  runtime: string;
10
10
  defaultsMode: import("@smithy/types").Provider<import("@smithy/smithy-client").ResolvedDefaultsMode>;
11
+ authSchemePreference: string[] | import("@smithy/types").Provider<string[]>;
11
12
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
12
13
  defaultUserAgentProvider: (config?: import("@aws-sdk/util-user-agent-node").PreviouslyResolved | undefined) => Promise<import("@smithy/types").UserAgent>;
13
14
  httpAuthSchemes: import("@smithy/types").HttpAuthScheme[] | {
@@ -45,7 +46,6 @@ export declare const getRuntimeConfig: (config: STSClientConfig) => {
45
46
  } | undefined) => import("@smithy/types").EndpointV2;
46
47
  tls?: boolean | undefined;
47
48
  serviceConfiguredEndpoint?: undefined;
48
- authSchemePreference?: string[] | import("@smithy/types").Provider<string[]> | undefined;
49
49
  httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").STSHttpAuthSchemeProvider;
50
50
  credentials?: import("@smithy/types").AwsCredentialIdentity | import("@smithy/types").AwsCredentialIdentityProvider | undefined;
51
51
  signer?: import("@smithy/types").RequestSigner | ((authScheme?: import("@smithy/types").AuthScheme | undefined) => Promise<import("@smithy/types").RequestSigner>) | undefined;
@@ -5,6 +5,7 @@ export declare const getRuntimeConfig: (config: SSOOIDCClientConfig) => {
5
5
  defaultsMode: import("@smithy/types").Provider<
6
6
  import("@smithy/smithy-client").ResolvedDefaultsMode
7
7
  >;
8
+ authSchemePreference: string[] | import("@smithy/types").Provider<string[]>;
8
9
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
9
10
  defaultUserAgentProvider: (
10
11
  config?:
@@ -64,10 +65,6 @@ export declare const getRuntimeConfig: (config: SSOOIDCClientConfig) => {
64
65
  ) => import("@smithy/types").EndpointV2;
65
66
  tls?: boolean | undefined;
66
67
  serviceConfiguredEndpoint?: undefined;
67
- authSchemePreference?:
68
- | string[]
69
- | import("@smithy/types").Provider<string[]>
70
- | undefined;
71
68
  httpAuthSchemes:
72
69
  | import("@smithy/types").HttpAuthScheme[]
73
70
  | (
@@ -7,6 +7,7 @@ export declare const getRuntimeConfig: (config: STSClientConfig) => {
7
7
  defaultsMode: import("@smithy/types").Provider<
8
8
  import("@smithy/smithy-client").ResolvedDefaultsMode
9
9
  >;
10
+ authSchemePreference: string[] | import("@smithy/types").Provider<string[]>;
10
11
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
11
12
  defaultUserAgentProvider: (
12
13
  config?:
@@ -84,10 +85,6 @@ export declare const getRuntimeConfig: (config: STSClientConfig) => {
84
85
  ) => import("@smithy/types").EndpointV2;
85
86
  tls?: boolean | undefined;
86
87
  serviceConfiguredEndpoint?: undefined;
87
- authSchemePreference?:
88
- | string[]
89
- | import("@smithy/types").Provider<string[]>
90
- | undefined;
91
88
  httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").STSHttpAuthSchemeProvider;
92
89
  credentials?:
93
90
  | import("@smithy/types").AwsCredentialIdentity
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/nested-clients",
3
- "version": "3.797.0",
3
+ "version": "3.799.0",
4
4
  "description": "Nested clients for AWS SDK packages.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -28,37 +28,37 @@
28
28
  "dependencies": {
29
29
  "@aws-crypto/sha256-browser": "5.2.0",
30
30
  "@aws-crypto/sha256-js": "5.2.0",
31
- "@aws-sdk/core": "3.796.0",
31
+ "@aws-sdk/core": "3.799.0",
32
32
  "@aws-sdk/middleware-host-header": "3.775.0",
33
33
  "@aws-sdk/middleware-logger": "3.775.0",
34
34
  "@aws-sdk/middleware-recursion-detection": "3.775.0",
35
- "@aws-sdk/middleware-user-agent": "3.796.0",
35
+ "@aws-sdk/middleware-user-agent": "3.799.0",
36
36
  "@aws-sdk/region-config-resolver": "3.775.0",
37
37
  "@aws-sdk/types": "3.775.0",
38
38
  "@aws-sdk/util-endpoints": "3.787.0",
39
39
  "@aws-sdk/util-user-agent-browser": "3.775.0",
40
- "@aws-sdk/util-user-agent-node": "3.796.0",
40
+ "@aws-sdk/util-user-agent-node": "3.799.0",
41
41
  "@smithy/config-resolver": "^4.1.0",
42
- "@smithy/core": "^3.2.0",
42
+ "@smithy/core": "^3.3.0",
43
43
  "@smithy/fetch-http-handler": "^5.0.2",
44
44
  "@smithy/hash-node": "^4.0.2",
45
45
  "@smithy/invalid-dependency": "^4.0.2",
46
46
  "@smithy/middleware-content-length": "^4.0.2",
47
- "@smithy/middleware-endpoint": "^4.1.0",
48
- "@smithy/middleware-retry": "^4.1.0",
47
+ "@smithy/middleware-endpoint": "^4.1.1",
48
+ "@smithy/middleware-retry": "^4.1.1",
49
49
  "@smithy/middleware-serde": "^4.0.3",
50
50
  "@smithy/middleware-stack": "^4.0.2",
51
51
  "@smithy/node-config-provider": "^4.0.2",
52
52
  "@smithy/node-http-handler": "^4.0.4",
53
53
  "@smithy/protocol-http": "^5.1.0",
54
- "@smithy/smithy-client": "^4.2.0",
54
+ "@smithy/smithy-client": "^4.2.1",
55
55
  "@smithy/types": "^4.2.0",
56
56
  "@smithy/url-parser": "^4.0.2",
57
57
  "@smithy/util-base64": "^4.0.0",
58
58
  "@smithy/util-body-length-browser": "^4.0.0",
59
59
  "@smithy/util-body-length-node": "^4.0.0",
60
- "@smithy/util-defaults-mode-browser": "^4.0.8",
61
- "@smithy/util-defaults-mode-node": "^4.0.8",
60
+ "@smithy/util-defaults-mode-browser": "^4.0.9",
61
+ "@smithy/util-defaults-mode-node": "^4.0.9",
62
62
  "@smithy/util-endpoints": "^3.0.2",
63
63
  "@smithy/util-middleware": "^4.0.2",
64
64
  "@smithy/util-retry": "^4.0.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/token-providers",
3
- "version": "3.797.0",
3
+ "version": "3.799.0",
4
4
  "description": "A collection of token providers",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@aws-sdk/nested-clients": "3.797.0",
30
+ "@aws-sdk/nested-clients": "3.799.0",
31
31
  "@aws-sdk/types": "3.775.0",
32
32
  "@smithy/property-provider": "^4.0.2",
33
33
  "@smithy/shared-ini-file-loader": "^4.0.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-user-agent-node",
3
- "version": "3.796.0",
3
+ "version": "3.799.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 util-user-agent-node",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@aws-sdk/middleware-user-agent": "3.796.0",
24
+ "@aws-sdk/middleware-user-agent": "3.799.0",
25
25
  "@aws-sdk/types": "3.775.0",
26
26
  "@smithy/node-config-provider": "^4.0.2",
27
27
  "@smithy/types": "^4.2.0",
@@ -51,6 +51,30 @@ var getSmithyContext = /* @__PURE__ */ __name((context) => context[import_types.
51
51
 
52
52
  // src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts
53
53
  var import_util_middleware = require("@smithy/util-middleware");
54
+
55
+ // src/middleware-http-auth-scheme/resolveAuthOptions.ts
56
+ var resolveAuthOptions = /* @__PURE__ */ __name((candidateAuthOptions, authSchemePreference) => {
57
+ if (!authSchemePreference || authSchemePreference.length === 0) {
58
+ return candidateAuthOptions;
59
+ }
60
+ const preferredAuthOptions = [];
61
+ for (const preferredSchemeName of authSchemePreference) {
62
+ for (const candidateAuthOption of candidateAuthOptions) {
63
+ const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
64
+ if (candidateAuthSchemeName === preferredSchemeName) {
65
+ preferredAuthOptions.push(candidateAuthOption);
66
+ }
67
+ }
68
+ }
69
+ for (const candidateAuthOption of candidateAuthOptions) {
70
+ if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
71
+ preferredAuthOptions.push(candidateAuthOption);
72
+ }
73
+ }
74
+ return preferredAuthOptions;
75
+ }, "resolveAuthOptions");
76
+
77
+ // src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts
54
78
  function convertHttpAuthSchemesToMap(httpAuthSchemes) {
55
79
  const map = /* @__PURE__ */ new Map();
56
80
  for (const scheme of httpAuthSchemes) {
@@ -63,10 +87,12 @@ var httpAuthSchemeMiddleware = /* @__PURE__ */ __name((config, mwOptions) => (ne
63
87
  const options = config.httpAuthSchemeProvider(
64
88
  await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input)
65
89
  );
90
+ const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
91
+ const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
66
92
  const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
67
93
  const smithyContext = (0, import_util_middleware.getSmithyContext)(context);
68
94
  const failureReasons = [];
69
- for (const option of options) {
95
+ for (const option of resolvedOptions) {
70
96
  const scheme = authSchemes.get(option.schemeId);
71
97
  if (!scheme) {
72
98
  failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
@@ -0,0 +1 @@
1
+ module.exports = require("../index.js");
@@ -1,5 +1,6 @@
1
1
  import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
2
2
  import { getSmithyContext } from "@smithy/util-middleware";
3
+ import { resolveAuthOptions } from "./resolveAuthOptions";
3
4
  function convertHttpAuthSchemesToMap(httpAuthSchemes) {
4
5
  const map = new Map();
5
6
  for (const scheme of httpAuthSchemes) {
@@ -9,10 +10,12 @@ function convertHttpAuthSchemesToMap(httpAuthSchemes) {
9
10
  }
10
11
  export const httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
11
12
  const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
13
+ const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
14
+ const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
12
15
  const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
13
16
  const smithyContext = getSmithyContext(context);
14
17
  const failureReasons = [];
15
- for (const option of options) {
18
+ for (const option of resolvedOptions) {
16
19
  const scheme = authSchemes.get(option.schemeId);
17
20
  if (!scheme) {
18
21
  failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
@@ -0,0 +1,20 @@
1
+ export const resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
2
+ if (!authSchemePreference || authSchemePreference.length === 0) {
3
+ return candidateAuthOptions;
4
+ }
5
+ const preferredAuthOptions = [];
6
+ for (const preferredSchemeName of authSchemePreference) {
7
+ for (const candidateAuthOption of candidateAuthOptions) {
8
+ const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
9
+ if (candidateAuthSchemeName === preferredSchemeName) {
10
+ preferredAuthOptions.push(candidateAuthOption);
11
+ }
12
+ }
13
+ }
14
+ for (const candidateAuthOption of candidateAuthOptions) {
15
+ if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
16
+ preferredAuthOptions.push(candidateAuthOption);
17
+ }
18
+ }
19
+ return preferredAuthOptions;
20
+ };
@@ -1,8 +1,9 @@
1
- import { HandlerExecutionContext, HttpAuthScheme, HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, IdentityProviderConfig, SelectedHttpAuthScheme, SerializeMiddleware, SMITHY_CONTEXT_KEY } from "@smithy/types";
1
+ import { HandlerExecutionContext, HttpAuthScheme, HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, IdentityProviderConfig, Provider, SelectedHttpAuthScheme, SerializeMiddleware, SMITHY_CONTEXT_KEY } from "@smithy/types";
2
2
  /**
3
3
  * @internal
4
4
  */
5
5
  export interface PreviouslyResolved<TParameters extends HttpAuthSchemeParameters> {
6
+ authSchemePreference?: Provider<string[]>;
6
7
  httpAuthSchemes: HttpAuthScheme[];
7
8
  httpAuthSchemeProvider: HttpAuthSchemeProvider<TParameters>;
8
9
  }
@@ -0,0 +1,10 @@
1
+ import { HttpAuthOption } from "@smithy/types";
2
+ /**
3
+ * Resolves list of auth options based on the supported ones, vs the preference list.
4
+ *
5
+ * @param candidateAuthOptions list of supported auth options selected by the standard
6
+ * resolution process (model-based, endpoints 2.0, etc.)
7
+ * @param authSchemePreference list of auth schemes preferred by user.
8
+ * @returns
9
+ */
10
+ export declare const resolveAuthOptions: (candidateAuthOptions: HttpAuthOption[], authSchemePreference: string[]) => HttpAuthOption[];
@@ -1,8 +1,9 @@
1
- import { HandlerExecutionContext, HttpAuthScheme, HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, IdentityProviderConfig, SelectedHttpAuthScheme, SerializeMiddleware, SMITHY_CONTEXT_KEY } from "@smithy/types";
1
+ import { HandlerExecutionContext, HttpAuthScheme, HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, IdentityProviderConfig, Provider, SelectedHttpAuthScheme, SerializeMiddleware, SMITHY_CONTEXT_KEY } from "@smithy/types";
2
2
  /**
3
3
  * @internal
4
4
  */
5
5
  export interface PreviouslyResolved<TParameters extends HttpAuthSchemeParameters> {
6
+ authSchemePreference?: Provider<string[]>;
6
7
  httpAuthSchemes: HttpAuthScheme[];
7
8
  httpAuthSchemeProvider: HttpAuthSchemeProvider<TParameters>;
8
9
  }
@@ -0,0 +1,10 @@
1
+ import { HttpAuthOption } from "@smithy/types";
2
+ /**
3
+ * Resolves list of auth options based on the supported ones, vs the preference list.
4
+ *
5
+ * @param candidateAuthOptions list of supported auth options selected by the standard
6
+ * resolution process (model-based, endpoints 2.0, etc.)
7
+ * @param authSchemePreference list of auth schemes preferred by user.
8
+ * @returns
9
+ */
10
+ export declare const resolveAuthOptions: (candidateAuthOptions: HttpAuthOption[], authSchemePreference: string[]) => HttpAuthOption[];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "scripts": {
5
5
  "build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline core",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/middleware-endpoint",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline middleware-endpoint",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@smithy/core": "^3.2.0",
27
+ "@smithy/core": "^3.3.0",
28
28
  "@smithy/middleware-serde": "^4.0.3",
29
29
  "@smithy/node-config-provider": "^4.0.2",
30
30
  "@smithy/shared-ini-file-loader": "^4.0.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/middleware-retry",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline middleware-retry",
@@ -35,11 +35,11 @@
35
35
  "dependencies": {
36
36
  "@smithy/node-config-provider": "^4.0.2",
37
37
  "@smithy/protocol-http": "^5.1.0",
38
- "@smithy/service-error-classification": "^4.0.2",
39
- "@smithy/smithy-client": "^4.2.0",
38
+ "@smithy/service-error-classification": "^4.0.3",
39
+ "@smithy/smithy-client": "^4.2.1",
40
40
  "@smithy/types": "^4.2.0",
41
41
  "@smithy/util-middleware": "^4.0.2",
42
- "@smithy/util-retry": "^4.0.2",
42
+ "@smithy/util-retry": "^4.0.3",
43
43
  "tslib": "^2.6.2",
44
44
  "uuid": "^9.0.1"
45
45
  },
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ isBrowserNetworkError: () => isBrowserNetworkError,
23
24
  isClockSkewCorrectedError: () => isClockSkewCorrectedError,
24
25
  isClockSkewError: () => isClockSkewError,
25
26
  isRetryableByTrait: () => isRetryableByTrait,
@@ -63,8 +64,27 @@ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMED
63
64
  var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait");
64
65
  var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError");
65
66
  var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => error.$metadata?.clockSkewCorrected, "isClockSkewCorrectedError");
67
+ var isBrowserNetworkError = /* @__PURE__ */ __name((error) => {
68
+ const errorMessages = /* @__PURE__ */ new Set([
69
+ "Failed to fetch",
70
+ // Chrome
71
+ "NetworkError when attempting to fetch resource",
72
+ // Firefox
73
+ "The Internet connection appears to be offline",
74
+ // Safari 16
75
+ "Load failed",
76
+ // Safari 17+
77
+ "Network request failed"
78
+ // `cross-fetch`
79
+ ]);
80
+ const isValid = error && error instanceof TypeError;
81
+ if (!isValid) {
82
+ return false;
83
+ }
84
+ return errorMessages.has(error.message);
85
+ }, "isBrowserNetworkError");
66
86
  var isThrottlingError = /* @__PURE__ */ __name((error) => error.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error.name) || error.$retryable?.throttling == true, "isThrottlingError");
67
- var isTransientError = /* @__PURE__ */ __name((error, depth = 0) => isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || error.cause !== void 0 && depth <= 10 && isTransientError(error.cause, depth + 1), "isTransientError");
87
+ var isTransientError = /* @__PURE__ */ __name((error, depth = 0) => isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error) || error.cause !== void 0 && depth <= 10 && isTransientError(error.cause, depth + 1), "isTransientError");
68
88
  var isServerError = /* @__PURE__ */ __name((error) => {
69
89
  if (error.$metadata?.httpStatusCode !== void 0) {
70
90
  const statusCode = error.$metadata.httpStatusCode;
@@ -81,6 +101,7 @@ var isServerError = /* @__PURE__ */ __name((error) => {
81
101
  isRetryableByTrait,
82
102
  isClockSkewError,
83
103
  isClockSkewCorrectedError,
104
+ isBrowserNetworkError,
84
105
  isThrottlingError,
85
106
  isTransientError,
86
107
  isServerError
@@ -2,6 +2,20 @@ import { CLOCK_SKEW_ERROR_CODES, NODEJS_TIMEOUT_ERROR_CODES, THROTTLING_ERROR_CO
2
2
  export const isRetryableByTrait = (error) => error.$retryable !== undefined;
3
3
  export const isClockSkewError = (error) => CLOCK_SKEW_ERROR_CODES.includes(error.name);
4
4
  export const isClockSkewCorrectedError = (error) => error.$metadata?.clockSkewCorrected;
5
+ export const isBrowserNetworkError = (error) => {
6
+ const errorMessages = new Set([
7
+ "Failed to fetch",
8
+ "NetworkError when attempting to fetch resource",
9
+ "The Internet connection appears to be offline",
10
+ "Load failed",
11
+ "Network request failed",
12
+ ]);
13
+ const isValid = error && error instanceof TypeError;
14
+ if (!isValid) {
15
+ return false;
16
+ }
17
+ return errorMessages.has(error.message);
18
+ };
5
19
  export const isThrottlingError = (error) => error.$metadata?.httpStatusCode === 429 ||
6
20
  THROTTLING_ERROR_CODES.includes(error.name) ||
7
21
  error.$retryable?.throttling == true;
@@ -9,6 +23,7 @@ export const isTransientError = (error, depth = 0) => isClockSkewCorrectedError(
9
23
  TRANSIENT_ERROR_CODES.includes(error.name) ||
10
24
  NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") ||
11
25
  TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) ||
26
+ isBrowserNetworkError(error) ||
12
27
  (error.cause !== undefined && depth <= 10 && isTransientError(error.cause, depth + 1));
13
28
  export const isServerError = (error) => {
14
29
  if (error.$metadata?.httpStatusCode !== undefined) {
@@ -8,6 +8,11 @@ export declare const isClockSkewError: (error: SdkError) => boolean;
8
8
  * @returns whether the error resulted in a systemClockOffset aka clock skew correction.
9
9
  */
10
10
  export declare const isClockSkewCorrectedError: (error: SdkError) => true | undefined;
11
+ /**
12
+ *
13
+ * @internal
14
+ */
15
+ export declare const isBrowserNetworkError: (error: SdkError) => boolean;
11
16
  export declare const isThrottlingError: (error: SdkError) => boolean;
12
17
  /**
13
18
  * Though NODEJS_TIMEOUT_ERROR_CODES are platform specific, they are
@@ -8,6 +8,11 @@ export declare const isClockSkewError: (error: SdkError) => boolean;
8
8
  * @returns whether the error resulted in a systemClockOffset aka clock skew correction.
9
9
  */
10
10
  export declare const isClockSkewCorrectedError: (error: SdkError) => true | undefined;
11
+ /**
12
+ *
13
+ * @internal
14
+ */
15
+ export declare const isBrowserNetworkError: (error: SdkError) => boolean;
11
16
  export declare const isThrottlingError: (error: SdkError) => boolean;
12
17
  /**
13
18
  * Though NODEJS_TIMEOUT_ERROR_CODES are platform specific, they are
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/service-error-classification",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline service-error-classification",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/smithy-client",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline smithy-client",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@smithy/core": "^3.2.0",
28
- "@smithy/middleware-endpoint": "^4.1.0",
27
+ "@smithy/core": "^3.3.0",
28
+ "@smithy/middleware-endpoint": "^4.1.1",
29
29
  "@smithy/middleware-stack": "^4.0.2",
30
30
  "@smithy/protocol-http": "^5.1.0",
31
31
  "@smithy/types": "^4.2.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-defaults-mode-browser",
3
- "version": "4.0.8",
3
+ "version": "4.0.9",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline util-defaults-mode-browser",
@@ -24,7 +24,7 @@
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
26
  "@smithy/property-provider": "^4.0.2",
27
- "@smithy/smithy-client": "^4.2.0",
27
+ "@smithy/smithy-client": "^4.2.1",
28
28
  "@smithy/types": "^4.2.0",
29
29
  "bowser": "^2.11.0",
30
30
  "tslib": "^2.6.2"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-defaults-mode-node",
3
- "version": "4.0.8",
3
+ "version": "4.0.9",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline util-defaults-mode-node",
@@ -27,7 +27,7 @@
27
27
  "@smithy/credential-provider-imds": "^4.0.2",
28
28
  "@smithy/node-config-provider": "^4.0.2",
29
29
  "@smithy/property-provider": "^4.0.2",
30
- "@smithy/smithy-client": "^4.2.0",
30
+ "@smithy/smithy-client": "^4.2.1",
31
31
  "@smithy/types": "^4.2.0",
32
32
  "tslib": "^2.6.2"
33
33
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-retry",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Shared retry utilities to be used in middleware packages.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@smithy/service-error-classification": "^4.0.2",
31
+ "@smithy/service-error-classification": "^4.0.3",
32
32
  "@smithy/types": "^4.2.0",
33
33
  "tslib": "^2.6.2"
34
34
  },
package/package.json CHANGED
@@ -42,17 +42,17 @@
42
42
  "organization": false
43
43
  },
44
44
  "devDependencies": {
45
- "@cdk8s/projen-common": "0.0.599",
45
+ "@cdk8s/projen-common": "0.0.600",
46
46
  "@stylistic/eslint-plugin": "^2",
47
47
  "@types/fs-extra": "^11.0.4",
48
48
  "@types/jest": "^27",
49
49
  "@types/node": "16.18.78",
50
50
  "@typescript-eslint/eslint-plugin": "^8",
51
51
  "@typescript-eslint/parser": "^8",
52
- "aws-cdk": "^2.1012.0",
52
+ "aws-cdk": "^2.1013.0",
53
53
  "aws-cdk-lib": "2.177.0",
54
54
  "cdk8s": "2.68.91",
55
- "cdk8s-cli": "^2.200.54",
55
+ "cdk8s-cli": "^2.200.58",
56
56
  "commit-and-tag-version": "^12",
57
57
  "constructs": "10.3.0",
58
58
  "eslint": "^9",
@@ -66,7 +66,7 @@
66
66
  "jsii-docgen": "^10.5.0",
67
67
  "jsii-pacmak": "^1.111.0",
68
68
  "jsii-rosetta": "^5",
69
- "projen": "^0.91.26",
69
+ "projen": "^0.91.29",
70
70
  "ts-jest": "^27",
71
71
  "ts-node": "^10.9.2",
72
72
  "typescript": "^5.8.3"
@@ -77,7 +77,7 @@
77
77
  "constructs": "^10.3.0"
78
78
  },
79
79
  "dependencies": {
80
- "@aws-sdk/client-cloudformation": "^3.797.0"
80
+ "@aws-sdk/client-cloudformation": "^3.799.0"
81
81
  },
82
82
  "bundledDependencies": [
83
83
  "@aws-sdk/client-cloudformation"
@@ -93,7 +93,7 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "version": "0.0.284",
96
+ "version": "0.0.286",
97
97
  "jest": {
98
98
  "coverageProvider": "v8",
99
99
  "testMatch": [