Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@smithy/config-resolver

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/config-resolver - npm Package Compare versions

Comparing version 2.0.23 to 2.1.0

8

dist-cjs/endpointsConfig/index.js

@@ -1,7 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./NodeUseDualstackEndpointConfigOptions"), exports);
tslib_1.__exportStar(require("./NodeUseFipsEndpointConfigOptions"), exports);
tslib_1.__exportStar(require("./resolveCustomEndpointsConfig"), exports);
tslib_1.__exportStar(require("./resolveEndpointsConfig"), exports);
module.exports = require("../index.js");

@@ -1,12 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = exports.DEFAULT_USE_DUALSTACK_ENDPOINT = exports.CONFIG_USE_DUALSTACK_ENDPOINT = exports.ENV_USE_DUALSTACK_ENDPOINT = void 0;
const util_config_provider_1 = require("@smithy/util-config-provider");
exports.ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
exports.CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
exports.DEFAULT_USE_DUALSTACK_ENDPOINT = false;
exports.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
environmentVariableSelector: (env) => (0, util_config_provider_1.booleanSelector)(env, exports.ENV_USE_DUALSTACK_ENDPOINT, util_config_provider_1.SelectorType.ENV),
configFileSelector: (profile) => (0, util_config_provider_1.booleanSelector)(profile, exports.CONFIG_USE_DUALSTACK_ENDPOINT, util_config_provider_1.SelectorType.CONFIG),
default: false,
};
module.exports = require("../index.js");

@@ -1,12 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = exports.DEFAULT_USE_FIPS_ENDPOINT = exports.CONFIG_USE_FIPS_ENDPOINT = exports.ENV_USE_FIPS_ENDPOINT = void 0;
const util_config_provider_1 = require("@smithy/util-config-provider");
exports.ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
exports.CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
exports.DEFAULT_USE_FIPS_ENDPOINT = false;
exports.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
environmentVariableSelector: (env) => (0, util_config_provider_1.booleanSelector)(env, exports.ENV_USE_FIPS_ENDPOINT, util_config_provider_1.SelectorType.ENV),
configFileSelector: (profile) => (0, util_config_provider_1.booleanSelector)(profile, exports.CONFIG_USE_FIPS_ENDPOINT, util_config_provider_1.SelectorType.CONFIG),
default: false,
};
module.exports = require("../index.js");

@@ -1,16 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveCustomEndpointsConfig = void 0;
const util_middleware_1 = require("@smithy/util-middleware");
const resolveCustomEndpointsConfig = (input) => {
var _a, _b;
const { endpoint, urlParser } = input;
return {
...input,
tls: (_a = input.tls) !== null && _a !== void 0 ? _a : true,
endpoint: (0, util_middleware_1.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint),
isCustomEndpoint: true,
useDualstackEndpoint: (0, util_middleware_1.normalizeProvider)((_b = input.useDualstackEndpoint) !== null && _b !== void 0 ? _b : false),
};
};
exports.resolveCustomEndpointsConfig = resolveCustomEndpointsConfig;
module.exports = require("../index.js");

@@ -1,20 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveEndpointsConfig = void 0;
const util_middleware_1 = require("@smithy/util-middleware");
const getEndpointFromRegion_1 = require("./utils/getEndpointFromRegion");
const resolveEndpointsConfig = (input) => {
var _a, _b;
const useDualstackEndpoint = (0, util_middleware_1.normalizeProvider)((_a = input.useDualstackEndpoint) !== null && _a !== void 0 ? _a : false);
const { endpoint, useFipsEndpoint, urlParser } = input;
return {
...input,
tls: (_b = input.tls) !== null && _b !== void 0 ? _b : true,
endpoint: endpoint
? (0, util_middleware_1.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint)
: () => (0, getEndpointFromRegion_1.getEndpointFromRegion)({ ...input, useDualstackEndpoint, useFipsEndpoint }),
isCustomEndpoint: !!endpoint,
useDualstackEndpoint,
};
};
exports.resolveEndpointsConfig = resolveEndpointsConfig;
module.exports = require("../index.js");

@@ -1,20 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEndpointFromRegion = void 0;
const getEndpointFromRegion = async (input) => {
var _a;
const { tls = true } = input;
const region = await input.region();
const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);
if (!dnsHostRegex.test(region)) {
throw new Error("Invalid region in client config");
}
const useDualstackEndpoint = await input.useDualstackEndpoint();
const useFipsEndpoint = await input.useFipsEndpoint();
const { hostname } = (_a = (await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }))) !== null && _a !== void 0 ? _a : {};
if (!hostname) {
throw new Error("Cannot resolve hostname from client config");
}
return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`);
};
exports.getEndpointFromRegion = getEndpointFromRegion;
module.exports = require("../../index.js");

239

dist-cjs/index.js

@@ -1,6 +0,233 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./endpointsConfig"), exports);
tslib_1.__exportStar(require("./regionConfig"), exports);
tslib_1.__exportStar(require("./regionInfo"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT,
CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT,
DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT,
DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT,
ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT,
ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT,
NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS,
NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS,
NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
REGION_ENV_NAME: () => REGION_ENV_NAME,
REGION_INI_NAME: () => REGION_INI_NAME,
getRegionInfo: () => getRegionInfo,
resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig,
resolveEndpointsConfig: () => resolveEndpointsConfig,
resolveRegionConfig: () => resolveRegionConfig
});
module.exports = __toCommonJS(src_exports);
// src/endpointsConfig/NodeUseDualstackEndpointConfigOptions.ts
var import_util_config_provider = require("@smithy/util-config-provider");
var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
var DEFAULT_USE_DUALSTACK_ENDPOINT = false;
var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV),
configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG),
default: false
};
// src/endpointsConfig/NodeUseFipsEndpointConfigOptions.ts
var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
var DEFAULT_USE_FIPS_ENDPOINT = false;
var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV),
configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG),
default: false
};
// src/endpointsConfig/resolveCustomEndpointsConfig.ts
var import_util_middleware = require("@smithy/util-middleware");
var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => {
const { endpoint, urlParser } = input;
return {
...input,
tls: input.tls ?? true,
endpoint: (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint),
isCustomEndpoint: true,
useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false)
};
}, "resolveCustomEndpointsConfig");
// src/endpointsConfig/resolveEndpointsConfig.ts
// src/endpointsConfig/utils/getEndpointFromRegion.ts
var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => {
const { tls = true } = input;
const region = await input.region();
const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);
if (!dnsHostRegex.test(region)) {
throw new Error("Invalid region in client config");
}
const useDualstackEndpoint = await input.useDualstackEndpoint();
const useFipsEndpoint = await input.useFipsEndpoint();
const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {};
if (!hostname) {
throw new Error("Cannot resolve hostname from client config");
}
return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`);
}, "getEndpointFromRegion");
// src/endpointsConfig/resolveEndpointsConfig.ts
var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => {
const useDualstackEndpoint = (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false);
const { endpoint, useFipsEndpoint, urlParser } = input;
return {
...input,
tls: input.tls ?? true,
endpoint: endpoint ? (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }),
isCustomEndpoint: !!endpoint,
useDualstackEndpoint
};
}, "resolveEndpointsConfig");
// src/regionConfig/config.ts
var REGION_ENV_NAME = "AWS_REGION";
var REGION_INI_NAME = "region";
var NODE_REGION_CONFIG_OPTIONS = {
environmentVariableSelector: (env) => env[REGION_ENV_NAME],
configFileSelector: (profile) => profile[REGION_INI_NAME],
default: () => {
throw new Error("Region is missing");
}
};
var NODE_REGION_CONFIG_FILE_OPTIONS = {
preferredFile: "credentials"
};
// src/regionConfig/isFipsRegion.ts
var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion");
// src/regionConfig/getRealRegion.ts
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");
// src/regionConfig/resolveRegionConfig.ts
var resolveRegionConfig = /* @__PURE__ */ __name((input) => {
const { region, useFipsEndpoint } = input;
if (!region) {
throw new Error("Region is missing");
}
return {
...input,
region: async () => {
if (typeof region === "string") {
return getRealRegion(region);
}
const providedRegion = await region();
return getRealRegion(providedRegion);
},
useFipsEndpoint: async () => {
const providedRegion = typeof region === "string" ? region : await region();
if (isFipsRegion(providedRegion)) {
return true;
}
return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
}
};
}, "resolveRegionConfig");
// src/regionInfo/getHostnameFromVariants.ts
var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => {
var _a;
return (_a = variants.find(
({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack")
)) == null ? void 0 : _a.hostname;
}, "getHostnameFromVariants");
// src/regionInfo/getResolvedHostname.ts
var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname");
// src/regionInfo/getResolvedPartition.ts
var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition");
// src/regionInfo/getResolvedSigningRegion.ts
var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => {
if (signingRegion) {
return signingRegion;
} else if (useFipsEndpoint) {
const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\.");
const regionRegexmatchArray = hostname.match(regionRegexJs);
if (regionRegexmatchArray) {
return regionRegexmatchArray[0].slice(1, -1);
}
}
}, "getResolvedSigningRegion");
// src/regionInfo/getRegionInfo.ts
var getRegionInfo = /* @__PURE__ */ __name((region, {
useFipsEndpoint = false,
useDualstackEndpoint = false,
signingService,
regionHash,
partitionHash
}) => {
var _a, _b, _c, _d, _e;
const partition = getResolvedPartition(region, { partitionHash });
const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region;
const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions);
const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions);
const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname });
if (hostname === void 0) {
throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`);
}
const signingRegion = getResolvedSigningRegion(hostname, {
signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion,
regionRegex: partitionHash[partition].regionRegex,
useFipsEndpoint
});
return {
partition,
signingService,
hostname,
...signingRegion && { signingRegion },
...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && {
signingService: regionHash[resolvedRegion].signingService
}
};
}, "getRegionInfo");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CONFIG_USE_DUALSTACK_ENDPOINT,
CONFIG_USE_FIPS_ENDPOINT,
DEFAULT_USE_DUALSTACK_ENDPOINT,
DEFAULT_USE_FIPS_ENDPOINT,
ENV_USE_DUALSTACK_ENDPOINT,
ENV_USE_FIPS_ENDPOINT,
NODE_REGION_CONFIG_FILE_OPTIONS,
NODE_REGION_CONFIG_OPTIONS,
NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
REGION_ENV_NAME,
REGION_INI_NAME,
getRegionInfo,
resolveCustomEndpointsConfig,
resolveEndpointsConfig,
resolveRegionConfig
});

@@ -1,15 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NODE_REGION_CONFIG_FILE_OPTIONS = exports.NODE_REGION_CONFIG_OPTIONS = exports.REGION_INI_NAME = exports.REGION_ENV_NAME = void 0;
exports.REGION_ENV_NAME = "AWS_REGION";
exports.REGION_INI_NAME = "region";
exports.NODE_REGION_CONFIG_OPTIONS = {
environmentVariableSelector: (env) => env[exports.REGION_ENV_NAME],
configFileSelector: (profile) => profile[exports.REGION_INI_NAME],
default: () => {
throw new Error("Region is missing");
},
};
exports.NODE_REGION_CONFIG_FILE_OPTIONS = {
preferredFile: "credentials",
};
module.exports = require("../index.js");

@@ -1,10 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRealRegion = void 0;
const isFipsRegion_1 = require("./isFipsRegion");
const getRealRegion = (region) => (0, isFipsRegion_1.isFipsRegion)(region)
? ["fips-aws-global", "aws-fips"].includes(region)
? "us-east-1"
: region.replace(/fips-(dkr-|prod-)?|-fips/, "")
: region;
exports.getRealRegion = getRealRegion;
module.exports = require("../index.js");

@@ -1,5 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./config"), exports);
tslib_1.__exportStar(require("./resolveRegionConfig"), exports);
module.exports = require("../index.js");

@@ -1,5 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isFipsRegion = void 0;
const isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
exports.isFipsRegion = isFipsRegion;
module.exports = require("../index.js");

@@ -1,29 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveRegionConfig = void 0;
const getRealRegion_1 = require("./getRealRegion");
const isFipsRegion_1 = require("./isFipsRegion");
const resolveRegionConfig = (input) => {
const { region, useFipsEndpoint } = input;
if (!region) {
throw new Error("Region is missing");
}
return {
...input,
region: async () => {
if (typeof region === "string") {
return (0, getRealRegion_1.getRealRegion)(region);
}
const providedRegion = await region();
return (0, getRealRegion_1.getRealRegion)(providedRegion);
},
useFipsEndpoint: async () => {
const providedRegion = typeof region === "string" ? region : await region();
if ((0, isFipsRegion_1.isFipsRegion)(providedRegion)) {
return true;
}
return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
},
};
};
exports.resolveRegionConfig = resolveRegionConfig;
module.exports = require("../index.js");

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
module.exports = require("../index.js");

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
module.exports = require("../index.js");

@@ -1,8 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHostnameFromVariants = void 0;
const getHostnameFromVariants = (variants = [], { useFipsEndpoint, useDualstackEndpoint }) => {
var _a;
return (_a = variants.find(({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack"))) === null || _a === void 0 ? void 0 : _a.hostname;
};
exports.getHostnameFromVariants = getHostnameFromVariants;
module.exports = require("../index.js");

@@ -1,34 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRegionInfo = void 0;
const getHostnameFromVariants_1 = require("./getHostnameFromVariants");
const getResolvedHostname_1 = require("./getResolvedHostname");
const getResolvedPartition_1 = require("./getResolvedPartition");
const getResolvedSigningRegion_1 = require("./getResolvedSigningRegion");
const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => {
var _a, _b, _c, _d, _e, _f;
const partition = (0, getResolvedPartition_1.getResolvedPartition)(region, { partitionHash });
const resolvedRegion = region in regionHash ? region : (_b = (_a = partitionHash[partition]) === null || _a === void 0 ? void 0 : _a.endpoint) !== null && _b !== void 0 ? _b : region;
const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
const regionHostname = (0, getHostnameFromVariants_1.getHostnameFromVariants)((_c = regionHash[resolvedRegion]) === null || _c === void 0 ? void 0 : _c.variants, hostnameOptions);
const partitionHostname = (0, getHostnameFromVariants_1.getHostnameFromVariants)((_d = partitionHash[partition]) === null || _d === void 0 ? void 0 : _d.variants, hostnameOptions);
const hostname = (0, getResolvedHostname_1.getResolvedHostname)(resolvedRegion, { regionHostname, partitionHostname });
if (hostname === undefined) {
throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`);
}
const signingRegion = (0, getResolvedSigningRegion_1.getResolvedSigningRegion)(hostname, {
signingRegion: (_e = regionHash[resolvedRegion]) === null || _e === void 0 ? void 0 : _e.signingRegion,
regionRegex: partitionHash[partition].regionRegex,
useFipsEndpoint,
});
return {
partition,
signingService,
hostname,
...(signingRegion && { signingRegion }),
...(((_f = regionHash[resolvedRegion]) === null || _f === void 0 ? void 0 : _f.signingService) && {
signingService: regionHash[resolvedRegion].signingService,
}),
};
};
exports.getRegionInfo = getRegionInfo;
module.exports = require("../index.js");

@@ -1,9 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResolvedHostname = void 0;
const getResolvedHostname = (resolvedRegion, { regionHostname, partitionHostname }) => regionHostname
? regionHostname
: partitionHostname
? partitionHostname.replace("{region}", resolvedRegion)
: undefined;
exports.getResolvedHostname = getResolvedHostname;
module.exports = require("../index.js");

@@ -1,5 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResolvedPartition = void 0;
const getResolvedPartition = (region, { partitionHash }) => { var _a; return (_a = Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region))) !== null && _a !== void 0 ? _a : "aws"; };
exports.getResolvedPartition = getResolvedPartition;
module.exports = require("../index.js");

@@ -1,16 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResolvedSigningRegion = void 0;
const getResolvedSigningRegion = (hostname, { signingRegion, regionRegex, useFipsEndpoint }) => {
if (signingRegion) {
return signingRegion;
}
else if (useFipsEndpoint) {
const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\.");
const regionRegexmatchArray = hostname.match(regionRegexJs);
if (regionRegexmatchArray) {
return regionRegexmatchArray[0].slice(1, -1);
}
}
};
exports.getResolvedSigningRegion = getResolvedSigningRegion;
module.exports = require("../index.js");

@@ -1,6 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./PartitionHash"), exports);
tslib_1.__exportStar(require("./RegionHash"), exports);
tslib_1.__exportStar(require("./getRegionInfo"), exports);
module.exports = require("../index.js");

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
module.exports = require("../index.js");

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
module.exports = require("../index.js");
{
"name": "@smithy/config-resolver",
"version": "2.0.23",
"version": "2.1.0",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
"build:cjs": "node ../../scripts/inline config-resolver",
"build:es": "yarn g:tsc -p tsconfig.es.json",

@@ -26,6 +26,6 @@ "build:types": "yarn g:tsc -p tsconfig.types.json",

"dependencies": {
"@smithy/node-config-provider": "^2.1.9",
"@smithy/types": "^2.8.0",
"@smithy/util-config-provider": "^2.1.0",
"@smithy/util-middleware": "^2.0.9",
"@smithy/node-config-provider": "^2.2.0",
"@smithy/types": "^2.9.0",
"@smithy/util-config-provider": "^2.2.0",
"@smithy/util-middleware": "^2.1.0",
"tslib": "^2.5.0"

@@ -32,0 +32,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc