include node_modules so release .zip is deployable
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadConfig = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const fromEnv_1 = require("./fromEnv");
|
||||
const fromSharedConfigFiles_1 = require("./fromSharedConfigFiles");
|
||||
const fromStatic_1 = require("./fromStatic");
|
||||
const loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, property_provider_1.memoize)((0, property_provider_1.chain)((0, fromEnv_1.fromEnv)(environmentVariableSelector), (0, fromSharedConfigFiles_1.fromSharedConfigFiles)(configFileSelector, configuration), (0, fromStatic_1.fromStatic)(defaultValue)));
|
||||
exports.loadConfig = loadConfig;
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromEnv = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const fromEnv = (envVarSelector) => async () => {
|
||||
try {
|
||||
const config = envVarSelector(process.env);
|
||||
if (config === undefined) {
|
||||
throw new Error();
|
||||
}
|
||||
return config;
|
||||
}
|
||||
catch (e) {
|
||||
throw new property_provider_1.CredentialsProviderError(e.message || `Cannot load config from environment variables with getter: ${envVarSelector}`);
|
||||
}
|
||||
};
|
||||
exports.fromEnv = fromEnv;
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromSharedConfigFiles = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const shared_ini_file_loader_1 = require("@smithy/shared-ini-file-loader");
|
||||
const fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
|
||||
const profile = (0, shared_ini_file_loader_1.getProfileName)(init);
|
||||
const { configFile, credentialsFile } = await (0, shared_ini_file_loader_1.loadSharedConfigFiles)(init);
|
||||
const profileFromCredentials = credentialsFile[profile] || {};
|
||||
const profileFromConfig = configFile[profile] || {};
|
||||
const mergedProfile = preferredFile === "config"
|
||||
? { ...profileFromCredentials, ...profileFromConfig }
|
||||
: { ...profileFromConfig, ...profileFromCredentials };
|
||||
try {
|
||||
const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
|
||||
const configValue = configSelector(mergedProfile, cfgFile);
|
||||
if (configValue === undefined) {
|
||||
throw new Error();
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
catch (e) {
|
||||
throw new property_provider_1.CredentialsProviderError(e.message || `Cannot load config for profile ${profile} in SDK configuration files with getter: ${configSelector}`);
|
||||
}
|
||||
};
|
||||
exports.fromSharedConfigFiles = fromSharedConfigFiles;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromStatic = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const isFunction = (func) => typeof func === "function";
|
||||
const fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, property_provider_1.fromStatic)(defaultValue);
|
||||
exports.fromStatic = fromStatic;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./configLoader"), exports);
|
||||
Reference in New Issue
Block a user