From 989628573b538fd3f4805253b714af73a43c738d Mon Sep 17 00:00:00 2001 From: Kevin Leyow Date: Wed, 13 Mar 2024 09:41:04 -0500 Subject: [PATCH 1/3] fix: add timer for party lookup in cache --- modules/api-svc/.env.example | 3 + modules/api-svc/package.json | 16 +-- ...tbound-bulk-accept-party-info-requested.js | 2 +- ...dk-outbound-bulk-accept-quote-requested.js | 2 +- .../sdk-outbound-bulk-response-prepared.js | 2 +- .../api-svc/src/BackendEventHandler/index.js | 12 +-- modules/api-svc/src/ControlAgent/index.js | 14 +-- modules/api-svc/src/ControlServer/index.js | 24 ++--- .../handlers/bulk-quotes-requested.js | 2 +- .../handlers/bulk-transfers-requested.js | 2 +- .../handlers/party-info-requested.js | 2 +- .../api-svc/src/FSPIOPEventHandler/index.js | 12 +-- modules/api-svc/src/InboundServer/handlers.js | 54 +++++----- modules/api-svc/src/InboundServer/index.js | 4 +- .../api-svc/src/InboundServer/middlewares.js | 24 ++--- modules/api-svc/src/OAuthTestServer/index.js | 4 +- .../api-svc/src/OutboundServer/handlers.js | 2 +- modules/api-svc/src/OutboundServer/index.js | 4 +- .../api-svc/src/OutboundServer/middlewares.js | 6 +- modules/api-svc/src/TestServer/index.js | 18 ++-- modules/api-svc/src/config.js | 1 + modules/api-svc/src/index.js | 24 +++-- modules/api-svc/src/lib/cache.js | 66 ++++++++---- modules/api-svc/src/lib/metrics.js | 4 +- .../api-svc/src/lib/model/AccountsModel.js | 36 +++---- .../api-svc/src/lib/model/Async2SyncModel.js | 16 +-- .../src/lib/model/InboundTransfersModel.js | 66 ++++++------ .../src/lib/model/OutboundBulkQuotesModel.js | 50 ++++----- .../lib/model/OutboundBulkTransfersModel.js | 56 +++++----- .../lib/model/OutboundRequestToPayModel.js | 48 ++++----- .../OutboundRequestToPayTransferModel.js | 92 ++++++++-------- .../src/lib/model/OutboundTransfersModel.js | 102 +++++++++--------- .../api-svc/src/lib/model/ProxyModel/index.js | 6 +- .../model/common/PersistentStateMachine.js | 10 +- .../lib/model/lib/requests/backendRequests.js | 10 +- modules/api-svc/src/lib/router.js | 4 +- modules/api-svc/src/lib/validate.js | 4 +- .../api-svc/test/unit/InboundServer.test.js | 48 +++++++-- modules/api-svc/test/unit/TestServer.test.js | 7 +- modules/api-svc/test/unit/api/utils.js | 3 +- modules/api-svc/test/unit/lib/cache.test.js | 5 +- .../test/unit/lib/model/AccountsModel.test.js | 7 +- .../lib/model/InboundTransfersModel.test.js | 8 ++ .../lib/model/OutboundBulkQuotesModel.test.js | 1 + .../model/OutboundBulkTransfersModel.test.js | 1 + .../model/OutboundRequestToPayModel.test.js | 7 +- .../OutboundRequestToPayTransferModel.test.js | 7 +- .../lib/model/OutboundTransfersModel.test.js | 1 + .../common/PersistentStateMachine.test.js | 7 +- .../package.json | 18 ++-- .../package.json | 16 +-- modules/private-shared-lib/package.json | 12 +-- package.json | 14 +-- 53 files changed, 527 insertions(+), 439 deletions(-) diff --git a/modules/api-svc/.env.example b/modules/api-svc/.env.example index 9a0eb4b73..adba04cbe 100644 --- a/modules/api-svc/.env.example +++ b/modules/api-svc/.env.example @@ -173,3 +173,6 @@ PM4ML_ENABLED=false # Maximum payload limits FSPIOP_API_SERVER_MAX_REQUEST_BYTES=209715200 BACKEND_API_SERVER_MAX_REQUEST_BYTES=209715200 + +# How much time to wait for cache to unsubscribe from a channel +UNSUBSCRIBE_TIMEOUT_MS=5000 diff --git a/modules/api-svc/package.json b/modules/api-svc/package.json index 36170ead6..cbb079592 100644 --- a/modules/api-svc/package.json +++ b/modules/api-svc/package.json @@ -67,16 +67,16 @@ "@mojaloop/central-services-error-handling": "^12.0.7", "@mojaloop/central-services-logger": "^11.2.2", "@mojaloop/central-services-metrics": "^12.0.8", - "@mojaloop/central-services-shared": "18.2.0", + "@mojaloop/central-services-shared": "18.3.0", "@mojaloop/event-sdk": "^14.0.0", "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^", - "@mojaloop/sdk-standard-components": "v17.4.0", + "@mojaloop/sdk-standard-components": "v18.0.0", "ajv": "8.12.0", "axios": "^1.6.7", "co-body": "^6.1.0", "dotenv": "^16.4.5", "env-var": "^7.4.1", - "express": "^4.18.2", + "express": "^4.18.3", "fast-json-patch": "^3.1.1", "fast-safe-stringify": "^2.1.1", "javascript-state-machine": "^3.1.0", @@ -96,21 +96,21 @@ "ws": "^8.16.0" }, "devDependencies": { - "@babel/core": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/core": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@redocly/openapi-cli": "^1.0.0-beta.94", "@types/jest": "^29.5.12", "babel-jest": "^29.7.0", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^27.9.0", "jest": "^29.7.0", "jest-junit": "^16.0.0", - "nock": "^13.5.3", + "nock": "^13.5.4", "npm-check-updates": "^16.7.10", "openapi-response-validator": "^12.1.3", - "openapi-typescript": "^6.7.4", + "openapi-typescript": "^6.7.5", "redis-mock": "^0.56.3", "replace": "^1.2.2", "standard-version": "^9.5.0", diff --git a/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-party-info-requested.js b/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-party-info-requested.js index 3856fef27..e2d062443 100644 --- a/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-party-info-requested.js +++ b/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-party-info-requested.js @@ -38,6 +38,6 @@ module.exports.handleSDKOutboundBulkAcceptPartyInfoRequestedDmEvt = async ( currentState: BulkTransactionState.WAITING_FOR_PARTY_ACCEPTANCE, }); } catch (err) { - logger.isErrorEnabled() && logger.push({ err }).error('Error in handleSDKOutboundBulkAcceptPartyInfoRequested'); + logger.isErrorEnabled && logger.push({ err }).error('Error in handleSDKOutboundBulkAcceptPartyInfoRequested'); } }; diff --git a/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-quote-requested.js b/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-quote-requested.js index 1e1f4c20f..12272a7a4 100644 --- a/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-quote-requested.js +++ b/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-accept-quote-requested.js @@ -38,6 +38,6 @@ module.exports.handleSDKOutboundBulkAcceptQuoteRequestedDmEvt = async ( currentState: BulkTransactionState.WAITING_FOR_QUOTE_ACCEPTANCE, }); } catch (err) { - logger.isErrorEnabled() && logger.push({ err }).error('Error in handleSDKOutboundBulkAcceptQuoteRequested'); + logger.isErrorEnabled && logger.push({ err }).error('Error in handleSDKOutboundBulkAcceptQuoteRequested'); } }; diff --git a/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-response-prepared.js b/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-response-prepared.js index 8ac1aed0d..bf8db3dc3 100644 --- a/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-response-prepared.js +++ b/modules/api-svc/src/BackendEventHandler/handlers/sdk-outbound-bulk-response-prepared.js @@ -45,6 +45,6 @@ module.exports.handleSDKOutboundBulkResponsePreparedDmEvt = async ( }); await options.producer.sendDomainEvent(sdkOutboundBulkResponseSentDmEvt); } catch (err) { - logger.isErrorEnabled() && logger.push({ err }).error('Error in handleSDKOutboundBulkResponsePreparedDmEvt'); + logger.isErrorEnabled && logger.push({ err }).error('Error in handleSDKOutboundBulkResponsePreparedDmEvt'); } }; diff --git a/modules/api-svc/src/BackendEventHandler/index.js b/modules/api-svc/src/BackendEventHandler/index.js index 18af14e2e..ce5ec91c2 100644 --- a/modules/api-svc/src/BackendEventHandler/index.js +++ b/modules/api-svc/src/BackendEventHandler/index.js @@ -58,13 +58,13 @@ class BackendEventHandler { async start() { const config = this._conf; - this._logger.isInfoEnabled() && this._logger.info('start'); + this._logger.isInfoEnabled && this._logger.info('start'); this._consumer = new KafkaDomainEventConsumer(this._messageHandler.bind(this), config.backendEventHandler.domainEventConsumer, this._loggerFromLoggingBC); - this._logger.isInfoEnabled() && this._logger.info(`Created Message Consumer of type ${this._consumer.constructor.name}`); + this._logger.isInfoEnabled && this._logger.info(`Created Message Consumer of type ${this._consumer.constructor.name}`); this._producer = new KafkaDomainEventProducer(config.backendEventHandler.domainEventProducer, this._loggerFromLoggingBC); - this._logger.isInfoEnabled() && this._logger.info(`Created Message Producer of type ${this._producer.constructor.name}`); + this._logger.isInfoEnabled && this._logger.info(`Created Message Producer of type ${this._producer.constructor.name}`); await this._producer.init(); // Create options for handlers @@ -79,7 +79,7 @@ class BackendEventHandler { } async stop() { - this._logger.isInfoEnabled() && this._logger.info('stop'); + this._logger.isInfoEnabled && this._logger.info('stop'); await Promise.all([ this._consumer?.destroy(), this._producer?.destroy(), @@ -88,7 +88,7 @@ class BackendEventHandler { } async _messageHandler(message) { - this._logger.isInfoEnabled() && this._logger.info(`Got domain event message: ${message.getName()}`); + this._logger.isInfoEnabled && this._logger.info(`Got domain event message: ${message.getName()}`); // TODO: Handle errors validation here switch (message.getName()) { case SDKOutboundBulkAcceptPartyInfoRequestedDmEvt.name: { @@ -104,7 +104,7 @@ class BackendEventHandler { break; } default: { - this._logger.isDebugEnabled() && this._logger.debug(`${message?.getName()}:${message?.getKey()} - Skipping unknown domain event`); + this._logger.isDebugEnabled && this._logger.debug(`${message?.getName()}:${message?.getKey()} - Skipping unknown domain event`); return; } } diff --git a/modules/api-svc/src/ControlAgent/index.js b/modules/api-svc/src/ControlAgent/index.js index d4efa3f3d..bdf32da05 100644 --- a/modules/api-svc/src/ControlAgent/index.js +++ b/modules/api-svc/src/ControlAgent/index.js @@ -144,7 +144,7 @@ class Client extends ws { async send(msg) { const data = typeof msg === 'string' ? msg : serialise(msg); - this._logger.isDebugEnabled() && this._logger.push({ data }).debug('Sending message'); + this._logger.isDebugEnabled && this._logger.push({ data }).debug('Sending message'); return new Promise((resolve) => super.send.call(this, data, resolve)); } @@ -152,14 +152,14 @@ class Client extends ws { async receive() { return new Promise((resolve) => this.once('message', (data) => { const msg = deserialise(data); - this._logger.isDebugEnabled() && this._logger.push({ msg }).debug('Received'); + this._logger.isDebugEnabled && this._logger.push({ msg }).debug('Received'); resolve(msg); })); } // Close connection async stop() { - this._logger.isInfoEnabled() && this._logger.info('Control client shutting down...'); + this._logger.isInfoEnabled && this._logger.info('Control client shutting down...'); this.close(); } @@ -171,24 +171,24 @@ class Client extends ws { try { msg = deserialise(data); } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ data }).console.error();('Couldn\'t parse received message'); + this._logger.isErrorEnabled && this._logger.push({ data }).console.error();('Couldn\'t parse received message'); this.send(build.ERROR.NOTIFY.JSON_PARSE_ERROR()); } - this._logger.isDebugEnabled() && this._logger.push({ msg }).debug('Handling received message'); + this._logger.isDebugEnabled && this._logger.push({ msg }).debug('Handling received message'); switch (msg.msg) { case MESSAGE.CONFIGURATION: switch (msg.verb) { case VERB.NOTIFY: { const dup = JSON.parse(JSON.stringify(this._appConfig)); // fast-json-patch explicitly mutates _.merge(dup, msg.data); - this._logger.isDebugEnabled() && this._logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); + this._logger.isDebugEnabled && this._logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); this.emit(EVENT.RECONFIGURE, dup); break; } case VERB.PATCH: { const dup = JSON.parse(JSON.stringify(this._appConfig)); // fast-json-patch explicitly mutates jsonPatch.applyPatch(dup, msg.data); - this._logger.isDebugEnabled() && this._logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); + this._logger.isDebugEnabled && this._logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); this.emit(EVENT.RECONFIGURE, dup); break; } diff --git a/modules/api-svc/src/ControlServer/index.js b/modules/api-svc/src/ControlServer/index.js index 566a00d11..423daac03 100644 --- a/modules/api-svc/src/ControlServer/index.js +++ b/modules/api-svc/src/ControlServer/index.js @@ -150,7 +150,7 @@ class Client extends ws { async send(msg) { const data = typeof msg === 'string' ? msg : serialise(msg); - this._logger.isDebugEnabled() && this._logger.push({ data }).debug('Sending message'); + this._logger.isDebugEnabled && this._logger.push({ data }).debug('Sending message'); return new Promise((resolve) => super.send.call(this, data, resolve)); } @@ -158,7 +158,7 @@ class Client extends ws { async receive() { return new Promise((resolve) => this.once('message', (data) => { const msg = deserialise(data); - this._logger.isDebugEnabled() && this._logger.push({ msg }).debug('Received'); + this._logger.isDebugEnabled && this._logger.push({ msg }).debug('Received'); resolve(msg); })); } @@ -186,7 +186,7 @@ class Server extends ws.Server { this._clientData = new Map(); this.on('error', err => { - this._logger.isErrorEnabled() && this._logger.push({ err }) + this._logger.isErrorEnabled && this._logger.push({ err }) .error('Unhandled websocket error occurred. Shutting down.'); process.exit(1); }); @@ -197,18 +197,18 @@ class Server extends ws.Server { ip: getWsIp(req), remoteAddress: req.socket.remoteAddress, }); - logger.isInfoEnabled() && logger.info('Websocket connection received'); + logger.isInfoEnabled && logger.info('Websocket connection received'); this._clientData.set(socket, { ip: req.connection.remoteAddress, logger }); socket.on('close', (code, reason) => { - logger.isInfoEnabled() && logger.push({ code, reason }).info('Websocket connection closed'); + logger.isInfoEnabled && logger.push({ code, reason }).info('Websocket connection closed'); this._clientData.delete(socket); }); socket.on('message', this._handle(socket, logger)); }); - this._logger.isInfoEnabled() && this._logger.push(this.address()).info('running on'); + this._logger.isInfoEnabled && this._logger.push(this.address()).info('running on'); } // Close the server then wait for all the client sockets to close @@ -218,14 +218,14 @@ class Server extends ws.Server { client.terminate(); } await closing; - this._logger.isInfoEnabled() && this._logger.info('Control server shutdown complete'); + this._logger.isInfoEnabled && this._logger.info('Control server shutdown complete'); } async notifyClientsOfCurrentConfig() { const updateConfMsg = build.CONFIGURATION.NOTIFY(this._appConfig); const logError = (socket, message) => (err) => - this._logger.isErrorEnabled() && this._logger + this._logger.isErrorEnabled && this._logger .push({ message, ip: this._clientData.get(socket).ip, err }) .error('Error sending reconfigure notification to client'); const sendToAllClients = (msg) => Promise.all( @@ -244,10 +244,10 @@ class Server extends ws.Server { try { msg = deserialise(data); } catch (err) { - logger.isErrorEnabled() && logger.push({ data }).error('Couldn\'t parse received message'); + logger.isErrorEnabled && logger.push({ data }).error('Couldn\'t parse received message'); client.send(build.ERROR.NOTIFY.JSON_PARSE_ERROR()); } - logger.isDebugEnabled() && logger.push({ msg }).debug('Handling received message'); + logger.isDebugEnabled && logger.push({ msg }).debug('Handling received message'); switch (msg.msg) { case MESSAGE.CONFIGURATION: switch (msg.verb) { @@ -257,7 +257,7 @@ class Server extends ws.Server { case VERB.NOTIFY: { const dup = structuredClone(this._appConfig); // fast-json-patch explicitly mutates _.merge(dup, msg.data); - this._logger.isDebugEnabled() && this._logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); + this._logger.isDebugEnabled && this._logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); this.emit(EVENT.RECONFIGURE, dup); break; } @@ -266,7 +266,7 @@ class Server extends ws.Server { // client library? const dup = structuredClone(this._appConfig); // fast-json-patch explicitly mutates jsonPatch.applyPatch(dup, msg.data); - logger.isDebugEnabled() && logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); + logger.isDebugEnabled && logger.push({ oldConf: this._appConfig, newConf: dup }).debug('Emitting new configuration'); this.emit(EVENT.RECONFIGURE, dup); break; } diff --git a/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-quotes-requested.js b/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-quotes-requested.js index e96b5717d..14f546c84 100644 --- a/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-quotes-requested.js +++ b/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-quotes-requested.js @@ -58,7 +58,7 @@ module.exports.handleBulkQuotesRequestedDmEvt = async ( await options.producer.sendDomainEvent(bulkQuotesCallbackReceivedDmEvt); } catch (err) { - logger.isErrorEnabled() && logger.push({ err }).error('Error in handleBulkQuotesRequestedDmEvt'); + logger.isErrorEnabled && logger.push({ err }).error('Error in handleBulkQuotesRequestedDmEvt'); const bulkQuotesCallbackReceivedDmEvt = new BulkQuotesCallbackReceivedDmEvt({ bulkId: event.getKey(), content: { diff --git a/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-transfers-requested.js b/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-transfers-requested.js index a83ec684b..74630bb33 100644 --- a/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-transfers-requested.js +++ b/modules/api-svc/src/FSPIOPEventHandler/handlers/bulk-transfers-requested.js @@ -57,7 +57,7 @@ module.exports.handleBulkTransfersRequestedDmEvt = async ( await options.producer.sendDomainEvent(bulkTransfersCallbackReceivedDmEvt); } catch (err) { - logger.isErrorEnabled() && logger.push({ err }).error('Error in handleBulkTransfersRequestedDmEvt'); + logger.isErrorEnabled && logger.push({ err }).error('Error in handleBulkTransfersRequestedDmEvt'); const bulkTransfersCallbackReceivedDmEvt = new BulkTransfersCallbackReceivedDmEvt({ bulkId: event.getKey(), content: { diff --git a/modules/api-svc/src/FSPIOPEventHandler/handlers/party-info-requested.js b/modules/api-svc/src/FSPIOPEventHandler/handlers/party-info-requested.js index 2eeb2e0a1..b48ad3977 100644 --- a/modules/api-svc/src/FSPIOPEventHandler/handlers/party-info-requested.js +++ b/modules/api-svc/src/FSPIOPEventHandler/handlers/party-info-requested.js @@ -70,7 +70,7 @@ module.exports.handlePartyInfoRequestedDmEvt = async ( }); await options.producer.sendDomainEvent(partyInfoCallbackReceivedDmEvt); } catch (err) { - logger.isErrorEnabled() && logger.push({ err }).error('Error in handlePartyInfoRequestedDmEvt'); + logger.isErrorEnabled && logger.push({ err }).error('Error in handlePartyInfoRequestedDmEvt'); const { code, message } = Errors.MojaloopApiErrorCodes.SERVER_TIMED_OUT; const partyInfoCallbackReceivedDmEvt = new PartyInfoCallbackReceivedDmEvt({ bulkId: event.getKey(), diff --git a/modules/api-svc/src/FSPIOPEventHandler/index.js b/modules/api-svc/src/FSPIOPEventHandler/index.js index b21e6adb3..07201d37b 100644 --- a/modules/api-svc/src/FSPIOPEventHandler/index.js +++ b/modules/api-svc/src/FSPIOPEventHandler/index.js @@ -52,13 +52,13 @@ class FSPIOPEventHandler { async start() { const config = this._conf; - this._logger.isInfoEnabled() && this._logger.info('start'); + this._logger.isInfoEnabled && this._logger.info('start'); this._consumer = new KafkaDomainEventConsumer(this._messageHandler.bind(this), config.fspiopEventHandler.domainEventConsumer, this._loggerFromLoggingBC); - this._logger.isInfoEnabled() && this._logger.info(`Created Message Consumer of type ${this._consumer.constructor.name}`); + this._logger.isInfoEnabled && this._logger.info(`Created Message Consumer of type ${this._consumer.constructor.name}`); this._producer = new KafkaDomainEventProducer(config.fspiopEventHandler.domainEventProducer, this._loggerFromLoggingBC); - this._logger.isInfoEnabled() && this._logger.info(`Created Message Producer of type ${this._producer.constructor.name}`); + this._logger.isInfoEnabled && this._logger.info(`Created Message Producer of type ${this._producer.constructor.name}`); await this._producer.init(); // Create options for handlers @@ -75,7 +75,7 @@ class FSPIOPEventHandler { } async stop() { - this._logger.isInfoEnabled() && this._logger.info('stop'); + this._logger.isInfoEnabled && this._logger.info('stop'); await Promise.all([ this._consumer?.destroy(), this._producer?.destroy(), @@ -83,7 +83,7 @@ class FSPIOPEventHandler { } async _messageHandler(message) { - this._logger.isInfoEnabled() && this._logger.info(`Got domain event message: ${message.getName()}`); + this._logger.isInfoEnabled && this._logger.info(`Got domain event message: ${message.getName()}`); // TODO: Handle errors validation here switch (message.getName()) { case PartyInfoRequestedDmEvt.name: { @@ -99,7 +99,7 @@ class FSPIOPEventHandler { break; } default: { - this._logger.isDebugEnabled() && this._logger.debug(`${message?.getName()}:${message?.getKey()} - Skipping unknown domain event`); + this._logger.isDebugEnabled && this._logger.debug(`${message?.getName()}:${message?.getKey()} - Skipping unknown domain event`); return; } } diff --git a/modules/api-svc/src/InboundServer/handlers.js b/modules/api-svc/src/InboundServer/handlers.js index 0f0d8e3e5..7028d29d2 100644 --- a/modules/api-svc/src/InboundServer/handlers.js +++ b/modules/api-svc/src/InboundServer/handlers.js @@ -45,11 +45,11 @@ const getAuthorizationsById = async (ctx) => { const response = await model.getAuthorizations(authId, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /parties/{idType}/{idValue} request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /parties/{idType}/{idValue} request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /parties/{idType}/{idValue}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /parties/{idType}/{idValue}'); } })(); @@ -83,11 +83,11 @@ const getParticipantsByTypeAndId = async (ctx) => { const response = await model.getParticipants(idType, idValue, subIdValue, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /participants/{idType}/{idValue}'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /participants/{idType}/{idValue}'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /participants/{idType}/{idValue}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /participants/{idType}/{idValue}'); } })(); @@ -130,11 +130,11 @@ const getPartiesByTypeAndId = async (ctx) => { // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /parties/{idType}/{idValue} request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /parties/{idType}/{idValue} request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /parties/{idType}/{idValue}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /parties/{idType}/{idValue}'); } })(); @@ -187,11 +187,11 @@ const postQuotes = async (ctx) => { } // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /quotes request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /quotes request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling POST /quotes'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling POST /quotes'); } })(); @@ -227,11 +227,11 @@ const postTransfers = async (ctx) => { const response = await model.prepareTransfer(transferRequest, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /transfers request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /transfers request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling POST /transfers'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling POST /transfers'); } })(); @@ -263,12 +263,12 @@ const getTransfersById = async (ctx) => { const response = await model.getTransfer(transferId, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({response}). + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({response}). debug('Inbound transfers model handled GET /transfers/{ID} request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /transfers/{ID}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /transfers/{ID}'); } })(); @@ -300,11 +300,11 @@ const postTransactionRequests = async (ctx) => { const response = await model.transactionRequest(transactionRequest, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /transactionRequests request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /transactionRequests request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling POST /transactionRequests'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling POST /transactionRequests'); } })(); @@ -540,11 +540,11 @@ const getQuoteById = async (ctx) => { const response = await model.getQuoteRequest(quoteId, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /quotes request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled GET /quotes request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /quotes'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /quotes'); } })(); @@ -588,11 +588,11 @@ const putTransactionRequestsById = async (ctx) => { const response = await model.putTransactionRequest(putTransactionRequest, transactionRequestId, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled PUT /transactionRequests/{ID} request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled PUT /transactionRequests/{ID} request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling PUT /transactionRequests/{ID}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling PUT /transactionRequests/{ID}'); } })(); } else { @@ -675,7 +675,7 @@ const patchTransfersById = async (ctx) => { const response = await model.sendNotificationToPayee(req.data, idValue); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({response}). + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({response}). debug('Inbound transfers model handled PATCH /transfers/{ID} request'); }; @@ -760,12 +760,12 @@ const getBulkQuotesById = async (ctx) => { const response = await model.getBulkQuote(bulkQuoteId, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({response}). + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({response}). debug('Inbound transfers model handled GET /bulkQuotes/{ID} request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /bulkQuotes/{ID}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /bulkQuotes/{ID}'); } })(); @@ -796,11 +796,11 @@ const postBulkQuotes = async (ctx) => { const response = await model.bulkQuoteRequest(bulkQuoteRequest, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /bulkQuotes request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /bulkQuotes request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling POST /bulkQuotes'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling POST /bulkQuotes'); } })(); @@ -867,12 +867,12 @@ const getBulkTransfersById = async (ctx) => { const response = await model.getBulkTransfer(bulkTransferId, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({response}). + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({response}). debug('Inbound transfers model handled GET /bulkTransfers/{ID} request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling GET /bulkTransfers/{ID}'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling GET /bulkTransfers/{ID}'); } })(); @@ -903,11 +903,11 @@ const postBulkTransfers = async (ctx) => { const response = await model.prepareBulkTransfer(bulkPrepareRequest, sourceFspId); // log the result - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /bulkTransfers request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ response }).debug('Inbound transfers model handled POST /bulkTransfers request'); } catch(err) { // nothing we can do if an error gets thrown back to us here apart from log it and continue - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Error handling POST /bulkTransfers'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Error handling POST /bulkTransfers'); } })(); diff --git a/modules/api-svc/src/InboundServer/index.js b/modules/api-svc/src/InboundServer/index.js index d8d6e77c6..139a4ce1f 100644 --- a/modules/api-svc/src/InboundServer/index.js +++ b/modules/api-svc/src/InboundServer/index.js @@ -161,7 +161,7 @@ class InboundServer extends EventEmitter { await this._validator.initialise(apiSpecs); await this._api.start(); await new Promise((resolve) => this._server.listen(this._conf.inbound.port, resolve)); - this._logger.isInfoEnabled() && this._logger.info(`Serving inbound API on port ${this._conf.inbound.port}`); + this._logger.isInfoEnabled && this._logger.info(`Serving inbound API on port ${this._conf.inbound.port}`); } async stop() { @@ -169,7 +169,7 @@ class InboundServer extends EventEmitter { await new Promise(resolve => this._server.close(resolve)); } await this._api.stop(); - this._logger.isInfoEnabled() && this._logger.info('inbound shut down complete'); + this._logger.isInfoEnabled && this._logger.info('inbound shut down complete'); } _createServer(tlsEnabled, tlsCreds, handler) { diff --git a/modules/api-svc/src/InboundServer/middlewares.js b/modules/api-svc/src/InboundServer/middlewares.js index c3c19e8f9..6db1f4b9d 100644 --- a/modules/api-svc/src/InboundServer/middlewares.js +++ b/modules/api-svc/src/InboundServer/middlewares.js @@ -35,7 +35,7 @@ const createErrorHandler = (logger) => async (ctx, next) => { await next(); } catch (err) { // TODO: return a 500 here if the response has not already been sent? - logger.isErrorEnabled() && logger.push({ err }).error('Error caught in catchall'); + logger.isErrorEnabled && logger.push({ err }).error('Error caught in catchall'); } }; @@ -149,7 +149,7 @@ const cacheRequest = (cache) => async (ctx, next) => { }; const prefix = ctx.method.toLowerCase() === 'put' ? cache.CALLBACK_PREFIX : cache.REQUEST_PREFIX; const res = await cache.set(`${prefix}${ctx.state.fspiopId}`, req); - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ res }).debug('Caching request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ res }).debug('Caching request'); } await next(); }; @@ -268,7 +268,7 @@ const createHeaderValidator = (conf, logger) => async ( } catch(err) { // error parsing body - logger.isErrorEnabled() && logger.push({ err }).error('Error parsing body'); + logger.isErrorEnabled && logger.push({ err }).error('Error parsing body'); ctx.response.status = Errors.MojaloopApiErrorCodes.MALFORMED_SYNTAX.httpStatusCode; ctx.response.body = new Errors.MojaloopFSPIOPError(err, err.message, null, Errors.MojaloopApiErrorCodes.MALFORMED_SYNTAX).toApiErrorObject(); @@ -298,7 +298,7 @@ const createJwsValidator = (logger, keys, exclusions) => { if (exclusions.includes('putParties') && ctx.request.method === 'PUT' && ctx.request.path.startsWith('/parties/')) { - logger.isDebugEnabled() && logger.debug('Skipping jws validation on put parties. config flag is set'); + logger.isDebugEnabled && logger.debug('Skipping jws validation on put parties. config flag is set'); return await next(); } @@ -307,13 +307,13 @@ const createJwsValidator = (logger, keys, exclusions) => { // there are potential security issues if message origin is used to // determine permission sets i.e. what is "readable" if(ctx.request.method !== 'GET') { - logger.isDebugEnabled() && logger.push({ request: ctx.request, body: ctx.request.body }).debug('Validating JWS'); + logger.isDebugEnabled && logger.push({ request: ctx.request, body: ctx.request.body }).debug('Validating JWS'); jwsValidator.validate(ctx.request, logger); } } catch(err) { - logger.isErrorEnabled() && logger.push({ err }).error('Inbound request failed JWS validation'); + logger.isErrorEnabled && logger.push({ err }).error('Inbound request failed JWS validation'); ctx.response.status = ReturnCodes.BADREQUEST.CODE; ctx.response.body = new Errors.MojaloopFSPIOPError( @@ -356,7 +356,7 @@ const createLogger = (logger) => async (ctx, next) => { path: ctx.path, method: ctx.method }}); - await ctx.state.logger.isDebugEnabled() && ctx.state.logger.debug('Request received'); + await ctx.state.logger.isDebugEnabled && ctx.state.logger.debug('Request received'); // TODO: we need to disable the following log message based on a configurable parameter like DEBUG if (!ctx.state.logExcludePaths.includes(ctx.path) && !ctx.path.startsWith('/bulk')) { ctx.state.logger.push({body: ctx.request.body}).debug('Request received'); @@ -364,10 +364,10 @@ const createLogger = (logger) => async (ctx, next) => { try { await next(); } catch (err) { - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push(err).error('Error'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push(err).error('Error'); } if (!ctx.state.logExcludePaths.includes(ctx.path)) { - await ctx.state.logger.isDebugEnabled() && ctx.state.logger.debug('Request processed'); + await ctx.state.logger.isDebugEnabled && ctx.state.logger.debug('Request processed'); } }; @@ -379,7 +379,7 @@ const createLogger = (logger) => async (ctx, next) => { */ const createRequestValidator = (validator) => async (ctx, next) => { if (!ctx.state.logExcludePaths.includes(ctx.path)) { - ctx.state.logger.isDebugEnabled() && ctx.state.logger.debug('Validating request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.debug('Validating request'); } try { const matchedPathObject = validator.validateRequest(ctx, ctx.state.logger); @@ -387,11 +387,11 @@ const createRequestValidator = (validator) => async (ctx, next) => { ...matchedPathObject }; if (!ctx.state.logExcludePaths.includes(ctx.path)) { - ctx.state.logger.isDebugEnabled() && ctx.state.logger.debug('Request passed validation'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.debug('Request passed validation'); } await next(); } catch (err) { - ctx.state.logger.isErrorEnabled() && ctx.state.logger.push({ err }).error('Request failed validation.'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.push({ err }).error('Request failed validation.'); // send a mojaloop spec error response ctx.response.status = err.httpStatusCode || ReturnCodes.BADREQUEST.CODE; diff --git a/modules/api-svc/src/OAuthTestServer/index.js b/modules/api-svc/src/OAuthTestServer/index.js index c665ecdbb..e55423cc2 100644 --- a/modules/api-svc/src/OAuthTestServer/index.js +++ b/modules/api-svc/src/OAuthTestServer/index.js @@ -51,7 +51,7 @@ class OAuthTestServer { await new Promise((resolve) => this._app.listen(this._port, resolve)); - this._logger.isInfoEnabled() && this._logger.push({ port: this._port }).info('Serving OAuth2 Test Server'); + this._logger.isInfoEnabled && this._logger.push({ port: this._port }).info('Serving OAuth2 Test Server'); } async stop() { @@ -60,7 +60,7 @@ class OAuthTestServer { } await new Promise(resolve => this._app.close(resolve)); this._app = null; - this._logger.isInfoEnabled() && this._logger.info('OAuth2 Test Server shut down complete'); + this._logger.isInfoEnabled && this._logger.info('OAuth2 Test Server shut down complete'); } handleResponse(req, res, response) { diff --git a/modules/api-svc/src/OutboundServer/handlers.js b/modules/api-svc/src/OutboundServer/handlers.js index 19e6f81cb..026fa391a 100644 --- a/modules/api-svc/src/OutboundServer/handlers.js +++ b/modules/api-svc/src/OutboundServer/handlers.js @@ -38,7 +38,7 @@ const { ReturnCodes } = Enum.Http; * Error handling logic shared by outbound API handlers */ const handleError = (method, err, ctx, stateField) => { - ctx.state.logger.isErrorEnabled() && ctx.state.logger.error(`Error handling ${method}: ${safeStringify(err)}`); + ctx.state.logger.isErrorEnabled && ctx.state.logger.error(`Error handling ${method}: ${safeStringify(err)}`); ctx.response.status = err.httpStatusCode || ReturnCodes.INTERNALSERVERERRROR.CODE; ctx.response.body = { message: err.message || 'Unspecified error', diff --git a/modules/api-svc/src/OutboundServer/index.js b/modules/api-svc/src/OutboundServer/index.js index ec792163d..76fc51aef 100644 --- a/modules/api-svc/src/OutboundServer/index.js +++ b/modules/api-svc/src/OutboundServer/index.js @@ -104,7 +104,7 @@ class OutboundServer extends EventEmitter { await this._validator.initialise(apiSpecs); await this._api.start(); await new Promise((resolve) => this._server.listen(this._conf.outbound.port, resolve)); - this._logger.isInfoEnabled() && this._logger.info(`Serving outbound API on port ${this._conf.outbound.port}`); + this._logger.isInfoEnabled && this._logger.info(`Serving outbound API on port ${this._conf.outbound.port}`); } async stop() { @@ -113,7 +113,7 @@ class OutboundServer extends EventEmitter { } await this._api.stop(); await this._eventProducer?.destroy(); - this._logger.isInfoEnabled() && this._logger.info('outbound shut down complete'); + this._logger.isInfoEnabled && this._logger.info('outbound shut down complete'); } } diff --git a/modules/api-svc/src/OutboundServer/middlewares.js b/modules/api-svc/src/OutboundServer/middlewares.js index 67a822bda..025f4d018 100644 --- a/modules/api-svc/src/OutboundServer/middlewares.js +++ b/modules/api-svc/src/OutboundServer/middlewares.js @@ -22,7 +22,7 @@ const { applyState, createErrorHandler, createLogger, createRequestIdGenerator } */ const createRequestValidator = (validator) => async (ctx, next) => { if (!ctx.state.logExcludePaths.includes(ctx.path)) { - ctx.state.logger.isDebugEnabled() && ctx.state.logger.debug('Validating request'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.debug('Validating request'); } try { const matchedPathObject = validator.validateRequest(ctx, ctx.state.logger); @@ -30,11 +30,11 @@ const createRequestValidator = (validator) => async (ctx, next) => { ...matchedPathObject }; if (!ctx.state.logExcludePaths.includes(ctx.path)) { - ctx.state.logger.isDebugEnabled() && ctx.state.logger.debug('Request passed validation'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.debug('Request passed validation'); } await next(); } catch (err) { - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({ err }).debug('Request failed validation.'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({ err }).debug('Request failed validation.'); ctx.response.status = ReturnCodes.BADREQUEST.CODE; ctx.response.body = { message: `${err.dataPath ? err.dataPath + ' ' : ''}${err.message}`, diff --git a/modules/api-svc/src/TestServer/index.js b/modules/api-svc/src/TestServer/index.js index a85e7da25..6c03a582f 100644 --- a/modules/api-svc/src/TestServer/index.js +++ b/modules/api-svc/src/TestServer/index.js @@ -59,7 +59,7 @@ class WsServer extends ws.Server { this._cache = cache; this.on('error', err => { - this._logger.isErrorEnabled() && this._logger.push({ err }) + this._logger.isErrorEnabled && this._logger.push({ err }) .error('Unhandled websocket error occurred. Shutting down.'); process.exit(1); }); @@ -70,10 +70,10 @@ class WsServer extends ws.Server { ip: getWsIp(req), remoteAddress: req.socket.remoteAddress, }); - logger.isDebugEnabled() && logger.debug('Websocket connection received'); + logger.isDebugEnabled && logger.debug('Websocket connection received'); this._wsClients.set(socket, req); socket.on('close', (code, reason) => { - logger.isDebugEnabled() && logger.push({ code, reason }).debug('Websocket connection closed'); + logger.isDebugEnabled && logger.push({ code, reason }).debug('Websocket connection closed'); this._wsClients.delete(socket); }); }); @@ -110,7 +110,7 @@ class WsServer extends ws.Server { // so we filter them here. const allowedPrefixes = [this._cache.CALLBACK_PREFIX, this._cache.REQUEST_PREFIX]; if (!allowedPrefixes.some((prefix) => key.startsWith(prefix))) { - logger.isDebugEnabled() && logger.push({ allowedPrefixes }) + logger.isDebugEnabled && logger.push({ allowedPrefixes }) .debug('Notification not of allowed message type. Ignored.'); return; } @@ -157,7 +157,7 @@ class WsServer extends ws.Server { id: requestId, }); } - this._logger.isDebugEnabled() && this._logger + this._logger.isDebugEnabled && this._logger .push({ url: req.url, key, @@ -200,21 +200,21 @@ class TestServer { await new Promise((resolve) => this._server.listen(this._port, resolve)); - this._logger.isInfoEnabled() && this._logger.info(`Serving test API on port ${this._port}`); + this._logger.isInfoEnabled && this._logger.info(`Serving test API on port ${this._port}`); } async stop() { if (this._wsapi) { - this._logger.isInfoEnabled() && this._logger.info('Shutting down websocket server'); + this._logger.isInfoEnabled && this._logger.info('Shutting down websocket server'); await this._wsapi.stop(); this._wsapi = null; } if (this._server) { - this._logger.isInfoEnabled() && this._logger.info('Shutting down http server'); + this._logger.isInfoEnabled && this._logger.info('Shutting down http server'); await new Promise(resolve => this._server.close(resolve)); this._server = null; } - this._logger.isInfoEnabled() && this._logger.info('Test server shutdown complete'); + this._logger.isInfoEnabled && this._logger.info('Test server shutdown complete'); } } diff --git a/modules/api-svc/src/config.js b/modules/api-svc/src/config.js index bb4c26f1e..c3b9c087e 100644 --- a/modules/api-svc/src/config.js +++ b/modules/api-svc/src/config.js @@ -159,6 +159,7 @@ module.exports = { jwsSigningKey: env.get('JWS_SIGNING_KEY_PATH').asFileContent(), jwsVerificationKeysDirectory: env.get('JWS_VERIFICATION_KEYS_DIRECTORY').asString(), cacheUrl: env.get('CACHE_URL').default('redis://localhost:6379').asUrlString(), + unsubscribeTimeoutMs: env.get('UNSUBSCRIBE_TIMEOUT_MS').default('5000').asIntPositive(), enableTestFeatures: env.get('ENABLE_TEST_FEATURES').default('false').asBool(), oauthTestServer: { enabled: env.get('ENABLE_OAUTH_TOKEN_ENDPOINT').default('false').asBool(), diff --git a/modules/api-svc/src/index.js b/modules/api-svc/src/index.js index 90952ba0b..ae74b593a 100644 --- a/modules/api-svc/src/index.js +++ b/modules/api-svc/src/index.js @@ -58,6 +58,7 @@ class Server extends EventEmitter { cacheUrl: conf.cacheUrl, logger: this.logger.push(LOG_ID.CACHE), enableTestFeatures: conf.enableTestFeatures, + unsubscribeTimeoutMs: conf.unsubscribeTimeoutMs, }); this.metricsClient = new MetricsClient(); @@ -86,7 +87,7 @@ class Server extends EventEmitter { this.wso2, ); this.inboundServer.on('error', (...args) => { - this.logger.isErrorEnabled() && this.logger.push({ args }).error('Unhandled error in Inbound Server'); + this.logger.isErrorEnabled && this.logger.push({ args }).error('Unhandled error in Inbound Server'); this.emit('error', 'Unhandled error in Inbound Server'); }); @@ -98,7 +99,7 @@ class Server extends EventEmitter { this.wso2, ); this.outboundServer.on('error', (...args) => { - this.logger.isErrorEnabled() && this.logger.push({ args }).error('Unhandled error in Outbound Server'); + this.logger.isErrorEnabled && this.logger.push({ args }).error('Unhandled error in Outbound Server'); this.emit('error', 'Unhandled error in Outbound Server'); }); @@ -190,6 +191,7 @@ class Server extends EventEmitter { cacheUrl: newConf.cacheUrl, logger: this.logger.push(LOG_ID.CACHE), enableTestFeatures: newConf.enableTestFeatures, + unsubscribeTimeoutMs: newConf.unsubscribeTimeoutMs, }); await this.cache.connect(); } @@ -221,7 +223,7 @@ class Server extends EventEmitter { this.wso2, ); this.inboundServer.on('error', (...args) => { - this.logger.isErrorEnabled() && this.logger.push({ args }).error('Unhandled error in Inbound Server'); + this.logger.isErrorEnabled && this.logger.push({ args }).error('Unhandled error in Inbound Server'); this.emit('error', 'Unhandled error in Inbound Server'); }); await this.inboundServer.start(); @@ -238,7 +240,7 @@ class Server extends EventEmitter { this.wso2, ); this.outboundServer.on('error', (...args) => { - this.logger.isErrorEnabled() && this.logger.push({ args }).error('Unhandled error in Outbound Server'); + this.logger.isErrorEnabled && this.logger.push({ args }).error('Unhandled error in Outbound Server'); this.emit('error', 'Unhandled error in Outbound Server'); }); await this.outboundServer.start(); @@ -329,11 +331,11 @@ class Server extends EventEmitter { * Call the Connector Manager in Management API to get the updated config */ async function _GetUpdatedConfigFromMgmtAPI(conf, logger, client) { - logger.isInfoEnabled() && logger.info(`Getting updated config from Management API at ${conf.control.mgmtAPIWsUrl}:${conf.control.mgmtAPIWsPort}...`); + logger.isInfoEnabled && logger.info(`Getting updated config from Management API at ${conf.control.mgmtAPIWsUrl}:${conf.control.mgmtAPIWsPort}...`); const clientSendResponse = await client.send(ControlAgent.build.CONFIGURATION.READ()); - logger.isInfoEnabled() && logger.info('client send returned:: ', clientSendResponse); + logger.isInfoEnabled && logger.info('client send returned:: ', clientSendResponse); const responseRead = await client.receive(); - logger.isInfoEnabled() && logger.info('client receive returned:: ', responseRead); + logger.isInfoEnabled && logger.info('client receive returned:: ', responseRead); return responseRead.data; } @@ -358,25 +360,25 @@ if(require.main === module) { appConfig: config, }); const updatedConfigFromMgmtAPI = await _GetUpdatedConfigFromMgmtAPI(config, logger, controlClient); - logger.isInfoEnabled() && logger.info(`updatedConfigFromMgmtAPI: ${JSON.stringify(updatedConfigFromMgmtAPI)}`); + logger.isInfoEnabled && logger.info(`updatedConfigFromMgmtAPI: ${JSON.stringify(updatedConfigFromMgmtAPI)}`); _.merge(config, updatedConfigFromMgmtAPI); controlClient.terminate(); } const svr = new Server(config, logger); svr.on('error', (err) => { - logger.isErrorEnabled() && logger.push({ err }).error('Unhandled server error'); + logger.isErrorEnabled && logger.push({ err }).error('Unhandled server error'); process.exit(1); }); // handle SIGTERM to exit gracefully process.on('SIGTERM', async () => { - logger.isInfoEnabled() && logger.info('SIGTERM received. Shutting down APIs...'); + logger.isInfoEnabled && logger.info('SIGTERM received. Shutting down APIs...'); await svr.stop(); process.exit(0); }); svr.start().catch(err => { - logger.isErrorEnabled() && logger.push({ err }).error('Error starting server'); + logger.isErrorEnabled && logger.push({ err }).error('Error starting server'); process.exit(1); }); })(); diff --git a/modules/api-svc/src/lib/cache.js b/modules/api-svc/src/lib/cache.js index cae2e4800..6d3409f41 100644 --- a/modules/api-svc/src/lib/cache.js +++ b/modules/api-svc/src/lib/cache.js @@ -50,6 +50,9 @@ class Cache { // tag each callback with an Id so we can gracefully unsubscribe and not leak resources this._callbackId = 0; + + this._unsubscribeTimeoutMs = config.unsubscribeTimeoutMs; + this._unsubscribeTimeoutMap = {}; } /** @@ -98,7 +101,7 @@ class Cache { // s Set commands // $ String commands const mode = enable ? 'Es$' : ''; - this._logger.isDebugEnabled() && this._logger + this._logger.isDebugEnabled && this._logger .push({ 'notify-keyspace-events': mode }) .debug('Configuring Redis to emit keyevent events'); await this._client.configSet('notify-keyspace-events', mode); @@ -150,20 +153,20 @@ class Cache { // we have some callbacks to make if (this._callbacks[channel]) { for (const [id, cb] of Object.entries(this._callbacks[channel])) { - this._logger.isDebugEnabled() && this._logger.debug(`Cache message received on channel ${channel}. Making callback with id ${id}`); + this._logger.isDebugEnabled && this._logger.debug(`Cache message received on channel ${channel}. Making callback with id ${id}`); // call the callback with the channel name, message and callbackId... // ...(which is useful for unsubscribe) try { cb(channel, msg, id); } catch (err) { - this._logger.isErrorEnabled() && this._logger + this._logger.isErrorEnabled && this._logger .push({ callbackId: id, err }) .error('Unhandled error in cache subscription handler'); } } } else { - this._logger.isDebugEnabled() && this._logger.debug(`Cache message received on unknown channel ${channel}. Ignoring...`); + this._logger.isDebugEnabled && this._logger.debug(`Cache message received on unknown channel ${channel}. Ignoring...`); } }); } else { @@ -171,7 +174,7 @@ class Cache { } // store the callback against the channel/id - this._logger.isDebugEnabled() && this._logger.debug(`Subscribed to cache pub/sub channel ${channel}`); + this._logger.isDebugEnabled && this._logger.debug(`Subscribed to cache pub/sub channel ${channel}`); return id; } @@ -183,20 +186,45 @@ class Cache { * @param channel {string} - name of the channel to unsubscribe from * @param callbackId {integer} - id of the callback to remove */ - async unsubscribe(channel, callbackId) { + + async unsubscribe(channel, callbackId, useUnsubscribeTimeout=false) { if(this._callbacks[channel] && this._callbacks[channel][callbackId]) { delete this._callbacks[channel][callbackId]; - this._logger.isDebugEnabled() && this._logger.debug(`Cache unsubscribed callbackId ${callbackId} from channel ${channel}`); - - if(Object.keys(this._callbacks[channel]).length < 1) { - //no more callbacks for this channel + this._logger.isDebugEnabled && this._logger.debug(`Cache unsubscribed callbackId ${callbackId} from channel ${channel}`); + // The unsubscribeTimeout is used to mitigate a believed issue happening in the + // parties lookup leg of transfers. When the same party is looked up multiple times in quick + // succession, the cache is subscribed to the same channel multiple times. We believe that + // requests that have just subscribed to the channel which have not received the message yet + // are getting unsubscribed when requests that have completed call `unsubscribe`. + // This leads the request state machine to timeout the request, fail and + // stall the service. This issue is only affects parties lookup since it is the only + // pub/sub that can use the same channel name, primarily in our `ml-core-test-harness` environment. + if (Object.keys(this._callbacks[channel]).length < 1 && !useUnsubscribeTimeout){ + // no more callbacks for this channel delete this._callbacks[channel]; - await this._subscriptionClient.unsubscribe(channel); + if (this._subscriptionClient) { + await this._subscriptionClient.unsubscribe(channel); + } + }else if(Object.keys(this._callbacks[channel]).length < 1) { + if (!this._unsubscribeTimeoutMap[channel]){ + this._unsubscribeTimeoutMap[channel] = setTimeout(async () => { + // no more callbacks for this channel + delete this._callbacks[channel]; + delete this._unsubscribeTimeoutMap[channel]; + if (this._subscriptionClient) { + await this._subscriptionClient.unsubscribe(channel); + } + }, this._unsubscribeTimeoutMs); + } + } else { + if (this._unsubscribeTimeoutMap[channel]) { + this._unsubscribeTimeoutMap[channel].refresh(); + } } } else { // we should not be asked to unsubscribe from a subscription we do not have. Raise this as a promise - // rejection so it can be spotted. It may indiate a logic bug somewhere else - this._logger.isErrorEnabled() && this._logger.error(`Cache not subscribed to channel ${channel} for callbackId ${callbackId}`); + // rejection so it can be spotted. It may indicate a logic bug somewhere else + this._logger.isErrorEnabled && this._logger.error(`Cache not subscribed to channel ${channel} for callbackId ${callbackId}`); throw new Error(`Channel ${channel} does not have a callback with id ${callbackId} subscribed`); } } @@ -214,15 +242,15 @@ class Cache { const client = redis.createClient({ url: this._url }); client.on('error', (err) => { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error from REDIS client getting subscriber'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error from REDIS client getting subscriber'); }); client.on('reconnecting', (err) => { - this._logger.isDebugEnabled() && this._logger.push({ err }).debug('REDIS client Reconnecting'); + this._logger.isDebugEnabled && this._logger.push({ err }).debug('REDIS client Reconnecting'); }); client.on('subscribe', (channel, count) => { - this._logger.isDebugEnabled() && this._logger.push({ channel, count }).debug('REDIS client subscribe'); + this._logger.isDebugEnabled && this._logger.push({ channel, count }).debug('REDIS client subscribe'); // On a subscribe event, ensure that testFeatures are enabled. // This is required here in the advent of a disconnect/reconnect event. Redis client will re-subscribe all subscriptions, but previously enabledTestFeatures will be lost. // Handling this on the on subscribe event will ensure its always configured. @@ -232,11 +260,11 @@ class Cache { }); client.on('connect', () => { - this._logger.isDebugEnabled() && this._logger.debug(`REDIS client connected at: ${this._url}`); + this._logger.isDebugEnabled && this._logger.debug(`REDIS client connected at: ${this._url}`); }); client.on('ready', () => { - this._logger.isDebugEnabled() && this._logger.debug(`Connected to REDIS at: ${this._url}`); + this._logger.isDebugEnabled && this._logger.debug(`Connected to REDIS at: ${this._url}`); }); await client.connect(); @@ -309,7 +337,7 @@ class Cache { value = JSON.parse(value); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error parsing JSON cache value'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error parsing JSON cache value'); } } return value; diff --git a/modules/api-svc/src/lib/metrics.js b/modules/api-svc/src/lib/metrics.js index d95b80d33..bcc920251 100644 --- a/modules/api-svc/src/lib/metrics.js +++ b/modules/api-svc/src/lib/metrics.js @@ -118,12 +118,12 @@ class MetricsServer { }); await new Promise((resolve) => this._server.listen(this._port, resolve)); - this._logger.isInfoEnabled() && this._logger.push({ port: this._port }).info('Serving Metrics'); + this._logger.isInfoEnabled && this._logger.push({ port: this._port }).info('Serving Metrics'); } async stop() { await new Promise(resolve => this._server.close(resolve)); - this._logger.isInfoEnabled() && this._logger.info('Metrics Server shut down complete'); + this._logger.isInfoEnabled && this._logger.info('Metrics Server shut down complete'); } setupApi() { diff --git a/modules/api-svc/src/lib/model/AccountsModel.js b/modules/api-svc/src/lib/model/AccountsModel.js index c330af90b..e134d6dbc 100644 --- a/modules/api-svc/src/lib/model/AccountsModel.js +++ b/modules/api-svc/src/lib/model/AccountsModel.js @@ -74,7 +74,7 @@ class AccountsModel { * Updates the internal state representation to reflect that of the state machine itself */ _afterTransition() { - this._logger.isDebugEnabled() && this._logger.debug(`State machine transitioned: ${this._data.currentState} -> ${this._stateMachine.state}`); + this._logger.isDebugEnabled && this._logger.debug(`State machine transitioned: ${this._data.currentState} -> ${this._stateMachine.state}`); this._data.currentState = this._stateMachine.state; } @@ -109,7 +109,7 @@ class AccountsModel { * Handles state machine transitions */ async _handleTransition(lifecycle, ...args) { - this._logger.isDebugEnabled() && this._logger.debug(`Request ${this._data.requestId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); + this._logger.isDebugEnabled && this._logger.debug(`Request ${this._data.requestId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); switch(lifecycle.transition) { case 'init': @@ -119,12 +119,12 @@ class AccountsModel { return this._createAccounts(); case 'error': - this._logger.isErrorEnabled() && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); this._data.lastError = args[0] || new BackendError('unspecified error', 500); break; default: - this._logger.isDebugEnabled() && this._logger.debug(`Unhandled state transition for request ${this._data.requestId}`); + this._logger.isDebugEnabled && this._logger.debug(`Unhandled state transition for request ${this._data.requestId}`); } } @@ -160,7 +160,7 @@ class AccountsModel { // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(requestKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${requestKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${requestKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -168,7 +168,7 @@ class AccountsModel { } const response = this._data.postAccountsResponse; - this._logger.isDebugEnabled() && this._logger.push({ response }).debug('Account creation response received'); + this._logger.isDebugEnabled && this._logger.push({ response }).debug('Account creation response received'); return resolve(response); } catch(err) { @@ -182,7 +182,7 @@ class AccountsModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(requestKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${requestKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${requestKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -192,7 +192,7 @@ class AccountsModel { // a POST /participants request to the switch try { const res = await this._requests.postParticipants(accountRequest); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Account creation request sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Account creation request sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -200,7 +200,7 @@ class AccountsModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(requestKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${requestKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${requestKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -288,7 +288,7 @@ class AccountsModel { break; default: - this._logger.isDebugEnabled() && this._logger.debug( + this._logger.isDebugEnabled && this._logger.debug( `Account model response being returned from an unexpected state: ${this._data.currentState}. ` + 'Returning ERROR_OCCURRED state' ); @@ -306,7 +306,7 @@ class AccountsModel { try { this._data.currentState = this._stateMachine.state; const res = await this._cache.set(`accountModel_${this._data.modelId}`, this._data); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Persisted account model in cache'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Persisted account model in cache'); } catch(err) { this._logger.push({ err }).error('Error saving account model'); @@ -327,7 +327,7 @@ class AccountsModel { throw new BackendError(`No cached data found for account model with id: ${modelId}`, 500); } await this.initialize(data); - this._logger.isDebugEnabled() && this._logger.push({ cache: this._data }).debug('Account model loaded from cached state'); + this._logger.isDebugEnabled && this._logger.push({ cache: this._data }).debug('Account model loaded from cached state'); } catch(err) { this._logger.push({ err }).error('Error loading account model'); @@ -348,7 +348,7 @@ class AccountsModel { const accounts = this._data.response; const failCount = accounts.filter((account) => account.error).length; const successCount = this._data.response.length - failCount; - this._logger.isDebugEnabled() && this._logger.debug(`Accounts created: ${successCount} succeeded, ${failCount} failed`); + this._logger.isDebugEnabled && this._logger.debug(`Accounts created: ${successCount} succeeded, ${failCount} failed`); // if (failCount > 0) { // throw new BackendError(`Failed to create ${failCount} account(s)`, 500); // } @@ -357,31 +357,31 @@ class AccountsModel { case 'succeeded': // all steps complete so return - this._logger.isDebugEnabled() && this._logger.debug('Accounts creation completed'); + this._logger.isDebugEnabled && this._logger.debug('Accounts creation completed'); await this._save(); return this.getResponse(); case 'errored': // stopped in errored state - this._logger.isErrorEnabled() && this._logger.error('State machine in errored state'); + this._logger.isErrorEnabled && this._logger.error('State machine in errored state'); return; } // now call ourselves recursively to deal with the next transition - this._logger.isDebugEnabled() && this._logger.debug( + this._logger.isDebugEnabled && this._logger.debug( `Account model state machine transition completed in state: ${this._stateMachine.state}. ` + 'Handling next transition.' ); return this.run(); } catch(err) { - this._logger.isErrorEnabled() && this._logger.error(`Error running account model: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`Error running account model: ${safeStringify(err)}`); // as this function is recursive, we dont want to error the state machine multiple times if(this._data.currentState !== 'errored') { // err should not have a executionState property here! if(err.executionState) { - this._logger.isErrorEnabled() && this._logger.error(`State machine is broken: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is broken: ${safeStringify(err)}`); } // transition to errored state await this._stateMachine.error(err); diff --git a/modules/api-svc/src/lib/model/Async2SyncModel.js b/modules/api-svc/src/lib/model/Async2SyncModel.js index f1e9bcc7c..6ad1aca7a 100644 --- a/modules/api-svc/src/lib/model/Async2SyncModel.js +++ b/modules/api-svc/src/lib/model/Async2SyncModel.js @@ -95,22 +95,22 @@ function generate({ // eslint-disable-next-line no-fallthrough case 'succeeded': // all steps complete so return - logger.isDebugEnabled() && logger.debug('Action called successfully'); + logger.isDebugEnabled && logger.debug('Action called successfully'); return this.getResponse(); case 'errored': // stopped in errored state - logger.isErrorEnabled() && logger.error('State machine in errored state'); + logger.isErrorEnabled && logger.error('State machine in errored state'); return; } } catch (err) { - logger.isErrorEnabled() && logger.error(`Error running ${modelName} model: ${safeStringify(err)}`); + logger.isErrorEnabled && logger.error(`Error running ${modelName} model: ${safeStringify(err)}`); // as this function is recursive, we don't want to error the state machine multiple times if (data.currentState !== 'errored') { // err should not have a requestActionState property here! if (err.requestActionState) { - logger.isDebugEnabled() && logger.debug('State machine is broken'); + logger.isDebugEnabled && logger.debug('State machine is broken'); } // transition to errored state await this.error(err); @@ -143,7 +143,7 @@ function generate({ // handle unexpected state if (!resp.currentState) { - logger.isErrorEnabled() && logger.error(`${modelName} model response being returned from an unexpected state: ${data.currentState}. Returning ERROR_OCCURRED state`); + logger.isErrorEnabled && logger.error(`${modelName} model response being returned from an unexpected state: ${data.currentState}. Returning ERROR_OCCURRED state`); resp.currentState = mapCurrentState.errored; } @@ -158,12 +158,12 @@ function generate({ async function onRequestAction(fsm, args) { const { cache, logger } = this.context; const { requests, config } = this.handlersContext; - logger.isDebugEnabled() && logger.push({ args }).debug('onRequestAction - arguments'); + logger.isDebugEnabled && logger.push({ args }).debug('onRequestAction - arguments'); return deferredJob(cache, channelNameMethod(args)) .init(async (channel) => { const res = await requestActionMethod(requests, args); - logger.isDebugEnabled() && logger.push({ res, channel, args }).debug('RequestAction call sent to peer, listening on response'); + logger.isDebugEnabled && logger.push({ res, channel, args }).debug('RequestAction call sent to peer, listening on response'); return res; }) .job((message) => { @@ -171,7 +171,7 @@ function generate({ ...reformatMessage(message), currentState: this.state }; - logger.isDebugEnabled() && logger.push({ message }).debug('requestActionMethod message received'); + logger.isDebugEnabled && logger.push({ message }).debug('requestActionMethod message received'); }) .wait(config.requestProcessingTimeoutSeconds * 1000); } diff --git a/modules/api-svc/src/lib/model/InboundTransfersModel.js b/modules/api-svc/src/lib/model/InboundTransfersModel.js index 1400ede27..c719263d0 100644 --- a/modules/api-svc/src/lib/model/InboundTransfersModel.js +++ b/modules/api-svc/src/lib/model/InboundTransfersModel.js @@ -103,9 +103,9 @@ class InboundTransfersModel { return this._mojaloopRequests.putAuthorizations(transactionRequestId, mlAuthorization, sourceFspId); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in getOTP'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in getOTP'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return this._mojaloopRequests.putAuthorizationsError(transactionRequestId, mojaloopError, sourceFspId); } @@ -129,9 +129,9 @@ class InboundTransfersModel { sourceFspId); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in getParticipants'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in getParticipants'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return this._mojaloopRequests.putParticipantsError(idType, idValue, idSubValue, mojaloopError, sourceFspId); } @@ -167,9 +167,9 @@ class InboundTransfersModel { return this._mojaloopRequests.putParties(idType, idValue, idSubValue, mlParty, sourceFspId); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in getParties'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in getParties'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return this._mojaloopRequests.putPartiesError(idType, idValue, idSubValue, mojaloopError, sourceFspId); } @@ -214,7 +214,7 @@ class InboundTransfersModel { if(previousTxnReq) { internalForm.homeR2PTransactionId = previousTxnReq.homeR2PTransactionId; } else { - this._logger.isErrorEnabled() && this._logger.error(`No previous transactionRequest found in cache with transactionRequestId: ${quoteRequest.transactionRequestId}. Unable to fetch homeR2PTransactionId.`); + this._logger.isErrorEnabled && this._logger.error(`No previous transactionRequest found in cache with transactionRequestId: ${quoteRequest.transactionRequestId}. Unable to fetch homeR2PTransactionId.`); } } @@ -274,7 +274,7 @@ class InboundTransfersModel { catch(err) { this._logger.push({ err }).error('Error in quoteRequest'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putQuotesError(quoteRequest.quoteId, mojaloopError, sourceFspId); } @@ -301,7 +301,7 @@ class InboundTransfersModel { // Update transactionRequest model in cache with notification await this._cache.set(`txnReqModel_${transactionRequestId}`, udpatedTxnReq); } else { - this._logger.isErrorEnabled() && this._logger.error(`No previous transactionRequest found in cache with transactionRequestId: ${transactionRequestId}. Unable to fetch homeR2PTransactionId.`); + this._logger.isErrorEnabled && this._logger.error(`No previous transactionRequest found in cache with transactionRequestId: ${transactionRequestId}. Unable to fetch homeR2PTransactionId.`); } } @@ -311,7 +311,7 @@ class InboundTransfersModel { catch(err) { this._logger.push({ err }).error('Error in putTransactionRequest'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putQuotesError(transactionRequestId, mojaloopError, sourceFspId); } @@ -340,7 +340,7 @@ class InboundTransfersModel { catch(err) { this._logger.push({ err }).error('Error in getQuoteRequest'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putQuotesError(quoteId, mojaloopError, sourceFspId); } @@ -371,7 +371,7 @@ class InboundTransfersModel { catch(err) { this._logger.push({ err }).error('Error in transactionRequest'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putTransactionRequestsError(transactionRequest.transactionRequestId, mojaloopError, sourceFspId); } @@ -438,7 +438,7 @@ class InboundTransfersModel { const expiration = quote.mojaloopResponse.expiration; if (now > expiration) { const error = Errors.MojaloopApiErrorObjectFromCode(Errors.MojaloopApiErrorCodes.QUOTE_EXPIRED); - this._logger.isErrorEnabled() && this._logger.error(`Error in prepareTransfer: quote expired for transfer ${prepareRequest.transferId}, system time=${now} > quote time=${expiration}`); + this._logger.isErrorEnabled && this._logger.error(`Error in prepareTransfer: quote expired for transfer ${prepareRequest.transferId}, system time=${now} > quote time=${expiration}`); await this.updateStateWithError(error); return this._mojaloopRequests.putTransfersError(prepareRequest.transferId, error, sourceFspId); } @@ -455,7 +455,7 @@ class InboundTransfersModel { return 'No response from backend'; } - this._logger.isDebugEnabled() && this._logger.debug(`Transfer accepted by backend returning homeTransactionId: ${response.homeTransactionId} for mojaloop transferId: ${prepareRequest.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer accepted by backend returning homeTransactionId: ${response.homeTransactionId} for mojaloop transferId: ${prepareRequest.transferId}`); this.data.homeTransactionId = response.homeTransactionId; // create a mojaloop transfer fulfil response @@ -481,9 +481,9 @@ class InboundTransfersModel { await this._save(); return res; } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in prepareTransfer'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in prepareTransfer'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putTransfersError(prepareRequest.transferId, mojaloopError, sourceFspId); } @@ -536,9 +536,9 @@ class InboundTransfersModel { sourceFspId); } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in getTransfers'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in getTransfers'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return this._mojaloopRequests.putTransfersError(transferId, mojaloopError, sourceFspId); } @@ -614,9 +614,9 @@ class InboundTransfersModel { return this._mojaloopRequests.putBulkQuotes(bulkQuoteId, mojaloopResponse, sourceFspId); } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in bulkQuotesRequest'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in bulkQuotesRequest'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putBulkQuotesError(bulkQuoteId, mojaloopError, sourceFspId); } @@ -642,9 +642,9 @@ class InboundTransfersModel { sourceFspId); } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in getBulkQuote'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in getBulkQuote'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return this._mojaloopRequests.putBulkQuotesError(bulkQuoteId, mojaloopError, sourceFspId); } @@ -717,7 +717,7 @@ class InboundTransfersModel { if (now > expiration) { // TODO: Verify and align with actual schema for bulk transfers error endpoint const error = Errors.MojaloopApiErrorObjectFromCode(Errors.MojaloopApiErrorCodes.QUOTE_EXPIRED); - this._logger.isErrorEnabled() && this._logger.error(`Error in prepareBulkTransfers: bulk quotes expired for bulk transfers ${bulkPrepareRequest.bulkTransferId}, system time=${now.toISOString()} > quote time=${expiration.toISOString()}`); + this._logger.isErrorEnabled && this._logger.error(`Error in prepareBulkTransfers: bulk quotes expired for bulk transfers ${bulkPrepareRequest.bulkTransferId}, system time=${now.toISOString()} > quote time=${expiration.toISOString()}`); return this._mojaloopRequests.putBulkTransfersError(bulkPrepareRequest.bulkTransferId, error, sourceFspId); } } @@ -732,8 +732,8 @@ class InboundTransfersModel { errorInformation: transferError, })) }; - this._logger.isErrorEnabled() && this._logger.push({ ...individualTransferErrors }).error('Error in prepareBulkTransfers'); - this._logger.isDebugEnabled() && this._logger.push({ ...individualTransferErrors }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isErrorEnabled && this._logger.push({ ...individualTransferErrors }).error('Error in prepareBulkTransfers'); + this._logger.isDebugEnabled && this._logger.push({ ...individualTransferErrors }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putBulkTransfersError(bulkPrepareRequest.transferId, mojaloopErrorResponse, sourceFspId); @@ -750,7 +750,7 @@ class InboundTransfersModel { return 'No response from backend'; } - this._logger.isDebugEnabled() && this._logger.debug(`Bulk transfer accepted by backend returning homeTransactionId: ${response.homeTransactionId} for mojaloop bulk transferId: ${bulkPrepareRequest.bulkTransferId}`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk transfer accepted by backend returning homeTransactionId: ${response.homeTransactionId} for mojaloop bulk transferId: ${bulkPrepareRequest.bulkTransferId}`); // create a mojaloop transfer fulfil response const mojaloopResponse = shared.internalBulkTransfersResponseToMojaloop(response, fulfilments); @@ -759,9 +759,9 @@ class InboundTransfersModel { return this._mojaloopRequests.putBulkTransfers(bulkPrepareRequest.bulkTransferId, mojaloopResponse, sourceFspId); } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in prepareBulkTransfers'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in prepareBulkTransfers'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return await this._mojaloopRequests.putBulkTransfersError(bulkPrepareRequest.bulkTransferId, mojaloopError, sourceFspId); } @@ -819,9 +819,9 @@ class InboundTransfersModel { sourceFspId); } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error in getBulkTransfer'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error in getBulkTransfer'); const mojaloopError = await this._handleError(err); - this._logger.isDebugEnabled() && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); + this._logger.isDebugEnabled && this._logger.push({ mojaloopError }).debug(`Sending error response to ${sourceFspId}`); return this._mojaloopRequests.putBulkTransfersError(bulkTransferId, mojaloopError, sourceFspId); } @@ -863,7 +863,7 @@ class InboundTransfersModel { const res = await this._backendRequests.putTransfersNotification(this.data, transferId); return res; } catch (err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error(`Error notifying backend of final transfer state equal to: ${body.transferState}`); + this._logger.isErrorEnabled && this._logger.push({ err }).error(`Error notifying backend of final transfer state equal to: ${body.transferState}`); } } @@ -919,7 +919,7 @@ class InboundTransfersModel { this._logger.push({ res }).debug('Persisted transfer model in cache'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error saving transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error saving transfer model'); throw err; } } @@ -935,7 +935,7 @@ class InboundTransfersModel { return data; } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error loading transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error loading transfer model'); throw err; } } diff --git a/modules/api-svc/src/lib/model/OutboundBulkQuotesModel.js b/modules/api-svc/src/lib/model/OutboundBulkQuotesModel.js index 20478c8a2..cac4a6eb4 100644 --- a/modules/api-svc/src/lib/model/OutboundBulkQuotesModel.js +++ b/modules/api-svc/src/lib/model/OutboundBulkQuotesModel.js @@ -78,7 +78,7 @@ class OutboundBulkQuotesModel { * Updates the internal state representation to reflect that of the state machine itself */ _afterTransition() { - this._logger.isDebugEnabled() && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); + this._logger.isDebugEnabled && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); this.data.currentState = this.stateMachine.state; } @@ -107,7 +107,7 @@ class OutboundBulkQuotesModel { * Handles state machine transitions */ async _handleTransition(lifecycle, ...args) { - this._logger.isDebugEnabled() && this._logger.debug(`Bulk quote ${this.data.bulkQuoteId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk quote ${this.data.bulkQuoteId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); switch(lifecycle.transition) { case 'init': @@ -120,7 +120,7 @@ class OutboundBulkQuotesModel { return this._getBulkQuote(this.data.bulkQuoteId); case 'error': - this._logger.isErrorEnabled() && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); this.data.lastError = args[0] || new Error('unspecified error'); break; @@ -155,7 +155,7 @@ class OutboundBulkQuotesModel { if (now > bulkQuote.expiration) { const msg = 'Bulk quote response missed expiry deadline'; error = new BackendError(msg, 504); - this._logger.isErrorEnabled() && this._logger.error(`${msg}: system time=${now} > expiration time=${bulkQuote.expiration}`); + this._logger.isErrorEnabled && this._logger.error(`${msg}: system time=${now} > expiration time=${bulkQuote.expiration}`); } } } else if (message.type === 'bulkQuoteResponseError') { @@ -163,7 +163,7 @@ class OutboundBulkQuotesModel { error.mojaloopError = message.data.body; } else { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Unknown message type ${message.type}.`); return; } @@ -174,7 +174,7 @@ class OutboundBulkQuotesModel { // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkQuoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -198,7 +198,7 @@ class OutboundBulkQuotesModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkQuoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -208,7 +208,7 @@ class OutboundBulkQuotesModel { // a POST /bulkQuotes request to the switch try { const res = await this._requests.postBulkQuotes(bulkQuote, this.data.individualQuotes[0].to.fspId); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Bulk quote request sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Bulk quote request sent to peer'); } catch (err) { // cancel the timout and unsubscribe before rejecting the promise @@ -216,7 +216,7 @@ class OutboundBulkQuotesModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkQuoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -299,7 +299,7 @@ class OutboundBulkQuotesModel { error = new BackendError(`Got an error response retrieving bulk quote: ${safeStringify(message.data.body, { depth: Infinity })}`, 500); error.mojaloopError = message.data.body; } else if (message.type !== 'bulkQuoteResponse') { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Unknown message type ${message.type}.`); return; } @@ -308,7 +308,7 @@ class OutboundBulkQuotesModel { // stop listening for bulk quote response messages this._cache.unsubscribe(bulkQuoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -316,7 +316,7 @@ class OutboundBulkQuotesModel { } const bulkQuote = message.data; - this._logger.isDebugEnabled() && this._logger.push({ bulkQuote }).debug('Bulk quote response received'); + this._logger.isDebugEnabled && this._logger.push({ bulkQuote }).debug('Bulk quote response received'); return resolve(bulkQuote); } @@ -331,7 +331,7 @@ class OutboundBulkQuotesModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkQuoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -341,7 +341,7 @@ class OutboundBulkQuotesModel { // a GET /bulkQuotes/{ID} request to the switch try { const res = await this._requests.getBulkQuotes(bulkQuoteId); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Bulk quote lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Bulk quote lookup sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -349,7 +349,7 @@ class OutboundBulkQuotesModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkQuoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${bulkQuoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -389,7 +389,7 @@ class OutboundBulkQuotesModel { break; default: - this._logger.isErrorEnabled() && this._logger.error(`Bulk quote model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); + this._logger.isErrorEnabled && this._logger.error(`Bulk quote model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); resp.currentState = SDKStateEnum.ERROR_OCCURRED; break; } @@ -404,7 +404,7 @@ class OutboundBulkQuotesModel { try { this.data.currentState = this.stateMachine.state; const res = await this._cache.set(`bulkQuoteModel_${this.data.bulkQuoteId}`, this.data); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Persisted bulk quote model in cache'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Persisted bulk quote model in cache'); } catch(err) { this._logger.push({ err }).error('Error saving bulk quote model'); @@ -424,7 +424,7 @@ class OutboundBulkQuotesModel { throw new Error(`No cached data found for bulkQuoteId: ${bulkQuoteId}`); } await this.initialize(data); - this._logger.isDebugEnabled() && this._logger.push({ cache: this.data }).debug('Bulk quote model loaded from cached state'); + this._logger.isDebugEnabled && this._logger.push({ cache: this.data }).debug('Bulk quote model loaded from cached state'); } catch(err) { this._logger.push({ err }).error('Error loading bulk quote model'); @@ -441,38 +441,38 @@ class OutboundBulkQuotesModel { switch(this.data.currentState) { case 'start': await this.stateMachine.requestBulkQuote(); - this._logger.isDebugEnabled() && this._logger.debug(`Quotes resolved for bulk quote ${this.data.bulkQuoteId}`); + this._logger.isDebugEnabled && this._logger.debug(`Quotes resolved for bulk quote ${this.data.bulkQuoteId}`); break; case 'getBulkQuote': await this.stateMachine.getBulkQuote(); - this._logger.isDebugEnabled() && this._logger.debug(`Get bulk quote ${this.data.bulkQuoteId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Get bulk quote ${this.data.bulkQuoteId} has been completed`); break; case 'succeeded': // all steps complete so return - this._logger.isDebugEnabled() && this._logger.debug('Bulk quoting completed successfully'); + this._logger.isDebugEnabled && this._logger.debug('Bulk quoting completed successfully'); await this._save(); return this.getResponse(); case 'errored': // stopped in errored state - this._logger.isErrorEnabled() && this._logger.error('State machine in errored state'); + this._logger.isErrorEnabled && this._logger.error('State machine in errored state'); return; } // now call ourselves recursively to deal with the next transition - this._logger.isDebugEnabled() && this._logger.debug(`Bulk quote model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk quote model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`); return this.run(); } catch(err) { - this._logger.isErrorEnabled() && this._logger.error(`Error running bulk quote model: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`Error running bulk quote model: ${safeStringify(err)}`); // as this function is recursive, we dont want to error the state machine multiple times if(this.data.currentState !== 'errored') { // err should not have a bulkQuoteState property here! if(err.bulkQuoteState) { - this._logger.isErrorEnabled() && this._logger.error(`State machine is broken: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is broken: ${safeStringify(err)}`); } // transition to errored state await this.stateMachine.error(err); diff --git a/modules/api-svc/src/lib/model/OutboundBulkTransfersModel.js b/modules/api-svc/src/lib/model/OutboundBulkTransfersModel.js index 699407589..455bb4a5d 100644 --- a/modules/api-svc/src/lib/model/OutboundBulkTransfersModel.js +++ b/modules/api-svc/src/lib/model/OutboundBulkTransfersModel.js @@ -77,7 +77,7 @@ class OutboundBulkTransfersModel { * Updates the internal state representation to reflect that of the state machine itself */ _afterTransition() { - this._logger.isDebugEnabled() && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); + this._logger.isDebugEnabled && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); this.data.currentState = this.stateMachine.state; } @@ -106,7 +106,7 @@ class OutboundBulkTransfersModel { * Handles state machine transitions */ async _handleTransition(lifecycle, ...args) { - this._logger.isDebugEnabled() && this._logger.debug(`Bulk transfer ${this.data.bulkTransferId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk transfer ${this.data.bulkTransferId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); switch(lifecycle.transition) { case 'init': @@ -119,7 +119,7 @@ class OutboundBulkTransfersModel { return this._getBulkTransfer(this.data.bulkTransferId); case 'error': - this._logger.isErrorEnabled() && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); this.data.lastError = args[0] || new Error('unspecified error'); break; @@ -154,7 +154,7 @@ class OutboundBulkTransfersModel { if (now > bulkTransferPrepare.expiration) { const msg = 'Bulk transfer fulfils missed expiry deadline'; error = new BackendError(msg, 504); - this._logger.isErrorEnabled() && this._logger.error(`${msg}: system time=${now} > expiration time=${bulkTransferPrepare.expiration}`); + this._logger.isErrorEnabled && this._logger.error(`${msg}: system time=${now} > expiration time=${bulkTransferPrepare.expiration}`); } } } else if (message.type === 'bulkTransferResponseError') { @@ -162,7 +162,7 @@ class OutboundBulkTransfersModel { error.mojaloopError = message.data.body; } else { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Unknown message type ${message.type}.`); return; } @@ -173,7 +173,7 @@ class OutboundBulkTransfersModel { // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkTransferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -182,7 +182,7 @@ class OutboundBulkTransfersModel { const bulkTransferFulfil = message.data; this.data.bulkTransfersResponse = bulkTransferFulfil.body; - this._logger.isDebugEnabled() && this._logger.push({ bulkTransferFulfil }).debug('Bulk transfer fulfils received'); + this._logger.isDebugEnabled && this._logger.push({ bulkTransferFulfil }).debug('Bulk transfer fulfils received'); return resolve(bulkTransferFulfil); } @@ -197,7 +197,7 @@ class OutboundBulkTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkTransferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -207,7 +207,7 @@ class OutboundBulkTransfersModel { // a POST /bulkTransfers request to the switch try { const res = await this._requests.postBulkTransfers(bulkTransferPrepare, bulkTransferPrepare.payeeFsp); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Bulk transfer request sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Bulk transfer request sent to peer'); } catch (err) { // cancel the timout and unsubscribe before rejecting the promise @@ -215,7 +215,7 @@ class OutboundBulkTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkTransferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -290,7 +290,7 @@ class OutboundBulkTransfersModel { error = new BackendError(`Got an error response retrieving bulk transfer: ${safeStringify(message.data.body, { depth: Infinity })}`, 500); error.mojaloopError = message.data.body; } else if (message.type !== 'bulkTransferResponse') { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Uknokwn message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Uknokwn message type ${message.type}.`); return; } @@ -299,7 +299,7 @@ class OutboundBulkTransfersModel { // stop listening for bulk transfer fulfil messages this._cache.unsubscribe(bulkTransferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -307,7 +307,7 @@ class OutboundBulkTransfersModel { } const fulfils = message.data; - this._logger.isDebugEnabled() && this._logger.push({ fulfils }).debug('Bulk transfer fulfils received'); + this._logger.isDebugEnabled && this._logger.push({ fulfils }).debug('Bulk transfer fulfils received'); return resolve(fulfils); } @@ -322,7 +322,7 @@ class OutboundBulkTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkTransferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -332,7 +332,7 @@ class OutboundBulkTransfersModel { // a GET /bulkTransfers/{ID} request to the switch try { const res = await this._requests.getBulkTransfers(bulkTransferId); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Bulk transfer lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Bulk transfer lookup sent to peer'); } catch(err) { // cancel the timeout and unsubscribe before rejecting the promise @@ -340,7 +340,7 @@ class OutboundBulkTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(bulkTransferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${bulkTransferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -380,7 +380,7 @@ class OutboundBulkTransfersModel { break; default: - this._logger.isDebugEnabled() && this._logger.debug(`Bulk transfer model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk transfer model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); resp.currentState = SDKStateEnum.ERROR_OCCURRED; break; } @@ -395,10 +395,10 @@ class OutboundBulkTransfersModel { try { this.data.currentState = this.stateMachine.state; const res = await this._cache.set(`bulkTransferModel_${this.data.bulkTransferId}`, this.data); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Persisted bulk transfer model in cache'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Persisted bulk transfer model in cache'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error saving bulk transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error saving bulk transfer model'); throw err; } } @@ -416,10 +416,10 @@ class OutboundBulkTransfersModel { throw new Error(`No cached data found for bulkTransferId: ${bulkTransferId}`); } await this.initialize(data); - this._logger.isDebugEnabled() && this._logger.push({ cache: this.data }).debug('Bulk transfer model loaded from cached state'); + this._logger.isDebugEnabled && this._logger.push({ cache: this.data }).debug('Bulk transfer model loaded from cached state'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error loading bulk transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error loading bulk transfer model'); throw err; } } @@ -433,38 +433,38 @@ class OutboundBulkTransfersModel { switch(this.data.currentState) { case 'start': await this.stateMachine.executeBulkTransfer(); - this._logger.isDebugEnabled() && this._logger.debug(`Bulk transfer ${this.data.bulkTransferId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk transfer ${this.data.bulkTransferId} has been completed`); break; case 'getBulkTransfer': await this.stateMachine.getBulkTransfer(); - this._logger.isDebugEnabled() && this._logger.debug(`Get bulk transfer ${this.data.bulkTransferId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Get bulk transfer ${this.data.bulkTransferId} has been completed`); break; case 'succeeded': // all steps complete so return - this._logger.isDebugEnabled() && this._logger.debug('Bulk transfer completed successfully'); + this._logger.isDebugEnabled && this._logger.debug('Bulk transfer completed successfully'); await this._save(); return this.getResponse(); case 'errored': // stopped in errored state - this._logger.isErrorEnabled() && this._logger.error('State machine in errored state'); + this._logger.isErrorEnabled && this._logger.error('State machine in errored state'); return; } // now call ourselves recursively to deal with the next transition - this._logger.isDebugEnabled() && this._logger.debug(`Bulk transfer model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`); + this._logger.isDebugEnabled && this._logger.debug(`Bulk transfer model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`); return this.run(); } catch(err) { - this._logger.isErrorEnabled() && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); // as this function is recursive, we dont want to error the state machine multiple times if(this.data.currentState !== 'errored') { // err should not have a bulkTransferState property here! if(err.bulkTransferState) { - this._logger.isErrorEnabled() && this._logger.error(`State machine is broken: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is broken: ${safeStringify(err)}`); } // transition to errored state await this.stateMachine.error(err); diff --git a/modules/api-svc/src/lib/model/OutboundRequestToPayModel.js b/modules/api-svc/src/lib/model/OutboundRequestToPayModel.js index 5b3a3b4a8..715fbfc07 100644 --- a/modules/api-svc/src/lib/model/OutboundRequestToPayModel.js +++ b/modules/api-svc/src/lib/model/OutboundRequestToPayModel.js @@ -100,7 +100,7 @@ class OutboundRequestToPayModel { * Handles state machine transitions */ async _handleTransition(lifecycle, ...args) { - this._logger.isDebugEnabled() && this._logger.debug(`Request To Pay ${this.data.transactionRequestId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); + this._logger.isDebugEnabled && this._logger.debug(`Request To Pay ${this.data.transactionRequestId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); switch(lifecycle.transition) { case 'init': @@ -116,7 +116,7 @@ class OutboundRequestToPayModel { return this._executeTransactionRequest(); case 'error': - this._logger.isErrorEnabled() && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); this.data.lastError = args[0] || new Error('unspecified error'); break; @@ -129,7 +129,7 @@ class OutboundRequestToPayModel { * Updates the internal state representation to reflect that of the state machine itself */ _afterTransition() { - this._logger.isDebugEnabled() && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); + this._logger.isDebugEnabled && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); this.data.currentState = this.stateMachine.state; } @@ -174,13 +174,13 @@ class OutboundRequestToPayModel { // cancel the timeout handler clearTimeout(timeout); - this._logger.isDebugEnabled() && this._logger.push({ payee }).debug('Payee resolved'); + this._logger.isDebugEnabled && this._logger.push({ payee }).debug('Payee resolved'); // stop listening for payee resolution messages // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); // check we got the right payee and info we need @@ -230,7 +230,7 @@ class OutboundRequestToPayModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -241,7 +241,7 @@ class OutboundRequestToPayModel { try { const res = await this._requests.getParties(this.data.to.idType, this.data.to.idValue, this.data.to.idSubValue); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Party lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Party lookup sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -249,7 +249,7 @@ class OutboundRequestToPayModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -281,7 +281,7 @@ class OutboundRequestToPayModel { // stop listening for transfer fulfil messages this._cache.unsubscribe(transactionRequestKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${transactionRequestKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${transactionRequestKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -305,7 +305,7 @@ class OutboundRequestToPayModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transactionRequestKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${transactionRequestKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${transactionRequestKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -315,7 +315,7 @@ class OutboundRequestToPayModel { // a POST /transfers request to the switch try { const res = await this._requests.postTransactionRequests(transactionRequest, this.data.to.fspId); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Transfer prepare sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Transfer prepare sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -323,7 +323,7 @@ class OutboundRequestToPayModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transactionRequestKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${transactionRequestKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${transactionRequestKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -394,10 +394,10 @@ class OutboundRequestToPayModel { throw new Error(`No cached data found for transactionRequestId: ${transactionRequestId}`); } await this.initialize(data); - this._logger.isDebugEnabled() && this._logger.push({ cache: this.data }).debug('TransactionRequest model loaded from cached state'); + this._logger.isDebugEnabled && this._logger.push({ cache: this.data }).debug('TransactionRequest model loaded from cached state'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error loading transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error loading transfer model'); throw err; } } @@ -412,7 +412,7 @@ class OutboundRequestToPayModel { case 'start': // next transition is to resolvePayee await this.stateMachine.resolvePayee(); - this._logger.isDebugEnabled() && this._logger.debug(`Payee resolved for transfer ${this.data.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`Payee resolved for transfer ${this.data.transferId}`); if(this.stateMachine.state === 'payeeResolved' && !this._autoAcceptR2PParty) { //we break execution here and return the resolved party details to allow asynchronous accept or reject //of the resolved party @@ -424,33 +424,33 @@ class OutboundRequestToPayModel { case 'payeeResolved': // next transition is to requestQuote await this.stateMachine.executeTransactionRequest(); - this._logger.isDebugEnabled() && this._logger.debug(`Transaction Request for ${this.data.transactionRequestId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Transaction Request for ${this.data.transactionRequestId} has been completed`); break; case 'succeeded': // all steps complete so return - this._logger.isDebugEnabled() && this._logger.debug('Transaction Request completed successfully'); + this._logger.isDebugEnabled && this._logger.debug('Transaction Request completed successfully'); await this._save(); return this.getResponse(); case 'errored': // stopped in errored state - this._logger.isErrorEnabled() && this._logger.error('State machine in errored state'); + this._logger.isErrorEnabled && this._logger.error('State machine in errored state'); return; } // now call ourselves recursively to deal with the next transition - this._logger.isDebugEnabled() && this._logger.debug(`Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`); return this.run(); } catch(err) { - this._logger.isErrorEnabled() && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); // as this function is recursive, we dont want to error the state machine multiple times if(this.data.currentState !== 'errored') { // err should not have a lastError property here! if(err.lastError) { - this._logger.isErrorEnabled() && this._logger.error(`State machine is broken: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is broken: ${safeStringify(err)}`); } // transition to errored state await this.stateMachine.error(err); @@ -487,7 +487,7 @@ class OutboundRequestToPayModel { break; default: - this._logger.isDebugEnabled() && this._logger.debug(`Transaction Request model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); + this._logger.isDebugEnabled && this._logger.debug(`Transaction Request model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); resp.currentState = SDKStateEnum.ERROR_OCCURRED; break; } @@ -502,10 +502,10 @@ class OutboundRequestToPayModel { try { this.data.currentState = this.stateMachine.state; const res = await this._cache.set(`txnReqModel_${this.data.transactionRequestId}`, this.data); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Persisted transaction request model in cache'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Persisted transaction request model in cache'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error saving transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error saving transfer model'); throw err; } } diff --git a/modules/api-svc/src/lib/model/OutboundRequestToPayTransferModel.js b/modules/api-svc/src/lib/model/OutboundRequestToPayTransferModel.js index b5c0c29e1..dbf4d3e49 100644 --- a/modules/api-svc/src/lib/model/OutboundRequestToPayTransferModel.js +++ b/modules/api-svc/src/lib/model/OutboundRequestToPayTransferModel.js @@ -121,7 +121,7 @@ class OutboundRequestToPayTransferModel { case 'start': // next transition is to requestQuote await this.stateMachine.requestQuote(); - this._logger.isDebugEnabled() && this._logger.debug(`Quote received for transfer ${this.data.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`Quote received for transfer ${this.data.transferId}`); if( (this.stateMachine.state === 'quoteReceived' && this.data.initiatorType !== 'BUSINESS') || (this.data.initiatorType === 'BUSINESS' && !this._autoAcceptR2PBusinessQuotes) @@ -136,7 +136,7 @@ class OutboundRequestToPayTransferModel { case 'quoteReceived': if (!this.data.authenticationType) { // Skipping otp step - this._logger.isDebugEnabled() && this._logger.debug(`Skipping authorization for transactionRequestId: ${this.data.transactionRequestId} as authenticationType is not provided`); + this._logger.isDebugEnabled && this._logger.debug(`Skipping authorization for transactionRequestId: ${this.data.transactionRequestId} as authenticationType is not provided`); // this.data.currentState = 'otpReceived' await this.stateMachine.skipOTP(); break; @@ -150,7 +150,7 @@ class OutboundRequestToPayTransferModel { } // next transition is requestOTP if(this.data.initiatorType !== 'BUSINESS') { - this._logger.isDebugEnabled() && this._logger.debug(`OTP received for transactionRequestId: ${this.data.transactionRequestId} and transferId: ${this.data.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`OTP received for transactionRequestId: ${this.data.transactionRequestId} and transferId: ${this.data.transferId}`); if(this.stateMachine.state === 'otpReceived' && !this._autoAcceptR2PDeviceOTP) { //we break execution here and return the otp response details to allow asynchronous accept or reject //of the quote @@ -163,33 +163,33 @@ class OutboundRequestToPayTransferModel { case 'otpReceived': // next transition is executeTransfer await this.stateMachine.executeTransfer(); - this._logger.isDebugEnabled() && this._logger.debug(`Transfer ${this.data.transferId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer ${this.data.transferId} has been completed`); break; case 'succeeded': // all steps complete so return - this._logger.isDebugEnabled() && this._logger.debug('Transfer completed successfully'); + this._logger.isDebugEnabled && this._logger.debug('Transfer completed successfully'); await this._save(); return this.getResponse(); case 'errored': // stopped in errored state - this._logger.isErrorEnabled() && this._logger.error('State machine in errored state'); + this._logger.isErrorEnabled && this._logger.error('State machine in errored state'); return; } // now call ourslves recursively to deal with the next transition - this._logger.isDebugEnabled() && this._logger.debug(`RequestToPay Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recusring to handle next transition.`); + this._logger.isDebugEnabled && this._logger.debug(`RequestToPay Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recusring to handle next transition.`); return this.run(); } catch(err) { - this._logger.isErrorEnabled() && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); // as this function is recursive, we dont want to error the state machine multiple times if(this.data.currentState !== 'errored') { // err should not have a transferState property here! if(err.transferState) { - this._logger.isErrorEnabled() && this._logger.error(`State machine is broken: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is broken: ${safeStringify(err)}`); } // transition to errored state await this.stateMachine.error(err); @@ -206,7 +206,7 @@ class OutboundRequestToPayTransferModel { * Updates the internal state representation to reflect that of the state machine itself */ _afterTransition() { - this._logger.isDebugEnabled() && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); + this._logger.isDebugEnabled && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); this.data.currentState = this.stateMachine.state; } @@ -214,7 +214,7 @@ class OutboundRequestToPayTransferModel { * Handles state machine transitions */ async _handleTransition(lifecycle, ...args) { - this._logger.isDebugEnabled() && this._logger.debug(`Transfer ${this.data.transferId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer ${this.data.transferId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); switch(lifecycle.transition) { case 'init': @@ -238,7 +238,7 @@ class OutboundRequestToPayTransferModel { return this._executeTransfer(); case 'error': - this._logger.isErrorEnabled() && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); this.data.lastError = args[0] || new Error('unspecified error'); break; @@ -304,13 +304,13 @@ class OutboundRequestToPayTransferModel { // cancel the timeout handler clearTimeout(timeout); - this._logger.isDebugEnabled() && this._logger.push({ payee }).debug('Payee resolved'); + this._logger.isDebugEnabled && this._logger.push({ payee }).debug('Payee resolved'); // stop listening for payee resolution messages // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); // check we got the right payee and info we need @@ -360,7 +360,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -371,7 +371,7 @@ class OutboundRequestToPayTransferModel { try { const res = await this._requests.getParties(this.data.to.idType, this.data.to.idValue, this.data.to.idSubValue); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Party lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Party lookup sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -379,7 +379,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -415,7 +415,7 @@ class OutboundRequestToPayTransferModel { if (now > quote.expiration) { const msg = 'Quote response missed expiry deadline'; error = new BackendError(msg, 504); - this._logger.isErrorEnabled() && this._logger.error(`${msg}: system time=${now} > expiration time=${quote.expiration}`); + this._logger.isErrorEnabled && this._logger.error(`${msg}: system time=${now} > expiration time=${quote.expiration}`); } } } else if (message.type === 'quoteResponseError') { @@ -423,7 +423,7 @@ class OutboundRequestToPayTransferModel { error.mojaloopError = message.data.body; } else { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`); return; } @@ -434,7 +434,7 @@ class OutboundRequestToPayTransferModel { // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(quoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -443,7 +443,7 @@ class OutboundRequestToPayTransferModel { const quoteResponseBody = message.data.body; const quoteResponseHeaders = message.data.headers; - this._logger.isDebugEnabled() && this._logger.push({ quoteResponseBody }).debug('Quote response received'); + this._logger.isDebugEnabled && this._logger.push({ quoteResponseBody }).debug('Quote response received'); this.data.quoteResponse = { body: quoteResponseBody, @@ -464,7 +464,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(quoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -474,7 +474,7 @@ class OutboundRequestToPayTransferModel { // a POST /quotes request to the switch try { const res = await this._requests.postQuotes(quote, this.data.to.fspId); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Quote request sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Quote request sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -482,7 +482,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(quoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -516,7 +516,7 @@ class OutboundRequestToPayTransferModel { // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(otpKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${otpKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${otpKey} ${subId}: ${e.stack || safeStringify(e)}`); }); const authorizationResponseBody = authorizationResponse.data; @@ -537,7 +537,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(otpKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${otpKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${otpKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -547,7 +547,7 @@ class OutboundRequestToPayTransferModel { // a POST /authorizations request to the switch try { const res = await this._requests.getAuthorizations(this.data.transactionRequestId,`authenticationType=OTP&retriesLeft=1&amount=${this.data.amount}¤cy=${this.data.currency}`,this.data.to.fspId); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Authorizations request sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Authorizations request sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -555,7 +555,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(otpKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${otpKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${otpKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -633,7 +633,7 @@ class OutboundRequestToPayTransferModel { const now = new Date().toISOString(); if (now > prepare.expiration) { const msg = 'Transfer fulfil missed expiry deadline'; - this._logger.isErrorEnabled() && this._logger.error(`${msg}: system time=${now} > expiration=${prepare.expiration}`); + this._logger.isErrorEnabled && this._logger.error(`${msg}: system time=${now} > expiration=${prepare.expiration}`); error = new BackendError(msg, 504); } } @@ -641,7 +641,7 @@ class OutboundRequestToPayTransferModel { error = new BackendError(`Got an error response preparing transfer: ${safeStringify(message.data.body)}`, 500); error.mojaloopError = message.data.body; } else { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`); return; } @@ -650,7 +650,7 @@ class OutboundRequestToPayTransferModel { // stop listening for transfer fulfil messages this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -658,7 +658,7 @@ class OutboundRequestToPayTransferModel { } const fulfil = message.data; - this._logger.isDebugEnabled() && this._logger.push({ fulfil }).debug('Transfer fulfil received'); + this._logger.isDebugEnabled && this._logger.push({ fulfil }).debug('Transfer fulfil received'); this.data.fulfil = fulfil; if(this._checkIlp && !this._ilp.validateFulfil(fulfil.body.fulfilment, this.data.quoteResponse.body.condition)) { @@ -678,7 +678,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -688,7 +688,7 @@ class OutboundRequestToPayTransferModel { // a POST /transfers request to the switch try { const res = await this._requests.postTransfers(prepare, this.data.quoteResponseSource); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Transfer prepare sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Transfer prepare sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -696,7 +696,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -722,7 +722,7 @@ class OutboundRequestToPayTransferModel { error = new BackendError(`Got an error response retrieving transfer: ${safeStringify(message.data.body)}`, 500); error.mojaloopError = message.data.body; } else if (message.type !== 'transferFulfil') { - this._logger.isErrorEnabled() && this._logger.push({ message }).error(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`); + this._logger.isErrorEnabled && this._logger.push({ message }).error(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`); return; } @@ -731,7 +731,7 @@ class OutboundRequestToPayTransferModel { // stop listening for transfer fulfil messages this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -739,7 +739,7 @@ class OutboundRequestToPayTransferModel { } const fulfil = message.data; - this._logger.isDebugEnabled() && this._logger.push({ fulfil }).debug('Transfer fulfil received'); + this._logger.isDebugEnabled && this._logger.push({ fulfil }).debug('Transfer fulfil received'); this.data.fulfil = fulfil; return resolve(this.data); @@ -755,7 +755,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -765,7 +765,7 @@ class OutboundRequestToPayTransferModel { // a GET /transfers request to the switch try { const res = await this._requests.getTransfers(this.data.transferId); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Transfer lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Transfer lookup sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -773,7 +773,7 @@ class OutboundRequestToPayTransferModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -861,7 +861,7 @@ class OutboundRequestToPayTransferModel { break; default: - this._logger.isDebugEnabled() && this._logger.debug(`Transfer model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); resp.currentState = SDKStateEnum.ERROR_OCCURRED; break; } @@ -877,10 +877,10 @@ class OutboundRequestToPayTransferModel { try { this.data.currentState = this.stateMachine.state; const res = await this._cache.set(`requestToPayTransferModel_${this.data.transactionRequestId}`, this.data); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Persisted transfer model in cache'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Persisted transfer model in cache'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error saving transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error saving transfer model'); throw err; } } @@ -898,10 +898,10 @@ class OutboundRequestToPayTransferModel { throw new Error(`No cached data found for transactionRequestId: ${transactionRequestId}`); } await this.initialize(data); - this._logger.isDebugEnabled() && this._logger.push({ cache: this.data }).debug('RequestToPay Transfer model loaded from cached state'); + this._logger.isDebugEnabled && this._logger.push({ cache: this.data }).debug('RequestToPay Transfer model loaded from cached state'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error loading transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error loading transfer model'); throw err; } } diff --git a/modules/api-svc/src/lib/model/OutboundTransfersModel.js b/modules/api-svc/src/lib/model/OutboundTransfersModel.js index 8cf205441..d83cf1f3c 100644 --- a/modules/api-svc/src/lib/model/OutboundTransfersModel.js +++ b/modules/api-svc/src/lib/model/OutboundTransfersModel.js @@ -134,7 +134,7 @@ class OutboundTransfersModel { * Updates the internal state representation to reflect that of the state machine itself */ _afterTransition() { - this._logger.isDebugEnabled() && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); + this._logger.isDebugEnabled && this._logger.debug(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state}`); this.data.currentState = this.stateMachine.state; } @@ -176,7 +176,7 @@ class OutboundTransfersModel { * Handles state machine transitions */ async _handleTransition(lifecycle, ...args) { - this._logger.isDebugEnabled() && this._logger.debug(`Transfer ${this.data.transferId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer ${this.data.transferId} is transitioning from ${lifecycle.from} to ${lifecycle.to} in response to ${lifecycle.transition}`); switch(lifecycle.transition) { case 'init': @@ -202,12 +202,12 @@ class OutboundTransfersModel { return this._executeTransfer(); case 'abort': - this._logger.isDebugEnabled() && this._logger.debug('State machine is aborting transfer'); + this._logger.isDebugEnabled && this._logger.debug('State machine is aborting transfer'); this.data.abortedReason = args[0]; break; case 'error': - this._logger.isErrorEnabled() && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is erroring with error: ${safeStringify(args)}`); this.data.lastError = args[0] || new Error('unspecified error'); break; @@ -265,13 +265,13 @@ class OutboundTransfersModel { // cancel the timeout handler clearTimeout(timeout); - this._logger.isDebugEnabled() && this._logger.push({ payee }).debug('Payee resolved'); + this._logger.isDebugEnabled && this._logger.push({ payee }).debug('Payee resolved'); // stop listening for payee resolution messages // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless - this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._cache.unsubscribe(payeeKey, subId, true).catch(e => { + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); // check we got the right payee and info we need @@ -322,8 +322,8 @@ class OutboundTransfersModel { const err = new BackendError(`Timeout resolving payee for transfer ${this.data.transferId}`, 504); // we dont really care if the unsubscribe fails but we should log it regardless - this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._cache.unsubscribe(payeeKey, subId, true).catch(e => { + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if(latencyTimerDone) { @@ -343,15 +343,15 @@ class OutboundTransfersModel { this.data.getPartiesRequest = res.originalRequest; this.metrics.partyLookupRequests.inc(); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Party lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Party lookup sent to peer'); } catch(err) { // cancel the timeout and unsubscribe before rejecting the promise clearTimeout(timeout); // we dont really care if the unsubscribe fails but we should log it regardless - this._cache.unsubscribe(payeeKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._cache.unsubscribe(payeeKey, subId, true).catch(e => { + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${payeeKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -439,7 +439,7 @@ class OutboundTransfersModel { if (!payeeList.length) { return reject(new BackendError(`Timeout resolving payees for transfer ${this.data.transferId}`, 504)); } - this._logger.isDebugEnabled() && this._logger.push({ payeeList }).debug('Payees resolved'); + this._logger.isDebugEnabled && this._logger.push({ payeeList }).debug('Payees resolved'); this.data.to = payeeList.map(payeeResolver); resolve(); }, this._multiplePartiesResponseSeconds * 1000); @@ -451,7 +451,7 @@ class OutboundTransfersModel { this.data.to.idSubValue); this.data.getPartiesRequest = res.originalRequest; this.metrics.partyLookupRequests.inc(); - this._logger.isErrorEnabled() && this._logger.push({ peer: res }).error('Party lookup sent to peer'); + this._logger.isErrorEnabled && this._logger.push({ peer: res }).error('Party lookup sent to peer'); } catch(err) { // cancel the timer before rejecting the promise @@ -494,7 +494,7 @@ class OutboundTransfersModel { if (now > quote.expiration) { const msg = 'Quote response missed expiry deadline'; error = new BackendError(msg, 504); - this._logger.isErrorEnabled() && this._logger.error(`${msg}: system time=${now} > expiration time=${quote.expiration}`); + this._logger.isErrorEnabled && this._logger.error(`${msg}: system time=${now} > expiration time=${quote.expiration}`); } } } else if (message.type === 'quoteResponseError') { @@ -502,7 +502,7 @@ class OutboundTransfersModel { error.mojaloopError = message.data.body; } else { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`); return; } @@ -513,7 +513,7 @@ class OutboundTransfersModel { // no need to await for the unsubscribe to complete. // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(quoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -541,7 +541,7 @@ class OutboundTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(quoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if(latencyTimerDone) { @@ -560,7 +560,7 @@ class OutboundTransfersModel { this.data.quoteRequest = res.originalRequest; this.metrics.quoteRequests.inc(); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Quote request sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Quote request sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -568,7 +568,7 @@ class OutboundTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(quoteKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${quoteKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -657,7 +657,7 @@ class OutboundTransfersModel { const now = new Date().toISOString(); if (now > prepare.expiration) { const msg = 'Transfer fulfil missed expiry deadline'; - this._logger.isErrorEnabled() && this._logger.error(`${msg}: system time=${now} > expiration=${prepare.expiration}`); + this._logger.isErrorEnabled && this._logger.error(`${msg}: system time=${now} > expiration=${prepare.expiration}`); error = new BackendError(msg, 504); } } @@ -665,7 +665,7 @@ class OutboundTransfersModel { error = new BackendError(`Got an error response preparing transfer: ${safeStringify(message.data.body, { depth: Infinity })}`, 500); error.mojaloopError = message.data.body; } else { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`); return; } @@ -674,7 +674,7 @@ class OutboundTransfersModel { // stop listening for transfer fulfil messages this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { @@ -682,7 +682,7 @@ class OutboundTransfersModel { } const fulfil = message.data; - this._logger.isDebugEnabled() && this._logger.push({ fulfil: fulfil.body }).debug('Transfer fulfil received'); + this._logger.isDebugEnabled && this._logger.push({ fulfil: fulfil.body }).debug('Transfer fulfil received'); this.data.fulfil = fulfil; if(this._checkIlp && !this._ilp.validateFulfil(fulfil.body.fulfilment, this.data.quoteResponse.body.condition)) { throw new Error('Invalid fulfilment received from peer DFSP.'); @@ -702,7 +702,7 @@ class OutboundTransfersModel { const res = this._requests.patchTransfers(this.data.transferId, patchNotification, this.data.quoteResponseSource); this.data.patch = res.originalRequest; - this._logger.isDebugEnabled() && this._logger.debug(`PATCH final notification sent to peer for transfer ${this.data.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`PATCH final notification sent to peer for transfer ${this.data.transferId}`); } return resolve(fulfil.body); } @@ -717,7 +717,7 @@ class OutboundTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if(latencyTimerDone) { @@ -736,7 +736,7 @@ class OutboundTransfersModel { this.data.prepare = res.originalRequest; this.metrics.transferPrepares.inc(); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Transfer prepare sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Transfer prepare sent to peer'); } catch(err) { // cancel the timeout and unsubscribe before rejecting the promise @@ -744,7 +744,7 @@ class OutboundTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in error handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in error handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -769,20 +769,20 @@ class OutboundTransfersModel { error = new BackendError(`Got an error response retrieving transfer: ${safeStringify(message.data.body, { depth: Infinity })}`, 500); error.mojaloopError = message.data.body; } else if (message.type !== 'transferFulfil') { - this._logger.isDebugEnabled() && this._logger.push({ message }).debug(`Ignoring cache notification for transfer ${transferKey}. Uknokwn message type ${message.type}.`); + this._logger.isDebugEnabled && this._logger.push({ message }).debug(`Ignoring cache notification for transfer ${transferKey}. Uknokwn message type ${message.type}.`); return; } // cancel the timeout handler clearTimeout(timeout); // stop listening for transfer fulfil messages this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in callback) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); if (error) { return reject(error); } const fulfil = message.data; - this._logger.isDebugEnabled() && this._logger.push({ fulfil: fulfil.body }).debug('Transfer fulfil received'); + this._logger.isDebugEnabled && this._logger.push({ fulfil: fulfil.body }).debug('Transfer fulfil received'); this.data.fulfil = fulfil; return resolve(this.data.fulfil); } @@ -797,7 +797,7 @@ class OutboundTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing (in timeout handler) ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -807,7 +807,7 @@ class OutboundTransfersModel { // a GET /transfers request to the switch try { const res = await this._requests.getTransfers(this.data.transferId); - this._logger.isDebugEnabled() && this._logger.push({ peer: res }).debug('Transfer lookup sent to peer'); + this._logger.isDebugEnabled && this._logger.push({ peer: res }).debug('Transfer lookup sent to peer'); } catch(err) { // cancel the timout and unsubscribe before rejecting the promise @@ -815,7 +815,7 @@ class OutboundTransfersModel { // we dont really care if the unsubscribe fails but we should log it regardless this._cache.unsubscribe(transferKey, subId).catch(e => { - this._logger.isErrorEnabled() && this._logger.error(`Error unsubscribing ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); + this._logger.isErrorEnabled && this._logger.error(`Error unsubscribing ${transferKey} ${subId}: ${e.stack || safeStringify(e)}`); }); return reject(err); @@ -907,7 +907,7 @@ class OutboundTransfersModel { break; default: - this._logger.isDebugEnabled() && this._logger.debug(`Transfer model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer model response being returned from an unexpected state: ${this.data.currentState}. Returning ERROR_OCCURRED state`); resp.currentState = SDKStateEnum.ERROR_OCCURRED; break; } @@ -923,10 +923,10 @@ class OutboundTransfersModel { try { this.data.currentState = this.stateMachine.state; const res = await this._cache.set(`transferModel_out_${this.data.transferId}`, this.data); - this._logger.isDebugEnabled() && this._logger.push({ res }).debug('Persisted transfer model in cache'); + this._logger.isDebugEnabled && this._logger.push({ res }).debug('Persisted transfer model in cache'); } catch(err) { - this._logger.isErrorEnabled() && this._logger.push({ err }).error('Error saving transfer model'); + this._logger.isErrorEnabled && this._logger.push({ err }).error('Error saving transfer model'); throw err; } } @@ -945,10 +945,10 @@ class OutboundTransfersModel { throw new Error(`No cached data found for transferId: ${transferId}`); } await this.initialize(data); - this._logger.isDebugEnabled() && this._logger.push({ cache: this.data }).debug('Transfer model loaded from cached state'); + this._logger.isDebugEnabled && this._logger.push({ cache: this.data }).debug('Transfer model loaded from cached state'); } catch(err) { - this._logger.isDebugEnabled() && this._logger.push({ err }).debug('Error loading transfer model'); + this._logger.isDebugEnabled && this._logger.push({ err }).debug('Error loading transfer model'); throw err; } } @@ -984,14 +984,14 @@ class OutboundTransfersModel { // first transition is to resolvePayee if(typeof(this.data.to.fspId) !== 'undefined' && this.data.skipPartyLookup) { // we already have the payee DFSP and we have bee asked to skip party resolution - this._logger.isDebugEnabled() && this._logger.debug(`Skipping payee resolution for transfer ${this.data.transferId} as to.fspId was provided and skipPartyLookup is truthy`); + this._logger.isDebugEnabled && this._logger.debug(`Skipping payee resolution for transfer ${this.data.transferId} as to.fspId was provided and skipPartyLookup is truthy`); this.data.currentState = 'payeeResolved'; break; } // next transition is to resolvePayee await this.stateMachine.resolvePayee(); - this._logger.isDebugEnabled() && this._logger.debug(`Payee resolved for transfer ${this.data.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`Payee resolved for transfer ${this.data.transferId}`); if(this.stateMachine.state === 'payeeResolved' && !this._autoAcceptParty) { //we break execution here and return the resolved party details to allow asynchronous accept or reject //of the resolved party @@ -1010,7 +1010,7 @@ class OutboundTransfersModel { // next transition is to requestQuote await this.stateMachine.requestQuote(); - this._logger.isDebugEnabled() && this._logger.debug(`Quote received for transfer ${this.data.transferId}`); + this._logger.isDebugEnabled && this._logger.debug(`Quote received for transfer ${this.data.transferId}`); if(this.stateMachine.state === 'quoteReceived' && !this._autoAcceptQuotes) { //we break execution here and return the quote response details to allow asynchronous accept or reject //of the quote @@ -1029,51 +1029,51 @@ class OutboundTransfersModel { // next transition is executeTransfer await this.stateMachine.executeTransfer(); - this._logger.isDebugEnabled() && this._logger.debug(`Transfer ${this.data.transferId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer ${this.data.transferId} has been completed`); break; case 'getTransfer': await this.stateMachine.getTransfer(); - this._logger.isDebugEnabled() && this._logger.debug(`Get transfer ${this.data.transferId} has been completed`); + this._logger.isDebugEnabled && this._logger.debug(`Get transfer ${this.data.transferId} has been completed`); break; case 'succeeded': // all steps complete so return - this._logger.isDebugEnabled() && this._logger.debug('Transfer completed successfully'); + this._logger.isDebugEnabled && this._logger.debug('Transfer completed successfully'); await this._save(); return this.getResponse(); case 'errored': // stopped in errored state await this._save(); - this._logger.isErrorEnabled() && this._logger.error('State machine in errored state'); + this._logger.isErrorEnabled && this._logger.error('State machine in errored state'); return; case 'aborted': // stopped in aborted state await this._save(); - this._logger.isDebugEnabled() && this._logger.debug('State machine in aborted state'); + this._logger.isDebugEnabled && this._logger.debug('State machine in aborted state'); return this.getResponse(); default: // The state is not handled here, throwing an error to avoid an infinite recursion of this function await this._save(); - this._logger.isErrorEnabled() && this._logger.error(`State machine in unhandled(${this.data.currentState}) state`); + this._logger.isErrorEnabled && this._logger.error(`State machine in unhandled(${this.data.currentState}) state`); return; } // now call ourselves recursively to deal with the next transition - this._logger.isDebugEnabled() && this._logger.debug(`Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recusring to handle next transition.`); + this._logger.isDebugEnabled && this._logger.debug(`Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recusring to handle next transition.`); return this.run(); } catch(err) { - this._logger.isErrorEnabled() && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`Error running transfer model: ${safeStringify(err)}`); // as this function is recursive, we dont want to error the state machine multiple times if(this.data.currentState !== 'errored') { // err should not have a transferState property here! if(err.transferState) { - this._logger.isErrorEnabled() && this._logger.error(`State machine is broken: ${safeStringify(err)}`); + this._logger.isErrorEnabled && this._logger.error(`State machine is broken: ${safeStringify(err)}`); } // transition to errored state await this.stateMachine.error(err); diff --git a/modules/api-svc/src/lib/model/ProxyModel/index.js b/modules/api-svc/src/lib/model/ProxyModel/index.js index 95ea91b50..f7d508ef2 100644 --- a/modules/api-svc/src/lib/model/ProxyModel/index.js +++ b/modules/api-svc/src/lib/model/ProxyModel/index.js @@ -72,7 +72,7 @@ class ProxyModel { const valid = validate(config); if (!valid) { const errors = safeStringify(validate.errors); - this._logger.isErrorEnabled() && this._logger.push({ errors }).error('Proxy config is invalid'); + this._logger.isErrorEnabled && this._logger.push({ errors }).error('Proxy config is invalid'); throw new Error(`Proxy config is invalid: ${errors}`); } } @@ -87,7 +87,7 @@ class ProxyModel { try { return config.routes.map(routeConfig => new Route(routeConfig)); } catch (e) { - this._logger.isErrorEnabled() && this._logger.push({ e }).error('Failed to create route'); + this._logger.isErrorEnabled && this._logger.push({ e }).error('Failed to create route'); throw e; } } @@ -119,7 +119,7 @@ class ProxyModel { } const url = this._getMatchingDestination(request); if (!url) { - this._logger.isDebugEnabled() && this._logger.debug(`No proxy rule found for ${request.url}`); + this._logger.isDebugEnabled && this._logger.debug(`No proxy rule found for ${request.url}`); return; } const destReq = { diff --git a/modules/api-svc/src/lib/model/common/PersistentStateMachine.js b/modules/api-svc/src/lib/model/common/PersistentStateMachine.js index 57e2264ce..ffc767203 100644 --- a/modules/api-svc/src/lib/model/common/PersistentStateMachine.js +++ b/modules/api-svc/src/lib/model/common/PersistentStateMachine.js @@ -15,17 +15,17 @@ async function saveToCache() { const { data, cache, key, logger } = this.context; try { const res = await cache.set(key, data); - logger.isDebugEnabled() && logger.push({ res }).debug(`Persisted model in cache: ${key}`); + logger.isDebugEnabled && logger.push({ res }).debug(`Persisted model in cache: ${key}`); } catch(err) { - logger.isErrorEnabled() && logger.push({ err }).error(`Error saving model: ${key}`); + logger.isErrorEnabled && logger.push({ err }).error(`Error saving model: ${key}`); throw err; } } async function onAfterTransition(transition) { const { logger } = this.context; - logger.isDebugEnabled() && logger.debug(`State machine transitioned '${transition.transition}': ${transition.from} -> ${transition.to}`); + logger.isDebugEnabled && logger.debug(`State machine transitioned '${transition.transition}': ${transition.from} -> ${transition.to}`); this.context.data.currentState = transition.to; } @@ -75,14 +75,14 @@ async function loadFromCache(cache, key, logger, stateMachineSpec, optCreate) { if(!data) { throw new Error(`No cached data found for: ${key}`); } - logger.isDebugEnabled() && logger.push({ cache: data }).debug('data loaded from cache'); + logger.isDebugEnabled && logger.push({ cache: data }).debug('data loaded from cache'); // use delegation to allow customization of 'create' const createPSM = optCreate || create; return createPSM(data, cache, key, logger, stateMachineSpec); } catch(err) { - logger.isErrorEnabled() &&logger.push({ err }).error(`Error loading data: ${key}`); + logger.isErrorEnabled &&logger.push({ err }).error(`Error loading data: ${key}`); throw err; } } diff --git a/modules/api-svc/src/lib/model/lib/requests/backendRequests.js b/modules/api-svc/src/lib/model/lib/requests/backendRequests.js index 9c4b2c4e8..8dc8cdb69 100644 --- a/modules/api-svc/src/lib/model/lib/requests/backendRequests.js +++ b/modules/api-svc/src/lib/model/lib/requests/backendRequests.js @@ -194,11 +194,11 @@ class BackendRequests { // Note we do not JWS sign requests with no body i.e. GET requests try { - this.logger.isDebugEnabled() && this.logger.push({ reqOpts }).debug('Executing HTTP GET'); + this.logger.isDebugEnabled && this.logger.push({ reqOpts }).debug('Executing HTTP GET'); return request({...reqOpts, agent: this.agent}).then(throwOrJson); } catch (e) { - this.logger.isErrorEnabled() && this.logger.push({ e }).error('Error attempting HTTP GET'); + this.logger.isErrorEnabled && this.logger.push({ e }).error('Error attempting HTTP GET'); throw e; } } @@ -213,7 +213,7 @@ class BackendRequests { }; try { - this.logger.isDebugEnabled() && this.logger.push({ reqOpts }).debug('Executing HTTP PUT'); + this.logger.isDebugEnabled && this.logger.push({ reqOpts }).debug('Executing HTTP PUT'); return request({...reqOpts, agent: this.agent}).then(throwOrJson); } catch (e) { @@ -232,11 +232,11 @@ class BackendRequests { }; try { - this.logger.isDebugEnabled() && this.logger.push({ reqOpts }).debug('Executing HTTP POST'); + this.logger.isDebugEnabled && this.logger.push({ reqOpts }).debug('Executing HTTP POST'); return request({...reqOpts, agent: this.agent}).then(throwOrJson); } catch (e) { - this.logger.isErrorEnabled() && this.logger.push({ e }).error('Error attempting POST.'); + this.logger.isErrorEnabled && this.logger.push({ e }).error('Error attempting POST.'); throw e; } } diff --git a/modules/api-svc/src/lib/router.js b/modules/api-svc/src/lib/router.js index aa4897dad..c15853b78 100644 --- a/modules/api-svc/src/lib/router.js +++ b/modules/api-svc/src/lib/router.js @@ -17,14 +17,14 @@ module.exports = (handlerMap) => async (ctx, next) => { const handlers = handlerMap[ctx.state.path.pattern]; const handler = handlers ? handlers[ctx.method.toLowerCase()] : undefined; if (!handlers || !handler) { - ctx.state.logger.isErrorEnabled() && ctx.state.logger.error('No handler found'); + ctx.state.logger.isErrorEnabled && ctx.state.logger.error('No handler found'); ctx.response.status = ReturnCodes.NOTFOUND.CODE; // TODO: response content according to API spec. Should probably actually be a 404 here. ctx.response.body = { statusCode: 404, message: 'Not found' }; } else { if (!ctx.state.logExcludePaths.includes(ctx.path)) { - ctx.state.logger.isDebugEnabled() && ctx.state.logger.push({handler}).debug('Found handler'); + ctx.state.logger.isDebugEnabled && ctx.state.logger.push({handler}).debug('Found handler'); } await handler(ctx); } diff --git a/modules/api-svc/src/lib/validate.js b/modules/api-svc/src/lib/validate.js index 86daeaf39..ca0c2b8e9 100644 --- a/modules/api-svc/src/lib/validate.js +++ b/modules/api-svc/src/lib/validate.js @@ -171,7 +171,7 @@ class Validator { result.params = Object.assign({}, ...path.match(result.matcher.regex).slice(1).map((m, i) => ({ [result.matcher.params[i]]: m}))); if (!this.logExcludePaths.includes(path)) { - logger.isDebugEnabled() && logger.push({path, result}).debug('Matched path'); + logger.isDebugEnabled && logger.push({path, result}).debug('Matched path'); } return result; } @@ -188,7 +188,7 @@ class Validator { const validationResult = path.methods[ctx.method.toLowerCase()].validator(ctx, path.params); if (validationResult !== undefined && validationResult.length > 0) { - logger.isDebugEnabled() && logger.push({ validationResult }).debug('Validation result'); + logger.isDebugEnabled && logger.push({ validationResult }).debug('Validation result'); let err; const firstError = validationResult[0]; diff --git a/modules/api-svc/test/unit/InboundServer.test.js b/modules/api-svc/test/unit/InboundServer.test.js index 4729ebbf5..5b073e7ae 100644 --- a/modules/api-svc/test/unit/InboundServer.test.js +++ b/modules/api-svc/test/unit/InboundServer.test.js @@ -45,7 +45,11 @@ describe('Inbound Server', () => { serverConfig.validateInboundJws = validateInboundJws; serverConfig.validateInboundPutPartiesJws = validateInboundPutPartiesJws; const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); const svr = new InboundServer(serverConfig, logger, cache); await svr.start(); await supertest(svr._server) @@ -61,7 +65,11 @@ describe('Inbound Server', () => { async function testPartiesHeaderValidation(contentType, expectedStatusCode, expectedBody = null) { const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); const svr = new InboundServer(serverConfig, logger, cache); await svr.start(); const result = await supertest(svr._server) @@ -141,7 +149,11 @@ describe('Inbound Server', () => { serverConfig.validateInboundJws = validateInboundJws; serverConfig.validateInboundPutPartiesJws = validateInboundPutPartiesJws; const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); const svr = new InboundServer(serverConfig, logger, cache); await svr.start(); await supertest(svr._server) @@ -158,7 +170,11 @@ describe('Inbound Server', () => { async function testQuotesHeaderValidation(contentType, expectedStatusCode, expectedBody = null) { const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); const svr = new InboundServer(serverConfig, logger, cache); await svr.start(); const result = await supertest(svr._server) @@ -232,7 +248,11 @@ describe('Inbound Server', () => { serverConfig.validateInboundJws = validateInboundJws; serverConfig.validateInboundPutPartiesJws = validateInboundPutPartiesJws; const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); const svr = new InboundServer(serverConfig, logger, cache); await svr.start(); await supertest(svr._server) @@ -249,7 +269,11 @@ describe('Inbound Server', () => { async function testParticipantsHeaderValidation(contentType, expectedStatusCode, expectedBody = null) { const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); const svr = new InboundServer(serverConfig, logger, cache); await svr.start(); const result = await supertest(svr._server) @@ -336,7 +360,11 @@ describe('Inbound Server', () => { async function testTlsServer(enableTls) { defConfig.inbound.tls.mutualTLS.enabled = enableTls; const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: defConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: defConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: defConfig.unsubscribeTimeoutMs, + }); const server = new InboundServer(defConfig, logger, cache); await server.start(); if (enableTls) { @@ -369,7 +397,11 @@ describe('Inbound Server', () => { fs.writeFileSync(mockFilePath, 'foo-key'); serverConfig.jwsVerificationKeysDirectory = keysDir; const logger = new Logger.Logger({ stringify: () => '' }); - const cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }) }); + const cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); svr = new InboundServer(serverConfig, logger, cache); await svr.start(); }); diff --git a/modules/api-svc/test/unit/TestServer.test.js b/modules/api-svc/test/unit/TestServer.test.js index 39c344d66..886721ccc 100644 --- a/modules/api-svc/test/unit/TestServer.test.js +++ b/modules/api-svc/test/unit/TestServer.test.js @@ -50,7 +50,12 @@ describe('Test Server', () => { ...JSON.parse(JSON.stringify(defaultConfig)), enableTestFeatures: true, }; - cache = new Cache({ cacheUrl: serverConfig.cacheUrl, logger: logger.push({ component: 'cache' }), enableTestFeatures: true }); + cache = new Cache({ + cacheUrl: serverConfig.cacheUrl, + logger: logger.push({ component: 'cache' }), + enableTestFeatures: true, + unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs, + }); testServer = new TestServer({ logger, cache }); await testServer.start(); diff --git a/modules/api-svc/test/unit/api/utils.js b/modules/api-svc/test/unit/api/utils.js index d9b3bd1b5..a025cce6a 100644 --- a/modules/api-svc/test/unit/api/utils.js +++ b/modules/api-svc/test/unit/api/utils.js @@ -54,7 +54,8 @@ const createTestServers = async (config) => { const defConfig = structuredClone(config); const cache = new Cache({ cacheUrl: defConfig.cacheUrl, - logger: logger.push({ component: 'cache' }) + logger: logger.push({ component: 'cache' }), + unsubscribeTimeoutMs: defConfig.unsubscribeTimeoutMs, }); await cache.connect(); defConfig.requestProcessingTimeoutSeconds = 2; diff --git a/modules/api-svc/test/unit/lib/cache.test.js b/modules/api-svc/test/unit/lib/cache.test.js index ac799077f..03946dc52 100644 --- a/modules/api-svc/test/unit/lib/cache.test.js +++ b/modules/api-svc/test/unit/lib/cache.test.js @@ -18,8 +18,9 @@ const { Logger } = require('@mojaloop/sdk-standard-components'); const createCache = async() => { const logger = new Logger.Logger({ context: { app: 'model-unit-tests-cache' }, stringify: () => '' }); const cache = new Cache({ - cacheUrl: 'redis://dummy:1234', - logger, + cacheUrl: 'redis://dummy:1234', + logger, + unsubscribeTimeoutMs: 5000, }); await cache.connect(); return cache; diff --git a/modules/api-svc/test/unit/lib/model/AccountsModel.test.js b/modules/api-svc/test/unit/lib/model/AccountsModel.test.js index 96df14412..1b96f46d7 100644 --- a/modules/api-svc/test/unit/lib/model/AccountsModel.test.js +++ b/modules/api-svc/test/unit/lib/model/AccountsModel.test.js @@ -94,9 +94,10 @@ describe('AccountsModel', () => { beforeEach(async () => { cache = new Cache({ - cacheUrl: 'redis://dummy:1234', - logger, - }); + cacheUrl: 'redis://dummy:1234', + logger, + unsubscribeTimeoutMs: 5000, + }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js b/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js index 65928e04b..95027781e 100644 --- a/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js +++ b/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js @@ -71,6 +71,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); @@ -139,6 +140,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); // eslint-disable-next-line no-unused-vars @@ -195,6 +197,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); @@ -231,6 +234,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); @@ -272,6 +276,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); @@ -550,6 +555,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); @@ -729,6 +735,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); @@ -811,6 +818,7 @@ describe('inboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/OutboundBulkQuotesModel.test.js b/modules/api-svc/test/unit/lib/model/OutboundBulkQuotesModel.test.js index 33db7da4f..154d306c1 100644 --- a/modules/api-svc/test/unit/lib/model/OutboundBulkQuotesModel.test.js +++ b/modules/api-svc/test/unit/lib/model/OutboundBulkQuotesModel.test.js @@ -95,6 +95,7 @@ describe('OutboundBulkQuotesModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/OutboundBulkTransfersModel.test.js b/modules/api-svc/test/unit/lib/model/OutboundBulkTransfersModel.test.js index 44067a239..9b1590a26 100644 --- a/modules/api-svc/test/unit/lib/model/OutboundBulkTransfersModel.test.js +++ b/modules/api-svc/test/unit/lib/model/OutboundBulkTransfersModel.test.js @@ -86,6 +86,7 @@ describe('outboundBulkTransferModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/OutboundRequestToPayModel.test.js b/modules/api-svc/test/unit/lib/model/OutboundRequestToPayModel.test.js index fe2b7a98c..2a801b63c 100644 --- a/modules/api-svc/test/unit/lib/model/OutboundRequestToPayModel.test.js +++ b/modules/api-svc/test/unit/lib/model/OutboundRequestToPayModel.test.js @@ -72,9 +72,10 @@ describe('outboundModel', () => { MojaloopRequests.__postTransactionRequests = jest.fn(() => Promise.resolve()); cache = new Cache({ - cacheUrl: 'redis://dummy:1234', - logger, - }); + cacheUrl: 'redis://dummy:1234', + logger, + unsubscribeTimeoutMs: 5000 + }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js b/modules/api-svc/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js index eb1223063..5d5d05770 100644 --- a/modules/api-svc/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +++ b/modules/api-svc/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js @@ -72,9 +72,10 @@ describe('outboundRequestToPayTransferModel', () => { MojaloopRequests.__postTransfers = jest.fn(() => Promise.resolve()); cache = new Cache({ - cacheUrl: 'redis://dummy:1234', - logger, - }); + cacheUrl: 'redis://dummy:1234', + logger, + unsubscribeTimeoutMs: 5000 + }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js b/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js index 1610865fd..f880141be 100644 --- a/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js +++ b/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js @@ -168,6 +168,7 @@ describe('outboundModel', () => { cache = new Cache({ cacheUrl: 'redis://dummy:1234', logger, + unsubscribeTimeoutMs: 5000 }); await cache.connect(); }); diff --git a/modules/api-svc/test/unit/lib/model/common/PersistentStateMachine.test.js b/modules/api-svc/test/unit/lib/model/common/PersistentStateMachine.test.js index 9d187c75a..bdfa86f64 100644 --- a/modules/api-svc/test/unit/lib/model/common/PersistentStateMachine.test.js +++ b/modules/api-svc/test/unit/lib/model/common/PersistentStateMachine.test.js @@ -72,9 +72,10 @@ describe('PersistentStateMachine', () => { data = { the: 'data' }; cache = new Cache({ - cacheUrl: 'redis://dummy:1234', - logger, - }); + cacheUrl: 'redis://dummy:1234', + logger, + unsubscribeTimeoutMs: 5000 + }); // mock cache set & get cache.get = jest.fn(async () => data); cache.set = jest.fn(async () => 'cache set replies'); diff --git a/modules/outbound-command-event-handler/package.json b/modules/outbound-command-event-handler/package.json index c39b7eac6..c38b38afb 100644 --- a/modules/outbound-command-event-handler/package.json +++ b/modules/outbound-command-event-handler/package.json @@ -42,13 +42,13 @@ }, "dependencies": { "@mojaloop/api-snippets": "17.4.0", - "@mojaloop/central-services-shared": "^18.2.0", + "@mojaloop/central-services-shared": "^18.3.0", "@mojaloop/logging-bc-client-lib": "^0.1.17", - "@mojaloop/logging-bc-public-types-lib": "^0.5.2", + "@mojaloop/logging-bc-public-types-lib": "^0.5.4", "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^", "ajv": "^8.12.0", "convict": "^6.2.4", - "express": "^4.18.2", + "express": "^4.18.3", "openapi-backend": "^5.10.6", "redis": "^4.6.13", "swagger-ui-express": "^5.0.0", @@ -58,23 +58,23 @@ "@types/convict": "^6.1.6", "@types/express": "^4.17.21", "@types/jest": "^29.5.12", - "@types/node": "^20.11.19", + "@types/node": "^20.11.27", "@types/node-cache": "^4.2.5", "@types/supertest": "^6.0.2", "@types/swagger-ui-express": "^4.1.6", "@types/yamljs": "^0.2.34", - "@typescript-eslint/eslint-plugin": "^7.0.2", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.2.0", + "@typescript-eslint/parser": "^7.2.0", "copyfiles": "^2.4.1", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "jest": "^29.7.0", - "nodemon": "^3.0.3", + "nodemon": "^3.1.0", "npm-check-updates": "^16.7.10", "replace": "^1.2.2", "standard-version": "^9.5.0", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", - "typescript": "^5.3.3" + "typescript": "^5.4.2" }, "nodemonConfig": { "watch": [ diff --git a/modules/outbound-domain-event-handler/package.json b/modules/outbound-domain-event-handler/package.json index 1c1770333..fa6af8717 100644 --- a/modules/outbound-domain-event-handler/package.json +++ b/modules/outbound-domain-event-handler/package.json @@ -43,10 +43,10 @@ "dependencies": { "@mojaloop/api-snippets": "17.4.0", "@mojaloop/logging-bc-client-lib": "^0.1.17", - "@mojaloop/logging-bc-public-types-lib": "^0.5.2", + "@mojaloop/logging-bc-public-types-lib": "^0.5.4", "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^", "convict": "^6.2.4", - "express": "^4.18.2", + "express": "^4.18.3", "openapi-backend": "^5.10.6", "redis": "^4.6.13", "swagger-ui-express": "^5.0.0", @@ -56,23 +56,23 @@ "@types/convict": "^6.1.6", "@types/express": "^4.17.21", "@types/jest": "^29.5.12", - "@types/node": "^20.11.19", + "@types/node": "^20.11.27", "@types/node-cache": "^4.2.5", "@types/supertest": "^6.0.2", "@types/swagger-ui-express": "^4.1.6", "@types/yamljs": "^0.2.34", - "@typescript-eslint/eslint-plugin": "^7.0.2", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.2.0", + "@typescript-eslint/parser": "^7.2.0", "copyfiles": "^2.4.1", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "jest": "^29.7.0", - "nodemon": "^3.0.3", + "nodemon": "^3.1.0", "npm-check-updates": "^16.7.10", "replace": "^1.2.2", "standard-version": "^9.5.0", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", - "typescript": "^5.3.3" + "typescript": "^5.4.2" }, "nodemonConfig": { "watch": [ diff --git a/modules/private-shared-lib/package.json b/modules/private-shared-lib/package.json index c1be551c0..a7d4bf76b 100644 --- a/modules/private-shared-lib/package.json +++ b/modules/private-shared-lib/package.json @@ -28,23 +28,23 @@ }, "dependencies": { "@mojaloop/api-snippets": "17.4.0", - "@mojaloop/central-services-shared": "^18.2.0", - "@mojaloop/logging-bc-public-types-lib": "^0.5.2", - "@mojaloop/platform-shared-lib-messaging-types-lib": "^0.5.4", + "@mojaloop/central-services-shared": "^18.3.0", + "@mojaloop/logging-bc-public-types-lib": "^0.5.4", + "@mojaloop/platform-shared-lib-messaging-types-lib": "^0.5.6", "@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": "0.2.15", "ajv": "^8.12.0", "redis": "^4.6.13", "uuid": "^9.0.1" }, "devDependencies": { - "@types/node": "^20.11.19", - "eslint": "^8.56.0", + "@types/node": "^20.11.27", + "eslint": "^8.57.0", "jest": "^29.7.0", "npm-check-updates": "^16.7.10", "replace": "^1.2.2", "standard-version": "^9.5.0", "ts-jest": "^29.1.2", - "typescript": "^5.3.3" + "typescript": "^5.4.2" }, "standard-version": { "scripts": { diff --git a/package.json b/package.json index 79252fe9a..05e08d53d 100644 --- a/package.json +++ b/package.json @@ -72,23 +72,23 @@ }, "devDependencies": { "@types/jest": "^29.5.12", - "@types/node": "^20.11.19", + "@types/node": "^20.11.27", "@types/node-cache": "^4.2.5", - "@typescript-eslint/eslint-plugin": "^7.0.2", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.2.0", + "@typescript-eslint/parser": "^7.2.0", "audit-ci": "^6.6.1", - "eslint": "^8.56.0", - "eslint-config-airbnb-typescript": "^17.1.0", + "eslint": "^8.57.0", + "eslint-config-airbnb-typescript": "^18.0.0", "eslint-plugin-import": "latest", "husky": "^9.0.11", "jest": "^29.7.0", - "nodemon": "^3.0.3", + "nodemon": "^3.1.0", "npm-check-updates": "^16.7.10", "replace": "^1.2.2", "standard-version": "^9.5.0", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", - "typescript": "^5.3.3", + "typescript": "^5.4.2", "yarn-audit-fix": "^10.0.7" }, "standard-version": { From 20be2c2ef901fbd7ddf261bfa27bed21ae4b749c Mon Sep 17 00:00:00 2001 From: Kevin Leyow Date: Wed, 13 Mar 2024 09:48:39 -0500 Subject: [PATCH 2/3] lock --- yarn.lock | 553 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 292 insertions(+), 261 deletions(-) diff --git a/yarn.lock b/yarn.lock index b9af98e24..f35c5eba9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -125,7 +125,7 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.23.3, @babel/compat-data@npm:^7.23.5": +"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.23.5": version: 7.23.5 resolution: "@babel/compat-data@npm:7.23.5" checksum: 06ce244cda5763295a0ea924728c09bae57d35713b675175227278896946f922a63edf803c322f855a3878323d48d0255a2a3023409d2a123483c8a69ebb4744 @@ -155,26 +155,26 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/core@npm:7.23.9" +"@babel/core@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/core@npm:7.24.0" dependencies: "@ampproject/remapping": ^2.2.0 "@babel/code-frame": ^7.23.5 "@babel/generator": ^7.23.6 "@babel/helper-compilation-targets": ^7.23.6 "@babel/helper-module-transforms": ^7.23.3 - "@babel/helpers": ^7.23.9 - "@babel/parser": ^7.23.9 - "@babel/template": ^7.23.9 - "@babel/traverse": ^7.23.9 - "@babel/types": ^7.23.9 + "@babel/helpers": ^7.24.0 + "@babel/parser": ^7.24.0 + "@babel/template": ^7.24.0 + "@babel/traverse": ^7.24.0 + "@babel/types": ^7.24.0 convert-source-map: ^2.0.0 debug: ^4.1.0 gensync: ^1.0.0-beta.2 json5: ^2.2.3 semver: ^6.3.1 - checksum: 634a511f74db52a5f5a283c1121f25e2227b006c095b84a02a40a9213842489cd82dc7d61cdc74e10b5bcd9bb0a4e28bab47635b54c7e2256d47ab57356e2a76 + checksum: 3124a8a1c550f3818a55dc6f621af9c580b4959bc780cce7220f671088c404830f41870573f5acf7f837878f8aa82e84675ea148a9852c1b053533cb899300d3 languageName: node linkType: hard @@ -343,6 +343,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-plugin-utils@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/helper-plugin-utils@npm:7.24.0" + checksum: e2baa0eede34d2fa2265947042aa84d444aa48dc51e9feedea55b67fc1bc3ab051387e18b33ca7748285a6061390831ab82f8a2c767d08470b93500ec727e9b9 + languageName: node + linkType: hard + "@babel/helper-remap-async-to-generator@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-remap-async-to-generator@npm:7.22.20" @@ -439,14 +446,14 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/helpers@npm:7.23.9" +"@babel/helpers@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/helpers@npm:7.24.0" dependencies: - "@babel/template": ^7.23.9 - "@babel/traverse": ^7.23.9 - "@babel/types": ^7.23.9 - checksum: 2678231192c0471dbc2fc403fb19456cc46b1afefcfebf6bc0f48b2e938fdb0fef2e0fe90c8c8ae1f021dae5012b700372e4b5d15867f1d7764616532e4a6324 + "@babel/template": ^7.24.0 + "@babel/traverse": ^7.24.0 + "@babel/types": ^7.24.0 + checksum: 2c1d9547c7a6e5aa648d4f3959252f825d4176ee52ed5430d65e50e68a138776adfd87ff3c8f9719ea6cd36601e935936d006340770ad8282b8664770aca8e33 languageName: node linkType: hard @@ -470,12 +477,12 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/parser@npm:7.23.9" +"@babel/parser@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/parser@npm:7.24.0" bin: parser: ./bin/babel-parser.js - checksum: e7cd4960ac8671774e13803349da88d512f9292d7baa952173260d3e8f15620a28a3701f14f709d769209022f9e7b79965256b8be204fc550cfe783cdcabe7c7 + checksum: 4a6afec49487a212e7a27345b0c090b56905efb62c0b3a1499b0a57a5b3bf43d9d1e99e31b137080eacc24dee659a29699740d0a6289999117c0d8c5a04bd68f languageName: node linkType: hard @@ -1110,18 +1117,18 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-object-rest-spread@npm:^7.23.4": - version: 7.23.4 - resolution: "@babel/plugin-transform-object-rest-spread@npm:7.23.4" +"@babel/plugin-transform-object-rest-spread@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/plugin-transform-object-rest-spread@npm:7.24.0" dependencies: - "@babel/compat-data": ^7.23.3 - "@babel/helper-compilation-targets": ^7.22.15 - "@babel/helper-plugin-utils": ^7.22.5 + "@babel/compat-data": ^7.23.5 + "@babel/helper-compilation-targets": ^7.23.6 + "@babel/helper-plugin-utils": ^7.24.0 "@babel/plugin-syntax-object-rest-spread": ^7.8.3 "@babel/plugin-transform-parameters": ^7.23.3 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 73fec495e327ca3959c1c03d07a621be09df00036c69fff0455af9a008291677ee9d368eec48adacdc6feac703269a649747568b4af4c4e9f134aa71cc5b378d + checksum: 8877b6a5493df0e36007286ea5e5e2305575346cf1b128049e7db3ff3861f2eb7eb0e8fa3e0b6334de27724253bf32b27e572b2c35dd93b02403476c306b9f5d languageName: node linkType: hard @@ -1336,13 +1343,13 @@ __metadata: languageName: node linkType: hard -"@babel/preset-env@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/preset-env@npm:7.23.9" +"@babel/preset-env@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/preset-env@npm:7.24.0" dependencies: "@babel/compat-data": ^7.23.5 "@babel/helper-compilation-targets": ^7.23.6 - "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-plugin-utils": ^7.24.0 "@babel/helper-validator-option": ^7.23.5 "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.23.3 "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.23.3 @@ -1395,7 +1402,7 @@ __metadata: "@babel/plugin-transform-new-target": ^7.23.3 "@babel/plugin-transform-nullish-coalescing-operator": ^7.23.4 "@babel/plugin-transform-numeric-separator": ^7.23.4 - "@babel/plugin-transform-object-rest-spread": ^7.23.4 + "@babel/plugin-transform-object-rest-spread": ^7.24.0 "@babel/plugin-transform-object-super": ^7.23.3 "@babel/plugin-transform-optional-catch-binding": ^7.23.4 "@babel/plugin-transform-optional-chaining": ^7.23.4 @@ -1422,7 +1429,7 @@ __metadata: semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 23a48468ba820c68ba34ea2c1dbc62fd2ff9cf858cfb69e159cabb0c85c72dc4c2266ce20ca84318d8742de050cb061e7c66902fbfddbcb09246afd248847933 + checksum: d9e894037382ce35be4b511034a9fb110003ca104f4f800e9b8f9c3b830999014c8314dcdaa3c89669e034784f7c81fe6851e2ff237805fef6479c7dff68d12c languageName: node linkType: hard @@ -1466,14 +1473,14 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/template@npm:7.23.9" +"@babel/template@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/template@npm:7.24.0" dependencies: "@babel/code-frame": ^7.23.5 - "@babel/parser": ^7.23.9 - "@babel/types": ^7.23.9 - checksum: 6e67414c0f7125d7ecaf20c11fab88085fa98a96c3ef10da0a61e962e04fdf3a18a496a66047005ddd1bb682a7cc7842d556d1db2f3f3f6ccfca97d5e445d342 + "@babel/parser": ^7.24.0 + "@babel/types": ^7.24.0 + checksum: f257b003c071a0cecdbfceca74185f18fe62c055469ab5c1d481aab12abeebed328e67e0a19fd978a2a8de97b28953fa4bc3da6d038a7345fdf37923b9fcdec8 languageName: node linkType: hard @@ -1495,9 +1502,9 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/traverse@npm:7.23.9" +"@babel/traverse@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/traverse@npm:7.24.0" dependencies: "@babel/code-frame": ^7.23.5 "@babel/generator": ^7.23.6 @@ -1505,11 +1512,11 @@ __metadata: "@babel/helper-function-name": ^7.23.0 "@babel/helper-hoist-variables": ^7.22.5 "@babel/helper-split-export-declaration": ^7.22.6 - "@babel/parser": ^7.23.9 - "@babel/types": ^7.23.9 + "@babel/parser": ^7.24.0 + "@babel/types": ^7.24.0 debug: ^4.3.1 globals: ^11.1.0 - checksum: a932f7aa850e158c00c97aad22f639d48c72805c687290f6a73e30c5c4957c07f5d28310c9bf59648e2980fe6c9d16adeb2ff92a9ca0f97fa75739c1328fc6c3 + checksum: 790cf14a6452575ceef767285bad0dd96d14b3640ed4e6a4ddb5b592e4e66020424bac21e4a4b965ac0d2fe9ed504fe3644748b1922fb8ac37c681cb435c3995 languageName: node linkType: hard @@ -1524,14 +1531,14 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/types@npm:7.23.9" +"@babel/types@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/types@npm:7.24.0" dependencies: "@babel/helper-string-parser": ^7.23.4 "@babel/helper-validator-identifier": ^7.22.20 to-fast-properties: ^2.0.0 - checksum: 0a9b008e9bfc89beb8c185e620fa0f8ed6c771f1e1b2e01e1596870969096fec7793898a1d64a035176abf1dd13e2668ee30bf699f2d92c210a8128f4b151e65 + checksum: 4b574a37d490f621470ff36a5afaac6deca5546edcb9b5e316d39acbb20998e9c2be42f3fc0bf2b55906fc49ff2a5a6a097e8f5a726ee3f708a0b0ca93aed807 languageName: node linkType: hard @@ -1611,10 +1618,10 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:8.56.0": - version: 8.56.0 - resolution: "@eslint/js@npm:8.56.0" - checksum: 5804130574ef810207bdf321c265437814e7a26f4e6fac9b496de3206afd52f533e09ec002a3be06cd9adcc9da63e727f1883938e663c4e4751c007d5b58e539 +"@eslint/js@npm:8.57.0": + version: 8.57.0 + resolution: "@eslint/js@npm:8.57.0" + checksum: 315dc65b0e9893e2bff139bddace7ea601ad77ed47b4550e73da8c9c2d2766c7a575c3cddf17ef85b8fd6a36ff34f91729d0dcca56e73ca887c10df91a41b0bb languageName: node linkType: hard @@ -1754,14 +1761,14 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.13": - version: 0.11.13 - resolution: "@humanwhocodes/config-array@npm:0.11.13" +"@humanwhocodes/config-array@npm:^0.11.14": + version: 0.11.14 + resolution: "@humanwhocodes/config-array@npm:0.11.14" dependencies: - "@humanwhocodes/object-schema": ^2.0.1 - debug: ^4.1.1 + "@humanwhocodes/object-schema": ^2.0.2 + debug: ^4.3.1 minimatch: ^3.0.5 - checksum: f8ea57b0d7ed7f2d64cd3944654976829d9da91c04d9c860e18804729a33f7681f78166ef4c761850b8c324d362f7d53f14c5c44907a6b38b32c703ff85e4805 + checksum: 861ccce9eaea5de19546653bccf75bf09fe878bc39c3aab00aeee2d2a0e654516adad38dd1098aab5e3af0145bbcbf3f309bdf4d964f8dab9dcd5834ae4c02f2 languageName: node linkType: hard @@ -1772,10 +1779,10 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^2.0.1": - version: 2.0.1 - resolution: "@humanwhocodes/object-schema@npm:2.0.1" - checksum: 24929487b1ed48795d2f08346a0116cc5ee4634848bce64161fb947109352c562310fd159fc64dda0e8b853307f5794605191a9547f7341158559ca3c8262a45 +"@humanwhocodes/object-schema@npm:^2.0.2": + version: 2.0.2 + resolution: "@humanwhocodes/object-schema@npm:2.0.2" + checksum: 2fc11503361b5fb4f14714c700c02a3f4c7c93e9acd6b87a29f62c522d90470f364d6161b03d1cc618b979f2ae02aed1106fd29d302695d8927e2fc8165ba8ee languageName: node linkType: hard @@ -2171,27 +2178,27 @@ __metadata: languageName: node linkType: hard -"@mojaloop/central-services-shared@npm:18.2.0, @mojaloop/central-services-shared@npm:^18.2.0": - version: 18.2.0 - resolution: "@mojaloop/central-services-shared@npm:18.2.0" +"@mojaloop/central-services-shared@npm:18.3.0, @mojaloop/central-services-shared@npm:^18.3.0": + version: 18.3.0 + resolution: "@mojaloop/central-services-shared@npm:18.3.0" dependencies: "@hapi/catbox": 12.1.1 "@hapi/catbox-memory": 5.0.1 - axios: 1.6.2 + axios: 1.6.7 clone: 2.1.2 - dotenv: 16.3.1 + dotenv: 16.4.5 env-var: 7.4.1 event-stream: 4.0.1 - immutable: 4.3.4 + immutable: 4.3.5 lodash: 4.17.21 mustache: 4.2.0 - openapi-backend: 5.10.5 + openapi-backend: 5.10.6 raw-body: 2.5.2 rc: 1.2.8 shins: 2.6.0 uuid4: 2.0.3 widdershins: ^4.0.1 - yaml: 2.3.4 + yaml: 2.4.1 peerDependencies: "@mojaloop/central-services-error-handling": ">=12.x.x" "@mojaloop/central-services-logger": ">=11.x.x" @@ -2212,7 +2219,7 @@ __metadata: optional: false ajv-keyboards: optional: false - checksum: a54d43571e4f7031374fa754443ad15a6c0c46c653e9367169612cb026657d80a47d601b28885ca73509abc574c3b25fca1579bdf71cf79df57feae17b961855 + checksum: 2e140b35a5d2c24c2081da918ebf0e1c377e161cf6383db3fd8d7264d9052c42823d2ce8483426ac55e75752029b99ad488f7a5b8860c057ef4910beb81d2a52 languageName: node linkType: hard @@ -2261,17 +2268,17 @@ __metadata: languageName: node linkType: hard -"@mojaloop/logging-bc-public-types-lib@npm:^0.5.2": - version: 0.5.2 - resolution: "@mojaloop/logging-bc-public-types-lib@npm:0.5.2" - checksum: 86beb99eb617f51fb1d0ea67a5fb464cb0335bf984fc59248c4cc236eb141aed2e0c619c8f9e27a70186204343e558b044310e63b98a03e2212014b1dbe12071 +"@mojaloop/logging-bc-public-types-lib@npm:^0.5.4": + version: 0.5.4 + resolution: "@mojaloop/logging-bc-public-types-lib@npm:0.5.4" + checksum: 68e130dacacc25c3cb126ad04f385a010d9d6f0ab2649bf2a8307a1461c6f0e8099061136d443301d7768a04d8cb5259d90288b74af1bf795a2078e9e8251e36 languageName: node linkType: hard -"@mojaloop/platform-shared-lib-messaging-types-lib@npm:^0.5.4": - version: 0.5.4 - resolution: "@mojaloop/platform-shared-lib-messaging-types-lib@npm:0.5.4" - checksum: edb78914d2e0feabff62fe6af76b1d65576f3e2f0ca222747620f69ac6d86643d143c7e4397d831a12284cb6aec07f1d7be7347cc9f10e71ed603f1631cf8684 +"@mojaloop/platform-shared-lib-messaging-types-lib@npm:^0.5.6": + version: 0.5.6 + resolution: "@mojaloop/platform-shared-lib-messaging-types-lib@npm:0.5.6" + checksum: 3808216530b55b434667a0282d13593334743906075f37491046740c7be1d50a5d036b636f2e47a53cd3d8d0eddbc29ded7c665790f20381810a9dc1d864bf32 languageName: node linkType: hard @@ -2308,17 +2315,17 @@ __metadata: version: 0.0.0-use.local resolution: "@mojaloop/sdk-scheme-adapter-api-svc@workspace:modules/api-svc" dependencies: - "@babel/core": ^7.23.9 - "@babel/preset-env": ^7.23.9 + "@babel/core": ^7.24.0 + "@babel/preset-env": ^7.24.0 "@koa/cors": ^5.0.0 "@mojaloop/api-snippets": 17.4.0 "@mojaloop/central-services-error-handling": ^12.0.7 "@mojaloop/central-services-logger": ^11.2.2 "@mojaloop/central-services-metrics": ^12.0.8 - "@mojaloop/central-services-shared": 18.2.0 + "@mojaloop/central-services-shared": 18.3.0 "@mojaloop/event-sdk": ^14.0.0 "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^" - "@mojaloop/sdk-standard-components": v17.4.0 + "@mojaloop/sdk-standard-components": v18.0.0 "@redocly/openapi-cli": ^1.0.0-beta.94 "@types/jest": ^29.5.12 ajv: 8.12.0 @@ -2327,11 +2334,11 @@ __metadata: co-body: ^6.1.0 dotenv: ^16.4.5 env-var: ^7.4.1 - eslint: ^8.56.0 + eslint: ^8.57.0 eslint-config-airbnb-base: ^15.0.0 eslint-plugin-import: ^2.29.1 eslint-plugin-jest: ^27.9.0 - express: ^4.18.2 + express: ^4.18.3 fast-json-patch: ^3.1.1 fast-safe-stringify: ^2.1.1 javascript-state-machine: ^3.1.0 @@ -2343,12 +2350,12 @@ __metadata: koa-body: ^6.0.1 lodash: ^4.17.21 module-alias: ^2.2.3 - nock: ^13.5.3 + nock: ^13.5.4 npm-check-updates: ^16.7.10 oauth2-server: ^4.0.0-dev.2 openapi-jsonschema-parameters: ^12.1.3 openapi-response-validator: ^12.1.3 - openapi-typescript: ^6.7.4 + openapi-typescript: ^6.7.5 prom-client: ^15.1.0 promise-timeout: ^1.3.0 random-word-slugs: ^0.1.7 @@ -2368,27 +2375,27 @@ __metadata: resolution: "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler@workspace:modules/outbound-command-event-handler" dependencies: "@mojaloop/api-snippets": 17.4.0 - "@mojaloop/central-services-shared": ^18.2.0 + "@mojaloop/central-services-shared": ^18.3.0 "@mojaloop/logging-bc-client-lib": ^0.1.17 - "@mojaloop/logging-bc-public-types-lib": ^0.5.2 + "@mojaloop/logging-bc-public-types-lib": ^0.5.4 "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^" "@types/convict": ^6.1.6 "@types/express": ^4.17.21 "@types/jest": ^29.5.12 - "@types/node": ^20.11.19 + "@types/node": ^20.11.27 "@types/node-cache": ^4.2.5 "@types/supertest": ^6.0.2 "@types/swagger-ui-express": ^4.1.6 "@types/yamljs": ^0.2.34 - "@typescript-eslint/eslint-plugin": ^7.0.2 - "@typescript-eslint/parser": ^7.0.2 + "@typescript-eslint/eslint-plugin": ^7.2.0 + "@typescript-eslint/parser": ^7.2.0 ajv: ^8.12.0 convict: ^6.2.4 copyfiles: ^2.4.1 - eslint: ^8.56.0 - express: ^4.18.2 + eslint: ^8.57.0 + express: ^4.18.3 jest: ^29.7.0 - nodemon: ^3.0.3 + nodemon: ^3.1.0 npm-check-updates: ^16.7.10 openapi-backend: ^5.10.6 redis: ^4.6.13 @@ -2397,7 +2404,7 @@ __metadata: swagger-ui-express: ^5.0.0 ts-jest: ^29.1.2 ts-node: ^10.9.2 - typescript: ^5.3.3 + typescript: ^5.4.2 yamljs: ^0.3.0 languageName: unknown linkType: soft @@ -2408,24 +2415,24 @@ __metadata: dependencies: "@mojaloop/api-snippets": 17.4.0 "@mojaloop/logging-bc-client-lib": ^0.1.17 - "@mojaloop/logging-bc-public-types-lib": ^0.5.2 + "@mojaloop/logging-bc-public-types-lib": ^0.5.4 "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^" "@types/convict": ^6.1.6 "@types/express": ^4.17.21 "@types/jest": ^29.5.12 - "@types/node": ^20.11.19 + "@types/node": ^20.11.27 "@types/node-cache": ^4.2.5 "@types/supertest": ^6.0.2 "@types/swagger-ui-express": ^4.1.6 "@types/yamljs": ^0.2.34 - "@typescript-eslint/eslint-plugin": ^7.0.2 - "@typescript-eslint/parser": ^7.0.2 + "@typescript-eslint/eslint-plugin": ^7.2.0 + "@typescript-eslint/parser": ^7.2.0 convict: ^6.2.4 copyfiles: ^2.4.1 - eslint: ^8.56.0 - express: ^4.18.2 + eslint: ^8.57.0 + express: ^4.18.3 jest: ^29.7.0 - nodemon: ^3.0.3 + nodemon: ^3.1.0 npm-check-updates: ^16.7.10 openapi-backend: ^5.10.6 redis: ^4.6.13 @@ -2434,7 +2441,7 @@ __metadata: swagger-ui-express: ^5.0.0 ts-jest: ^29.1.2 ts-node: ^10.9.2 - typescript: ^5.3.3 + typescript: ^5.4.2 yamljs: ^0.3.0 languageName: unknown linkType: soft @@ -2444,20 +2451,20 @@ __metadata: resolution: "@mojaloop/sdk-scheme-adapter-private-shared-lib@workspace:modules/private-shared-lib" dependencies: "@mojaloop/api-snippets": 17.4.0 - "@mojaloop/central-services-shared": ^18.2.0 - "@mojaloop/logging-bc-public-types-lib": ^0.5.2 - "@mojaloop/platform-shared-lib-messaging-types-lib": ^0.5.4 + "@mojaloop/central-services-shared": ^18.3.0 + "@mojaloop/logging-bc-public-types-lib": ^0.5.4 + "@mojaloop/platform-shared-lib-messaging-types-lib": ^0.5.6 "@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": 0.2.15 - "@types/node": ^20.11.19 + "@types/node": ^20.11.27 ajv: ^8.12.0 - eslint: ^8.56.0 + eslint: ^8.57.0 jest: ^29.7.0 npm-check-updates: ^16.7.10 redis: ^4.6.13 replace: ^1.2.2 standard-version: ^9.5.0 ts-jest: ^29.1.2 - typescript: ^5.3.3 + typescript: ^5.4.2 uuid: ^9.0.1 languageName: unknown linkType: soft @@ -2467,17 +2474,17 @@ __metadata: resolution: "@mojaloop/sdk-scheme-adapter@workspace:." dependencies: "@types/jest": ^29.5.12 - "@types/node": ^20.11.19 + "@types/node": ^20.11.27 "@types/node-cache": ^4.2.5 - "@typescript-eslint/eslint-plugin": ^7.0.2 - "@typescript-eslint/parser": ^7.0.2 + "@typescript-eslint/eslint-plugin": ^7.2.0 + "@typescript-eslint/parser": ^7.2.0 audit-ci: ^6.6.1 - eslint: ^8.56.0 - eslint-config-airbnb-typescript: ^17.1.0 + eslint: ^8.57.0 + eslint-config-airbnb-typescript: ^18.0.0 eslint-plugin-import: latest husky: ^9.0.11 jest: ^29.7.0 - nodemon: ^3.0.3 + nodemon: ^3.1.0 npm-check-updates: ^16.7.10 nx: 16.5.0 replace: ^1.2.2 @@ -2485,21 +2492,21 @@ __metadata: ts-jest: ^29.1.2 ts-node: ^10.9.2 tslib: ^2.6.2 - typescript: ^5.3.3 + typescript: ^5.4.2 yarn-audit-fix: ^10.0.7 languageName: unknown linkType: soft -"@mojaloop/sdk-standard-components@npm:v17.4.0": - version: 17.4.0 - resolution: "@mojaloop/sdk-standard-components@npm:17.4.0" +"@mojaloop/sdk-standard-components@npm:v18.0.0": + version: 18.0.0 + resolution: "@mojaloop/sdk-standard-components@npm:18.0.0" dependencies: base64url: 3.0.1 fast-safe-stringify: ^2.1.1 ilp-packet: 2.2.0 jsonwebtoken: 9.0.2 jws: 4.0.0 - checksum: 285ad04124a01e1c30def7493a391c6409abbdb7b6d763a18c5ce637529a3fdccd359a03fb45a0069872fdae634361a800790035cf66cf6145cbb59cb5e01ca9 + checksum: 444d599df617102450765eb249a962efae753dfc4b65bea29f4748bd7f5fd5fc6a2906abf968441a6021e5e90d0b6932b44a11e4032cb65a050888188848acad languageName: node linkType: hard @@ -3471,12 +3478,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.11.19": - version: 20.11.19 - resolution: "@types/node@npm:20.11.19" +"@types/node@npm:^20.11.27": + version: 20.11.27 + resolution: "@types/node@npm:20.11.27" dependencies: undici-types: ~5.26.4 - checksum: 259d16643ba611ade617a8212e594a3ac014727457507389bbf7213971346ab052d870f1e6e2df0afd0876ecd7874f578bccb130be01e069263cfc7136ddc0c1 + checksum: 24a134a3c18e7261b6d6385c2b7714b6cf93663f30d5df8ca95c649f9cef917a422d77bfd4a18b2c7d190d3a39f445b345ecd9ef6f994e61c7e92f400ecbe80f languageName: node linkType: hard @@ -3611,15 +3618,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/eslint-plugin@npm:7.0.2" +"@typescript-eslint/eslint-plugin@npm:^7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/eslint-plugin@npm:7.2.0" dependencies: "@eslint-community/regexpp": ^4.5.1 - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/type-utils": 7.0.2 - "@typescript-eslint/utils": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/scope-manager": 7.2.0 + "@typescript-eslint/type-utils": 7.2.0 + "@typescript-eslint/utils": 7.2.0 + "@typescript-eslint/visitor-keys": 7.2.0 debug: ^4.3.4 graphemer: ^1.4.0 ignore: ^5.2.4 @@ -3632,25 +3639,25 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: ec65524af6948d3ca8ee709c8eb12b086235467fa9de10e4e692d62e42ca9d8da255cec641f59e6912d7658dc9ecfc29f121e00704107d345310b71914916589 + checksum: 1f6e1d12774f4a2cbe585fdaa0e74982c6b553281624c23646e043547736d2893c4a55fbbee4f7d9d596291f3b94b1856f11c4d71cf6b5bce988945f0fad60d4 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/parser@npm:7.0.2" +"@typescript-eslint/parser@npm:^7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/parser@npm:7.2.0" dependencies: - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/scope-manager": 7.2.0 + "@typescript-eslint/types": 7.2.0 + "@typescript-eslint/typescript-estree": 7.2.0 + "@typescript-eslint/visitor-keys": 7.2.0 debug: ^4.3.4 peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: ac47105ee238f6085c281f2634579ffe2e54f3f62c8540c569536f3229b9a7ba4eeeda947461255266e8d5c4162ab4c43974d174c93591d1a16c3bb0c8123eec + checksum: 21deb2e7ad1fc730f637af08f5c549f30ef5b50f424639f57f5bc01274e648db47c696bb994bb24e87424b593d4084e306447c9431a0c0e4807952996db306f4 languageName: node linkType: hard @@ -3664,22 +3671,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/scope-manager@npm:7.0.2" +"@typescript-eslint/scope-manager@npm:7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/scope-manager@npm:7.2.0" dependencies: - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 - checksum: e8db4d7cab296bb234c720f16b35aef6e44d94f3f0fc1565209e69aa17d2ae63fa4ad8650d77135cd45d658551072179d82d379725751a6b23d9a97f54928484 + "@typescript-eslint/types": 7.2.0 + "@typescript-eslint/visitor-keys": 7.2.0 + checksum: b4ef8e35a56f590fa56cf769e111907828abb4793f482bf57e3fc8c987294ec119acb96359aa4b0150eea7416816e0b2d8635dccd1e4a5c2b02678b0f74def94 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/type-utils@npm:7.0.2" +"@typescript-eslint/type-utils@npm:7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/type-utils@npm:7.2.0" dependencies: - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/utils": 7.0.2 + "@typescript-eslint/typescript-estree": 7.2.0 + "@typescript-eslint/utils": 7.2.0 debug: ^4.3.4 ts-api-utils: ^1.0.1 peerDependencies: @@ -3687,7 +3694,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 288c556dc33fea3ed3089c7075a18b7ca8b1c34dcb7530c4c31c7c0282522266fbfd2f202aae47b4b2e600a9c5fb6bd15a080aad33b2f810f647af25b0d28dea + checksum: d38b91ce2c3ffced243948e4778c3b015cf6a4fe988f35000977bf611c33edf455a92a78e69efe1ffa68257110a286c9c5593553bc32e19170410a1f730efed6 languageName: node linkType: hard @@ -3698,10 +3705,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/types@npm:7.0.2" - checksum: 4224afa1cc2e056f3a83d9a69fd894d2b3b15eaa8319ef075066ffd8d20379983124c7663bee873b541e8a95c5dd61a5bad864eeecc7ec68968b6cb4ca70c6bd +"@typescript-eslint/types@npm:7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/types@npm:7.2.0" + checksum: 237acd24aa55b762ee98904e4f422ba86579325200dcd058b3cbfe70775926e7f00ee0295788d81eb728f3a6326fe4401c648aee9eb1480d9030a441c17520e8 languageName: node linkType: hard @@ -3723,12 +3730,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/typescript-estree@npm:7.0.2" +"@typescript-eslint/typescript-estree@npm:7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.2.0" dependencies: - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/types": 7.2.0 + "@typescript-eslint/visitor-keys": 7.2.0 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -3738,24 +3745,24 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 3fc491081746fa0bb7ba552cdfecd7490de16867541fa6748462856a2a49a60158f65f48ce45f4ae451655ecbce840d065fc5b06d6f0f61d60d0997a2d08cdf2 + checksum: fe882195cad45bb67e7e127efa9c31977348d0ca923ef26bb9fbd03a2ab64e6772e6e60954ba07a437684fae8e35897d71f0e6a1ef8fbf3f0025cd314960cd9d languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/utils@npm:7.0.2" +"@typescript-eslint/utils@npm:7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/utils@npm:7.2.0" dependencies: "@eslint-community/eslint-utils": ^4.4.0 "@types/json-schema": ^7.0.12 "@types/semver": ^7.5.0 - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 + "@typescript-eslint/scope-manager": 7.2.0 + "@typescript-eslint/types": 7.2.0 + "@typescript-eslint/typescript-estree": 7.2.0 semver: ^7.5.4 peerDependencies: eslint: ^8.56.0 - checksum: 76b067290f926cf5f955e5e4217958fec5b83f9071f92ec11c2fb1395c61c0b5481706de7ad0260669c02fa8762e18ff397a1fbba822634880f8c6f1690b957c + checksum: 1d333bdc50c52de5757d860512db0dde5748c5fbf8c66a8a984a3bff10d4cd492878c9d5ca3a49d869fdf8d6cf415594be8e7c3cfb4dfe9e3f3f5db297877ad4 languageName: node linkType: hard @@ -3787,13 +3794,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/visitor-keys@npm:7.0.2" +"@typescript-eslint/visitor-keys@npm:7.2.0": + version: 7.2.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.2.0" dependencies: - "@typescript-eslint/types": 7.0.2 + "@typescript-eslint/types": 7.2.0 eslint-visitor-keys: ^3.4.1 - checksum: f1f97961baa6dda9235576c0ec0c359fd157aa2336b82f46578697f6b1c0ad3a76b28bc0ac586305595aaa1b84fdaaba668e53dd24819ad184d2e1f7031353dc + checksum: d9b11b52737450f213cea5c6e07e4672684da48325905c096ee09302b6b261c0bb226e1e350011bdf127c0cbbdd9e6474c905befdfa0a2118fc89ece16770f2b languageName: node linkType: hard @@ -4327,18 +4334,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:1.6.2": - version: 1.6.2 - resolution: "axios@npm:1.6.2" - dependencies: - follow-redirects: ^1.15.0 - form-data: ^4.0.0 - proxy-from-env: ^1.1.0 - checksum: 4a7429e2b784be0f2902ca2680964391eae7236faa3967715f30ea45464b98ae3f1c6f631303b13dfe721b17126b01f486c7644b9ef276bfc63112db9fd379f8 - languageName: node - linkType: hard - -"axios@npm:^1.0.0, axios@npm:^1.6.7": +"axios@npm:1.6.7, axios@npm:^1.0.0, axios@npm:^1.6.7": version: 1.6.7 resolution: "axios@npm:1.6.7" dependencies: @@ -4615,6 +4611,26 @@ __metadata: languageName: node linkType: hard +"body-parser@npm:1.20.2": + version: 1.20.2 + resolution: "body-parser@npm:1.20.2" + dependencies: + bytes: 3.1.2 + content-type: ~1.0.5 + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + on-finished: 2.4.1 + qs: 6.11.0 + raw-body: 2.5.2 + type-is: ~1.6.18 + unpipe: 1.0.0 + checksum: 14d37ec638ab5c93f6099ecaed7f28f890d222c650c69306872e00b9efa081ff6c596cd9afb9930656aae4d6c4e1c17537bea12bb73c87a217cb3cfea8896737 + languageName: node + linkType: hard + "boolbase@npm:^1.0.0": version: 1.0.0 resolution: "boolbase@npm:1.0.0" @@ -5452,7 +5468,7 @@ __metadata: languageName: node linkType: hard -"content-type@npm:^1.0.4, content-type@npm:~1.0.4": +"content-type@npm:^1.0.4, content-type@npm:~1.0.4, content-type@npm:~1.0.5": version: 1.0.5 resolution: "content-type@npm:1.0.5" checksum: 566271e0a251642254cde0f845f9dd4f9856e52d988f4eb0d0dcffbb7a1f8ec98de7a5215fc628f3bce30fe2fb6fd2bc064b562d721658c59b544e2d34ea2766 @@ -6206,14 +6222,7 @@ __metadata: languageName: node linkType: hard -"dotenv@npm:16.3.1": - version: 16.3.1 - resolution: "dotenv@npm:16.3.1" - checksum: 15d75e7279018f4bafd0ee9706593dd14455ddb71b3bcba9c52574460b7ccaf67d5cf8b2c08a5af1a9da6db36c956a04a1192b101ee102a3e0cf8817bbcf3dfd - languageName: node - linkType: hard - -"dotenv@npm:^16.4.5": +"dotenv@npm:16.4.5, dotenv@npm:^16.4.5": version: 16.4.5 resolution: "dotenv@npm:16.4.5" checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c @@ -6557,17 +6566,16 @@ __metadata: languageName: node linkType: hard -"eslint-config-airbnb-typescript@npm:^17.1.0": - version: 17.1.0 - resolution: "eslint-config-airbnb-typescript@npm:17.1.0" +"eslint-config-airbnb-typescript@npm:^18.0.0": + version: 18.0.0 + resolution: "eslint-config-airbnb-typescript@npm:18.0.0" dependencies: eslint-config-airbnb-base: ^15.0.0 peerDependencies: - "@typescript-eslint/eslint-plugin": ^5.13.0 || ^6.0.0 - "@typescript-eslint/parser": ^5.0.0 || ^6.0.0 - eslint: ^7.32.0 || ^8.2.0 - eslint-plugin-import: ^2.25.3 - checksum: cfd26a2782e322ebfdfbf9a64262332c7653f297c4a32d7b951079eb18bb9502a83d67b3f7ef2cc1c5374ae06098eb454ed010784b3416e7274839083022a08c + "@typescript-eslint/eslint-plugin": ^7.0.0 + "@typescript-eslint/parser": ^7.0.0 + eslint: ^8.56.0 + checksum: 0fc4a79c67f55792bea2ccc7045977f7fdaeeab206c9477e47d6816948e260f8cb8b3cb6d09b385bdd2ae14cdc3aca82a14199d43a8ed75531914c864edbb709 languageName: node linkType: hard @@ -6666,15 +6674,15 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.56.0": - version: 8.56.0 - resolution: "eslint@npm:8.56.0" +"eslint@npm:^8.57.0": + version: 8.57.0 + resolution: "eslint@npm:8.57.0" dependencies: "@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/regexpp": ^4.6.1 "@eslint/eslintrc": ^2.1.4 - "@eslint/js": 8.56.0 - "@humanwhocodes/config-array": ^0.11.13 + "@eslint/js": 8.57.0 + "@humanwhocodes/config-array": ^0.11.14 "@humanwhocodes/module-importer": ^1.0.1 "@nodelib/fs.walk": ^1.2.8 "@ungap/structured-clone": ^1.2.0 @@ -6710,7 +6718,7 @@ __metadata: text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: 883436d1e809b4a25d9eb03d42f584b84c408dbac28b0019f6ea07b5177940bf3cca86208f749a6a1e0039b63e085ee47aca1236c30721e91f0deef5cc5a5136 + checksum: 3a48d7ff85ab420a8447e9810d8087aea5b1df9ef68c9151732b478de698389ee656fd895635b5f2871c89ee5a2652b3f343d11e9db6f8486880374ebc74a2d9 languageName: node linkType: hard @@ -6877,7 +6885,7 @@ __metadata: languageName: node linkType: hard -"express@npm:^4.15.5, express@npm:^4.18.2": +"express@npm:^4.15.5": version: 4.18.2 resolution: "express@npm:4.18.2" dependencies: @@ -6916,6 +6924,45 @@ __metadata: languageName: node linkType: hard +"express@npm:^4.18.3": + version: 4.18.3 + resolution: "express@npm:4.18.3" + dependencies: + accepts: ~1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.2 + content-disposition: 0.5.4 + content-type: ~1.0.4 + cookie: 0.5.0 + cookie-signature: 1.0.6 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: ~1.0.2 + escape-html: ~1.0.3 + etag: ~1.8.1 + finalhandler: 1.2.0 + fresh: 0.5.2 + http-errors: 2.0.0 + merge-descriptors: 1.0.1 + methods: ~1.1.2 + on-finished: 2.4.1 + parseurl: ~1.3.3 + path-to-regexp: 0.1.7 + proxy-addr: ~2.0.7 + qs: 6.11.0 + range-parser: ~1.2.1 + safe-buffer: 5.2.1 + send: 0.18.0 + serve-static: 1.15.0 + setprototypeof: 1.2.0 + statuses: 2.0.1 + type-is: ~1.6.18 + utils-merge: 1.0.1 + vary: ~1.1.2 + checksum: 3d7fc8762a81dee0adf0b604f11627db2af082c5f2234e78a4aa8134f22c51f96c6282063f2f8b87f5dbc70679a3087caccb93b6107e324c6feb3a70960a5864 + languageName: node + linkType: hard + "extend-shallow@npm:^2.0.1": version: 2.0.1 resolution: "extend-shallow@npm:2.0.1" @@ -7153,7 +7200,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.0, follow-redirects@npm:^1.15.4": +"follow-redirects@npm:^1.15.4": version: 1.15.4 resolution: "follow-redirects@npm:1.15.4" peerDependenciesMeta: @@ -8145,10 +8192,10 @@ __metadata: languageName: node linkType: hard -"immutable@npm:4.3.4": - version: 4.3.4 - resolution: "immutable@npm:4.3.4" - checksum: de3edd964c394bab83432429d3fb0b4816b42f56050f2ca913ba520bd3068ec3e504230d0800332d3abc478616e8f55d3787424a90d0952e6aba864524f1afc3 +"immutable@npm:4.3.5": + version: 4.3.5 + resolution: "immutable@npm:4.3.5" + checksum: 0e25dd5c314421faede9e1122ab26cdb638cc3edc8678c4a75dee104279b12621a30c80a480fae7f68bc7e81672f1e672e454dc0fdc7e6cf0af10809348387b8 languageName: node linkType: hard @@ -10596,14 +10643,14 @@ __metadata: languageName: node linkType: hard -"nock@npm:^13.5.3": - version: 13.5.3 - resolution: "nock@npm:13.5.3" +"nock@npm:^13.5.4": + version: 13.5.4 + resolution: "nock@npm:13.5.4" dependencies: debug: ^4.1.0 json-stringify-safe: ^5.0.1 propagate: ^2.0.0 - checksum: f119e71d8e56a456a29bfa00a1d959387210fe8ada69443a7102fa9329a9c5fb2e0db149c4a00d304b11681127efd03fc0e6bc142a4ff609b1e153f70aa8712d + checksum: d31f924e34c87ae985edfb7b5a56e8a4dcfc3a072334ceb6d686326581f93090b3e23492663a64ce61b8df4f365b113231d926bc300bcfe9e5eb309c3e4b8628 languageName: node linkType: hard @@ -10745,9 +10792,9 @@ __metadata: languageName: node linkType: hard -"nodemon@npm:^3.0.3": - version: 3.0.3 - resolution: "nodemon@npm:3.0.3" +"nodemon@npm:^3.1.0": + version: 3.1.0 + resolution: "nodemon@npm:3.1.0" dependencies: chokidar: ^3.5.2 debug: ^4 @@ -10761,7 +10808,7 @@ __metadata: undefsafe: ^2.0.5 bin: nodemon: bin/nodemon.js - checksum: 121ebb6349167d87cefd5767ec453ceb49ec5a8d50146134a54b0e25502c29ad01caaa41460e303b35728439012564782d278b3fef3c615f3c278979c2b7d586 + checksum: 0b721f66ee60d9bf092f6101965bc65769698fa2921d0283d90bbf3f0906aa4f3ac77316682375bd7f09c91679fddb131aa39f9fc839fea57061bbc8e81b60e3 languageName: node linkType: hard @@ -11316,25 +11363,7 @@ __metadata: languageName: node linkType: hard -"openapi-backend@npm:5.10.5": - version: 5.10.5 - resolution: "openapi-backend@npm:5.10.5" - dependencies: - "@apidevtools/json-schema-ref-parser": ^11.1.0 - ajv: ^8.6.2 - bath-es5: ^3.0.3 - cookie: ^0.5.0 - dereference-json-schema: ^0.2.1 - lodash: ^4.17.15 - mock-json-schema: ^1.0.7 - openapi-schema-validator: ^12.0.0 - openapi-types: ^12.0.2 - qs: ^6.9.3 - checksum: 1ae7f54e45c055bb773a1c1f1c4d50d3e53ea07771f3513c879eb4101916d6ca337082bb401b8f3a789853d4591066da21f884dda30716425639e719aefe0449 - languageName: node - linkType: hard - -"openapi-backend@npm:^5.10.6": +"openapi-backend@npm:5.10.6, openapi-backend@npm:^5.10.6": version: 5.10.6 resolution: "openapi-backend@npm:5.10.6" dependencies: @@ -11416,9 +11445,9 @@ __metadata: languageName: node linkType: hard -"openapi-typescript@npm:^6.7.4": - version: 6.7.4 - resolution: "openapi-typescript@npm:6.7.4" +"openapi-typescript@npm:^6.7.5": + version: 6.7.5 + resolution: "openapi-typescript@npm:6.7.5" dependencies: ansi-colors: ^4.1.3 fast-glob: ^3.3.2 @@ -11428,7 +11457,7 @@ __metadata: yargs-parser: ^21.1.1 bin: openapi-typescript: bin/cli.js - checksum: bb1fa984088f3d0d985cf05dd39c53bf3d11a8d70afc5f2183d2f96c133fc0bc37c3328fc7ca357c5b5e48937b1cae7fe84ed093fbe4f3a70c1952a3761ceec2 + checksum: f404cf8e5cdc59a6773cfd9adfd3545159a2d59d7393f97d003d9f8be6a28e0a71cfbb502da66bdd7c38ec2ad92b5b570202aa243bda908fafe31ea130c9f976 languageName: node linkType: hard @@ -14229,23 +14258,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.3.3": - version: 5.3.3 - resolution: "typescript@npm:5.3.3" +"typescript@npm:^5.4.2": + version: 5.4.2 + resolution: "typescript@npm:5.4.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 2007ccb6e51bbbf6fde0a78099efe04dc1c3dfbdff04ca3b6a8bc717991862b39fd6126c0c3ebf2d2d98ac5e960bcaa873826bb2bb241f14277034148f41f6a2 + checksum: 96d80fde25a09bcb04d399082fb27a808a9e17c2111e43849d2aafbd642d835e4f4ef0de09b0ba795ec2a700be6c4c2c3f62bf4660c05404c948727b5bbfb32a languageName: node linkType: hard -"typescript@patch:typescript@^5.3.3#~builtin": - version: 5.3.3 - resolution: "typescript@patch:typescript@npm%3A5.3.3#~builtin::version=5.3.3&hash=14eedb" +"typescript@patch:typescript@^5.4.2#~builtin": + version: 5.4.2 + resolution: "typescript@patch:typescript@npm%3A5.4.2#~builtin::version=5.4.2&hash=14eedb" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: f61375590b3162599f0f0d5b8737877ac0a7bc52761dbb585d67e7b8753a3a4c42d9a554c4cc929f591ffcf3a2b0602f65ae3ce74714fd5652623a816862b610 + checksum: c1b669146bca5529873aae60870e243fa8140c85f57ca32c42f898f586d73ce4a6b4f6bb02ae312729e214d7f5859a0c70da3e527a116fdf5ad00c9fc733ecc6 languageName: node linkType: hard @@ -14955,10 +14984,12 @@ __metadata: languageName: node linkType: hard -"yaml@npm:2.3.4": - version: 2.3.4 - resolution: "yaml@npm:2.3.4" - checksum: e6d1dae1c6383bcc8ba11796eef3b8c02d5082911c6723efeeb5ba50fc8e881df18d645e64de68e421b577296000bea9c75d6d9097c2f6699da3ae0406c030d8 +"yaml@npm:2.4.1": + version: 2.4.1 + resolution: "yaml@npm:2.4.1" + bin: + yaml: bin.mjs + checksum: 4c391d07a5d5e935e058babb71026c9cdc9a6fd889e35dd91b53cfb0a12691b67c6c5c740858e71345fef18cd9c13c554a6dda9196f59820d769d94041badb0b languageName: node linkType: hard From 375e9048cc47f591d450ccd53ab9021b2778e3fd Mon Sep 17 00:00:00 2001 From: Kevin Leyow Date: Wed, 13 Mar 2024 10:07:31 -0500 Subject: [PATCH 3/3] audit --- audit-ci.jsonc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/audit-ci.jsonc b/audit-ci.jsonc index d3f7708c7..16315cb4c 100644 --- a/audit-ci.jsonc +++ b/audit-ci.jsonc @@ -28,6 +28,8 @@ // Issue with PostCSS library (https://github.com/advisories/GHSA-7fh5-64p2-3v2j) "GHSA-7fh5-64p2-3v2j", // SSRF attacks against npm IP (https://github.com/advisories/GHSA-78xj-cgh5-2h22) - "GHSA-78xj-cgh5-2h22" + "GHSA-78xj-cgh5-2h22", + // https://github.com/advisories/GHSA-rm97-x556-q36h + "GHSA-rm97-x556-q36h", ] }