Socket
Socket
Sign inDemoInstall

@aws-sdk/node-config-provider

Package Overview
Dependencies
4
Maintainers
5
Versions
118
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.186.0 to 3.188.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
**Note:** Version bump only for package @aws-sdk/node-config-provider
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)

@@ -8,0 +16,0 @@

6

dist-es/configLoader.js

@@ -5,6 +5,2 @@ import { chain, memoize } from "@aws-sdk/property-provider";

import { fromStatic } from "./fromStatic";
export var loadConfig = function (_a, configuration) {
var environmentVariableSelector = _a.environmentVariableSelector, configFileSelector = _a.configFileSelector, defaultValue = _a.default;
if (configuration === void 0) { configuration = {}; }
return memoize(chain(fromEnv(environmentVariableSelector), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
};
export const loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => memoize(chain(fromEnv(environmentVariableSelector), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));

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

import { __awaiter, __generator } from "tslib";
import { CredentialsProviderError } from "@aws-sdk/property-provider";
export var fromEnv = function (envVarSelector) {
return function () { return __awaiter(void 0, void 0, void 0, function () {
var config;
return __generator(this, function (_a) {
try {
config = envVarSelector(process.env);
if (config === undefined) {
throw new Error();
}
return [2, config];
}
catch (e) {
throw new CredentialsProviderError(e.message || "Cannot load config from environment variables with getter: ".concat(envVarSelector));
}
return [2];
});
}); };
export const fromEnv = (envVarSelector) => async () => {
try {
const config = envVarSelector(process.env);
if (config === undefined) {
throw new Error();
}
return config;
}
catch (e) {
throw new CredentialsProviderError(e.message || `Cannot load config from environment variables with getter: ${envVarSelector}`);
}
};

@@ -1,35 +0,22 @@

import { __assign, __awaiter, __generator, __rest } from "tslib";
import { CredentialsProviderError } from "@aws-sdk/property-provider";
import { getProfileName, loadSharedConfigFiles } from "@aws-sdk/shared-ini-file-loader";
export var fromSharedConfigFiles = function (configSelector, _a) {
if (_a === void 0) { _a = {}; }
var _b = _a.preferredFile, preferredFile = _b === void 0 ? "config" : _b, init = __rest(_a, ["preferredFile"]);
return function () { return __awaiter(void 0, void 0, void 0, function () {
var profile, _a, configFile, credentialsFile, profileFromCredentials, profileFromConfig, mergedProfile, configValue;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
profile = getProfileName(init);
return [4, loadSharedConfigFiles(init)];
case 1:
_a = _b.sent(), configFile = _a.configFile, credentialsFile = _a.credentialsFile;
profileFromCredentials = credentialsFile[profile] || {};
profileFromConfig = configFile[profile] || {};
mergedProfile = preferredFile === "config"
? __assign(__assign({}, profileFromCredentials), profileFromConfig) : __assign(__assign({}, profileFromConfig), profileFromCredentials);
try {
configValue = configSelector(mergedProfile);
if (configValue === undefined) {
throw new Error();
}
return [2, configValue];
}
catch (e) {
throw new CredentialsProviderError(e.message ||
"Cannot load config for profile ".concat(profile, " in SDK configuration files with getter: ").concat(configSelector));
}
return [2];
}
});
}); };
export const fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
const profile = getProfileName(init);
const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
const profileFromCredentials = credentialsFile[profile] || {};
const profileFromConfig = configFile[profile] || {};
const mergedProfile = preferredFile === "config"
? { ...profileFromCredentials, ...profileFromConfig }
: { ...profileFromConfig, ...profileFromCredentials };
try {
const configValue = configSelector(mergedProfile);
if (configValue === undefined) {
throw new Error();
}
return configValue;
}
catch (e) {
throw new CredentialsProviderError(e.message ||
`Cannot load config for profile ${profile} in SDK configuration files with getter: ${configSelector}`);
}
};

@@ -1,11 +0,3 @@

import { __awaiter, __generator } from "tslib";
import { fromStatic as convertToProvider } from "@aws-sdk/property-provider";
var isFunction = function (func) { return typeof func === "function"; };
export var fromStatic = function (defaultValue) {
return isFunction(defaultValue) ? function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, defaultValue()];
case 1: return [2, _a.sent()];
}
}); }); } : convertToProvider(defaultValue);
};
const isFunction = (func) => typeof func === "function";
export const fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : convertToProvider(defaultValue);
{
"name": "@aws-sdk/node-config-provider",
"version": "3.186.0",
"version": "3.188.0",
"description": "Load config default values from ini config files and environmental variable",

@@ -25,5 +25,5 @@ "scripts": {

"dependencies": {
"@aws-sdk/property-provider": "3.186.0",
"@aws-sdk/shared-ini-file-loader": "3.186.0",
"@aws-sdk/types": "3.186.0",
"@aws-sdk/property-provider": "3.188.0",
"@aws-sdk/shared-ini-file-loader": "3.188.0",
"@aws-sdk/types": "3.188.0",
"tslib": "^2.3.1"

@@ -30,0 +30,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc