From 4c30aa2e570478c4b7f2e33703e53545b92d0350 Mon Sep 17 00:00:00 2001 From: Juan Correa Date: Tue, 21 Jan 2020 00:52:19 -0800 Subject: [PATCH] Issue826-IntegrateEventFrameworkIntoALS (#139) * Issue826-WipRegisterEventPluginApplySpanToRouteHandlerAndModelLogic * Issue826-UpdatingRequireSrcLibUtilRequirePathAndAddNewLineAtSrcLibUtil * Issue826-EventFrameworkIntegration -update swagger operation ids to follow convention -configure event framework to additional operations -update unit tests to account for headers and span parameters * Issue826-EventFrameworkIntegration -run audit check and resolve and reminder -set package version to 8.5.0 -remove comments from oracle tests * Issue826-UpdateIntegrationTestAddHeaderAndSpan * Issue826-EventFrameworkIntegrationRemovePayloadRetrievalFromDeleteOracle * Issue826-EventFrameworkIntegrationRemovePayloadRetrievalFromDeleteEndpointcache * Issue826-EventFrameworkIntegrationFixPartiesTypeIdErrorUnitTest * Issue826-CleaupNotImplemenetedPUTParticipantsTypeIdSubIdErrorEndpoint * Issue826-Fix2UnitTestForParticipantsTypeIdErrorAndRemoveUnnecessaryQuotesPerStandard * Issue826-UpdateDependencies * Issue826-TestIntegrationChangeWithOlderHapiSwaggerVersion * Issue826-IgnoreHapiSwaggerFixIntegrationTest * Issue826-UpdateIntegrationTestCreateSpanManually * Issue826-UpdateIntegrationTestAddEsLintPlusAuditCheck * Issue1086-UpdateTagsContentAndTagUtilUpdateDepsAndResolveAuditChecks * Issue1086-FixIndentationPerStandard * 1086-UpdatePackageVersionAndReAddEventSDKDependencyAfterMergeRemovedIt * 1086-RefactorPerPRReviewMoveEventCodeToHandlerFromDomainUpdateDependencies * 826-UpdateVersionAndUpdateDependencies --- .eslintrc | 6 +- audit-resolve.json | 40 +- package-lock.json | 1257 ++++++++++++----- package.json | 17 +- src/domain/participants/participants.js | 32 +- src/domain/parties/parties.js | 23 +- src/handlers/endpointcache.js | 9 + src/handlers/oracles.js | 17 + src/handlers/oracles/{ID}.js | 21 + src/handlers/participants.js | 14 +- src/handlers/participants/{Type}/{ID}.js | 28 +- .../participants/{Type}/{ID}/error.js | 13 +- src/handlers/parties/{Type}/{ID}.js | 23 +- src/handlers/parties/{Type}/{ID}/error.js | 14 +- src/interface/admin_swagger.json | 22 +- src/interface/api_swagger.json | 105 +- src/lib/util.js | 19 + src/models/participantEndpoint/facade.js | 16 +- src/plugins.js | 4 +- test/integration/domain/oracle/index.test.js | 15 +- test/unit/domain/oracle/oracle.test.js | 91 +- .../domain/participants/participants.test.js | 2 +- .../participants/{Type}/{ID}/error.test.js | 40 +- .../parties/{Type}/{ID}/error.test.js | 16 +- 24 files changed, 1374 insertions(+), 470 deletions(-) create mode 100644 src/lib/util.js diff --git a/.eslintrc b/.eslintrc index 52e5db58..b5efd7d1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,7 +23,9 @@ }, "env": { "es6": true, - "node": true + "node": true, + "jest/globals": true }, - "extends": "eslint:recommended" + "extends": ["eslint:recommended", "plugin:jest/all"], + "plugins": ["jest"] } diff --git a/audit-resolve.json b/audit-resolve.json index 78b23299..c651aee3 100644 --- a/audit-resolve.json +++ b/audit-resolve.json @@ -25,16 +25,44 @@ "madeAt": 1574094978728 }, "1300|nyc>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1574094978728 + "decision": "postpone", + "madeAt": 1573225898636 + }, + "1316|hapi-swagger>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 }, "1316|jest>jest-cli>@jest/core>@jest/reporters>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1574094978728 + "decision": "postpone", + "madeAt": 1575494053928 }, "1316|nyc>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1574094978728 + "decision": "postpone", + "madeAt": 1575494053928 + }, + "1324|hapi-swagger>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 + }, + "1324|jest>jest-cli>@jest/core>@jest/reporters>istanbul-reports>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 + }, + "1324|nyc>istanbul-reports>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 + }, + "1325|hapi-swagger>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 + }, + "1325|jest>jest-cli>@jest/core>@jest/reporters>istanbul-reports>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 + }, + "1325|nyc>istanbul-reports>handlebars": { + "decision": "postpone", + "madeAt": 1575494053928 } }, "rules": {}, diff --git a/package-lock.json b/package-lock.json index fc99ef23..d296e4ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "account-lookup-service", - "version": "8.8.0", + "version": "8.8.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1053,11 +1053,11 @@ } }, "@mojaloop/central-services-error-handling": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-8.6.2.tgz", - "integrity": "sha512-VaIkDLNkICvb9EMvKQKXPuaxhsOhrcnJbAO6DrQKuqYl3hq7FD/4w6bAmOhJ6OEUNVbn3Baukk0hHigKcv2YGw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-8.7.0.tgz", + "integrity": "sha512-3CanhajjN1l3dHy4P2f5IM8DGe6A+aXMn1v46RDfFwwKehfoJfmwV2sYNumXWUDRmEYsYL4L3IdoY+E8hHTZzA==", "requires": { - "@mojaloop/sdk-standard-components": "8.6.1", + "@mojaloop/sdk-standard-components": "8.6.7", "lodash": "4.17.15" } }, @@ -1119,6 +1119,28 @@ } } }, + "@mojaloop/event-sdk": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@mojaloop/event-sdk/-/event-sdk-8.3.0.tgz", + "integrity": "sha512-Shc2NMZPHu8BKU9qPNxJVUhocr+l500DYZ2v+gxDjUL9PgmBCcFKsmGyf10PtV5xK9bLWxviWrhvXdZZyOQ6oQ==", + "requires": { + "@grpc/proto-loader": "0.5.2", + "@mojaloop/central-services-logger": "8.1.2", + "@types/protobufjs": "6.0.0", + "brototype": "0.0.6", + "error-callsites": "2.0.2", + "grpc": "1.24.0", + "lodash": "4.17.15", + "moment": "2.24.0", + "parse-strings-in-object": "1.2.0", + "protobufjs": "6.8.8", + "rc": "1.2.8", + "serialize-error": "4.1.0", + "sinon": "7.5.0", + "traceparent": "1.0.0", + "uuid4": "1.1.4" + } + }, "@mojaloop/sdk-standard-components": { "version": "8.1.4", "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-8.1.4.tgz", @@ -1131,6 +1153,83 @@ "request": "^2.34", "request-promise-native": "^1.0.7" } + }, + "@sinonjs/formatio": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", + "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "requires": { + "@sinonjs/commons": "^1", + "@sinonjs/samsam": "^3.1.0" + } + }, + "@sinonjs/samsam": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", + "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "requires": { + "@sinonjs/commons": "^1.3.0", + "array-from": "^2.1.1", + "lodash": "^4.17.15" + }, + "dependencies": { + "array-from": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", + "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=" + } + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" + }, + "lolex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", + "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==" + }, + "nise": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", + "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "requires": { + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "lolex": "^5.0.1", + "path-to-regexp": "^1.7.0" + }, + "dependencies": { + "lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "requires": { + "@sinonjs/commons": "^1.7.0" + } + } + } + }, + "parse-strings-in-object": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parse-strings-in-object/-/parse-strings-in-object-1.2.0.tgz", + "integrity": "sha512-lI8XgBWZ5COL0G2G6MsLqPSc4X/SnYPw5jGDiins/qzdOdlY493j/niCY9UiJqWjDoeY20k7vhEXvKRHTy6Dfw==" + }, + "sinon": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", + "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", + "requires": { + "@sinonjs/commons": "^1.4.0", + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/samsam": "^3.3.3", + "diff": "^3.5.0", + "lolex": "^4.2.0", + "nise": "^1.5.2", + "supports-color": "^5.5.0" + } } } }, @@ -1160,24 +1259,22 @@ } }, "@mojaloop/central-services-shared": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-8.7.1.tgz", - "integrity": "sha512-kA3jq0HwTfcZV6tWYKJpvVvlD9U+lxyOa9ZDsK7uXmxXJc5DekU8TySRbL6bPMDSeiqYHJaCO3lvhFvK6dD/ng==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-8.8.1.tgz", + "integrity": "sha512-FRBYdjVZlkVJ/AD8yDNTUwnKQ8PCTsxIuAQCT4wPKINedLSgXAcJ+bV27J8nK+1iETSHCar+IVrv3+aRG9Q54Q==", "requires": { "@hapi/catbox": "10.2.3", - "@hapi/catbox-memory": "4.1.1", - "@mojaloop/central-services-error-handling": "8.6.2", + "@hapi/catbox-memory": "5.0.0", + "@mojaloop/central-services-error-handling": "8.7.0", "@mojaloop/central-services-logger": "8.6.0", - "@mojaloop/central-services-stream": "8.4.0", - "@mojaloop/event-sdk": "8.6.2", - "axios": "0.19.0", + "@mojaloop/event-sdk": "8.8.1-snapshot.2", + "axios": "0.19.1", "base64url": "3.0.1", "clone": "2.1.2", - "data-urls": "1.1.0", - "glob": "7.1.6", + "data-urls": "2.0.0", "immutable": "3.8.2", "lodash": "4.17.15", - "mustache": "3.1.0", + "mustache": "3.2.1", "raw-body": "2.4.1" }, "dependencies": { @@ -1190,43 +1287,24 @@ "protobufjs": "^6.8.6" } }, - "@mojaloop/central-services-stream": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-stream/-/central-services-stream-8.4.0.tgz", - "integrity": "sha512-8bxafIFGHb4pZn7lT9xxMh+QyHV9vojSWHSrzST3Z74CyQv5Llj2AzaXpKP0En22Rt7GUc7PKRGs/qSEdMaSUg==", + "@hapi/catbox-memory": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@hapi/catbox-memory/-/catbox-memory-5.0.0.tgz", + "integrity": "sha512-ByuxVJPHNaXwLzbBv4GdTr6ccpe1nG+AfYt+8ftDWEJY7EWBWzD+Klhy5oPTDGzU26pNUh1e7fcYI1ILZRxAXQ==", "requires": { - "@mojaloop/central-services-error-handling": "8.3.0", - "@mojaloop/central-services-logger": "8.1.2", - "async": "3.1.0", - "debug": "4.1.1", - "events": "3.0.0", - "node-rdkafka": "2.7.1", - "raw-body": "2.4.1" - }, - "dependencies": { - "@mojaloop/central-services-error-handling": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-8.3.0.tgz", - "integrity": "sha512-2m/TyJ45AGJ+1hCobLiIj9idb1BGKGhq1LJ5n6nRlF6cJR7wx0+Y2cOlI2khl7VZ+PNdonHL9ODbRo7ZGqFczQ==", - "requires": { - "@mojaloop/sdk-standard-components": "8.1.4", - "lodash": "4.17.15" - } - }, - "@mojaloop/central-services-logger": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-logger/-/central-services-logger-8.1.2.tgz", - "integrity": "sha512-wNnr07xcJNAy+KX2C8Djb6ubeH2c1KkfXMyMJz+/dKrfqyVcqcI0RuhneERZrJMI5Ah4X9Sjcuz+LqH9HQoW/w==", - "requires": { - "winston": "3.2.1" - } - } + "@hapi/boom": "9.x.x", + "@hapi/hoek": "9.x.x" } }, + "@hapi/hoek": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.0.2.tgz", + "integrity": "sha512-LyibKv2QnD9BPI5g2L+g85yiIPv3ajYpENGFgy4u0xCLPhXWG1Zdx29neSB8sgX0/wz6k5TMjHzTwJ6+DaBYOA==" + }, "@mojaloop/event-sdk": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/@mojaloop/event-sdk/-/event-sdk-8.6.2.tgz", - "integrity": "sha512-ZeQffxnRNU7+/2PF2viuje2F5cz5EvvDkfajYZJtL9SBPxPqHlXxEV+J3FmHsM8JMDMr5j8rDwz++mVCyYj8Kw==", + "version": "8.8.1-snapshot.2", + "resolved": "https://registry.npmjs.org/@mojaloop/event-sdk/-/event-sdk-8.8.1-snapshot.2.tgz", + "integrity": "sha512-ufq+PCbASUfVA24jJ7yFKBUNVVeayop9Us8eKh05Ow5AD+JNfoulVDKPnhqDplTuRQ8Jss88u2kjPmcx9B8IXA==", "requires": { "@grpc/proto-loader": "0.5.3", "@mojaloop/central-services-logger": "8.6.0", @@ -1240,66 +1318,663 @@ "protobufjs": "6.8.8", "rc": "1.2.8", "serialize-error": "4.1.0", - "sinon": "7.5.0", + "sinon": "8.0.4", "traceparent": "1.0.0", "tslib": "1.10.0", - "uuid4": "1.1.4" - } - }, - "@mojaloop/sdk-standard-components": { - "version": "8.1.4", - "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-8.1.4.tgz", - "integrity": "sha512-OyUYb3DenwZyUQdvdfpOqUHXlOaHCqedh12Y7RIXPUwanadL/AU+b5RWKm6HY1PrELhvTaBoyzOLRaCrAegx5Q==", - "requires": { - "base64url": "^3.0.1", - "ilp-packet": "2.2.0", - "jsonwebtoken": "^8.5.1", - "jws": "^3.2.2", - "request": "^2.34", - "request-promise-native": "^1.0.7" + "uuid4": "1.1.4", + "winston": "3.2.1" } }, "@sinonjs/formatio": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", - "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-4.0.1.tgz", + "integrity": "sha512-asIdlLFrla/WZybhm0C8eEzaDNNrzymiTqHMeJl6zPW2881l3uuVRpm0QlRQEjqYWv6CcKMGYME3LbrLJsORBw==", "requires": { "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" + "@sinonjs/samsam": "^4.2.0" } }, "@sinonjs/samsam": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", - "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-4.2.2.tgz", + "integrity": "sha512-z9o4LZUzSD9Hl22zV38aXNykgFeVj8acqfFabCY6FY83n/6s/XwNJyYYldz6/9lBJanpno9h+oL6HTISkviweA==", "requires": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" } }, - "async": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", - "integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==" + "axios": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.1.tgz", + "integrity": "sha512-Yl+7nfreYKaLRvAvjNPkvfjnQHJM1yLBY3zhqAwcJSwR/6ETkanUgylgtIvkvz0xJ+p/vZuNw8X7Hnb7Whsbpw==", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "data-urls": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", + "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", + "requires": { + "abab": "^2.0.3", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.0.0" + } }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "grpc": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.24.2.tgz", + "integrity": "sha512-EG3WH6AWMVvAiV15d+lr+K77HJ/KV/3FvMpjKjulXHbTwgDZkhkcWbwhxFAoTdxTkQvy0WFcO3Nog50QBbHZWw==", "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } + "@types/bytebuffer": "^5.0.40", + "lodash.camelcase": "^4.3.0", + "lodash.clone": "^4.5.0", + "nan": "^2.13.2", + "node-pre-gyp": "^0.14.0", + "protobufjs": "^5.0.3" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.3", + "bundled": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "debug": { + "version": "3.2.6", + "bundled": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true + }, + "fs-minipass": { + "version": "1.2.7", + "bundled": true, + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.4", + "bundled": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.3", + "bundled": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "bundled": true + }, + "ini": { + "version": "1.3.5", + "bundled": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "bundled": true + }, + "minipass": { + "version": "2.9.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "bundled": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true + } + } + }, + "ms": { + "version": "2.1.2", + "bundled": true + }, + "needle": { + "version": "2.4.0", + "bundled": true, + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.14.0", + "bundled": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.6", + "bundled": true + }, + "npm-packlist": { + "version": "1.4.6", + "bundled": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true + }, + "protobufjs": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", + "requires": { + "ascli": "~1", + "bytebuffer": "~5", + "glob": "^7.0.5", + "yargs": "^3.10.0" + } + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "bundled": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "sax": { + "version": "1.2.4", + "bundled": true + }, + "semver": { + "version": "5.7.1", + "bundled": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true + }, + "tar": { + "version": "4.4.13", + "bundled": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "yallist": { + "version": "3.1.1", + "bundled": true + } + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, + "nise": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/nise/-/nise-3.0.1.tgz", + "integrity": "sha512-fYcH9y0drBGSoi88kvhpbZEsenX58Yr+wOJ4/Mi1K4cy+iGP/a73gNoyNhu5E9QxPdgTlVChfIaAlnyOy/gHUA==", + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "lolex": "^5.0.1", + "path-to-regexp": "^1.7.0" + } + }, + "sinon": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-8.0.4.tgz", + "integrity": "sha512-cFsmgmvsgFb87e7SV7IcekogITlHX2KmlplyI9Pda0FH1Z8Ms/kWbpLs25Idp0m6ZJ3HEEjhaYYXbcTtWWUn4w==", + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", + "@sinonjs/samsam": "^4.2.1", + "diff": "^4.0.1", + "lolex": "^5.1.2", + "nise": "^3.0.1", + "supports-color": "^7.1.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "tr46": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.0.0.tgz", + "integrity": "sha512-LrErSqfhdUw73AC/eXV2fEmNkvgSYxfm5lvxnLvuVgoVDknvD28Pa5FeDGc8RuVouDxUD3GnHHFv7xnBp7As5w==", + "requires": { + "punycode": "^2.1.1" + } + }, + "webidl-conversions": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", + "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" + }, + "whatwg-url": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.0.0.tgz", + "integrity": "sha512-41ou2Dugpij8/LPO5Pq64K5q++MnRCBpEHvQr26/mArEKTkCV5aoXIqyhuYtE0pkqScXwhf2JP57rkRTYM29lQ==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^2.0.0", + "webidl-conversions": "^5.0.0" + } + } + } + }, + "@mojaloop/central-services-stream": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-stream/-/central-services-stream-8.1.1.tgz", + "integrity": "sha512-hmhBgiqHhQP8XEcHTRoVHWWwdHlv7FSz56U99ieoXNmK/V1Aqfdgo2IXokxOPlCyalwgteq+PpYlioyBje7YfA==", + "requires": { + "@mojaloop/central-services-error-handling": "7.5.0", + "@mojaloop/central-services-logger": "8.1.1", + "async": "3.1.0", + "debug": "4.1.1", + "events": "3.0.0", + "node-rdkafka": "2.7.1", + "raw-body": "2.4.1" + }, + "dependencies": { + "@mojaloop/central-services-error-handling": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-7.5.0.tgz", + "integrity": "sha512-Spjllgyx6Y7En5vj7LaRVM5aTU+uuEykawPQaYzj3ZXAQdyHO4Slns8/ggwQ65T2qyMv1PXiqLK5dPBcIRlWYg==", + "requires": { + "@mojaloop/sdk-standard-components": "7.4.0", + "lodash": "4.17.15" + } + }, + "@mojaloop/central-services-logger": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-logger/-/central-services-logger-8.1.1.tgz", + "integrity": "sha512-ZAum8Mtl4NvW4IBfQ91bXsAvMwKFu1IDN0Ds81PemEB1Q6bQzAb4o5sIymeb55vwBxgR0msCsDsjMhIxBOjGMQ==", + "requires": { + "winston": "3.2.1" + } + }, + "@mojaloop/sdk-standard-components": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-7.4.0.tgz", + "integrity": "sha512-5bpw0oFuSon9Zd7qNOhWoLozHLBPGqcu0vFhxMcLecSA5UPjyq5JJf3tAcaAtnJspkTMDW/GieI0uCr9pCEJzA==", + "requires": { + "base64url": "^3.0.1", + "ilp-packet": "2.2.0", + "jsonwebtoken": "^8.5.1", + "jws": "^3.2.2", + "request": "^2.34", + "request-promise-native": "^1.0.7" + } + }, + "async": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", + "integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==" + } + } + }, + "@mojaloop/event-sdk": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@mojaloop/event-sdk/-/event-sdk-8.7.0.tgz", + "integrity": "sha512-pJX9R7lDUt0UgE+2cddcJ6pCpLzX/J3fV5lO84Es+mK/pym2W7QVPcJF3flK7I46tYJ9fNC/Z+wYnmmLMbFuYQ==", + "requires": { + "@grpc/proto-loader": "0.5.3", + "@mojaloop/central-services-logger": "8.6.0", + "@types/protobufjs": "6.0.0", + "brototype": "0.0.6", + "error-callsites": "2.0.2", + "grpc": "1.24.2", + "lodash": "4.17.15", + "moment": "2.24.0", + "parse-strings-in-object": "2.0.0", + "protobufjs": "6.8.8", + "rc": "1.2.8", + "serialize-error": "4.1.0", + "sinon": "8.0.4", + "traceparent": "1.0.0", + "tslib": "1.10.0", + "uuid4": "1.1.4" + }, + "dependencies": { + "@grpc/proto-loader": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.3.tgz", + "integrity": "sha512-8qvUtGg77G2ZT2HqdqYoM/OY97gQd/0crSG34xNmZ4ZOsv3aQT/FQV9QfZPazTGna6MIoyUd+u6AxsoZjJ/VMQ==", + "requires": { + "lodash.camelcase": "^4.3.0", + "protobufjs": "^6.8.6" + } + }, + "@sinonjs/formatio": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-4.0.1.tgz", + "integrity": "sha512-asIdlLFrla/WZybhm0C8eEzaDNNrzymiTqHMeJl6zPW2881l3uuVRpm0QlRQEjqYWv6CcKMGYME3LbrLJsORBw==", + "requires": { + "@sinonjs/commons": "^1", + "@sinonjs/samsam": "^4.2.0" + } + }, + "@sinonjs/samsam": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-4.2.2.tgz", + "integrity": "sha512-z9o4LZUzSD9Hl22zV38aXNykgFeVj8acqfFabCY6FY83n/6s/XwNJyYYldz6/9lBJanpno9h+oL6HTISkviweA==", + "requires": { + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" }, "grpc": { "version": "1.24.2", @@ -1730,211 +2405,60 @@ } } }, - "lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==" - }, - "mustache": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.1.0.tgz", - "integrity": "sha512-3Bxq1R5LBZp7fbFPZzFe5WN4s0q3+gxZaZuZVY+QctYJiCiVgXHOTIC0/HgZuOPFt/6BQcx5u0H2CUOxT/RoGQ==" - }, - "nise": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", - "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", - "requires": { - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "lolex": "^5.0.1", - "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", - "requires": { - "@sinonjs/commons": "^1.7.0" - } - } - } - }, - "sinon": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", - "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", - "requires": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" - } - } - } - }, - "@mojaloop/central-services-stream": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-stream/-/central-services-stream-8.1.1.tgz", - "integrity": "sha512-hmhBgiqHhQP8XEcHTRoVHWWwdHlv7FSz56U99ieoXNmK/V1Aqfdgo2IXokxOPlCyalwgteq+PpYlioyBje7YfA==", - "requires": { - "@mojaloop/central-services-error-handling": "7.5.0", - "@mojaloop/central-services-logger": "8.1.1", - "async": "3.1.0", - "debug": "4.1.1", - "events": "3.0.0", - "node-rdkafka": "2.7.1", - "raw-body": "2.4.1" - }, - "dependencies": { - "@mojaloop/central-services-error-handling": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-7.5.0.tgz", - "integrity": "sha512-Spjllgyx6Y7En5vj7LaRVM5aTU+uuEykawPQaYzj3ZXAQdyHO4Slns8/ggwQ65T2qyMv1PXiqLK5dPBcIRlWYg==", - "requires": { - "@mojaloop/sdk-standard-components": "7.4.0", - "lodash": "4.17.15" - } - }, - "@mojaloop/central-services-logger": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-logger/-/central-services-logger-8.1.1.tgz", - "integrity": "sha512-ZAum8Mtl4NvW4IBfQ91bXsAvMwKFu1IDN0Ds81PemEB1Q6bQzAb4o5sIymeb55vwBxgR0msCsDsjMhIxBOjGMQ==", - "requires": { - "winston": "3.2.1" - } - }, - "@mojaloop/sdk-standard-components": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-7.4.0.tgz", - "integrity": "sha512-5bpw0oFuSon9Zd7qNOhWoLozHLBPGqcu0vFhxMcLecSA5UPjyq5JJf3tAcaAtnJspkTMDW/GieI0uCr9pCEJzA==", - "requires": { - "base64url": "^3.0.1", - "ilp-packet": "2.2.0", - "jsonwebtoken": "^8.5.1", - "jws": "^3.2.2", - "request": "^2.34", - "request-promise-native": "^1.0.7" - } - }, - "async": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", - "integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==" - } - } - }, - "@mojaloop/event-sdk": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/@mojaloop/event-sdk/-/event-sdk-8.3.0.tgz", - "integrity": "sha512-Shc2NMZPHu8BKU9qPNxJVUhocr+l500DYZ2v+gxDjUL9PgmBCcFKsmGyf10PtV5xK9bLWxviWrhvXdZZyOQ6oQ==", - "requires": { - "@grpc/proto-loader": "0.5.2", - "@mojaloop/central-services-logger": "8.1.2", - "@types/protobufjs": "6.0.0", - "brototype": "0.0.6", - "error-callsites": "2.0.2", - "grpc": "1.24.0", - "lodash": "4.17.15", - "moment": "2.24.0", - "parse-strings-in-object": "1.2.0", - "protobufjs": "6.8.8", - "rc": "1.2.8", - "serialize-error": "4.1.0", - "sinon": "7.5.0", - "traceparent": "1.0.0", - "uuid4": "1.1.4" - }, - "dependencies": { - "@mojaloop/central-services-logger": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-logger/-/central-services-logger-8.1.2.tgz", - "integrity": "sha512-wNnr07xcJNAy+KX2C8Djb6ubeH2c1KkfXMyMJz+/dKrfqyVcqcI0RuhneERZrJMI5Ah4X9Sjcuz+LqH9HQoW/w==", - "requires": { - "winston": "3.2.1" - } - }, - "@sinonjs/formatio": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", - "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", - "requires": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" - } + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, - "@sinonjs/samsam": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", - "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", "requires": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" + "@sinonjs/commons": "^1.7.0" } }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" - }, - "lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==" - }, "nise": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", - "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/nise/-/nise-3.0.1.tgz", + "integrity": "sha512-fYcH9y0drBGSoi88kvhpbZEsenX58Yr+wOJ4/Mi1K4cy+iGP/a73gNoyNhu5E9QxPdgTlVChfIaAlnyOy/gHUA==", "requires": { - "@sinonjs/formatio": "^3.2.1", + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", "@sinonjs/text-encoding": "^0.7.1", "just-extend": "^4.0.2", "lolex": "^5.0.1", "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", - "requires": { - "@sinonjs/commons": "^1.7.0" - } - } } }, - "parse-strings-in-object": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/parse-strings-in-object/-/parse-strings-in-object-1.2.0.tgz", - "integrity": "sha512-lI8XgBWZ5COL0G2G6MsLqPSc4X/SnYPw5jGDiins/qzdOdlY493j/niCY9UiJqWjDoeY20k7vhEXvKRHTy6Dfw==" - }, "sinon": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", - "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-8.0.4.tgz", + "integrity": "sha512-cFsmgmvsgFb87e7SV7IcekogITlHX2KmlplyI9Pda0FH1Z8Ms/kWbpLs25Idp0m6ZJ3HEEjhaYYXbcTtWWUn4w==", + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", + "@sinonjs/samsam": "^4.2.1", + "diff": "^4.0.1", + "lolex": "^5.1.2", + "nise": "^3.0.1", + "supports-color": "^7.1.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" + "has-flag": "^4.0.0" } } } }, "@mojaloop/sdk-standard-components": { - "version": "8.6.1", - "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-8.6.1.tgz", - "integrity": "sha512-KN8OO+uwoIfUZG9XamUNtY+doXlaNSae9ZZDpNhYjsVkaR1uE6TKPXiisH1gHMGkr9nNMCw8ON6EQr8s4jSO+A==", + "version": "8.6.7", + "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-8.6.7.tgz", + "integrity": "sha512-pDojVFEkHYGp2znje9qUQor1WsUx9ue5v3ToxBrl60X/Ydq//KbraknnedHvpAhwkxXS0SkaJwQp9Qc3sWau1Q==", "requires": { "base64url": "^3.0.1", "ilp-packet": "2.2.0", @@ -2045,24 +2569,24 @@ } }, "@sinonjs/formatio": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", - "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-4.0.1.tgz", + "integrity": "sha512-asIdlLFrla/WZybhm0C8eEzaDNNrzymiTqHMeJl6zPW2881l3uuVRpm0QlRQEjqYWv6CcKMGYME3LbrLJsORBw==", "dev": true, "requires": { "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" + "@sinonjs/samsam": "^4.2.0" } }, "@sinonjs/samsam": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", - "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-4.2.2.tgz", + "integrity": "sha512-z9o4LZUzSD9Hl22zV38aXNykgFeVj8acqfFabCY6FY83n/6s/XwNJyYYldz6/9lBJanpno9h+oL6HTISkviweA==", "dev": true, "requires": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" } }, "@sinonjs/text-encoding": { @@ -2161,9 +2685,9 @@ } }, "@types/jest": { - "version": "24.0.23", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.23.tgz", - "integrity": "sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.0.tgz", + "integrity": "sha512-dXvuABY9nM1xgsXlOtLQXJKdacxZJd7AtvLsKZ/0b57ruMXDKCOXAC/M75GbllQX6o1pcZ5hAG4JzYy7Z/wM2w==", "dev": true, "requires": { "jest-diff": "^24.3.0" @@ -2175,9 +2699,9 @@ "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" }, "@types/node": { - "version": "10.17.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.6.tgz", - "integrity": "sha512-0a2X6cgN3RdPBL2MIlR6Lt0KlM7fOFsutuXcdglcOq6WvLnYXgPQSh0Mx6tO1KCAE8MxbHSOSTWDoUxRq+l3DA==" + "version": "10.17.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.13.tgz", + "integrity": "sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg==" }, "@types/protobufjs": { "version": "6.0.0", @@ -2431,11 +2955,6 @@ "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "dev": true }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=" - }, "array-includes": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", @@ -3742,9 +4261,9 @@ } }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "diff-sequences": { @@ -4014,9 +4533,9 @@ } }, "eslint": { - "version": "6.7.2", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.2.tgz", - "integrity": "sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -4462,6 +4981,11 @@ "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", "dev": true }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" + }, "espree": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", @@ -6189,6 +6713,39 @@ "bytebuffer": "~5", "glob": "^7.0.5", "yargs": "^3.10.0" + }, + "dependencies": { + "ascli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", + "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=", + "requires": { + "colour": "~0.7.1", + "optjs": "~3.2.2" + } + }, + "bytebuffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", + "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", + "requires": { + "long": "~3" + } + }, + "yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", + "requires": { + "camelcase": "^2.0.1", + "cliui": "^3.0.3", + "decamelize": "^1.1.1", + "os-locale": "^1.4.0", + "string-width": "^1.0.1", + "window-size": "^0.1.4", + "y18n": "^3.2.0" + } + } } }, "rc": { @@ -8443,14 +9000,15 @@ "dev": true }, "knex": { - "version": "0.20.4", - "resolved": "https://registry.npmjs.org/knex/-/knex-0.20.4.tgz", - "integrity": "sha512-gNpYj9BtacWnQwkyPaHOlzHRLJ7N6Abz8AKYb4OqoDA/iCY50VAUSpigjkS7Z4sr7uW64sxW2cVoXudaLN1ZQw==", + "version": "0.20.8", + "resolved": "https://registry.npmjs.org/knex/-/knex-0.20.8.tgz", + "integrity": "sha512-fLiSg5PIBisORs0M+UGjg2s1P/E1BrYvb/NkSVk6Y90HJujkqLufSC6ag+hDgXqW73mFAF283M6+q3/NW0TrHw==", "requires": { - "bluebird": "^3.7.1", + "bluebird": "^3.7.2", "colorette": "1.1.0", - "commander": "^4.0.1", + "commander": "^4.1.0", "debug": "4.1.1", + "esm": "^3.2.25", "getopts": "2.2.5", "inherits": "~2.0.4", "interpret": "^2.0.0", @@ -8464,6 +9022,11 @@ "v8flags": "^3.1.3" }, "dependencies": { + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, "interpret": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.0.0.tgz", @@ -8663,10 +9226,13 @@ } }, "lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", - "dev": true + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } }, "long": { "version": "3.2.0", @@ -9056,9 +9622,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "mustache": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.1.0.tgz", - "integrity": "sha512-3Bxq1R5LBZp7fbFPZzFe5WN4s0q3+gxZaZuZVY+QctYJiCiVgXHOTIC0/HgZuOPFt/6BQcx5u0H2CUOxT/RoGQ==" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.2.1.tgz", + "integrity": "sha512-RERvMFdLpaFfSRIEe632yDm5nsd0SDKn8hGmcUwswnyiE5mtdZLDybtHAz6hjJhawokF0hXvGLtx9mrQfm6FkA==" }, "mute-stream": { "version": "0.0.8", @@ -9123,27 +9689,17 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, "nise": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", - "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/nise/-/nise-3.0.1.tgz", + "integrity": "sha512-fYcH9y0drBGSoi88kvhpbZEsenX58Yr+wOJ4/Mi1K4cy+iGP/a73gNoyNhu5E9QxPdgTlVChfIaAlnyOy/gHUA==", "dev": true, "requires": { - "@sinonjs/formatio": "^3.2.1", + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", "@sinonjs/text-encoding": "^0.7.1", "just-extend": "^4.0.2", "lolex": "^5.0.1", "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.7.0" - } - } } }, "node-alias": { @@ -11629,18 +12185,35 @@ } }, "sinon": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", - "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-8.0.4.tgz", + "integrity": "sha512-cFsmgmvsgFb87e7SV7IcekogITlHX2KmlplyI9Pda0FH1Z8Ms/kWbpLs25Idp0m6ZJ3HEEjhaYYXbcTtWWUn4w==", "dev": true, "requires": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", + "@sinonjs/samsam": "^4.2.1", + "diff": "^4.0.1", + "lolex": "^5.1.2", + "nise": "^3.0.1", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "sisteransi": { diff --git a/package.json b/package.json index 4ebf3885..1b957b56 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "account-lookup-service", "description": "Account Lookup Service is used to validate Party and Participant lookups", - "version": "8.8.0", + "version": "8.8.1", "license": "Apache-2.0", "author": "ModusBox", "contributors": [ @@ -71,11 +71,12 @@ "@hapi/inert": "5.2.2", "@hapi/vision": "5.5.4", "@mojaloop/central-services-database": "8.2.1", - "@mojaloop/central-services-error-handling": "8.6.2", + "@mojaloop/central-services-error-handling": "8.7.0", "@mojaloop/central-services-health": "8.3.0", "@mojaloop/central-services-logger": "8.6.0", "@mojaloop/central-services-metrics": "8.3.0", - "@mojaloop/central-services-shared": "8.7.1", + "@mojaloop/central-services-shared": "8.8.1", + "@mojaloop/event-sdk": "8.7.0", "@now-ims/hapi-now-auth": "2.0.0", "blipp": "4.0.1", "commander": "4.1.0", @@ -84,8 +85,8 @@ "hapi-openapi": "1.2.6", "hapi-swagger": "10.3.0", "json-rules-engine": "5.0.0", - "knex": "0.20.4", - "mustache": "3.1.0", + "knex": "0.20.8", + "mustache": "3.2.1", "mysql": "2.17.1", "npm-run-all": "4.1.5", "parse-strings-in-object": "2.0.0", @@ -93,8 +94,8 @@ "uuid4": "1.1.4" }, "devDependencies": { - "@types/jest": "24.0.23", - "eslint": "6.7.2", + "@types/jest": "24.9.0", + "eslint": "6.8.0", "get-port": "5.0.0", "jest": "24.9.0", "jest-junit": "10.0.0", @@ -105,7 +106,7 @@ "nyc": "15.0.0", "pre-commit": "1.2.2", "proxyquire": "2.1.3", - "sinon": "7.5.0", + "sinon": "8.0.4", "standard": "14.3.1", "swagmock": "1.0.0", "tap-xunit": "2.4.1" diff --git a/src/domain/participants/participants.js b/src/domain/participants/participants.js index d719459c..a1d6eaec 100644 --- a/src/domain/participants/participants.js +++ b/src/domain/participants/participants.js @@ -20,6 +20,7 @@ - Rajiv Mothilal - Steven Oderayi + - Juan Correa -------------- ******/ @@ -42,9 +43,9 @@ const Config = require('../../lib/config') * @param {object} params - uri parameters of the http request * @param {string} method - http request method * @param {object} query - uri query parameters of the http request - * + * @param {object} span * */ -const getParticipantsByTypeAndID = async (headers, params, method, query) => { +const getParticipantsByTypeAndID = async (headers, params, method, query, span) => { try { Logger.info('getParticipantsByTypeAndID::begin') const type = params.Type @@ -52,7 +53,7 @@ const getParticipantsByTypeAndID = async (headers, params, method, query) => { const requesterName = headers[Enums.Http.Headers.FSPIOP.SOURCE] const callbackEndpointType = partySubIdOrType ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT const errorCallbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR - const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE]) + const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], span) if (requesterParticipantModel) { const response = await oracle.oracleRequest(headers, method, params, query) if (response && response.data && Array.isArray(response.data.partyList) && response.data.partyList.length > 0) { @@ -68,10 +69,10 @@ const getParticipantsByTypeAndID = async (headers, params, method, query) => { if (!clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION] || clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION] === '') { clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION] = payload.fspId } - await participant.sendRequest(clonedHeaders, requesterName, callbackEndpointType, Enums.Http.RestMethods.PUT, payload, options) + await participant.sendRequest(clonedHeaders, requesterName, callbackEndpointType, Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT, Enums.Http.RestMethods.PUT, payload, options, span) } else { await participant.sendErrorToParticipant(requesterName, errorCallbackEndpointType, - ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } Logger.info('getParticipantsByTypeAndID::end') } else { @@ -84,7 +85,7 @@ const getParticipantsByTypeAndID = async (headers, params, method, query) => { const errorCallbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR await participant.sendErrorToParticipant( headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, - ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } catch (exc) { // We can't do anything else here- we _must_ handle all errors _within_ this function because // we've already sent a sync response- we cannot throw. @@ -217,9 +218,9 @@ const putParticipantsErrorByTypeAndID = async (headers, params, payload, dataUri * @param {string} method - http request method * @param {object} params - uri parameters of the http request * @param {object} payload - payload of the request being sent out - * + * @param {object} span */ -const postParticipants = async (headers, method, params, payload) => { +const postParticipants = async (headers, method, params, payload, span) => { try { Logger.info('postParticipants::begin') const type = params.Type @@ -227,7 +228,7 @@ const postParticipants = async (headers, method, params, payload) => { const callbackEndpointType = partySubIdOrType ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT const errorCallbackEndpointType = partySubIdOrType ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR if (Object.values(Enums.Accounts.PartyAccountTypes).includes(type)) { - const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE]) + const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], span) if (requesterParticipantModel) { const response = await oracle.oracleRequest(headers, method, params, undefined, payload) if (response && response.status === Enums.Http.ReturnCodes.CREATED.CODE) { @@ -257,7 +258,7 @@ const postParticipants = async (headers, method, params, payload) => { await participant.sendRequest(clonedHeaders, clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION], callbackEndpointType, Enums.Http.RestMethods.PUT, responsePayload, options) } else { await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, - ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } } else { Logger.error('Requester FSP not found') @@ -265,7 +266,7 @@ const postParticipants = async (headers, method, params, payload) => { } } else { await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, - ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } Logger.info('postParticipants::end') } catch (err) { @@ -273,7 +274,7 @@ const postParticipants = async (headers, method, params, payload) => { try { const errorCallbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, - ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } catch (exc) { // We can't do anything else here- we _must_ handle all errors _within_ this function because // we've already sent a sync response- we cannot throw. @@ -290,14 +291,15 @@ const postParticipants = async (headers, method, params, payload) => { * @param {object} headers - incoming http request headers * @param {string} method - http request method * @param {object} requestPayload - payload of the request being sent out + * @param {object} span */ -const postParticipantsBatch = async (headers, method, requestPayload) => { +const postParticipantsBatch = async (headers, method, requestPayload, span) => { try { Logger.info('postParticipantsBatch::begin') const typeMap = new Map() const overallReturnList = [] const requestId = requestPayload.requestId - const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE]) + const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], span) if (requesterParticipantModel) { for (const party of requestPayload.partyList) { if (Object.values(Enums.Accounts.PartyAccountTypes).includes(party.partyIdType)) { @@ -363,7 +365,7 @@ const postParticipantsBatch = async (headers, method, requestPayload) => { clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION] = payload.partyList[0].partyId.fspId clonedHeaders[Enums.Http.Headers.FSPIOP.SOURCE] = Enums.Http.Headers.FSPIOP.SWITCH.value } - await participant.sendRequest(clonedHeaders, clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION], Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_BATCH_PUT, Enums.Http.RestMethods.PUT, payload, { requestId }) + await participant.sendRequest(clonedHeaders, clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION], Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_BATCH_PUT, Enums.Http.RestMethods.PUT, payload, { requestId }, span) Logger.info('postParticipantsBatch::end') } else { Logger.error('Requester FSP not found') diff --git a/src/domain/parties/parties.js b/src/domain/parties/parties.js index 4f2879a5..062d14f4 100644 --- a/src/domain/parties/parties.js +++ b/src/domain/parties/parties.js @@ -21,6 +21,7 @@ - Rajiv Mothilal - Henk Kodde - Steven Oderayi + - Juan Correa -------------- ******/ @@ -45,15 +46,16 @@ const Config = require('../../lib/config') * @param {object} params - uri parameters of the http request * @param {string} method - http request method * @param {object} query - uri query parameters of the http request + * @param {object} span */ -const getPartiesByTypeAndID = async (headers, params, method, query) => { +const getPartiesByTypeAndID = async (headers, params, method, query, span = undefined) => { try { Logger.info('parties::getPartiesByTypeAndID::begin') const type = params.Type const partySubIdOrType = params.SubId || undefined const callbackEndpointType = partySubIdOrType ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_SUB_ID_GET : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_GET const errorCallbackEndpointType = partySubIdOrType ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR - const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE]) + const requesterParticipantModel = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], span) if (requesterParticipantModel) { const response = await oracle.oracleRequest(headers, method, params, query) if (response && response.data && Array.isArray(response.data.partyList) && response.data.partyList.length > 0) { @@ -66,7 +68,7 @@ const getPartiesByTypeAndID = async (headers, params, method, query) => { if (!clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION]) { clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION] = response.data.partyList[0].fspId } - await participant.sendRequest(clonedHeaders, response.data.partyList[0].fspId, callbackEndpointType, Enums.Http.RestMethods.GET, undefined, options) + await participant.sendRequest(clonedHeaders, response.data.partyList[0].fspId, callbackEndpointType, Enums.Http.RestMethods.GET, undefined, options, span) } else { const callbackHeaders = createCallbackHeaders({ requestHeaders: headers, @@ -75,7 +77,7 @@ const getPartiesByTypeAndID = async (headers, params, method, query) => { endpointTemplate: partySubIdOrType ? Enums.EndPoints.FspEndpointTemplates.PARTIES_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTemplates.PARTIES_PUT_ERROR }) await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, - ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND).toApiErrorObject(Config.ERROR_HANDLING), callbackHeaders, params) + ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND).toApiErrorObject(Config.ERROR_HANDLING), callbackHeaders, params, span) } } else { Logger.error('Requester FSP not found') @@ -86,7 +88,7 @@ const getPartiesByTypeAndID = async (headers, params, method, query) => { try { const errorCallbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, - ErrorHandler.Factory.reformatFSPIOPError(err).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.reformatFSPIOPError(err).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } catch (exc) { // We can't do anything else here- we _must_ handle all errors _within_ this function because // we've already sent a sync response- we cannot throw. @@ -156,25 +158,26 @@ const putPartiesByTypeAndID = async (headers, params, method, payload, dataUri) * @param {object} params - uri parameters of the http request * @param {object} payload - payload of the request being sent out * @param {string} dataUri - encoded payload of the request being sent out + * @param {object} span */ -const putPartiesErrorByTypeAndID = async (headers, params, payload, dataUri) => { +const putPartiesErrorByTypeAndID = async (headers, params, payload, dataUri, span) => { try { const partySubIdOrType = params.SubId || undefined const callbackEndpointType = partySubIdOrType ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR - const destinationParticipant = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.DESTINATION]) + const destinationParticipant = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.DESTINATION], span) if (destinationParticipant) { const decodedPayload = decodePayload(dataUri, { asParsed: false }) - await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.DESTINATION], callbackEndpointType, decodedPayload.body.toString(), headers, params) + await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.DESTINATION], callbackEndpointType, decodedPayload.body.toString(), headers, params, span) } else { await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], callbackEndpointType, - ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_FSP_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params, payload) + ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_FSP_ERROR).toApiErrorObject(Config.ERROR_HANDLING), headers, params, payload, span) } } catch (err) { Logger.error(err) try { const callbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], callbackEndpointType, - ErrorHandler.Factory.reformatFSPIOPError(err).toApiErrorObject(Config.ERROR_HANDLING), headers, params) + ErrorHandler.Factory.reformatFSPIOPError(err).toApiErrorObject(Config.ERROR_HANDLING), headers, params, span) } catch (exc) { // We can't do anything else here- we _must_ handle all errors _within_ this function because // we've already sent a sync response- we cannot throw. diff --git a/src/handlers/endpointcache.js b/src/handlers/endpointcache.js index 494094d4..74de19ec 100644 --- a/src/handlers/endpointcache.js +++ b/src/handlers/endpointcache.js @@ -26,6 +26,9 @@ const ParticipantEndpointCache = require('@mojaloop/central-services-shared').Util.Endpoints const Config = require('../lib/config.js') +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../lib/util') /** * Operations on /endpointcache @@ -39,6 +42,12 @@ module.exports = { * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ delete: async (request, h) => { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.ENDPOINTCACHE, Enum.Events.Event.Action.DELETE) + span.setTags(spanTags) + await span.audit({ + headers: request.headers + }, EventSdk.AuditEventAction.start) await ParticipantEndpointCache.stopCache() await ParticipantEndpointCache.initializeCache(Config.ENDPOINT_CACHE_CONFIG) return h.response().code(202) diff --git a/src/handlers/oracles.js b/src/handlers/oracles.js index ecc543d9..f40abf5d 100644 --- a/src/handlers/oracles.js +++ b/src/handlers/oracles.js @@ -25,6 +25,9 @@ 'use strict' const oracle = require('../domain/oracle') +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../lib/util') /** * Operations on /oracles @@ -38,6 +41,13 @@ module.exports = { * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503 */ get: async (request, h) => { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.ORACLE, Enum.Events.Event.Action.LOOKUP) + span.setTags(spanTags) + await span.audit({ + headers: request.headers, + query: request.query + }, EventSdk.AuditEventAction.start) const response = await oracle.getOracle(request.query) return h.response(response).code(200) }, @@ -49,6 +59,13 @@ module.exports = { * responses: 201, 400, 401, 403, 404, 405, 406, 501, 503 */ post: async (request, h) => { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.ORACLE, Enum.Events.Event.Action.POST) + span.setTags(spanTags) + await span.audit({ + headers: request.headers, + payload: request.payload + }, EventSdk.AuditEventAction.start) await oracle.createOracle(request.payload) return h.response().code(201) } diff --git a/src/handlers/oracles/{ID}.js b/src/handlers/oracles/{ID}.js index dee155a0..477a9c70 100644 --- a/src/handlers/oracles/{ID}.js +++ b/src/handlers/oracles/{ID}.js @@ -26,6 +26,10 @@ const oracle = require('../../domain/oracle') const ErrorHandler = require('@mojaloop/central-services-error-handling') +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../../lib/util') +const Logger = require('@mojaloop/central-services-logger') /** * Operations on /oracles/{ID} @@ -39,10 +43,19 @@ module.exports = { * responses: 204, 400, 401, 403, 404, 405, 406, 501, 503 */ put: async (request, h) => { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.ORACLE, Enum.Events.Event.Action.PUT) + span.setTags(spanTags) + await span.audit({ + headers: request.headers, + payload: request.payload + }, EventSdk.AuditEventAction.start) + const metadata = `${request.method} ${request.path}` try { await oracle.updateOracle(request.params, request.payload) return h.response().code(204) } catch (err) { + Logger.error(`ERROR - ${metadata}: ${err.stack}`) throw ErrorHandler.Factory.reformatFSPIOPError(err) } }, @@ -54,10 +67,18 @@ module.exports = { * responses: 204, 400, 401, 403, 404, 405, 406, 501, 503 */ delete: async (request, h) => { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.ORACLE, Enum.Events.Event.Action.DELETE) + span.setTags(spanTags) + await span.audit({ + headers: request.headers + }, EventSdk.AuditEventAction.start) + const metadata = `${request.method} ${request.path}` try { await oracle.deleteOracle(request.params) return h.response().code(204) } catch (err) { + Logger.error(`ERROR - ${metadata}: ${err.stack}`) throw ErrorHandler.Factory.reformatFSPIOPError(err) } } diff --git a/src/handlers/participants.js b/src/handlers/participants.js index 38a176d0..d894e085 100644 --- a/src/handlers/participants.js +++ b/src/handlers/participants.js @@ -24,6 +24,9 @@ *****/ 'use strict' +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../lib/util') const participants = require('../domain/participants') /** @@ -37,10 +40,17 @@ module.exports = { * produces: application/json * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ - post: function (req, h) { + post: async function (req, h) { + const span = req.span + const spanTags = LibUtil.getSpanTags(req, Enum.Events.Event.Type.PARTICIPANT, Enum.Events.Event.Action.POST) + span.setTags(spanTags) + await span.audit({ + headers: req.headers, + payload: req.payload + }, EventSdk.AuditEventAction.start) // Here we call an async function- but as we send an immediate sync response, _all_ errors // _must_ be handled by postParticipantsBatch. - participants.postParticipantsBatch(req.headers, req.method, req.payload) + participants.postParticipantsBatch(req.headers, req.method, req.payload, span) return h.response().code(200) } } diff --git a/src/handlers/participants/{Type}/{ID}.js b/src/handlers/participants/{Type}/{ID}.js index 200f58a9..95c91ae7 100644 --- a/src/handlers/participants/{Type}/{ID}.js +++ b/src/handlers/participants/{Type}/{ID}.js @@ -19,11 +19,15 @@ * Name Surname * Rajiv Mothilal + * Juan Correa -------------- ******/ 'use strict' +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../../../lib/util') const participants = require('../../../domain/participants') const Logger = require('@mojaloop/central-services-logger') const ErrorHandler = require('@mojaloop/central-services-error-handling') @@ -39,10 +43,17 @@ module.exports = { * produces: application/json * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ - get: function (req, h) { - const metadata = `${req.method} ${req.path}` + get: async function (request, h) { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.PARTICIPANT, Enum.Events.Event.Action.LOOKUP) + span.setTags(spanTags) + await span.audit({ + headers: request.headers, + payload: request.payload + }, EventSdk.AuditEventAction.start) + const metadata = `${request.method} ${request.path}` try { - participants.getParticipantsByTypeAndID(req.headers, req.params, req.method, req.query) + participants.getParticipantsByTypeAndID(request.headers, request.params, request.method, request.query, span) } catch (err) { Logger.error(`ERROR - ${metadata}: ${err}`) throw ErrorHandler.Factory.reformatFSPIOPError(err) @@ -73,10 +84,17 @@ module.exports = { * produces: application/json * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ - post: function (request, h) { + post: async function (request, h) { + const span = request.span + const spanTags = LibUtil.getSpanTags(request, Enum.Events.Event.Type.PARTICIPANT, Enum.Events.Event.Action.POST) + span.setTags(spanTags) + await span.audit({ + headers: request.headers, + payload: request.payload + }, EventSdk.AuditEventAction.start) const metadata = `${request.method} ${request.path}` try { - participants.postParticipants(request.headers, request.method, request.params, request.payload) + participants.postParticipants(request.headers, request.method, request.params, request.payload, span) } catch (err) { Logger.error(`ERROR - ${metadata}: ${err.stack}`) throw ErrorHandler.Factory.reformatFSPIOPError(err) diff --git a/src/handlers/participants/{Type}/{ID}/error.js b/src/handlers/participants/{Type}/{ID}/error.js index 91f7b65a..700369d7 100644 --- a/src/handlers/participants/{Type}/{ID}/error.js +++ b/src/handlers/participants/{Type}/{ID}/error.js @@ -19,11 +19,15 @@ - Name Surname - Rajiv Mothilal + - Juan Correa -------------- ******/ 'use strict' +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../../../../lib/util') const pp = require('util').inspect const participants = require('../../../../domain/participants') const ErrorHandler = require('@mojaloop/central-services-error-handling') @@ -41,10 +45,17 @@ module.exports = { */ put: function (req, h) { (async function () { + const span = req.span + const spanTags = LibUtil.getSpanTags(req, Enum.Events.Event.Type.PARTICIPANT, Enum.Events.Event.Action.PUT) + span.setTags(spanTags) const metadata = `${req.method} ${req.path}` try { + await span.audit({ + headers: req.headers, + payload: req.payload + }, EventSdk.AuditEventAction.start) req.server.log(['info'], `received: ${metadata}. ${pp(req.params)}`) - await participants.putParticipantsErrorByTypeAndID(req.headers, req.params, req.payload, req.dataUri) + await participants.putParticipantsErrorByTypeAndID(req.headers, req.params, req.payload, req.dataUri, span) req.server.log(['info'], `success: ${metadata}.`) } catch (err) { req.server.log(['error'], `ERROR - ${metadata}: ${pp(err)}`) diff --git a/src/handlers/parties/{Type}/{ID}.js b/src/handlers/parties/{Type}/{ID}.js index 5a55b4cf..93d8ab75 100644 --- a/src/handlers/parties/{Type}/{ID}.js +++ b/src/handlers/parties/{Type}/{ID}.js @@ -24,6 +24,9 @@ ******/ 'use strict' +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../../../lib/util') const parties = require('../../../domain/parties') /** @@ -37,10 +40,17 @@ module.exports = { * produces: application/json * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ - get: function (req, h) { + get: async function (req, h) { + const span = req.span + const spanTags = LibUtil.getSpanTags(req, Enum.Events.Event.Type.PARTY, Enum.Events.Event.Action.LOOKUP) + span.setTags(spanTags) + await span.audit({ + headers: req.headers, + payload: req.payload + }, EventSdk.AuditEventAction.start) // Here we call an async function- but as we send an immediate sync response, _all_ errors // _must_ be handled by getPartiesByTypeAndID. - parties.getPartiesByTypeAndID(req.headers, req.params, req.method, req.query) + parties.getPartiesByTypeAndID(req.headers, req.params, req.method, req.query, span) return h.response().code(202) }, @@ -51,7 +61,14 @@ module.exports = { * produces: application/json * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503 */ - put: function (req, h) { + put: async function (req, h) { + const span = req.span + const spanTags = LibUtil.getSpanTags(req, Enum.Events.Event.Type.PARTY, Enum.Events.Event.Action.PUT) + span.setTags(spanTags) + await span.audit({ + headers: req.headers, + payload: req.payload + }, EventSdk.AuditEventAction.start) // Here we call an async function- but as we send an immediate sync response, _all_ errors // _must_ be handled by getPartiesByTypeAndID. parties.putPartiesByTypeAndID(req.headers, req.params, req.method, req.payload, req.dataUri) diff --git a/src/handlers/parties/{Type}/{ID}/error.js b/src/handlers/parties/{Type}/{ID}/error.js index 0f1779f4..f324ef47 100644 --- a/src/handlers/parties/{Type}/{ID}/error.js +++ b/src/handlers/parties/{Type}/{ID}/error.js @@ -24,6 +24,9 @@ ******/ 'use strict' +const Enum = require('@mojaloop/central-services-shared').Enum +const EventSdk = require('@mojaloop/event-sdk') +const LibUtil = require('../../../../lib/util') const parties = require('../../../../domain/parties') const Logger = require('@mojaloop/central-services-logger') const ErrorHandler = require('@mojaloop/central-services-error-handling') @@ -39,9 +42,16 @@ module.exports = { * produces: application/json * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503 */ - put: function (req, h) { + put: async function (req, h) { try { - parties.putPartiesErrorByTypeAndID(req.headers, req.params, req.payload, req.dataUri) + const span = req.span + const spanTags = LibUtil.getSpanTags(req, Enum.Events.Event.Type.PARTY, Enum.Events.Event.Action.PUT) + span.setTags(spanTags) + await span.audit({ + headers: req.headers, + payload: req.payload + }, EventSdk.AuditEventAction.start) + parties.putPartiesErrorByTypeAndID(req.headers, req.params, req.payload, req.dataUri, span) } catch (err) { Logger.error(err) throw ErrorHandler.Factory.reformatFSPIOPError(err) diff --git a/src/interface/admin_swagger.json b/src/interface/admin_swagger.json index 596bb989..066f45a9 100644 --- a/src/interface/admin_swagger.json +++ b/src/interface/admin_swagger.json @@ -21,9 +21,10 @@ "description": "The HTTP request GET /oracles is used to return the list of all oracle endpoints. There are optional fields for type and currency i.e. /admin/oracles?type=MSISDN¤cy=USD which can be used to get more filtered results or a specific entry", "summary": "Get Oracles", "tags": [ - "admin" + "admin", + "sampled" ], - "operationId": "OracleGet", + "operationId": "als_oracles_get", "produces": [ "application/json" ], @@ -78,9 +79,10 @@ "description": "The HTTP request POST /oracles is used to create information in the server regarding the provided oracles. This request should be used for creation of Oracle information.", "summary": "Create Oracles", "tags": [ - "admin" + "admin", + "sampled" ], - "operationId": "OraclePost", + "operationId": "als_oracles_post", "produces": [ "application/json" ], @@ -153,9 +155,10 @@ "description": "The HTTP request PUT /oracles/{ID} is used to update information in the server regarding the provided oracle. This request should be used for individual update of Oracle information.", "summary": "Update Oracle", "tags": [ - "admin" + "admin", + "sampled" ], - "operationId": "OraclePut", + "operationId": "als_oracles_put", "produces": [ "application/json" ], @@ -226,9 +229,10 @@ "description": "The HTTP request DELETE /oracles/{ID} is used to delete information in the server regarding the provided oracle.", "summary": "Delete Oracle", "tags": [ - "admin" + "admin", + "sampled" ], - "operationId": "OracleDelete", + "operationId": "als_oracles_delete", "produces": [ "application/json" ], @@ -284,7 +288,7 @@ "tags": [ "admin" ], - "operationId": "AdminHealthGet", + "operationId": "als_admin_health_get", "produces": [ "application/json" ], diff --git a/src/interface/api_swagger.json b/src/interface/api_swagger.json index e8d36553..47b81a62 100644 --- a/src/interface/api_swagger.json +++ b/src/interface/api_swagger.json @@ -21,9 +21,10 @@ "description": "If there is an error during FSP information creation in the server, the error callback PUT /participants//error is used. The in the URI should contain the requestId that was used for the creation of the participant information.", "summary": "ParticipantsByIDAndError", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsByIDAndError", + "operationId": "als_participantsByIDAndError_put", "produces": [ "application/json" ], @@ -126,9 +127,10 @@ "description": "The callback PUT /participants/ is used to inform the client of the result of the creation of the provided list of identities.", "summary": "ParticipantsByID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsByIDPut", + "operationId": "als_participantsByID_put", "produces": [ "application/json" ], @@ -230,9 +232,10 @@ "description": "If the server is unable to find, create or delete the associated FSP of the provided identity, or another processing error occurred, the error callback PUT /participants///error (or PUT /participants////error) is used.", "summary": "ParticipantsErrorByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsErrorByTypeAndID", + "operationId": "als_participantsErrorByTypeAndID_put", "produces": [ "application/json" ], @@ -338,9 +341,10 @@ "description": "If the server is unable to find, create or delete the associated FSP of the provided identity, or another processing error occurred, the error callback PUT /participants///error (or PUT /participants////error) is used.", "summary": "ParticipantsSubIdErrorByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsSubIdErrorByTypeAndID", + "operationId": "als_participantsSubIdErrorByTypeAndID_put", "produces": [ "application/json" ], @@ -490,9 +494,10 @@ "description": "The HTTP request GET /participants// (or GET /participants///) is used to find out in which FSP the requested Party, defined by , and optionally , is located (for example, GET /participants/MSISDN/123456789, or GET /participants/BUSINESS/shoecompany/employee1).", "summary": "ParticipantsSubIdByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsSubIdByTypeAndID", + "operationId": "als_participantsSubIdByTypeAndID_get", "produces": [ "application/json" ], @@ -571,9 +576,10 @@ "description": "The callback PUT /participants// (or PUT /participants///) is used to inform the client of a successful result of the lookup, creation, or deletion of the FSP information related to the Party. If the FSP information is deleted, the fspId element should be empty; otherwise the element should include the FSP information for the Party.", "summary": "ParticipantsSubIdByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsSubIdByTypeAndID3", + "operationId": "als_participantsSubIdByTypeAndID3_put", "produces": [ "application/json" ], @@ -668,9 +674,10 @@ "description": "The HTTP request POST /participants// (or POST /participants///) is used to create information in the server regarding the provided identity, defined by , , and optionally (for example, POST /participants/MSISDN/123456789 or POST /participants/BUSINESS/shoecompany/employee1).", "summary": "ParticipantsSubIdByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsSubIdByTypeAndIDPost", + "operationId": "als_participantsSubIdByTypeAndID_post", "produces": [ "application/json" ], @@ -766,9 +773,10 @@ "description": "The HTTP request DELETE /participants// (or DELETE /participants///) is used to delete information in the server regarding the provided identity, defined by and ) (for example, DELETE /participants/MSISDN/123456789), and optionally . This HTTP request should support a query string to delete FSP information regarding a specific currency only. To delete a specific currency only, the HTTP request DELETE /participants//?currency=XYZ should be used, where XYZ is the requested currency. Note - The Account Lookup System should verify that it is the Party’s current FSP that is deleting the FSP information.", "summary": "ParticipantsSubIdByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsSubIdByTypeAndID2", + "operationId": "als_participantsSubIdByTypeAndID2_delete", "produces": [ "application/json" ], @@ -887,9 +895,10 @@ "description": "The HTTP request GET /participants// (or GET /participants///) is used to find out in which FSP the requested Party, defined by , and optionally , is located (for example, GET /participants/MSISDN/123456789, or GET /participants/BUSINESS/shoecompany/employee1).", "summary": "ParticipantsByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsByTypeAndID", + "operationId": "als_participantsByTypeAndID_get", "produces": [ "application/json" ], @@ -965,9 +974,10 @@ "description": "The callback PUT /participants// (or PUT /participants///) is used to inform the client of a successful result of the lookup, creation, or deletion of the FSP information related to the Party. If the FSP information is deleted, the fspId element should be empty; otherwise the element should include the FSP information for the Party.", "summary": "ParticipantsByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsByTypeAndID3", + "operationId": "als_participantsByTypeAndID3_put", "produces": [ "application/json" ], @@ -1059,9 +1069,10 @@ "description": "The HTTP request POST /participants// (or POST /participants///) is used to create information in the server regarding the provided identity, defined by , , and optionally (for example, POST /participants/MSISDN/123456789 or POST /participants/BUSINESS/shoecompany/employee1).", "summary": "ParticipantsByIDAndType", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsByIDAndType", + "operationId": "als_participantsByIDAndType_post", "produces": [ "application/json" ], @@ -1154,9 +1165,10 @@ "description": "The HTTP request DELETE /participants// (or DELETE /participants///) is used to delete information in the server regarding the provided identity, defined by and ) (for example, DELETE /participants/MSISDN/123456789), and optionally . This HTTP request should support a query string to delete FSP information regarding a specific currency only. To delete a specific currency only, the HTTP request DELETE /participants//?currency=XYZ should be used, where XYZ is the requested currency. Note - The Account Lookup System should verify that it is the Party’s current FSP that is deleting the FSP information.", "summary": "ParticipantsByTypeAndID", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "ParticipantsByTypeAndID2", + "operationId": "als_participantsByTypeAndID2_delete", "produces": [ "application/json" ], @@ -1234,9 +1246,10 @@ "description": "The HTTP request POST /participants is used to create information in the server regarding the provided list of identities. This request should be used for bulk creation of FSP information for more than one Party. The optional currency parameter should indicate that each provided Party supports the currency", "summary": "Participants", "tags": [ - "participants" + "participants", + "sampled" ], - "operationId": "Participants1", + "operationId": "als_participants1_post", "produces": [ "application/json" ], @@ -1377,9 +1390,10 @@ "description": "The HTTP request GET /parties// (or GET /parties///) is used to lookup information regarding the requested Party, defined by , and optionally (for example, GET /parties/MSISDN/123456789, or GET /parties/BUSINESS/shoecompany/employee1).", "summary": "PartiesByTypeAndID", "tags": [ - "parties" + "parties", + "sampled" ], - "operationId": "PartiesByTypeAndID", + "operationId": "als_partiesByTypeAndID_get", "produces": [ "application/json" ], @@ -1455,9 +1469,10 @@ "description": "The callback PUT /parties// (or PUT /parties///) is used to inform the client of a successful result of the Party information lookup.", "summary": "PartiesByTypeAndID2", "tags": [ - "parties" + "parties", + "sampled" ], - "operationId": "PartiesByTypeAndID2", + "operationId": "als_partiesByTypeAndID2_put", "produces": [ "application/json" ], @@ -1568,9 +1583,10 @@ "description": "If the server is unable to find Party information of the provided identity, or another processing error occurred, the error callback PUT /parties///error (or PUT /parties////error) is used.", "summary": "PartiesErrorByTypeAndID", "tags": [ - "parties" + "parties", + "sampled" ], - "operationId": "PartiesErrorByTypeAndID", + "operationId": "als_partiesErrorByTypeAndID_put", "produces": [ "application/json" ], @@ -1717,9 +1733,10 @@ "description": "The HTTP request GET /parties// (or GET /parties///) is used to lookup information regarding the requested Party, defined by , and optionally (for example, GET /parties/MSISDN/123456789, or GET /parties/BUSINESS/shoecompany/employee1).", "summary": "PartiesSubIdByTypeAndID", "tags": [ - "parties" + "parties", + "sampled" ], - "operationId": "PartiesSubIdByTypeAndID", + "operationId": "als_partiesSubIdByTypeAndID_get", "produces": [ "application/json" ], @@ -1798,9 +1815,10 @@ "description": "The callback PUT /parties// (or PUT /parties///) is used to inform the client of a successful result of the Party information lookup.", "summary": "PartiesSubIdByTypeAndID", "tags": [ - "parties" + "parties", + "sampled" ], - "operationId": "PartiesSubIdByTypeAndIDPut", + "operationId": "also_partiesSubIdByTypeAndID_put", "produces": [ "application/json" ], @@ -1911,9 +1929,10 @@ "description": "If the server is unable to find Party information of the provided identity, or another processing error occurred, the error callback PUT /parties///error (or PUT /parties////error) is used.", "summary": "PartiesSubIdErrorByTypeAndID", "tags": [ - "parties" + "parties", + "sampled" ], - "operationId": "PartiesSubIdErrorByTypeAndID", + "operationId": "als_partiesSubIdErrorByTypeAndID_put", "produces": [ "application/json" ], @@ -2022,9 +2041,10 @@ "description": "The HTTP request GET /health is used to return the current status of the ALS API.", "summary": "Get health", "tags": [ - "health" + "health", + "sampled" ], - "operationId": "ApiHealthGet", + "operationId": "als_ApiHealth_get", "produces": [ "application/json" ], @@ -2064,9 +2084,10 @@ "description": "The HTTP request DELETE /endpointcache is used to reset the endpoint cache by performing an stopCache and initializeCache the Admin API.", "summary": "Endpoint Cache", "tags": [ - "cache" + "cache", + "sampled" ], - "operationId": "EndpointCache", + "operationId": "als_endpointCache_get", "parameters": [ { "$ref": "#/parameters/Date" diff --git a/src/lib/util.js b/src/lib/util.js new file mode 100644 index 00000000..750ba212 --- /dev/null +++ b/src/lib/util.js @@ -0,0 +1,19 @@ +const Enum = require('@mojaloop/central-services-shared').Enum + +const getSpanTags = ({ headers }, transactionType, transactionAction) => { + const tags = { + transactionType, + transactionAction + } + if (headers && headers[Enum.Http.Headers.FSPIOP.SOURCE]) { + tags.source = headers[Enum.Http.Headers.FSPIOP.SOURCE] + } + if (headers && headers[Enum.Http.Headers.FSPIOP.DESTINATION]) { + tags.destination = headers[Enum.Http.Headers.FSPIOP.DESTINATION] + } + return tags +} + +module.exports = { + getSpanTags +} diff --git a/src/models/participantEndpoint/facade.js b/src/models/participantEndpoint/facade.js index 5a8bb780..abe6e15a 100644 --- a/src/models/participantEndpoint/facade.js +++ b/src/models/participantEndpoint/facade.js @@ -19,6 +19,7 @@ - Name Surname - Rajiv Mothilal + - Juan Correa -------------- ******/ @@ -46,14 +47,15 @@ const Config = require('../../lib/config') * @param {string} method - the http method * @param {object} payload - payload of the request being sent out * @param {object} options - the options to be used in the template + * @param {object} span * * @returns {object} - Returns http response from request endpoint */ -exports.sendRequest = async (headers, requestedParticipant, endpointType, method = undefined, payload = undefined, options = undefined) => { +exports.sendRequest = async (headers, requestedParticipant, endpointType, method = undefined, payload = undefined, options = undefined, span = undefined) => { try { const requestedEndpoint = await Util.Endpoints.getEndpoint(Config.SWITCH_ENDPOINT, requestedParticipant, endpointType, options || undefined) Logger.debug(`participant endpoint url: ${requestedEndpoint} for endpoint type ${endpointType}`) - return await Util.Request.sendRequest(requestedEndpoint, headers, headers[Enums.Http.Headers.FSPIOP.SOURCE], headers[Enums.Http.Headers.FSPIOP.DESTINATION], method, payload) + return await Util.Request.sendRequest(requestedEndpoint, headers, headers[Enums.Http.Headers.FSPIOP.SOURCE], headers[Enums.Http.Headers.FSPIOP.DESTINATION], method, payload, span) } catch (err) { Logger.error(err) throw ErrorHandler.Factory.reformatFSPIOPError(err) @@ -66,13 +68,14 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method * @description sends a request to central-ledger to retrieve participant details and validate that they exist within the switch * * @param {string} fsp The FSPIOP-Source fsp id + * @param {object} span * @returns the participants info in a successful case and */ -exports.validateParticipant = async (fsp) => { +exports.validateParticipant = async (fsp, span = undefined) => { try { const requestedParticipantUrl = Mustache.render(Config.SWITCH_ENDPOINT + Enums.EndPoints.FspEndpointTemplates.PARTICIPANTS_GET, { fsp }) Logger.debug(`validateParticipant url: ${requestedParticipantUrl}`) - return await Util.Request.sendRequest(requestedParticipantUrl, Util.Http.SwitchDefaultHeaders(Enums.Http.Headers.FSPIOP.SWITCH.value, Enums.Http.HeaderResources.PARTICIPANTS, Enums.Http.Headers.FSPIOP.SWITCH.value), Enums.Http.Headers.FSPIOP.SWITCH.value, Enums.Http.Headers.FSPIOP.SWITCH.value) + return await Util.Request.sendRequest(requestedParticipantUrl, Util.Http.SwitchDefaultHeaders(Enums.Http.Headers.FSPIOP.SWITCH.value, Enums.Http.HeaderResources.PARTICIPANTS, Enums.Http.Headers.FSPIOP.SWITCH.value), Enums.Http.Headers.FSPIOP.SWITCH.value, Enums.Http.Headers.FSPIOP.SWITCH.value, span) } catch (err) { Logger.error(err) throw ErrorHandler.Factory.reformatFSPIOPError(err) @@ -90,10 +93,11 @@ exports.validateParticipant = async (fsp) => { * @param {object} headers - incoming http request headers * @param {object} params - uri parameters of the http request * @param {object} payload - payload of the request being sent out + * @param {object} span * * @returns {object} - Returns http response from request endpoint */ -exports.sendErrorToParticipant = async (participantName, endpointType, errorInformation, headers, params = {}, payload = undefined) => { +exports.sendErrorToParticipant = async (participantName, endpointType, errorInformation, headers, params = {}, payload = undefined, span = undefined) => { try { let requestIdExists = false if (payload && payload.requestId) { @@ -113,7 +117,7 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo } Logger.debug(`participant endpoint url: ${requesterErrorEndpoint} for endpoint type ${endpointType}`) - await Util.Request.sendRequest(requesterErrorEndpoint, clonedHeaders, clonedHeaders[Enums.Http.Headers.FSPIOP.SOURCE], clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION], Enums.Http.RestMethods.PUT, errorInformation) + await Util.Request.sendRequest(requesterErrorEndpoint, clonedHeaders, clonedHeaders[Enums.Http.Headers.FSPIOP.SOURCE], clonedHeaders[Enums.Http.Headers.FSPIOP.DESTINATION], Enums.Http.RestMethods.PUT, errorInformation, span) } catch (err) { Logger.error(err) throw ErrorHandler.Factory.reformatFSPIOPError(err) diff --git a/src/plugins.js b/src/plugins.js index 63c68995..3a57cb9b 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -29,6 +29,7 @@ const Inert = require('@hapi/inert') const Vision = require('@hapi/vision') const Blipp = require('blipp') const ErrorHandling = require('@mojaloop/central-services-error-handling') +const CentralServices = require('@mojaloop/central-services-shared') const RawPayloadToDataUri = require('@mojaloop/central-services-shared').Util.Hapi.HapiRawPayload const registerPlugins = async (server) => { @@ -67,7 +68,8 @@ const registerPlugins = async (server) => { Inert, Vision, ErrorHandling, - RawPayloadToDataUri + RawPayloadToDataUri, + CentralServices.Util.Hapi.HapiEventPlugin ]) if (Config.DISPLAY_ROUTES === true) { diff --git a/test/integration/domain/oracle/index.test.js b/test/integration/domain/oracle/index.test.js index 377d184a..f9fad992 100644 --- a/test/integration/domain/oracle/index.test.js +++ b/test/integration/domain/oracle/index.test.js @@ -28,6 +28,7 @@ const Db = require('../../../../src/lib/db') const Config = require('../../../../src/lib/config') const Oracle = require('../../../../src/domain/oracle') const OracleModel = require('../../../../src/models/oracle') +const EventSdk = require('@mojaloop/event-sdk') describe('Oracle', () => { beforeAll(async () => { @@ -49,9 +50,21 @@ describe('Oracle', () => { endpointType: 'URL' } } + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + 'content-length': 164, + connection: 'keep-alive' + } + + const testSpan = EventSdk.Tracer.createSpan('createOracle service') // Act - const result = await Oracle.createOracle(payload) + const result = await Oracle.createOracle(payload, createHeaders, testSpan) // Assert expect(result).toBe(true) diff --git a/test/unit/domain/oracle/oracle.test.js b/test/unit/domain/oracle/oracle.test.js index 22615a39..37914cf5 100644 --- a/test/unit/domain/oracle/oracle.test.js +++ b/test/unit/domain/oracle/oracle.test.js @@ -70,6 +70,7 @@ const getOracleDatabaseResponse = [{ }] let sandbox +let SpanStub describe('Oracle tests', () => { beforeEach(() => { @@ -90,6 +91,16 @@ describe('Oracle tests', () => { Db.oracleEndpoint.insert.returns(true) Db.oracleEndpoint.query.returns(getOracleDatabaseResponse) Db.oracleEndpoint.update.returns(true) + + SpanStub = { + audit: sandbox.stub().callsFake(), + error: sandbox.stub().callsFake(), + finish: sandbox.stub().callsFake(), + debug: sandbox.stub().callsFake(), + info: sandbox.stub().callsFake(), + getChild: sandbox.stub().returns(SpanStub), + setTags: sandbox.stub().callsFake() + } }) afterEach(() => { @@ -202,9 +213,21 @@ describe('Oracle tests', () => { }, isDefault: true } + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + 'user-agent': 'PostmanRuntime/7.17.1', + 'postman-token': 'fc2ac209-de3e-4851-b6ba-02efde9060fa', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + 'content-length': 164, + connection: 'keep-alive' + } // Act - const response = await oracleDomain.createOracle(createPayload) + const response = await oracleDomain.createOracle(createPayload, createHeaders, SpanStub) // Assert expect(response).toBe(true) @@ -219,9 +242,21 @@ describe('Oracle tests', () => { endpointType: 'URL' } } + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + 'user-agent': 'PostmanRuntime/7.17.1', + 'postman-token': 'fc2ac209-de3e-4851-b6ba-02efde9060fa', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + 'content-length': 164, + connection: 'keep-alive' + } // Act - const response = await oracleDomain.createOracle(createPayload) + const response = await oracleDomain.createOracle(createPayload, createHeaders, SpanStub) // Assert expect(response).toBe(true) @@ -251,6 +286,17 @@ describe('Oracle tests', () => { it('should get the details of the requested oracle without currency and type', async () => { // Arrange const query = {} + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + 'user-agent': 'PostmanRuntime/7.17.1', + 'postman-token': 'fc2ac209-de3e-4851-b6ba-02efde9060fa', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + connection: 'keep-alive' + } const expected = [{ oracleId: 1, oracleIdType: 'MSISDN', @@ -263,7 +309,7 @@ describe('Oracle tests', () => { }] // Act - const response = await oracleDomain.getOracle(query) + const response = await oracleDomain.getOracle(query, createHeaders, SpanStub) // Assert expect(response).toEqual(expected) @@ -274,6 +320,17 @@ describe('Oracle tests', () => { const query = { currency: 'USD' } + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + 'user-agent': 'PostmanRuntime/7.17.1', + 'postman-token': 'fc2ac209-de3e-4851-b6ba-02efde9060fa', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + connection: 'keep-alive' + } const expected = [{ oracleId: 1, oracleIdType: 'MSISDN', @@ -286,7 +343,7 @@ describe('Oracle tests', () => { }] // Act - const response = await oracleDomain.getOracle(query) + const response = await oracleDomain.getOracle(query, createHeaders, SpanStub) // Assert expect(response).toEqual(expected) @@ -297,6 +354,17 @@ describe('Oracle tests', () => { const query = { type: 'MSISDN' } + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + 'user-agent': 'PostmanRuntime/7.17.1', + 'postman-token': 'fc2ac209-de3e-4851-b6ba-02efde9060fa', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + connection: 'keep-alive' + } const expected = [{ oracleId: 1, oracleIdType: 'MSISDN', @@ -309,7 +377,7 @@ describe('Oracle tests', () => { }] // Act - const response = await oracleDomain.getOracle(query) + const response = await oracleDomain.getOracle(query, createHeaders, SpanStub) // Assert expect(response).toEqual(expected) @@ -321,6 +389,17 @@ describe('Oracle tests', () => { currency: 'USD', type: 'MSISDN' } + const createHeaders = { + accept: 'application/vnd.interoperability.participants+json;version=1', + 'cache-control': 'no-cache', + date: '', + 'content-type': 'application/vnd.interoperability.participants+json;version=1.0', + 'user-agent': 'PostmanRuntime/7.17.1', + 'postman-token': 'fc2ac209-de3e-4851-b6ba-02efde9060fa', + host: '127.0.0.1:4003', + 'accept-encoding': 'gzip, deflate', + connection: 'keep-alive' + } const expected = [{ oracleId: 1, oracleIdType: 'MSISDN', @@ -333,7 +412,7 @@ describe('Oracle tests', () => { }] // Act - const response = await oracleDomain.getOracle(query) + const response = await oracleDomain.getOracle(query, createHeaders, SpanStub) // Assert expect(response).toEqual(expected) diff --git a/test/unit/domain/participants/participants.test.js b/test/unit/domain/participants/participants.test.js index cfd348ca..db37aefc 100644 --- a/test/unit/domain/participants/participants.test.js +++ b/test/unit/domain/participants/participants.test.js @@ -110,7 +110,7 @@ describe('Participant Tests', () => { const firstCallArgs = participant.sendRequest.getCall(0).args expect(firstCallArgs[0][Enums.Http.Headers.FSPIOP.DESTINATION]).toBe('payeefsp') expect(firstCallArgs[2]).toBe(expectedCallbackEndpointType) - expect(firstCallArgs[5].partySubIdOrType).toBe('subId') + expect(firstCallArgs[6].partySubIdOrType).toBe('subId') }) it('fails to get participants and sends error callback with appropriate endpoint type when SubId is specified', async () => { diff --git a/test/unit/handlers/participants/{Type}/{ID}/error.test.js b/test/unit/handlers/participants/{Type}/{ID}/error.test.js index cd46856e..9d84396d 100644 --- a/test/unit/handlers/participants/{Type}/{ID}/error.test.js +++ b/test/unit/handlers/participants/{Type}/{ID}/error.test.js @@ -37,6 +37,7 @@ const Db = require(`${src}/lib/db`) const participants = require(`${src}/domain/participants`) const ErrHandler = require(`${src}/handlers/participants/{Type}/{ID}/error`) const Helper = require('../../../../../util/helper') +const LibUtil = require(`${src}/lib/util`) let server let sandbox @@ -46,6 +47,7 @@ describe('/participants/{Type}/{ID}/error', () => { sandbox = Sinon.createSandbox() sandbox.stub(Db, 'connect').returns(Promise.resolve({})) server = await initServer(await getPort()) + sandbox.stub(LibUtil, 'getSpanTags').returns({}) }) afterAll(async () => { @@ -63,13 +65,25 @@ describe('/participants/{Type}/{ID}/error', () => { } const mock = await Helper.generateMockRequest('/participants/{Type}/{ID}/error', 'put') + const setTagsStub = sandbox.stub().returns({}) sandbox.stub(participants, 'putParticipantsErrorByTypeAndID').returns({}) - mock.request.server = { - log: sandbox.stub() + mock.request = { + server: { + log: sandbox.stub() + }, + method: sandbox.stub(), + path: sandbox.stub(), + metadata: sandbox.stub(), + headers: sandbox.stub(), + payload: sandbox.stub(), + span: { + setTags: setTagsStub, + audit: sandbox.stub().returns(Promise.resolve({})) + } } // Act - await ErrHandler.put(mock.request, handler) + await Promise.resolve(await ErrHandler.put(mock.request, handler)) // Assert /* @@ -77,9 +91,9 @@ describe('/participants/{Type}/{ID}/error', () => { errors properly. Instead of failing the test on an error, we can inspect the 2nd call of the `log` function, and ensure it was as expected. */ - const secondCallArgs = mock.request.server.log.getCall(1).args expect(secondCallArgs[0]).toEqual(['info']) + expect(mock.request.server.log.callCount).toEqual(2) participants.putParticipantsErrorByTypeAndID.restore() }) @@ -93,13 +107,25 @@ describe('/participants/{Type}/{ID}/error', () => { } const mock = await Helper.generateMockRequest('/participants/{Type}/{ID}/error', 'put') + const setTagsStub = sandbox.stub().returns({}) sandbox.stub(participants, 'putParticipantsErrorByTypeAndID').throws(new Error('Error in putParticipantsErrorByTypeAndID')) - mock.request.server = { - log: sandbox.stub() + mock.request = { + server: { + log: sandbox.stub() + }, + method: sandbox.stub(), + path: sandbox.stub(), + metadata: sandbox.stub(), + headers: sandbox.stub(), + payload: sandbox.stub(), + span: { + setTags: setTagsStub, + audit: sandbox.stub().returns(Promise.resolve({})) + } } // Act - await ErrHandler.put(mock.request, handler) + await Promise.resolve(await ErrHandler.put(mock.request, handler)) // Assert /* diff --git a/test/unit/handlers/parties/{Type}/{ID}/error.test.js b/test/unit/handlers/parties/{Type}/{ID}/error.test.js index 94ce79cf..2fe1e2ce 100644 --- a/test/unit/handlers/parties/{Type}/{ID}/error.test.js +++ b/test/unit/handlers/parties/{Type}/{ID}/error.test.js @@ -37,6 +37,7 @@ const Db = require(`${src}/lib/db`) const parties = require(`${src}/domain/parties`) const ErrHandler = require(`${src}/handlers/parties/{Type}/{ID}/error`) const Helper = require('../../../../../util/helper') +const LibUtil = require(`${src}/lib/util`) let server let sandbox @@ -46,6 +47,7 @@ describe('/parties/{Type}/{ID}/error', () => { sandbox = Sinon.createSandbox() sandbox.stub(Db, 'connect').returns(Promise.resolve({})) server = await initServer(await getPort()) + sandbox.stub(LibUtil, 'getSpanTags').returns({}) }) afterAll(async () => { @@ -63,13 +65,20 @@ describe('/parties/{Type}/{ID}/error', () => { } const mock = await Helper.generateMockRequest('/parties/{Type}/{ID}/error', 'put') + const setTagsStub = sandbox.stub().returns({}) + mock.request.span = { + setTags: setTagsStub, + audit: sandbox.stub().returns(Promise.resolve({})) + } sandbox.stub(parties, 'putPartiesErrorByTypeAndID').returns({}) // Act - ErrHandler.put(mock.request, handler) + await ErrHandler.put(mock.request, handler) // Assert expect(codeStub.calledWith(200)).toBe(true) + expect(setTagsStub.calledWith({})).toBe(true) + expect(setTagsStub.calledOnce).toBe(true) parties.putPartiesErrorByTypeAndID.restore() }) @@ -83,6 +92,11 @@ describe('/parties/{Type}/{ID}/error', () => { } const mock = await Helper.generateMockRequest('/parties/{Type}/{ID}/error', 'put') + const setTagsStub = sandbox.stub().returns({}) + mock.request.span = { + setTags: setTagsStub, + audit: sandbox.stub().returns(Promise.resolve({})) + } sandbox.stub(parties, 'putPartiesErrorByTypeAndID').throws(new Error('Error in putPartiesErrorByTypeAndId')) // Act