@aws-sdk/region-config-resolver 3.901.0 → 3.910.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.
Files changed (2) hide show
  1. package/dist-cjs/index.js +59 -95
  2. package/package.json +5 -5
package/dist-cjs/index.js CHANGED
@@ -1,105 +1,69 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ 'use strict';
2
+
3
+ const getAwsRegionExtensionConfiguration = (runtimeConfig) => {
4
+ return {
5
+ setRegion(region) {
6
+ runtimeConfig.region = region;
7
+ },
8
+ region() {
9
+ return runtimeConfig.region;
10
+ },
11
+ };
10
12
  };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
13
+ const resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => {
14
+ return {
15
+ region: awsRegionExtensionConfiguration.region(),
16
+ };
18
17
  };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS,
25
- NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS,
26
- REGION_ENV_NAME: () => REGION_ENV_NAME,
27
- REGION_INI_NAME: () => REGION_INI_NAME,
28
- getAwsRegionExtensionConfiguration: () => getAwsRegionExtensionConfiguration,
29
- resolveAwsRegionExtensionConfiguration: () => resolveAwsRegionExtensionConfiguration,
30
- resolveRegionConfig: () => resolveRegionConfig
31
- });
32
- module.exports = __toCommonJS(index_exports);
33
18
 
34
- // src/extensions/index.ts
35
- var getAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
36
- return {
37
- setRegion(region) {
38
- runtimeConfig.region = region;
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");
39
26
  },
40
- region() {
41
- return runtimeConfig.region;
42
- }
43
- };
44
- }, "getAwsRegionExtensionConfiguration");
45
- var resolveAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((awsRegionExtensionConfiguration) => {
46
- return {
47
- region: awsRegionExtensionConfiguration.region()
48
- };
49
- }, "resolveAwsRegionExtensionConfiguration");
50
-
51
- // src/regionConfig/config.ts
52
- var REGION_ENV_NAME = "AWS_REGION";
53
- var REGION_INI_NAME = "region";
54
- var NODE_REGION_CONFIG_OPTIONS = {
55
- environmentVariableSelector: /* @__PURE__ */ __name((env) => env[REGION_ENV_NAME], "environmentVariableSelector"),
56
- configFileSelector: /* @__PURE__ */ __name((profile) => profile[REGION_INI_NAME], "configFileSelector"),
57
- default: /* @__PURE__ */ __name(() => {
58
- throw new Error("Region is missing");
59
- }, "default")
60
27
  };
61
- var NODE_REGION_CONFIG_FILE_OPTIONS = {
62
- preferredFile: "credentials"
28
+ const NODE_REGION_CONFIG_FILE_OPTIONS = {
29
+ preferredFile: "credentials",
63
30
  };
64
31
 
65
- // src/regionConfig/isFipsRegion.ts
66
- var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion");
32
+ const isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
67
33
 
68
- // src/regionConfig/getRealRegion.ts
69
- var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion");
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;
70
39
 
71
- // src/regionConfig/resolveRegionConfig.ts
72
- var resolveRegionConfig = /* @__PURE__ */ __name((input) => {
73
- const { region, useFipsEndpoint } = input;
74
- if (!region) {
75
- throw new Error("Region is missing");
76
- }
77
- return Object.assign(input, {
78
- region: /* @__PURE__ */ __name(async () => {
79
- if (typeof region === "string") {
80
- return getRealRegion(region);
81
- }
82
- const providedRegion = await region();
83
- return getRealRegion(providedRegion);
84
- }, "region"),
85
- useFipsEndpoint: /* @__PURE__ */ __name(async () => {
86
- const providedRegion = typeof region === "string" ? region : await region();
87
- if (isFipsRegion(providedRegion)) {
88
- return true;
89
- }
90
- return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
91
- }, "useFipsEndpoint")
92
- });
93
- }, "resolveRegionConfig");
94
- // Annotate the CommonJS export names for ESM import in node:
95
-
96
- 0 && (module.exports = {
97
- getAwsRegionExtensionConfiguration,
98
- resolveAwsRegionExtensionConfiguration,
99
- REGION_ENV_NAME,
100
- REGION_INI_NAME,
101
- NODE_REGION_CONFIG_OPTIONS,
102
- NODE_REGION_CONFIG_FILE_OPTIONS,
103
- resolveRegionConfig
104
- });
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
+ };
105
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;
67
+ exports.getAwsRegionExtensionConfiguration = getAwsRegionExtensionConfiguration;
68
+ exports.resolveAwsRegionExtensionConfiguration = resolveAwsRegionExtensionConfiguration;
69
+ exports.resolveRegionConfig = resolveRegionConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/region-config-resolver",
3
- "version": "3.901.0",
3
+ "version": "3.910.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,11 +23,11 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@aws-sdk/types": "3.901.0",
27
- "@smithy/node-config-provider": "^4.3.0",
28
- "@smithy/types": "^4.6.0",
26
+ "@aws-sdk/types": "3.910.0",
27
+ "@smithy/node-config-provider": "^4.3.2",
28
+ "@smithy/types": "^4.7.1",
29
29
  "@smithy/util-config-provider": "^4.2.0",
30
- "@smithy/util-middleware": "^4.2.0",
30
+ "@smithy/util-middleware": "^4.2.2",
31
31
  "tslib": "^2.6.2"
32
32
  },
33
33
  "devDependencies": {