@aws-sdk/region-config-resolver 3.893.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.
- package/dist-cjs/index.js +59 -95
- package/package.json +6 -6
package/dist-cjs/index.js
CHANGED
|
@@ -1,105 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
62
|
-
|
|
28
|
+
const NODE_REGION_CONFIG_FILE_OPTIONS = {
|
|
29
|
+
preferredFile: "credentials",
|
|
63
30
|
};
|
|
64
31
|
|
|
65
|
-
|
|
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
|
-
|
|
69
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
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.
|
|
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.
|
|
27
|
-
"@smithy/node-config-provider": "^4.
|
|
28
|
-
"@smithy/types": "^4.
|
|
29
|
-
"@smithy/util-config-provider": "^4.
|
|
30
|
-
"@smithy/util-middleware": "^4.
|
|
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",
|
|
31
31
|
"tslib": "^2.6.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|