diff --git a/migrations/401300_settlementModel.js b/migrations/401300_settlementModel.js index 51316e742..2d9e53960 100644 --- a/migrations/401300_settlementModel.js +++ b/migrations/401300_settlementModel.js @@ -43,6 +43,7 @@ exports.up = async (knex, Promise) => { t.boolean('requireLiquidityCheck').defaultTo(true).notNullable() t.integer('ledgerAccountTypeId').unsigned().notNullable() t.foreign('ledgerAccountTypeId').references('ledgerAccountTypeId').inTable('ledgerAccountType') + t.boolean('autoPositionReset').defaultTo(false).notNullable() }) } }) diff --git a/package-lock.json b/package-lock.json index a4d8822ea..93b6cb728 100644 --- a/package-lock.json +++ b/package-lock.json @@ -341,9 +341,9 @@ } }, "@hapi/hoek": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz", - "integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw==" + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz", + "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==" }, "@hapi/inert": { "version": "5.2.2", @@ -647,15 +647,40 @@ "uuid": "^3.3.3", "v8flags": "^3.1.3" } + }, + "mysql": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.17.1.tgz", + "integrity": "sha512-7vMqHQ673SAk5C8fOzTG2LpPcf3bNt0oL3sFpxPEEFp1mdlDcrLK0On7z8ZYKaaHrHwNcQ/MTUz7/oobZ2OyyA==", + "requires": { + "bignumber.js": "7.2.1", + "readable-stream": "2.3.6", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "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" + } } } }, "@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" } }, @@ -844,17 +869,17 @@ } }, "@mojaloop/central-services-metrics": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-metrics/-/central-services-metrics-8.3.0.tgz", - "integrity": "sha512-T3luQbyJ6DBFmexhnkONy8XY0u0oc2fi1L7DK5UfWxJmVPTMLsC5d7p2YFOu79n9i2c+nrD5eZN5bxe1sz9f9A==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-metrics/-/central-services-metrics-8.8.0.tgz", + "integrity": "sha512-rkwSHs2TaKsQ+xwh/KP5nv8lBbXpfQOq+0HfVbDpiI85d92yMmfhQFlBZ8ypxxXHejHP2cfUcroGmZ7ZHdk9Ug==", "requires": { "prom-client": "11.5.3" } }, "@mojaloop/central-services-shared": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-9.1.0.tgz", - "integrity": "sha512-kQkfFvenhuZxvc+8IpTQ/OJK+irChcbV7PncmNqycVrFw6JCapiA5a8BtW5xpHoZzalXbMMoAVuT+MbZEzDBjA==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-9.1.1.tgz", + "integrity": "sha512-ZY15we/VUcSbRcudwK92Qy+1HFLrsFALllkIaHnX9z8dgX8LVCcbM415HJMdeQUrDjx5eLsaXw8IW9rsXa+f+g==", "requires": { "@hapi/catbox": "10.2.3", "@hapi/catbox-memory": "5.0.0", @@ -899,26 +924,9 @@ } }, "@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/central-services-error-handling": { - "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.7", - "lodash": "4.17.15" - } - }, - "@mojaloop/central-services-metrics": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-metrics/-/central-services-metrics-8.8.0.tgz", - "integrity": "sha512-rkwSHs2TaKsQ+xwh/KP5nv8lBbXpfQOq+0HfVbDpiI85d92yMmfhQFlBZ8ypxxXHejHP2cfUcroGmZ7ZHdk9Ug==", - "requires": { - "prom-client": "11.5.3" - } + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.0.3.tgz", + "integrity": "sha512-jKtjLLDiH95b002sJVc5c74PE6KKYftuyVdVmsuYId5stTaWcRFqE+5ukZI4gDUKjGn8wv2C3zPn3/nyjEI7gg==" }, "@mojaloop/event-sdk": { "version": "8.8.1-snapshot.2", @@ -944,17 +952,23 @@ "winston": "3.2.1" } }, - "@mojaloop/sdk-standard-components": { - "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==", + "@sinonjs/formatio": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-4.0.1.tgz", + "integrity": "sha512-asIdlLFrla/WZybhm0C8eEzaDNNrzymiTqHMeJl6zPW2881l3uuVRpm0QlRQEjqYWv6CcKMGYME3LbrLJsORBw==", "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" + "@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" } }, "axios": { @@ -975,6 +989,11 @@ "whatwg-url": "^8.0.0" } }, + "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", "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.24.2.tgz", @@ -1404,16 +1423,64 @@ } } }, + "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" + } + }, "mustache": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.0.0.tgz", "integrity": "sha512-FJgjyX/IVkbXBXYUwH+OYwQKqWpFPLaLVESd70yHjSDunwzV2hZOoTBvPf4KLoxesUzzyfTH6F784Uqd7Wm5yA==" }, + "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" + } + }, "parse-strings-in-object": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/parse-strings-in-object/-/parse-strings-in-object-2.0.0.tgz", "integrity": "sha512-hb50xDyEo8boMtyzB1IdVE4KcTNVbIirk/ZqC8na1irOf/70DyZS30y1FIIAUe9jyHJk9s2QoZ4aBNHR9NXHsg==" }, + "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", @@ -1451,6 +1518,28 @@ "node-rdkafka": "2.7.4" }, "dependencies": { + "@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==", + "requires": { + "@mojaloop/sdk-standard-components": "8.6.1", + "lodash": "4.17.15" + } + }, + "@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==", + "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", @@ -1499,6 +1588,30 @@ "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", "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.24.2.tgz", @@ -1928,10 +2041,58 @@ } } }, + "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" + } + }, "parse-strings-in-object": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/parse-strings-in-object/-/parse-strings-in-object-2.0.0.tgz", "integrity": "sha512-hb50xDyEo8boMtyzB1IdVE4KcTNVbIirk/ZqC8na1irOf/70DyZS30y1FIIAUe9jyHJk9s2QoZ4aBNHR9NXHsg==" + }, + "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" + } } } }, @@ -1975,9 +2136,9 @@ } }, "@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", @@ -1988,19 +2149,19 @@ } }, "@now-ims/hapi-now-auth": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@now-ims/hapi-now-auth/-/hapi-now-auth-2.0.0.tgz", - "integrity": "sha512-vJhuq3V0ft8Ze1kQ4yhOJNsNJWp9yIRcN5JvZCZPf5DEhrV3TU+htlNCOKaW7/IeAVid8WLz2xk/5FR9lwz23g==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@now-ims/hapi-now-auth/-/hapi-now-auth-2.0.1.tgz", + "integrity": "sha512-w41uSwWopVc+FEBJyh4Jx40TvMovEHzVL9qsSBZEaxHnJMWQJpm+soZaRS8GDvCEsUbGd3FzCr6NYWafNt9HTg==", "requires": { - "@hapi/boom": "^7.4.2", - "@hapi/hoek": "^7.1.0", + "@hapi/boom": "^7.4.11", + "@hapi/hoek": "^9.0.2", "jsonwebtoken": "^8.5.1" }, "dependencies": { "@hapi/hoek": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-7.2.1.tgz", - "integrity": "sha512-X6YzLoU+VvZwUNe0VFJV/r4IiFHf61/6VItdnKjlay+YS/5qoczO3u/7wyTj2NtaOZHlFJBndNkfZ2Ag2XxCsg==" + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.0.3.tgz", + "integrity": "sha512-jKtjLLDiH95b002sJVc5c74PE6KKYftuyVdVmsuYId5stTaWcRFqE+5ukZI4gDUKjGn8wv2C3zPn3/nyjEI7gg==" } } }, @@ -3249,9 +3410,9 @@ } }, "commander": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz", - "integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" }, "commondir": { "version": "1.0.1", @@ -3349,9 +3510,9 @@ } }, "cron": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/cron/-/cron-1.7.2.tgz", - "integrity": "sha512-+SaJ2OfeRvfQqwXQ2kgr0Y5pzBR/lijf5OpnnaruwWnmI799JfWr2jN2ItOV9s3A/+TFOt6mxvKzQq5F0Jp6VQ==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/cron/-/cron-1.8.2.tgz", + "integrity": "sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg==", "requires": { "moment-timezone": "^0.5.x" } @@ -3629,9 +3790,9 @@ } }, "docdash": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/docdash/-/docdash-1.1.1.tgz", - "integrity": "sha512-WQkkr01zL6kcIfq9YCSXtqqevM6NYoTXLdl+Td0OYCEcX0RgsuEMeqHXQaXFt+p6Lo15RIgA5XhLAn7RL+erhA==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/docdash/-/docdash-1.2.0.tgz", + "integrity": "sha512-IYZbgYthPTspgqYeciRJNPhSwL51yer7HAwDXhF5p+H7mTDbPvY3PCk/QDjNxdPCpWkaJVFC4t7iCNB/t9E5Kw==" }, "doctrine": { "version": "3.0.0", @@ -4250,6 +4411,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", @@ -4703,6 +4869,23 @@ "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==" }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + } + } + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -4899,9 +5082,9 @@ "dev": true }, "get-port": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.0.tgz", - "integrity": "sha512-bjioH1E9bTQUvgaB6VycVy1QVbTZI41yTnF9qkZz6ixgy/uhCH6D63bKeZ6Code/07JYA61MeI94jSdHss8PNA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", + "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", "dev": true }, "get-stdin": { @@ -5535,9 +5718,9 @@ }, "dependencies": { "@hapi/hoek": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz", - "integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw==" + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz", + "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==" } } } @@ -6807,14 +6990,15 @@ "dev": true }, "knex": { - "version": "0.20.7", - "resolved": "https://registry.npmjs.org/knex/-/knex-0.20.7.tgz", - "integrity": "sha512-Yu5WfQqK9JSkxMAWnCdeWbsjTKTzsjMYjqmUowOQnyLMs4RspVehqXCVjg+aTtcVrTtIZ3WvoeE00OzFsZKJow==", + "version": "0.20.9", + "resolved": "https://registry.npmjs.org/knex/-/knex-0.20.9.tgz", + "integrity": "sha512-Vv2OTcJSZ8z3G5wXZfeLRgdaf+bab2lpKgLBgRJCaVfFX/fPmrP4M1p/ciLR0fZtHpYFtOBUggs9cSjWuj8rAw==", "requires": { "bluebird": "^3.7.2", "colorette": "1.1.0", - "commander": "^4.1.0", + "commander": "^4.1.1", "debug": "4.1.1", + "esm": "^3.2.25", "getopts": "2.2.5", "inherits": "~2.0.4", "interpret": "^2.0.0", @@ -6824,7 +7008,7 @@ "pg-connection-string": "2.1.0", "tarn": "^2.0.0", "tildify": "2.0.0", - "uuid": "^3.3.3", + "uuid": "^3.4.0", "v8flags": "^3.1.3" }, "dependencies": { @@ -6845,6 +7029,11 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.0.0.tgz", "integrity": "sha512-e0/LknJ8wpMMhTiWcjivB+ESwIuvHnBSlBbmP/pSb8CQJldoj1p2qv7xGZ/+BtbTziYRFSz8OsvdbiX45LtYQA==" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" } } }, @@ -7148,6 +7337,15 @@ "kind-of": "^6.0.2" } }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -7192,6 +7390,25 @@ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", "dev": true }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + } + } + }, "memory-pager": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", @@ -7433,9 +7650,9 @@ } }, "mongoose": { - "version": "5.8.7", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.8.7.tgz", - "integrity": "sha512-PCCuTrdxpUmO86L1geXWE+9AvJRFuneIrMUT2hB/LXZ+5HIGOIfE6OSMU7cd8wFU7JRINP9V73zZ9YsmAbt+Iw==", + "version": "5.8.11", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.8.11.tgz", + "integrity": "sha512-Yz0leNEJsAtNtMTxTDEadacLWt58gaVeBVL3c1Z3vaBoc159aJqlf+T8jaL9mAdBxKndF5YWhh6Q719xac7cjA==", "requires": { "bson": "~1.1.1", "kareem": "2.3.1", @@ -7516,29 +7733,22 @@ "dev": true }, "mysql": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.17.1.tgz", - "integrity": "sha512-7vMqHQ673SAk5C8fOzTG2LpPcf3bNt0oL3sFpxPEEFp1mdlDcrLK0On7z8ZYKaaHrHwNcQ/MTUz7/oobZ2OyyA==", + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "optional": true, "requires": { - "bignumber.js": "7.2.1", - "readable-stream": "2.3.6", + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", "safe-buffer": "5.1.2", "sqlstring": "2.3.1" }, "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "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" - } + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==", + "optional": true } } }, @@ -7726,9 +7936,9 @@ "dev": true }, "npm-audit-resolver": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/npm-audit-resolver/-/npm-audit-resolver-2.1.0.tgz", - "integrity": "sha512-8VaG7p3tbP0+JbpDKldQueZvh9oUcr3H/C2FIbcIhYBANAQ1kCIhUqYOxVFjG3RKEV9G1coIFzUOxBoPyyejNg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/npm-audit-resolver/-/npm-audit-resolver-2.2.0.tgz", + "integrity": "sha512-nBhxrc0Y34vIFl38G42PkWSBEbOAL3Gg6aRxm1hYzM4Vm+Rv0ozALj2LixdeytkUC2OGWP4QqCF0fKAb14NnPQ==", "dev": true, "requires": { "audit-resolve-core": "^1.1.7", @@ -7737,7 +7947,8 @@ "jsonlines": "^0.1.1", "read": "^1.0.7", "spawn-shell": "^2.1.0", - "yargs-parser": "^13.1.1" + "yargs-parser": "^13.1.1", + "yargs-unparser": "^1.5.0" } }, "npm-bundled": { @@ -8751,12 +8962,24 @@ "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "dev": true + }, "p-limit": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", @@ -9979,14 +10202,15 @@ } }, "sinon": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-8.0.4.tgz", - "integrity": "sha512-cFsmgmvsgFb87e7SV7IcekogITlHX2KmlplyI9Pda0FH1Z8Ms/kWbpLs25Idp0m6ZJ3HEEjhaYYXbcTtWWUn4w==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-8.1.1.tgz", + "integrity": "sha512-E+tWr3acRdoe1nXbHMu86SSqA1WGM7Yw3jZRLvlCMnXwTHP8lgFFVn5BnKnF26uc5SfZ3D7pA9sN7S3Y2jG4Ew==", + "dev": true, "requires": { "@sinonjs/commons": "^1.7.0", "@sinonjs/formatio": "^4.0.1", - "@sinonjs/samsam": "^4.2.1", - "diff": "^4.0.1", + "@sinonjs/samsam": "^4.2.2", + "diff": "^4.0.2", "lolex": "^5.1.2", "nise": "^3.0.1", "supports-color": "^7.1.0" @@ -9996,6 +10220,7 @@ "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": "^4.2.0" @@ -10005,6 +10230,7 @@ "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.6.0", "lodash.get": "^4.4.2", @@ -10012,19 +10238,22 @@ } }, "diff": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": 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==" + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true }, "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" } @@ -10033,6 +10262,7 @@ "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/commons": "^1.7.0", "@sinonjs/formatio": "^4.0.1", @@ -10046,6 +10276,7 @@ "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" } @@ -11647,6 +11878,203 @@ } } }, + "yargs-unparser": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", + "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.11", + "yargs": "^12.0.5" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "z-schema": { "version": "3.25.1", "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-3.25.1.tgz", diff --git a/package.json b/package.json index dddf4fd1d..d3d7fb964 100644 --- a/package.json +++ b/package.json @@ -79,54 +79,54 @@ "@hapi/vision": "5.5.4", "@mojaloop/central-object-store": "8.5.0-snapshot", "@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": "9.1.0", + "@mojaloop/central-services-metrics": "8.8.0", + "@mojaloop/central-services-shared": "9.1.1", "@mojaloop/central-services-stream": "8.7.2", "@mojaloop/event-sdk": "8.7.0", "@mojaloop/forensic-logging-client": "8.3.0", "@mojaloop/ml-number": "8.2.0", - "@now-ims/hapi-now-auth": "2.0.0", + "@now-ims/hapi-now-auth": "2.0.1", "awaitify-stream": "1.0.2", "base64url": "3.0.1", "blipp": "4.0.1", "catbox-memory": "4.0.1", - "commander": "4.1.0", - "cron": "1.7.2", + "commander": "4.1.1", + "cron": "1.8.2", "decimal.js": "10.2.0", - "docdash": "1.1.1", + "docdash": "1.2.0", "five-bells-condition": "5.0.1", "glob": "7.1.6", "hapi-auth-basic": "5.0.0", "hapi-auth-bearer-token": "6.2.1", "hapi-swagger": "11.1.0", - "knex": "0.20.7", + "knex": "0.20.9", "lodash": "4.17.15", "moment": "2.24.0", - "mongoose": "5.8.7", + "mongoose": "5.8.11", "npm-run-all": "4.1.5", "rc": "1.2.8", "require-glob": "3.2.0", "uuid4": "1.1.4" }, "optionalDependencies": { - "mysql": "2.17.1" + "mysql": "2.18.1" }, "devDependencies": { "async-retry": "1.3.1", "faucet": "0.0.1", - "get-port": "5.1.0", + "get-port": "5.1.1", "jsdoc": "3.6.3", "jsonpath": "1.0.2", "nodemon": "2.0.2", - "npm-audit-resolver": "2.1.0", + "npm-audit-resolver": "2.2.0", "npm-check-updates": "4.0.1", "nyc": "15.0.0", "pre-commit": "1.2.2", "proxyquire": "2.1.3", - "sinon": "8.0.4", + "sinon": "8.1.1", "standard": "14.3.1", "tap-xunit": "2.4.1", "tape": "4.13.0", diff --git a/src/api/settlement/handler.js b/src/api/settlementModels/handler.js similarity index 94% rename from src/api/settlement/handler.js rename to src/api/settlementModels/handler.js index 754cac0de..139d5393a 100644 --- a/src/api/settlement/handler.js +++ b/src/api/settlementModels/handler.js @@ -18,10 +18,11 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas -------------- ******/ - 'use strict' const SettlementService = require('../../domain/settlement') @@ -38,13 +39,13 @@ const create = async function (request, h) { const settlementDelay = Enum.SettlementDelay[request.payload.settlementDelay] const ledgerAccountType = await SettlementService.getLedgerAccountTypeName(request.payload.ledgerAccountType) if (!ledgerAccountType) { - throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR, 'Ledger account type was not found.') + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR, 'Ledger account type was not found') } const settlementModelExist = await SettlementService.getByName(request.payload.name) if (settlementModelExist) { throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.CLIENT_ERROR, 'This Settlement Model already exists') } else { - await SettlementService.createSettlementModel(request.payload.name, true, settlementGranularity, settlementInterchange, settlementDelay, request.payload.currency, request.payload.requireLiquidityCheck, ledgerAccountType.ledgerAccountTypeId) + await SettlementService.createSettlementModel(request.payload.name, true, settlementGranularity, settlementInterchange, settlementDelay, request.payload.currency, request.payload.requireLiquidityCheck, ledgerAccountType.ledgerAccountTypeId, request.payload.autoPositionReset) return h.response().code(201) } } catch (err) { diff --git a/src/api/settlement/routes.js b/src/api/settlementModels/routes.js similarity index 91% rename from src/api/settlement/routes.js rename to src/api/settlementModels/routes.js index 356b1175c..531d148ba 100644 --- a/src/api/settlement/routes.js +++ b/src/api/settlementModels/routes.js @@ -18,10 +18,11 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas -------------- ******/ - 'use strict' const Handler = require('./handler') @@ -36,7 +37,7 @@ const tags = ['api', 'settlement'] module.exports = [ { method: 'POST', - path: '/settlementModel', + path: '/settlementModels', handler: Handler.create, options: { tags, @@ -52,7 +53,8 @@ module.exports = [ settlementDelay: Joi.string().required().valid(...settlementDelayList).description('Delay type for the settlement model IMMEDIATE or DEFERRED'), currency: Joi.string().valid(...currencyList).description('Currency code'), requireLiquidityCheck: Joi.boolean().required().description('Liquidity Check boolean'), - ledgerAccountType: Joi.string().required().valid(...ledgerAccountList).description('Account type for the settlement model POSITION, SETTLEMENT or INTERCHANGE_FEE') + ledgerAccountType: Joi.string().required().valid(...ledgerAccountList).description('Account type for the settlement model POSITION, SETTLEMENT or INTERCHANGE_FEE'), + autoPositionReset: Joi.boolean().required().description('Automatic position reset setting, which determines whether to execute the settlement transfer or not') }) } } diff --git a/src/domain/settlement/index.js b/src/domain/settlement/index.js index ad9a693a6..f0ac8f4c8 100644 --- a/src/domain/settlement/index.js +++ b/src/domain/settlement/index.js @@ -18,20 +18,21 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas -------------- ******/ - 'use strict' -const SettlementModel = require('../../models/settlement/settlement') +const SettlementModelModel = require('../../models/settlement/settlementModel') const LedgerAccountTypeModel = require('../../models/ledgerAccountType/ledgerAccountType') const ErrorHandler = require('@mojaloop/central-services-error-handling') -const createSettlementModel = async (name, isActive = true, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId = null, requireLiquidityCheck = true, ledgerAccountTypeId) => { +const createSettlementModel = async (name, isActive = true, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId = null, requireLiquidityCheck = true, ledgerAccountTypeId, autoPositionReset = false) => { try { - await SettlementModel.create(name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId) + await SettlementModelModel.create(name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId, autoPositionReset) return true } catch (err) { throw ErrorHandler.Factory.reformatFSPIOPError(err) @@ -39,7 +40,7 @@ const createSettlementModel = async (name, isActive = true, settlementGranularit } const getByName = async (name) => { try { - return await SettlementModel.getByName(name) + return await SettlementModelModel.getByName(name) } catch (err) { throw ErrorHandler.Factory.reformatFSPIOPError(err) } diff --git a/src/models/settlement/settlement.js b/src/models/settlement/settlementModel.js similarity index 92% rename from src/models/settlement/settlement.js rename to src/models/settlement/settlementModel.js index 1c41772aa..138ac00fd 100644 --- a/src/models/settlement/settlement.js +++ b/src/models/settlement/settlementModel.js @@ -18,16 +18,17 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas - -------------- ******/ - 'use strict' + const Db = require('../../lib/db') const ErrorHandler = require('@mojaloop/central-services-error-handling') -exports.create = async (name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId) => { +exports.create = async (name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId, autoPositionReset) => { try { return await Db.settlementModel.insert({ name, @@ -37,7 +38,8 @@ exports.create = async (name, isActive, settlementGranularityId, settlementInter settlementDelayId, currencyId, requireLiquidityCheck, - ledgerAccountTypeId + ledgerAccountTypeId, + autoPositionReset }) } catch (err) { throw ErrorHandler.Factory.reformatFSPIOPError(err) diff --git a/test/unit/api/settlement/handler.test.js b/test/unit/api/settlementModels/handler.test.js similarity index 55% rename from test/unit/api/settlement/handler.test.js rename to test/unit/api/settlementModels/handler.test.js index 3fc11eeea..f39575e5c 100644 --- a/test/unit/api/settlement/handler.test.js +++ b/test/unit/api/settlementModels/handler.test.js @@ -1,12 +1,37 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ 'use strict' const Test = require('tapes')(require('tape')) const Sinon = require('sinon') const Logger = require('@mojaloop/central-services-logger') -const Handler = require('../../../../src/api/settlement/handler') +const Handler = require('../../../../src/api/settlementModels/handler') const Sidecar = require('../../../../src/lib/sidecar') -const Settlement = require('../../../../src/domain/settlement') +const SettlementService = require('../../../../src/domain/settlement') Test('SettlementModel', settlementModelHandlerTest => { let sandbox @@ -22,9 +47,7 @@ Test('SettlementModel', settlementModelHandlerTest => { sandbox = Sinon.createSandbox() sandbox.stub(Sidecar) sandbox.stub(Logger) - sandbox.stub(Settlement) - // sandbox.stub(Cache) - // Cache.getEnums.returns(Promise.resolve({ POSITION: 1, SETTLEMENT: 2, HUB_RECONCILIATION: 3, HUB_MULTILATERAL_SETTLEMENT: 4, HUB_FEE: 5 })) + sandbox.stub(SettlementService) test.end() }) @@ -42,10 +65,11 @@ Test('SettlementModel', settlementModelHandlerTest => { settlementDelay: 'IMMEDIATE', settlementCurrency: 'USD', requireLiquidityCheck: true, - type: 'POSITION' + type: 'POSITION', + autoPositionReset: true } - Settlement.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) - Settlement.getByName.returns(Promise.resolve(false)) + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) + SettlementService.getByName.returns(Promise.resolve(false)) const reply = { response: () => { return { @@ -67,10 +91,11 @@ Test('SettlementModel', settlementModelHandlerTest => { settlementDelay: 'IMMEDIATE', settlementCurrency: 'USD', requireLiquidityCheck: true, - type: 'POSITION' + type: 'POSITION', + autoPositionReset: true } - Settlement.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) - Settlement.getByName.returns(Promise.resolve(true)) + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) + SettlementService.getByName.returns(Promise.resolve(true)) try { await Handler.create({ payload }) test.fail('Error not thrown') @@ -89,16 +114,17 @@ Test('SettlementModel', settlementModelHandlerTest => { settlementDelay: 'DEFERRED', settlementCurrency: 'USD', requireLiquidityCheck: true, - type: 'POSITION' + type: 'POSITION', + autoPositionReset: true } - Settlement.getLedgerAccountTypeName.returns(Promise.resolve(false)) + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(false)) try { await Handler.create({ payload }) test.fail('Error not thrown') } catch (e) { test.ok(e instanceof Error) - test.equal(e.message, 'Ledger account type was not found.') + test.equal(e.message, 'Ledger account type was not found') test.end() } }) diff --git a/test/unit/api/settlement/routes.test.js b/test/unit/api/settlementModels/routes.test.js similarity index 89% rename from test/unit/api/settlement/routes.test.js rename to test/unit/api/settlementModels/routes.test.js index 5f35c946d..900d0facc 100644 --- a/test/unit/api/settlement/routes.test.js +++ b/test/unit/api/settlementModels/routes.test.js @@ -18,18 +18,19 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas -------------- ******/ - 'use strict' const Test = require('tape') const Base = require('../../base') const AdminRoutes = require('../../../../src/api/routes') -Test('test settlementModel routes', async function (assert) { - const req = Base.buildRequest({ url: '/settlementModel', method: 'POST' }) +Test('test settlementModels routes', async function (assert) { + const req = Base.buildRequest({ url: '/settlementModels', method: 'POST' }) const server = await Base.setup(AdminRoutes) const res = await server.inject(req) assert.ok(res) diff --git a/test/unit/domain/settlement/index.test.js b/test/unit/domain/settlement/index.test.js index effb39733..8d4d05ddb 100644 --- a/test/unit/domain/settlement/index.test.js +++ b/test/unit/domain/settlement/index.test.js @@ -18,22 +18,22 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas - -------------- ******/ - 'use strict' const Test = require('tapes')(require('tape')) const Sinon = require('sinon') const Db = require('../../../../src/lib/db') -const SettlementModel = require('../../../../src/models/settlement/settlement') +const SettlementModel = require('../../../../src/models/settlement/settlementModel') const LedgerAccountTypeModel = require('../../../../src/models/ledgerAccountType/ledgerAccountType') -const Service = require('../../../../src/domain/settlement/index') +const SettlementService = require('../../../../src/domain/settlement/index') -Test('SettlementModel service', async (settlementModelTest) => { +Test('SettlementModel SettlementService', async (settlementModelTest) => { let sandbox settlementModelTest.beforeEach(t => { @@ -72,7 +72,7 @@ Test('SettlementModel service', async (settlementModelTest) => { await settlementModelTest.test('create settlement model', async (assert) => { try { sandbox.stub(SettlementModel, 'create') - const expected = await Service.createSettlementModel('IMMEDIATE_GROSS', true, 1, 1, 1, 'USD', true, 'POSITION') + const expected = await SettlementService.createSettlementModel('IMMEDIATE_GROSS', true, 1, 1, 1, 'USD', true, 'POSITION', true) assert.equal(expected, true) assert.end() } catch (err) { @@ -84,7 +84,7 @@ Test('SettlementModel service', async (settlementModelTest) => { await settlementModelTest.test('create settlement model should throw an error', async (assert) => { try { sandbox.stub(SettlementModel, 'create').throws(new Error()) - await Service.createSettlementModel() + await SettlementService.createSettlementModel() assert.fail('Error not thrown') assert.end() } catch (err) { @@ -107,7 +107,7 @@ Test('SettlementModel service', async (settlementModelTest) => { try { LedgerAccountTypeModel.getLedgerAccountByName.withArgs(name.type).returns(ledgerAccountsMock) - const expected = await Service.getLedgerAccountTypeName(name.type) + const expected = await SettlementService.getLedgerAccountTypeName(name.type) assert.deepEqual(expected, ledgerAccountsMock, 'Results matched') assert.end() } catch (err) { @@ -131,7 +131,7 @@ Test('SettlementModel service', async (settlementModelTest) => { try { LedgerAccountTypeModel.getLedgerAccountByName.withArgs(name.type).throws(new Error()) - const expected = await Service.getLedgerAccountTypeName(name.type) + const expected = await SettlementService.getLedgerAccountTypeName(name.type) assert.deepEqual(expected, ledgerAccountsMock, 'Results matched') assert.end() } catch (err) { @@ -142,7 +142,7 @@ Test('SettlementModel service', async (settlementModelTest) => { await settlementModelTest.test('get settlement model by name', async (assert) => { try { sandbox.stub(SettlementModel, 'getByName').returns(settlementModel) - const expected = await Service.getByName('test') + const expected = await SettlementService.getByName('test') assert.equal(expected, settlementModel) assert.end() } catch (err) { @@ -154,7 +154,7 @@ Test('SettlementModel service', async (settlementModelTest) => { await settlementModelTest.test('get settlement model by name should throw an error', async (assert) => { try { sandbox.stub(SettlementModel, 'getByName').throws(new Error()) - await Service.getByName('test') + await SettlementService.getByName('test') assert.fail('Error not thrown') assert.end() } catch (err) { diff --git a/test/unit/models/settlement/settlement.test.js b/test/unit/models/settlement/settlementModel.test.js similarity index 87% rename from test/unit/models/settlement/settlement.test.js rename to test/unit/models/settlement/settlementModel.test.js index d4a2282cc..b7a59c1bc 100644 --- a/test/unit/models/settlement/settlement.test.js +++ b/test/unit/models/settlement/settlementModel.test.js @@ -18,18 +18,18 @@ * Gates Foundation - Name Surname + * ModusBox + - Georgi Georgiev - Lazola Lucas - -------------- ******/ - 'use strict' const Test = require('tapes')(require('tape')) const Sinon = require('sinon') const Db = require('../../../../src/lib/db') const Logger = require('@mojaloop/central-services-logger') -const Model = require('../../../../src/models/settlement/settlement') +const SettlementModelModel = require('../../../../src/models/settlement/settlementModel') Test('Settlement model', async (settlementTest) => { const sandbox = Sinon.createSandbox() @@ -40,7 +40,7 @@ Test('Settlement model', async (settlementTest) => { find: sandbox.stub() } try { - const r = await Model.create({ name: 'DEFERRED_NET', settlementGranularityId: 2, settlementInterchangeId: 2, settlementDelayId: 2, ledgerAccountTypeId: 1 }) + const r = await SettlementModelModel.create({ name: 'DEFERRED_NET', settlementGranularityId: 2, settlementInterchangeId: 2, settlementDelayId: 2, ledgerAccountTypeId: 1 }) assert.ok(r) assert.end() } catch (err) { @@ -53,7 +53,7 @@ Test('Settlement model', async (settlementTest) => { await settlementTest.test('create settlement model should throw an error', async (assert) => { Db.settlementModel.insert.throws(new Error('message')) try { - const r = await Model.create({ participantId: 1, currencyId: 'USD', createdBy: 'unknown' }) + const r = await SettlementModelModel.create({ participantId: 1, currencyId: 'USD', createdBy: 'unknown' }) assert.comment(r) assert.fail(' should throw') } catch (err) { @@ -89,7 +89,7 @@ Test('Settlement model', async (settlementTest) => { requireLiquidityCheck: 1, ledgerAccountTypeId: 6 } - const result = await Model.getByName('test') + const result = await SettlementModelModel.getByName('test') assert.equal(JSON.stringify(result), JSON.stringify(expected)) assert.end() } catch (err) { @@ -102,7 +102,7 @@ Test('Settlement model', async (settlementTest) => { await settlementTest.test('get with empty name', async (assert) => { Db.settlementModel.find.withArgs({ name: '' }).throws(new Error()) try { - await Model.getByName('') + await SettlementModelModel.getByName('') assert.fail(' should throws with empty name ') } catch (err) { assert.assert(err instanceof Error, ` throws ${err} `)