@aws-sdk/region-config-resolver 3.901.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,105 +1,42 @@
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
+ var configResolver = require('@smithy/config-resolver');
4
+
5
+ const getAwsRegionExtensionConfiguration = (runtimeConfig) => {
6
+ return {
7
+ setRegion(region) {
8
+ runtimeConfig.region = region;
9
+ },
10
+ region() {
11
+ return runtimeConfig.region;
12
+ },
13
+ };
10
14
  };
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;
15
+ const resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => {
16
+ return {
17
+ region: awsRegionExtensionConfiguration.region(),
18
+ };
18
19
  };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
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
21
+ Object.defineProperty(exports, "NODE_REGION_CONFIG_FILE_OPTIONS", {
22
+ enumerable: true,
23
+ get: function () { return configResolver.NODE_REGION_CONFIG_FILE_OPTIONS; }
31
24
  });
32
- module.exports = __toCommonJS(index_exports);
33
-
34
- // src/extensions/index.ts
35
- var getAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
36
- return {
37
- setRegion(region) {
38
- runtimeConfig.region = region;
39
- },
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
- };
61
- var NODE_REGION_CONFIG_FILE_OPTIONS = {
62
- preferredFile: "credentials"
63
- };
64
-
65
- // src/regionConfig/isFipsRegion.ts
66
- var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion");
67
-
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");
70
-
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
25
+ Object.defineProperty(exports, "NODE_REGION_CONFIG_OPTIONS", {
26
+ enumerable: true,
27
+ get: function () { return configResolver.NODE_REGION_CONFIG_OPTIONS; }
104
28
  });
105
-
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
+ });
41
+ exports.getAwsRegionExtensionConfiguration = getAwsRegionExtensionConfiguration;
42
+ exports.resolveAwsRegionExtensionConfiguration = resolveAwsRegionExtensionConfiguration;
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.901.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.901.0",
27
- "@smithy/node-config-provider": "^4.3.0",
28
- "@smithy/types": "^4.6.0",
29
- "@smithy/util-config-provider": "^4.2.0",
30
- "@smithy/util-middleware": "^4.2.0",
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 {};