@mojaloop/account-lookup-bc-client-lib
Advanced tools
Comparing version 0.1.24 to 0.1.25
@@ -37,7 +37,5 @@ /***** | ||
private readonly _baseUrlHttpService; | ||
private readonly _cache; | ||
private readonly _cacheTimeoutMs; | ||
private readonly _requestTimeoutMs; | ||
constructor(logger: ILogger, baseUrlHttpService: string, authRequester: IAuthenticatedHttpRequester, cacheTimeoutMs?: number, requestTimeoutMs?: number); | ||
constructor(logger: ILogger, baseUrlHttpService: string, authRequester: IAuthenticatedHttpRequester, requestTimeoutMs?: number); | ||
participantLookUp(partyType: string, partyId: string, currency: string | null): Promise<string | null>; | ||
} |
@@ -35,6 +35,4 @@ /***** | ||
const errors_1 = require("./errors"); | ||
const account_lookup_bc_implementations_lib_1 = require("@mojaloop/account-lookup-bc-implementations-lib"); | ||
const SERVICE_BASE_PATH = "/account-lookup"; | ||
const DEFAULT_REQUEST_TIMEOUT_MS = 5000; | ||
const DEFAULT_CACHE_TIMEOUT_MS = 1 * 60 * 1000; | ||
class AccountLookupHttpClient { | ||
@@ -44,12 +42,8 @@ _logger; | ||
_baseUrlHttpService; | ||
_cache; | ||
_cacheTimeoutMs; | ||
_requestTimeoutMs; | ||
constructor(logger, baseUrlHttpService, authRequester, cacheTimeoutMs = DEFAULT_CACHE_TIMEOUT_MS, requestTimeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) { | ||
constructor(logger, baseUrlHttpService, authRequester, requestTimeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) { | ||
this._logger = logger; | ||
this._baseUrlHttpService = baseUrlHttpService; | ||
this._authRequester = authRequester; | ||
this._cacheTimeoutMs = cacheTimeoutMs; | ||
this._requestTimeoutMs = requestTimeoutMs; | ||
this._cache = new account_lookup_bc_implementations_lib_1.LocalCache(this._logger, this._cacheTimeoutMs); | ||
} | ||
@@ -64,8 +58,4 @@ async participantLookUp(partyType, partyId, currency) { | ||
} | ||
const cached = this._cache.get(partyId, partyType, currency); | ||
if (cached) { | ||
return cached.toString(); | ||
} | ||
const url = new URL(urlBuilder, this._baseUrlHttpService).toString(); | ||
const resp = await this._authRequester.fetch(url, DEFAULT_REQUEST_TIMEOUT_MS) | ||
const resp = await this._authRequester.fetch(url, this._requestTimeoutMs) | ||
.catch((err) => { | ||
@@ -81,3 +71,2 @@ console.log(err); | ||
}); | ||
this._cache.set(data, partyId, partyType, currency); | ||
return data; | ||
@@ -84,0 +73,0 @@ } |
{ | ||
"name": "@mojaloop/account-lookup-bc-client-lib", | ||
"version": "0.1.24", | ||
"version": "0.1.25", | ||
"description": "Account Lookup BC - Clients", | ||
@@ -38,4 +38,3 @@ "license": "Apache-2.0", | ||
"@mojaloop/logging-bc-client-lib": "^0.1.24", | ||
"@mojaloop/security-bc-client-lib": "0.1.31", | ||
"@mojaloop/account-lookup-bc-implementations-lib": "*" | ||
"@mojaloop/security-bc-client-lib": "0.1.31" | ||
}, | ||
@@ -42,0 +41,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
2
1
16856
228