@aws-sdk/region-config-resolver 3.910.0 → 3.914.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
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var configResolver = require('@smithy/config-resolver');
4
+
3
5
  const getAwsRegionExtensionConfiguration = (runtimeConfig) => {
4
6
  return {
5
7
  setRegion(region) {
@@ -16,54 +18,25 @@ const resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration)
16
18
  };
17
19
  };
18
20
 
19
- const REGION_ENV_NAME = "AWS_REGION";
20
- const REGION_INI_NAME = "region";
21
- const NODE_REGION_CONFIG_OPTIONS = {
22
- environmentVariableSelector: (env) => env[REGION_ENV_NAME],
23
- configFileSelector: (profile) => profile[REGION_INI_NAME],
24
- default: () => {
25
- throw new Error("Region is missing");
26
- },
27
- };
28
- const NODE_REGION_CONFIG_FILE_OPTIONS = {
29
- preferredFile: "credentials",
30
- };
31
-
32
- const isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
33
-
34
- const getRealRegion = (region) => isFipsRegion(region)
35
- ? ["fips-aws-global", "aws-fips"].includes(region)
36
- ? "us-east-1"
37
- : region.replace(/fips-(dkr-|prod-)?|-fips/, "")
38
- : region;
39
-
40
- const resolveRegionConfig = (input) => {
41
- const { region, useFipsEndpoint } = input;
42
- if (!region) {
43
- throw new Error("Region is missing");
44
- }
45
- return Object.assign(input, {
46
- region: async () => {
47
- if (typeof region === "string") {
48
- return getRealRegion(region);
49
- }
50
- const providedRegion = await region();
51
- return getRealRegion(providedRegion);
52
- },
53
- useFipsEndpoint: async () => {
54
- const providedRegion = typeof region === "string" ? region : await region();
55
- if (isFipsRegion(providedRegion)) {
56
- return true;
57
- }
58
- return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
59
- },
60
- });
61
- };
62
-
63
- exports.NODE_REGION_CONFIG_FILE_OPTIONS = NODE_REGION_CONFIG_FILE_OPTIONS;
64
- exports.NODE_REGION_CONFIG_OPTIONS = NODE_REGION_CONFIG_OPTIONS;
65
- exports.REGION_ENV_NAME = REGION_ENV_NAME;
66
- exports.REGION_INI_NAME = REGION_INI_NAME;
21
+ Object.defineProperty(exports, "NODE_REGION_CONFIG_FILE_OPTIONS", {
22
+ enumerable: true,
23
+ get: function () { return configResolver.NODE_REGION_CONFIG_FILE_OPTIONS; }
24
+ });
25
+ Object.defineProperty(exports, "NODE_REGION_CONFIG_OPTIONS", {
26
+ enumerable: true,
27
+ get: function () { return configResolver.NODE_REGION_CONFIG_OPTIONS; }
28
+ });
29
+ Object.defineProperty(exports, "REGION_ENV_NAME", {
30
+ enumerable: true,
31
+ get: function () { return configResolver.REGION_ENV_NAME; }
32
+ });
33
+ Object.defineProperty(exports, "REGION_INI_NAME", {
34
+ enumerable: true,
35
+ get: function () { return configResolver.REGION_INI_NAME; }
36
+ });
37
+ Object.defineProperty(exports, "resolveRegionConfig", {
38
+ enumerable: true,
39
+ get: function () { return configResolver.resolveRegionConfig; }
40
+ });
67
41
  exports.getAwsRegionExtensionConfiguration = getAwsRegionExtensionConfiguration;
68
42
  exports.resolveAwsRegionExtensionConfiguration = resolveAwsRegionExtensionConfiguration;
69
- exports.resolveRegionConfig = resolveRegionConfig;
package/dist-es/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from "./extensions";
2
- export * from "./regionConfig";
2
+ export * from "./regionConfig/awsRegionConfig";
@@ -0,0 +1,2 @@
1
+ export { REGION_ENV_NAME, REGION_INI_NAME, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS, } from "@smithy/config-resolver";
2
+ export { resolveRegionConfig } from "@smithy/config-resolver";
@@ -1,5 +1,5 @@
1
- import { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
2
- import { Provider } from "@smithy/types";
1
+ import type { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
2
+ import type { Provider } from "@smithy/types";
3
3
  export type RegionExtensionRuntimeConfigType = Partial<{
4
4
  region: string | Provider<string>;
5
5
  }>;
@@ -1,2 +1,2 @@
1
1
  export * from "./extensions";
2
- export * from "./regionConfig";
2
+ export * from "./regionConfig/awsRegionConfig";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Backward compatibility re-export alias.
3
+ * @internal
4
+ */
5
+ export { REGION_ENV_NAME, REGION_INI_NAME, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS, } from "@smithy/config-resolver";
6
+ /**
7
+ * Backward compatibility re-export alias.
8
+ * @internal
9
+ */
10
+ export type { RegionInputConfig, RegionResolvedConfig } from "@smithy/config-resolver";
11
+ /**
12
+ * Backward compatibility re-export alias.
13
+ * @internal
14
+ */
15
+ export { resolveRegionConfig } from "@smithy/config-resolver";
@@ -1,2 +1,2 @@
1
1
  export * from "./extensions";
2
- export * from "./regionConfig";
2
+ export * from "./regionConfig/awsRegionConfig";
@@ -0,0 +1,11 @@
1
+ export {
2
+ REGION_ENV_NAME,
3
+ REGION_INI_NAME,
4
+ NODE_REGION_CONFIG_OPTIONS,
5
+ NODE_REGION_CONFIG_FILE_OPTIONS,
6
+ } from "@smithy/config-resolver";
7
+ export {
8
+ RegionInputConfig,
9
+ RegionResolvedConfig,
10
+ } from "@smithy/config-resolver";
11
+ export { resolveRegionConfig } from "@smithy/config-resolver";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/region-config-resolver",
3
- "version": "3.910.0",
3
+ "version": "3.914.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 region-config-resolver",
@@ -23,18 +23,15 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@aws-sdk/types": "3.910.0",
27
- "@smithy/node-config-provider": "^4.3.2",
28
- "@smithy/types": "^4.7.1",
29
- "@smithy/util-config-provider": "^4.2.0",
30
- "@smithy/util-middleware": "^4.2.2",
26
+ "@aws-sdk/types": "3.914.0",
27
+ "@smithy/config-resolver": "^4.4.0",
28
+ "@smithy/types": "^4.8.0",
31
29
  "tslib": "^2.6.2"
32
30
  },
33
31
  "devDependencies": {
34
32
  "@tsconfig/recommended": "1.0.1",
35
33
  "concurrently": "7.0.0",
36
34
  "downlevel-dts": "0.10.1",
37
- "jest": "28.1.1",
38
35
  "rimraf": "3.0.2",
39
36
  "typescript": "~5.8.3"
40
37
  },
@@ -1,12 +0,0 @@
1
- export const REGION_ENV_NAME = "AWS_REGION";
2
- export const REGION_INI_NAME = "region";
3
- export const NODE_REGION_CONFIG_OPTIONS = {
4
- environmentVariableSelector: (env) => env[REGION_ENV_NAME],
5
- configFileSelector: (profile) => profile[REGION_INI_NAME],
6
- default: () => {
7
- throw new Error("Region is missing");
8
- },
9
- };
10
- export const NODE_REGION_CONFIG_FILE_OPTIONS = {
11
- preferredFile: "credentials",
12
- };
@@ -1,6 +0,0 @@
1
- import { isFipsRegion } from "./isFipsRegion";
2
- export const getRealRegion = (region) => isFipsRegion(region)
3
- ? ["fips-aws-global", "aws-fips"].includes(region)
4
- ? "us-east-1"
5
- : region.replace(/fips-(dkr-|prod-)?|-fips/, "")
6
- : region;
@@ -1,2 +0,0 @@
1
- export * from "./config";
2
- export * from "./resolveRegionConfig";
@@ -1 +0,0 @@
1
- export const isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
@@ -1,24 +0,0 @@
1
- import { getRealRegion } from "./getRealRegion";
2
- import { isFipsRegion } from "./isFipsRegion";
3
- export const resolveRegionConfig = (input) => {
4
- const { region, useFipsEndpoint } = input;
5
- if (!region) {
6
- throw new Error("Region is missing");
7
- }
8
- return Object.assign(input, {
9
- region: async () => {
10
- if (typeof region === "string") {
11
- return getRealRegion(region);
12
- }
13
- const providedRegion = await region();
14
- return getRealRegion(providedRegion);
15
- },
16
- useFipsEndpoint: async () => {
17
- const providedRegion = typeof region === "string" ? region : await region();
18
- if (isFipsRegion(providedRegion)) {
19
- return true;
20
- }
21
- return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
22
- },
23
- });
24
- };
@@ -1,17 +0,0 @@
1
- import { LoadedConfigSelectors, LocalConfigOptions } from "@smithy/node-config-provider";
2
- /**
3
- * @internal
4
- */
5
- export declare const REGION_ENV_NAME = "AWS_REGION";
6
- /**
7
- * @internal
8
- */
9
- export declare const REGION_INI_NAME = "region";
10
- /**
11
- * @internal
12
- */
13
- export declare const NODE_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<string>;
14
- /**
15
- * @internal
16
- */
17
- export declare const NODE_REGION_CONFIG_FILE_OPTIONS: LocalConfigOptions;
@@ -1,4 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export declare const getRealRegion: (region: string) => string;
@@ -1,8 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export * from "./config";
5
- /**
6
- * @internal
7
- */
8
- export * from "./resolveRegionConfig";
@@ -1,4 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export declare const isFipsRegion: (region: string) => boolean;
@@ -1,37 +0,0 @@
1
- import { Provider } from "@smithy/types";
2
- /**
3
- * @public
4
- */
5
- export interface RegionInputConfig {
6
- /**
7
- * The AWS region to which this client will send requests
8
- */
9
- region?: string | Provider<string>;
10
- /**
11
- * Enables FIPS compatible endpoints.
12
- */
13
- useFipsEndpoint?: boolean | Provider<boolean>;
14
- }
15
- /**
16
- * @internal
17
- */
18
- interface PreviouslyResolved {
19
- }
20
- /**
21
- * @internal
22
- */
23
- export interface RegionResolvedConfig {
24
- /**
25
- * Resolved value for input config {@link RegionInputConfig.region}
26
- */
27
- region: Provider<string>;
28
- /**
29
- * Resolved value for input {@link RegionInputConfig.useFipsEndpoint}
30
- */
31
- useFipsEndpoint: Provider<boolean>;
32
- }
33
- /**
34
- * @internal
35
- */
36
- export declare const resolveRegionConfig: <T>(input: T & RegionInputConfig & PreviouslyResolved) => T & RegionResolvedConfig;
37
- export {};
@@ -1,8 +0,0 @@
1
- import {
2
- LoadedConfigSelectors,
3
- LocalConfigOptions,
4
- } from "@smithy/node-config-provider";
5
- export declare const REGION_ENV_NAME = "AWS_REGION";
6
- export declare const REGION_INI_NAME = "region";
7
- export declare const NODE_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<string>;
8
- export declare const NODE_REGION_CONFIG_FILE_OPTIONS: LocalConfigOptions;
@@ -1 +0,0 @@
1
- export declare const getRealRegion: (region: string) => string;
@@ -1,2 +0,0 @@
1
- export * from "./config";
2
- export * from "./resolveRegionConfig";
@@ -1 +0,0 @@
1
- export declare const isFipsRegion: (region: string) => boolean;
@@ -1,14 +0,0 @@
1
- import { Provider } from "@smithy/types";
2
- export interface RegionInputConfig {
3
- region?: string | Provider<string>;
4
- useFipsEndpoint?: boolean | Provider<boolean>;
5
- }
6
- interface PreviouslyResolved {}
7
- export interface RegionResolvedConfig {
8
- region: Provider<string>;
9
- useFipsEndpoint: Provider<boolean>;
10
- }
11
- export declare const resolveRegionConfig: <T>(
12
- input: T & RegionInputConfig & PreviouslyResolved
13
- ) => T & RegionResolvedConfig;
14
- export {};