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