@iyio/common
Advanced tools
Comparing version 0.0.13 to 0.0.14
{ | ||
"name": "@iyio/common", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -12,3 +12,3 @@ "use strict"; | ||
const _internal_common_1 = require("./_internal.common"); | ||
exports.apiBaseUrlParam = (0, scope_lib_1.defineStringParam)('API_BASE_URL'); | ||
exports.apiBaseUrlParam = (0, scope_lib_1.defineStringParam)('apiBaseUrl'); | ||
// HTTP | ||
@@ -18,8 +18,8 @@ exports.httpClient = (0, scope_lib_1.defineClient)('httpClient', scope => HttpClient_1.HttpClient.fromScope(scope)); | ||
exports.HttpFetchers = (0, scope_lib_1.defineProvider)('HttpFetchers', () => new HttpDefaultFetcher_1.HttpDefaultFetcher()); | ||
exports.httpBaseUrlMapParam = (0, scope_lib_1.defineParam)('HTTP_BASE_URL_MAP', string_converters_1.stringToHashMap); | ||
exports.httpBaseUrlPrefixParam = (0, scope_lib_1.defineStringParam)('HTTP_BASE_URL_PREFIX'); | ||
exports.httpLogRequestsParam = (0, scope_lib_1.defineBoolParam)('HTTP_LOG_REQUESTS'); | ||
exports.httpLogResponsesParam = (0, scope_lib_1.defineBoolParam)('HTTP_LOG_RESPONSES'); | ||
exports.httpMaxRetriesParam = (0, scope_lib_1.defineNumberParam)('HTTP_MAX_RETRIES', 5); | ||
exports.httpRetryDelayMsParam = (0, scope_lib_1.defineNumberParam)('HTTP_RETRY_DELAY_MS', 500); | ||
exports.httpBaseUrlMapParam = (0, scope_lib_1.defineParam)('httpBaseUrlMap', string_converters_1.stringToHashMap); | ||
exports.httpBaseUrlPrefixParam = (0, scope_lib_1.defineStringParam)('httpBaseUrlPrefix'); | ||
exports.httpLogRequestsParam = (0, scope_lib_1.defineBoolParam)('httpLogRequests'); | ||
exports.httpLogResponsesParam = (0, scope_lib_1.defineBoolParam)('httpLogResponses'); | ||
exports.httpMaxRetriesParam = (0, scope_lib_1.defineNumberParam)('httpMaxRetries', 5); | ||
exports.httpRetryDelayMsParam = (0, scope_lib_1.defineNumberParam)('httpRetryDelayMs', 500); | ||
// JWP | ||
@@ -26,0 +26,0 @@ exports.JwtProviders = (0, scope_lib_1.defineProvider)('JwtProviders'); |
@@ -42,4 +42,4 @@ "use strict"; | ||
exports.emptyFunction = emptyFunction; | ||
const nameToEnvName = (name) => name ? name.replace(/[A-Z]+/g, m => '_' + m).toUpperCase() : ''; | ||
const nameToEnvName = (name) => name ? name.replace(/[A-Z]+/g, m => '_' + m).replace(/__+/g, '_').toUpperCase() : ''; | ||
exports.nameToEnvName = nameToEnvName; | ||
//# sourceMappingURL=common-lib.js.map |
@@ -103,2 +103,3 @@ "use strict"; | ||
} | ||
const hasKey = name.replace(/_/g, '').toLowerCase(); | ||
for (const p of providers) { | ||
@@ -113,3 +114,3 @@ const valueP = getProviderValue(p); | ||
else if (valueP) { | ||
const value = valueP[name]; | ||
const value = valueP[hasKey]; | ||
if (typeof value === 'string') { | ||
@@ -363,3 +364,12 @@ return value; | ||
} | ||
provideForType(ParamProviderType, () => valueProvider); | ||
if (typeof valueProvider.getParam === 'function') { | ||
provideForType(ParamProviderType, () => valueProvider); | ||
} | ||
else { | ||
const map = {}; | ||
for (const e in valueProvider) { | ||
map[e.replace(/_/g, '').toLowerCase()] = valueProvider[e]; | ||
} | ||
provideForType(ParamProviderType, () => map); | ||
} | ||
}; | ||
@@ -366,0 +376,0 @@ const defineParam = (name, valueConverter, defaultValue) => (_defineCallableType({ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
370384
6105