diff --git a/package-lock.json b/package-lock.json index 42e2707..5deb4bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,34 +1,35 @@ { "name": "transaction-requests-service", - "version": "7.3.0", + "version": "7.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { "@ava/babel-plugin-throws-helper": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@ava/babel-plugin-throws-helper/-/babel-plugin-throws-helper-3.0.0.tgz", - "integrity": "sha512-mN9UolOs4WX09QkheU1ELkVy2WPnwonlO3XMdN8JF8fQqRVgVTR21xDbvEOUsbwz6Zwjq7ji9yzyjuXqDPalxg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@ava/babel-plugin-throws-helper/-/babel-plugin-throws-helper-4.0.0.tgz", + "integrity": "sha512-3diBLIVBPPh3j4+hb5lo0I1D+S/O/VDJPI4Y502apBxmwEqjyXG4gTSPFUlm41sSZeZzMarT/Gzovw9kV7An0w==", "dev": true }, "@ava/babel-preset-stage-4": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@ava/babel-preset-stage-4/-/babel-preset-stage-4-3.0.0.tgz", - "integrity": "sha512-uI5UBx++UsckkfnbF0HH6jvTIvM4r/Kxt1ROO2YXKu5H15sScAtxUIAHiUVbPIw24zPqz/PlF3xxlIDuyFzlQw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@ava/babel-preset-stage-4/-/babel-preset-stage-4-4.0.0.tgz", + "integrity": "sha512-lZEV1ZANzfzSYBU6WHSErsy7jLPbD1iIgAboASPMcKo7woVni5/5IKWeT0RxC8rY802MFktur3OKEw2JY1Tv2w==", "dev": true, "requires": { "@babel/plugin-proposal-async-generator-functions": "^7.2.0", + "@babel/plugin-proposal-dynamic-import": "^7.5.0", "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-transform-dotall-regex": "^7.4.3", - "@babel/plugin-transform-modules-commonjs": "^7.4.3" + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/plugin-transform-modules-commonjs": "^7.5.0" } }, "@ava/babel-preset-transform-test-files": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@ava/babel-preset-transform-test-files/-/babel-preset-transform-test-files-5.0.0.tgz", - "integrity": "sha512-rqgyQwkT0+j2JzYP51dOv80u33rzAvjBtXRzUON+7+6u26mjoudRXci2+1s18rat8r4uOlZfbzm114YS6pwmYw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@ava/babel-preset-transform-test-files/-/babel-preset-transform-test-files-6.0.0.tgz", + "integrity": "sha512-8eKhFzZp7Qcq1VLfoC75ggGT8nQs9q8fIxltU47yCB7Wi7Y8Qf6oqY1Bm0z04fIec24vEgr0ENhDHEOUGVDqnA==", "dev": true, "requires": { - "@ava/babel-plugin-throws-helper": "^3.0.0", + "@ava/babel-plugin-throws-helper": "^4.0.0", "babel-plugin-espower": "^3.0.1" } }, @@ -406,6 +407,16 @@ "@babel/plugin-syntax-async-generators": "^7.2.0" } }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz", + "integrity": "sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.2.0" + } + }, "@babel/plugin-proposal-optional-catch-binding": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz", @@ -425,10 +436,10 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, - "@babel/plugin-syntax-object-rest-spread": { + "@babel/plugin-syntax-dynamic-import": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz", - "integrity": "sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA==", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz", + "integrity": "sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" @@ -534,12 +545,19 @@ } }, "@hapi/accept": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@hapi/accept/-/accept-3.2.2.tgz", - "integrity": "sha512-UtXlTT59srtMr7ZRBzK2CvyWqFwlf78hPt9jEXqkwfbwiwRH1PRv/qkS8lgr5ZyoG6kfpU3xTgt2X91Yfe/6Yg==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/@hapi/accept/-/accept-3.2.3.tgz", + "integrity": "sha512-qEzsOJkCAJZxwj3iF83bSG9Lxy8Bpbrt8mRLNdvSALT6vlU2cYh6ZEHKEZPy4h/Mo31Su3j0rJgFF91+W1RWDQ==", "requires": { "@hapi/boom": "7.x.x", - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/address": { @@ -556,11 +574,18 @@ } }, "@hapi/b64": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@hapi/b64/-/b64-4.2.0.tgz", - "integrity": "sha512-hmfPC1aF7cP21489A/IWPC3s1GE+1eAteVwFcOWLwj0Pky8eHgvrXPSSko2IeCpxqOdZhYw71IFN8xKPdv3CtQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@hapi/b64/-/b64-4.2.1.tgz", + "integrity": "sha512-zqHpQuH5CBMw6hADzKfU/IGNrxq1Q+/wTYV+OiZRQN9F3tMyk+9BUMeBvFRMamduuqL8iSp62QAnJ+7ATiYLWA==", "requires": { - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/boom": { @@ -586,32 +611,53 @@ "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==" }, "@hapi/call": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@hapi/call/-/call-5.1.0.tgz", - "integrity": "sha512-CiVEXjD/jiIHBqufBW3pdedshEMjRmHtff7m1puot8j4MUmuKRbLlh0DB8fv6QqH/7/55pH1qgFj300r0WpyMw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@hapi/call/-/call-5.1.1.tgz", + "integrity": "sha512-M6fC+9+K/ZB4hIdVQ8i0kc/6J5PWlW3PEWYKAAZpw0sk+28LiRTSF8BjOWwmiIjZWWs42AnEIiFJA0YrvcDnlw==", "requires": { "@hapi/boom": "7.x.x", - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/catbox": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@hapi/catbox/-/catbox-10.2.1.tgz", - "integrity": "sha512-u13BXlnmmrNUZssjTriRVTLuk6I/yUy5C1/Pia1+E2cpfd7o2/jmEvYdFgeS0Ft9QTz7WWhpXKlrguARUuohhQ==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@hapi/catbox/-/catbox-10.2.2.tgz", + "integrity": "sha512-a4KejaKqDOMdwo/PIYoAaObVMmkfkG3RS85kPqNTTURjWnIV1+rrZ938f6RCz5EbrroKbuNC0bcvAt7lAD5LNg==", "requires": { "@hapi/boom": "7.x.x", - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/joi": "15.x.x", "@hapi/podium": "3.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/catbox-memory": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@hapi/catbox-memory/-/catbox-memory-4.1.0.tgz", - "integrity": "sha512-libCGyufOZaJu6uE9nVXw/u8tqOt4ifNIrOSAsDjzS+af3vPJyid8faOICqKCAh3E338UAsUe5AeYdezdsmtpg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@hapi/catbox-memory/-/catbox-memory-4.1.1.tgz", + "integrity": "sha512-T6Hdy8DExzG0jY7C8yYWZB4XHfc0v+p1EGkwxl2HoaPYAmW7I3E59M/IvmSVpis8RPcIoBp41ZpO2aZPBpM2Ww==", "requires": { "@hapi/boom": "7.x.x", - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/content": { @@ -630,21 +676,33 @@ "@hapi/boom": "7.x.x" } }, + "@hapi/file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@hapi/file/-/file-1.0.0.tgz", + "integrity": "sha512-Bsfp/+1Gyf70eGtnIgmScvrH8sSypO3TcK3Zf0QdHnzn/ACnAkI6KLtGACmNRPEzzIy+W7aJX5E+1fc9GwIABQ==" + }, "@hapi/good": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@hapi/good/-/good-8.2.0.tgz", - "integrity": "sha512-/teb7vubMlWup+Eg/VLdJ6blhWNkU8JUhEbpAP6XTycWbtYwBoXLv3CBFre0jSBZQ7gElKhEzZXYBpr1ET/5JA==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/good/-/good-8.2.1.tgz", + "integrity": "sha512-/DO3d9BMgW/6fleOjqgP381Z4DMASbKutgI+OzIiVxOjw8SCOiRKsY94X3R3e0HQOXCbFF6hoXz6IoQGpQXjfQ==", "requires": { - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/joi": "15.x.x", "@hapi/oppsy": "2.x.x", "pumpify": "1.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/hapi": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/@hapi/hapi/-/hapi-18.3.1.tgz", - "integrity": "sha512-gBiU9isWWezrg0ucX95Ph6AY6fUKZub3FxKapaleoFBJDOUcxTYiQR6Lha2zvHalIFoTl3K04O3Yr/5pD17QkQ==", + "version": "18.3.2", + "resolved": "https://registry.npmjs.org/@hapi/hapi/-/hapi-18.3.2.tgz", + "integrity": "sha512-UJogSyMPe4VFfzjQW5v2ixLvTLZLSfPs1XV/DRnAl2znzsGCaNJI+tgNxjM9lszOjEEkMfxLgoXZadk9exnIxw==", "requires": { "@hapi/accept": "3.x.x", "@hapi/ammo": "3.x.x", @@ -654,7 +712,7 @@ "@hapi/catbox": "10.x.x", "@hapi/catbox-memory": "4.x.x", "@hapi/heavy": "6.x.x", - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/joi": "15.x.x", "@hapi/mimos": "4.x.x", "@hapi/podium": "3.x.x", @@ -664,16 +722,30 @@ "@hapi/subtext": "6.x.x", "@hapi/teamwork": "3.x.x", "@hapi/topo": "3.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/heavy": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@hapi/heavy/-/heavy-6.2.0.tgz", - "integrity": "sha512-tzGU9cElY0IxRBudGB7tLFkdpBD8XQPfd6G7DSOnvHRK+q96UHGHn4t59Yd7kDpVucNkErWWYarsGx2KmKPkXA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@hapi/heavy/-/heavy-6.2.1.tgz", + "integrity": "sha512-uaEyC4AtGCGKt/LLBbdDQxJP1bFAbxiot6n/fwa4kyo6w8ULpXXCh8FxLlJ5mC06lqbAxQv45JyozIB6P4Dsig==", "requires": { "@hapi/boom": "7.x.x", - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/joi": "15.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/hoek": { @@ -702,14 +774,21 @@ } }, "@hapi/iron": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@hapi/iron/-/iron-5.1.0.tgz", - "integrity": "sha512-+MK3tBPkEKd50SrDTRXa2DVvE0UTPFKxGbodlbQpNP9SVlxi+ZwA640VJtMNj84FZh81UUxda8AOLPRKFffnEA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@hapi/iron/-/iron-5.1.1.tgz", + "integrity": "sha512-QYfm6nofZ19pIxm8LR0lsANBabrdxqe0vUYKKI+0w9VdCetoove+dxfbLfduVDM72kh/RNOQG6E5/xyI826PcA==", "requires": { "@hapi/b64": "4.x.x", "@hapi/boom": "7.x.x", "@hapi/cryptiles": "4.x.x", - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/joi": { @@ -723,95 +802,159 @@ } }, "@hapi/mimos": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@hapi/mimos/-/mimos-4.1.0.tgz", - "integrity": "sha512-CkxOB15TFZDMl5tQ5qezKZvvBnkRYVc8YksNfA5TnqQMMsU7vGPyvuuNFqj+15bfEwHyM6qasxyQNdkX9B/cQw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@hapi/mimos/-/mimos-4.1.1.tgz", + "integrity": "sha512-CXoi/zfcTWfKYX756eEea8rXJRIb9sR4d7VwyAH9d3BkDyNgAesZxvqIdm55npQc6S9mU3FExinMAQVlIkz0eA==", "requires": { - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "mime-db": "1.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/nigel": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@hapi/nigel/-/nigel-3.1.0.tgz", - "integrity": "sha512-IJyau32pz5Bf7pzUU/8AIn/SvPvhLMQcOel6kM7ECpKyPc895AwttSusRKfgTwfxZOEG6W8DnNv25gLtqrVFSg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@hapi/nigel/-/nigel-3.1.1.tgz", + "integrity": "sha512-R9YWx4S8yu0gcCBrMUDCiEFm1SQT895dMlYoeNBp8I6YhF1BFF1iYPueKA2Kkp9BvyHdjmvrxCOns7GMmpl+Fw==", "requires": { - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/vise": "3.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/oppsy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@hapi/oppsy/-/oppsy-2.1.1.tgz", - "integrity": "sha512-Pi07rU7p8Zz1TdjhNu8iUlNTp1d22geW2UkA766zkrzbhgycsqPtRfnco2t3aXSqm54dgkZAK3I0fJ42q5dRVA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@hapi/oppsy/-/oppsy-2.1.2.tgz", + "integrity": "sha512-V/KNuFemyA//sowFFpeMRY4zE6szuy8vh6v2vWDPDhZFowOIwB7kqdFvmnBogk+aHHR+iKgKCU/SuUiv/xZyzg==", "requires": { - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/pez": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@hapi/pez/-/pez-4.1.0.tgz", - "integrity": "sha512-c+AxL8/cCj+7FB+tzJ5FhWKYP8zF7/7mA3Ft3a5y7h6YT26qzhj5d2JY27jur30KaZbrZAd4ofXXkqvE/IpJlA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@hapi/pez/-/pez-4.1.1.tgz", + "integrity": "sha512-TUa2C7Xk6J69HWrm+Ad+O6dFvdVAG0BiFUYaRsmkdWjFIfwHBCaOI1dWT/juNukSb39Lj6/mDVyjN+H4nKB3xg==", "requires": { "@hapi/b64": "4.x.x", "@hapi/boom": "7.x.x", "@hapi/content": "4.x.x", - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/nigel": "3.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/podium": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@hapi/podium/-/podium-3.4.0.tgz", - "integrity": "sha512-IwyewAPGlCoq+g5536PKSDqSTfgpwbj+q4cBJpEUNqzwc5C5SM2stuFsULU7x1jKeWevfgWDoYWC75ML4IOYug==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@hapi/podium/-/podium-3.4.1.tgz", + "integrity": "sha512-WbwYr5nK+GIrCdgEbN8R7Mh7z+j9AgntOLQ/YQdeLtBp+uScVmW9FoycKdNS5uweO74xwICr28Ob0DU74a2zmg==", "requires": { - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/joi": "15.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/shot": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@hapi/shot/-/shot-4.1.0.tgz", - "integrity": "sha512-rpUU5cF08fqAZLLnue6Sy0osj1QMPbrYskehxtLFPdk7CwlPcu9N/wRtgu7vDHTQCKTkag6M8sjc8V8p8lSxpg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@hapi/shot/-/shot-4.1.1.tgz", + "integrity": "sha512-TrsqCyaq24XcdvD0bSi26hjwyQQy5q/nzpasbPNgPLoGnxW3sCWE7ws3ba6dd6Atb8TEh9QBD7mBQDCrMMz2Ig==", "requires": { - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/joi": "15.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/somever": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@hapi/somever/-/somever-2.1.0.tgz", - "integrity": "sha512-kMPewbpgLd0MSlNg0bjvq57Levozbg7c3O0idpWRxRgXfXBALNATLf8GRVbnMehYXAh7YRD2mR/91kginDtJ2Q==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@hapi/somever/-/somever-2.1.1.tgz", + "integrity": "sha512-cic5Sto4KGd9B0oQSdKTokju+rYhCbdpzbMb0EBnrH5Oc1z048hY8PaZ1lx2vBD7I/XIfTQVQetBH57fU51XRA==", "requires": { "@hapi/bounce": "1.x.x", - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/statehood": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@hapi/statehood/-/statehood-6.1.0.tgz", - "integrity": "sha512-qc8Qq3kg0b3XK7siXf6DK0wp+rcOrXv336kIP6YrtD9TbQ45TsBobwKkUXB+4R3GCCQ8a6tOj8FR/9bdtjKJCA==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@hapi/statehood/-/statehood-6.1.1.tgz", + "integrity": "sha512-tMfS6B8QdrqTaKRUhHv6Ur7oPK6kcEZcnnvBK4IuaPZA9ma5UsyprTXkzbiB0V+0E56dMg3RabO1SABeZkzy6g==", "requires": { "@hapi/boom": "7.x.x", "@hapi/bounce": "1.x.x", "@hapi/bourne": "1.x.x", "@hapi/cryptiles": "4.x.x", - "@hapi/hoek": "6.x.x", + "@hapi/hoek": "8.x.x", "@hapi/iron": "5.x.x", "@hapi/joi": "15.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/subtext": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@hapi/subtext/-/subtext-6.1.0.tgz", - "integrity": "sha512-dNL4IspNciKUK9RJuArwyS1MO07ZU64z4JrCzY1+vRKczYqin8M5i34cpOrQNP3pD/A/6IbRcFg0Jl0G6pwjnA==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@hapi/subtext/-/subtext-6.1.1.tgz", + "integrity": "sha512-Y7NjKFRPwlzKRw5IdwRou42hR4IBQZolT+/DlvfSr/CBjGyu38n5+9LKfNKzqB/0AVEk+xynCijsx1o1UVWX8A==", "requires": { "@hapi/boom": "7.x.x", "@hapi/bourne": "1.x.x", "@hapi/content": "4.x.x", - "@hapi/hoek": "6.x.x", + "@hapi/file": "1.x.x", + "@hapi/hoek": "8.x.x", "@hapi/pez": "4.x.x", "@hapi/wreck": "15.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/teamwork": { @@ -828,11 +971,18 @@ } }, "@hapi/vise": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@hapi/vise/-/vise-3.1.0.tgz", - "integrity": "sha512-DUDzV0D4iVO5atghsjGZtzaF0HVtRLcxcnH6rAONyH0stnoLiFloGEuP5nkbIPU0B9cgWTzTUsQPuNHBzxy9Yw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@hapi/vise/-/vise-3.1.1.tgz", + "integrity": "sha512-OXarbiCSadvtg+bSdVPqu31Z1JoBL+FwNYz3cYoBKQ5xq1/Cr4A3IkGpAZbAuxU5y4NL5pZFZG3d2a3ZGm/dOQ==", "requires": { - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@hapi/vision": { @@ -847,45 +997,68 @@ } }, "@hapi/wreck": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-15.0.1.tgz", - "integrity": "sha512-ByXQna/W1FZk7dg8NEhL79u4QkhzszRz76VpgyGstSH8bLM01a0C8RsxmUBgi6Tjkag5jA9kaEIhF9dLpMrtBw==", + "version": "15.0.2", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-15.0.2.tgz", + "integrity": "sha512-D/7sGmx3XxxkaMWHZDKTMai8rIEfIgE+DnoZeKfmxhKGgvIpMu1f8BBmLADbdniccGer79w74IWWdXleNrT1Rw==", "requires": { "@hapi/boom": "7.x.x", "@hapi/bourne": "1.x.x", - "@hapi/hoek": "6.x.x" - } - }, - "@modusbox/mojaloop-sdk-standard-components": { - "version": "0.0.37", - "resolved": "https://registry.npmjs.org/@modusbox/mojaloop-sdk-standard-components/-/mojaloop-sdk-standard-components-0.0.37.tgz", - "integrity": "sha512-L9Klvp7USsQwpFIcGmBjYBVFa5MrtL66h8hMgoP/wUCDnhYjlyTOsf+4m5r9x2bS/ShMz2MkNQ1wUk/SjWf+8Q==", - "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" + "@hapi/hoek": "8.x.x" + }, + "dependencies": { + "@hapi/hoek": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz", + "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==" + } } }, "@mojaloop/central-services-error-handling": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-7.3.0.tgz", - "integrity": "sha512-LSqQkI2/2BI7EukrWgOFafk1rBkxrwgNDfJ1NQ1ZqvsJ5/Xuapd2rJbRi2mik5bfjObU43+GBEzWBqIGnZpksQ==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-7.4.0.tgz", + "integrity": "sha512-+2OhkP06q6aR23tqxelHwG/hzA+y10cbPBAC3ovlB0z/n1R90ENek0RKyNcDw0F9ComSmBFiY3k9gOrPYv0w8A==", "requires": { - "@modusbox/mojaloop-sdk-standard-components": "0.0.37", - "@mojaloop/central-services-shared": "6.4.1", + "@mojaloop/central-services-shared": "7.4.4", + "@mojaloop/sdk-standard-components": "7.4.0", "lodash": "4.17.15" }, "dependencies": { - "@mojaloop/central-services-shared": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-6.4.1.tgz", - "integrity": "sha512-ihtRxZiMghJgqXdstVi/qr0VepOfr2uA1VYfnPNB16TZoojWtG0xt538XG/3TfYJfxVOaShc+WlJBVoxUs774w==", + "@mojaloop/central-services-error-handling": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-7.3.0.tgz", + "integrity": "sha512-LSqQkI2/2BI7EukrWgOFafk1rBkxrwgNDfJ1NQ1ZqvsJ5/Xuapd2rJbRi2mik5bfjObU43+GBEzWBqIGnZpksQ==", "requires": { - "async": "3.1.0", - "debug": "4.1.1", + "@mojaloop/central-services-shared": "6.4.1", + "lodash": "4.17.15" + }, + "dependencies": { + "@mojaloop/central-services-shared": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-6.4.1.tgz", + "integrity": "sha512-ihtRxZiMghJgqXdstVi/qr0VepOfr2uA1VYfnPNB16TZoojWtG0xt538XG/3TfYJfxVOaShc+WlJBVoxUs774w==", + "requires": { + "async": "3.1.0", + "debug": "4.1.1", + "winston": "3.2.1" + } + } + } + }, + "@mojaloop/central-services-shared": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-7.4.4.tgz", + "integrity": "sha512-BB2iHjFuLbKyN2RUVRb5vPICfkAwJuf1uenCDvJdbl6b8/9ZB83uKyaia8BbIlhzVfv3rAFzH9Z5R3edllwvcw==", + "requires": { + "@mojaloop/central-services-stream": "6.2.2", + "axios": "0.19.0", + "catbox": "10.0.6", + "catbox-memory": "4.0.1", + "glob": "7.1.4", + "immutable": "3.8.2", + "lodash": "4.17.15", + "mustache": "3.0.1", + "raw-body": "2.4.1", + "uuid4": "1.1.4", "winston": "3.2.1" } }, @@ -906,6 +1079,11 @@ "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "mustache": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.0.1.tgz", + "integrity": "sha512-jFI/4UVRsRYdUbuDTKT7KzfOp7FiD5WzYmmwNwXyUVypC0xjoTL78Fqc0jHUPIvvGD+6DQSPHIt1NE7D1ArsqA==" } } }, @@ -920,6 +1098,31 @@ "@mojaloop/central-services-shared": "6.4.1" }, "dependencies": { + "@hapi/hapi": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/@hapi/hapi/-/hapi-18.3.1.tgz", + "integrity": "sha512-gBiU9isWWezrg0ucX95Ph6AY6fUKZub3FxKapaleoFBJDOUcxTYiQR6Lha2zvHalIFoTl3K04O3Yr/5pD17QkQ==", + "requires": { + "@hapi/accept": "3.x.x", + "@hapi/ammo": "3.x.x", + "@hapi/boom": "7.x.x", + "@hapi/bounce": "1.x.x", + "@hapi/call": "5.x.x", + "@hapi/catbox": "10.x.x", + "@hapi/catbox-memory": "4.x.x", + "@hapi/heavy": "6.x.x", + "@hapi/hoek": "6.x.x", + "@hapi/joi": "15.x.x", + "@hapi/mimos": "4.x.x", + "@hapi/podium": "3.x.x", + "@hapi/shot": "4.x.x", + "@hapi/somever": "2.x.x", + "@hapi/statehood": "6.x.x", + "@hapi/subtext": "6.x.x", + "@hapi/teamwork": "3.x.x", + "@hapi/topo": "3.x.x" + } + }, "@mojaloop/central-services-error-handling": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-5.2.0.tgz", @@ -997,11 +1200,11 @@ } }, "@mojaloop/central-services-shared": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-7.2.0.tgz", - "integrity": "sha512-dBjthgRj38GINGn2UaVHykrSaQHt9CUsxmdCEjKMOPXs67wzg7QFJJf7fOouuIqynvJnz7rBM0Df5pyM+k3ICg==", + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-7.4.5.tgz", + "integrity": "sha512-/jaqOF2M4ExfrPxWHF1npT1pZuM6EroYAQxY/nvprhRyFapI+phVsrIw2rXlgNBtcMqH7+z1DaVaN4phwRfyCQ==", "requires": { - "@mojaloop/central-services-error-handling": "7.2.2", + "@mojaloop/central-services-error-handling": "7.4.0", "@mojaloop/central-services-stream": "6.2.2", "axios": "0.19.0", "catbox": "10.0.6", @@ -1009,61 +1212,21 @@ "glob": "7.1.4", "immutable": "3.8.2", "lodash": "4.17.15", - "mustache": "3.0.1", + "mustache": "3.0.3", "raw-body": "2.4.1", "uuid4": "1.1.4", "winston": "3.2.1" }, "dependencies": { - "@modusbox/mojaloop-sdk-standard-components": { - "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@modusbox/mojaloop-sdk-standard-components/-/mojaloop-sdk-standard-components-0.0.36.tgz", - "integrity": "sha512-wtRm+BOvImnkSaq2UkAWWj3SWaSR2c6l8ibrNWNfZXJaGmcaWb+T+caue/XYGTtQyOjL1+q5Qe4P8ppfc6ZRBA==", - "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" - } - }, - "@mojaloop/central-services-error-handling": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-7.2.2.tgz", - "integrity": "sha512-nDzMRXF8OlqE0gFGMv3f3jo5Dx7YverVya3REhV6xlmXTCVytSmk2smefNFYloGumMsfcC8QTaiUhTQIU2KJfA==", - "requires": { - "@modusbox/mojaloop-sdk-standard-components": "0.0.36", - "lodash": "4.17.15" - } - }, - "@mojaloop/central-services-shared": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-6.4.1.tgz", - "integrity": "sha512-ihtRxZiMghJgqXdstVi/qr0VepOfr2uA1VYfnPNB16TZoojWtG0xt538XG/3TfYJfxVOaShc+WlJBVoxUs774w==", - "requires": { - "async": "3.1.0", - "debug": "4.1.1", - "winston": "3.2.1" - } - }, - "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==" - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "mustache": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.0.3.tgz", + "integrity": "sha512-vM5FkMHamTYmVYeAujypihuPrJQDtaUIlKeeVb1AMJ73OZLtWiF7GprqrjxD0gJWT53W9JfqXxf97nXQjMQkqA==" } } }, @@ -1125,6 +1288,19 @@ } } }, + "@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" + } + }, "@nodelib/fs.scandir": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.1.tgz", @@ -1226,9 +1402,9 @@ "dev": true }, "@types/node": { - "version": "12.7.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.1.tgz", - "integrity": "sha512-aK9jxMypeSrhiYofWWBf/T7O+KwaiAHzM4sveCdWPn71lzUSMimRnKzhXDKfKwV1kWoBo2P1aGgaIYGLf9/ljw==", + "version": "12.7.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz", + "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==", "dev": true }, "abab": { @@ -1237,15 +1413,15 @@ "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==" }, "acorn": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", - "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz", + "integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==", "dev": true }, "acorn-jsx": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz", - "integrity": "sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz", + "integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==", "dev": true }, "ajv": { @@ -1297,18 +1473,18 @@ "dev": true }, "ansi-styles": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.0.0.tgz", - "integrity": "sha512-8zjUtFJ3db/QoPXuuEMloS2AUf79/yeyttJ7Abr3hteopJu9HK8vsgGviGUMq+zyA6cZZO6gAyZoMTF6TgaEjA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.1.0.tgz", + "integrity": "sha512-Qts4KCLKG+waHc9C4m07weIY8qyeixoS0h6RnbsNVD6Fw+pEZGW3vTyObL3WXpE09Mq4Oi7/lBEyLmOiLtlYWQ==", "dev": true, "requires": { - "color-convert": "^2.0.0" + "color-convert": "^2.0.1" }, "dependencies": { "color-convert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.0.tgz", - "integrity": "sha512-hzTicsCJIHdxih9+2aLR1tNGZX5qSJGRHDPVwSY26tVrEf55XNajLOBWz2UuWSIergszA09/bqnOiHyqx9fxQg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { "color-name": "~1.1.4" @@ -1434,20 +1610,17 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "ava": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ava/-/ava-2.2.0.tgz", - "integrity": "sha512-lROj3eQ8L4ZjfiN5P8UGekEQLfKmseGMtat6pUOHgJLEb2K1kT0ZpR/IlWwuytjvwO6nZpzpD+QsTW/XiayIgg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ava/-/ava-2.3.0.tgz", + "integrity": "sha512-4VaaSnl13vpTZmqW3aMqioSolT0/ozRkjQxTLi3p8wtyRONuX/uLKL3uF0j50w2BNRoLsJqztnkX2h8xeVp2lg==", "dev": true, "requires": { - "@ava/babel-preset-stage-4": "^3.0.0", - "@ava/babel-preset-transform-test-files": "^5.0.0", - "@babel/core": "^7.5.0", - "@babel/generator": "^7.5.0", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", + "@ava/babel-preset-stage-4": "^4.0.0", + "@ava/babel-preset-transform-test-files": "^6.0.0", + "@babel/core": "^7.5.5", + "@babel/generator": "^7.5.5", "@concordance/react": "^2.0.0", - "ansi-escapes": "^4.2.0", + "ansi-escapes": "^4.2.1", "ansi-styles": "^4.0.0", "arr-flatten": "^1.1.0", "array-union": "^2.1.0", @@ -1458,7 +1631,7 @@ "chokidar": "^3.0.2", "chunkd": "^1.0.0", "ci-parallel-vars": "^1.0.0", - "clean-stack": "^2.1.0", + "clean-stack": "^2.2.0", "clean-yaml-object": "^0.1.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.0.0", @@ -1480,18 +1653,18 @@ "get-port": "^5.0.0", "globby": "^10.0.1", "ignore-by-default": "^1.0.0", - "import-local": "^3.0.1", + "import-local": "^3.0.2", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "is-error": "^2.2.2", "is-observable": "^2.0.0", "is-plain-object": "^3.0.0", "is-promise": "^2.1.0", - "lodash": "^4.17.11", + "lodash": "^4.17.15", "loud-rejection": "^2.1.0", "make-dir": "^3.0.0", "matcher": "^2.0.0", - "md5-hex": "^3.0.0", + "md5-hex": "^3.0.1", "meow": "^5.0.0", "micromatch": "^4.0.2", "ms": "^2.1.2", @@ -1504,7 +1677,7 @@ "require-precompiled": "^0.1.0", "resolve-cwd": "^3.0.0", "slash": "^3.0.0", - "source-map-support": "^0.5.12", + "source-map-support": "^0.5.13", "stack-utils": "^1.0.2", "strip-ansi": "^5.2.0", "strip-bom-buf": "^2.0.0", @@ -1528,14 +1701,6 @@ "lodash": "^4.17.13", "source-map": "^0.5.0", "trim-right": "^1.0.1" - }, - "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - } } }, "@babel/types": { @@ -1547,14 +1712,6 @@ "esutils": "^2.0.2", "lodash": "^4.17.13", "to-fast-properties": "^2.0.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - } } }, "debug": { @@ -1587,6 +1744,12 @@ "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, "supports-color": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.0.0.tgz", @@ -2562,9 +2725,9 @@ } }, "deglob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/deglob/-/deglob-3.1.0.tgz", - "integrity": "sha512-al10l5QAYaM/PeuXkAr1Y9AQz0LCtWsnJG23pIgh44hDxHFOj36l6qvhfjnIWBYwZOqM1fXUFV9tkjL7JPdGvw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/deglob/-/deglob-4.0.1.tgz", + "integrity": "sha512-/g+RDZ7yf2HvoW+E5Cy+K94YhgcFgr6C8LuHZD1O5HoNPkf3KY6RfXJ0DBGlB/NkLi5gml+G9zqRzk9S0mHZCg==", "dev": true, "requires": { "find-root": "^1.0.0", @@ -2884,9 +3047,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.1.0.tgz", - "integrity": "sha512-QhrbdRD7ofuV09IuE2ySWBz0FyXCq0rriLTZXZqaWSI79CVtHVRdkFuFTViiqzZhkCgfOh9USpriuGN2gIpZDQ==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.2.2.tgz", + "integrity": "sha512-mf0elOkxHbdyGX1IJEUsNBzCDdyoUgljF3rRlgfyYh0pwGnreLc0jjD6ZuleOibjmnUWZLY2eXwSooeOgGJ2jw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -2896,9 +3059,9 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "eslint-scope": "^5.0.0", - "eslint-utils": "^1.3.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^6.0.0", + "eslint-utils": "^1.4.2", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.1", "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", @@ -2985,15 +3148,15 @@ } }, "eslint-config-standard": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-13.0.1.tgz", - "integrity": "sha512-zLKp4QOgq6JFgRm1dDCVv1Iu0P5uZ4v5Wa4DTOkg2RFMxdCX/9Qf7lz9ezRj2dBRa955cWQF/O/LWEiYWAHbTw==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.0.1.tgz", + "integrity": "sha512-1RWsAKTDTZgA8bIM6PSC9aTGDAUlKqNkYNJlTZ5xYD/HYkIM6GlcefFvgcJ8xi0SWG5203rttKYX28zW+rKNOg==", "dev": true }, "eslint-config-standard-jsx": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-7.0.0.tgz", - "integrity": "sha512-OiKOF3MFVmWOCVfsi8GHlVorOEiBsPzAnUhM3c6HML94O2krbdQ/eMABySHgHHOIBYRls9sR9I3lo6O0vXhVEg==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-8.0.1.tgz", + "integrity": "sha512-SDnpVLSzTcT0eLNTG7s8ffRi3WadBBpw+pFsiBj4BcrHOFOga9O/7mjtNRyPgetmsiDPWGxsiS4UdJLZhaIukA==", "dev": true }, "eslint-import-resolver-node": { @@ -3327,9 +3490,9 @@ } }, "eslint-plugin-standard": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz", - "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz", + "integrity": "sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==", "dev": true }, "eslint-scope": { @@ -3343,9 +3506,9 @@ } }, "eslint-utils": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.0.tgz", - "integrity": "sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz", + "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==", "dev": true, "requires": { "eslint-visitor-keys": "^1.0.0" @@ -3376,14 +3539,14 @@ } }, "espree": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.0.0.tgz", - "integrity": "sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz", + "integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==", "dev": true, "requires": { - "acorn": "^6.0.7", - "acorn-jsx": "^5.0.0", - "eslint-visitor-keys": "^1.0.0" + "acorn": "^7.0.0", + "acorn-jsx": "^5.0.2", + "eslint-visitor-keys": "^1.1.0" } }, "esprima": { @@ -3724,6 +3887,27 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "funding": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/funding/-/funding-1.0.8.tgz", + "integrity": "sha512-M4yYVbIgS9jxKY0XS89DDpsiMHe+JiwavRaXCmJxNmhJhVPEi8KigfP6mP69oOWaTDrCfrF4rE36OhGfoHkTTQ==", + "dev": true, + "requires": { + "boxen": "^3.2.0", + "chalk": "^2.4.2", + "ci-info": "^2.0.0", + "term-size": "^2.1.0", + "word-wrap": "^1.2.3" + }, + "dependencies": { + "term-size": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.1.0.tgz", + "integrity": "sha512-I42EWhJ+2aeNQawGx1VtpO0DFI9YcfuvAMNIdKyf/6sRbHJ4P+ZQ/zIT87tE+ln1ymAGcCJds4dolfSAS0AcNg==", + "dev": true + } + } + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -3905,9 +4089,9 @@ } }, "hapi-swagger": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/hapi-swagger/-/hapi-swagger-10.0.2.tgz", - "integrity": "sha512-WnmqsGNsLSdCHRBB3LEnmDEBMl7W7IgBvvWiWe3SJLGnFgEuaY2++6zHIce4Xmmn1WRJoqIv2iNzwxN/7g62hQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/hapi-swagger/-/hapi-swagger-10.1.0.tgz", + "integrity": "sha512-mOEvz9xmonhBfKpNhfhSVYLKK1DjvqaE7jgupH68z24p/NDyhSwKGXad0w+RPx4nuGmPBW1pvVggaIsSclmZGA==", "requires": { "@hapi/boom": "^7.1.1", "@hapi/hoek": "^6.1.2", @@ -4070,9 +4254,9 @@ } }, "ignore": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.2.tgz", - "integrity": "sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", "dev": true }, "ignore-by-default": { @@ -4175,31 +4359,101 @@ "dev": true }, "inquirer": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.1.tgz", - "integrity": "sha512-uxNHBeQhRXIoHWTSNYUFhQVrHYFThIt6IVo2fFmSe8aBwdR3/w6b58hJpiL/fMukFkvGzjg+hSxFtwvVmKZmXw==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", "dev": true, "requires": { - "ansi-escapes": "^4.2.1", + "ansi-escapes": "^3.2.0", "chalk": "^2.4.2", - "cli-cursor": "^3.1.0", + "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.15", - "mute-stream": "0.0.8", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", "run-async": "^2.2.0", "rxjs": "^6.4.0", - "string-width": "^4.1.0", + "string-width": "^2.1.0", "strip-ansi": "^5.1.0", "through": "^2.3.6" }, "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "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" + }, + "dependencies": { + "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" + } + } + } } } }, @@ -5264,14 +5518,14 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "mustache": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.0.1.tgz", - "integrity": "sha512-jFI/4UVRsRYdUbuDTKT7KzfOp7FiD5WzYmmwNwXyUVypC0xjoTL78Fqc0jHUPIvvGD+6DQSPHIt1NE7D1ArsqA==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.0.2.tgz", + "integrity": "sha512-64neoEgmozb8e/ecGBOSE+RfnevLSFzCI0UKPcrWmjv953/8fXhYO9+EQFtfbi6hwoFxcTA+Fp5mRiOiI9eTuA==" }, "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "dev": true }, "nan": { @@ -6335,9 +6589,9 @@ } }, "readdirp": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.1.1.tgz", - "integrity": "sha512-XXdSXZrQuvqoETj50+JAitxz1UPdt5dupjT6T5nVB+WvjMv2XKYj+s7hPeAVCXvmJrL36O4YYyWlIC3an2ePiQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.1.2.tgz", + "integrity": "sha512-8rhl0xs2cxfVsqzreYCvs8EwBfn/DhVdqtoLmw19uI3SC5avYX9teCurlErfpPXGmYtMHReGaP2RsLnFvz/lnw==", "dev": true, "requires": { "picomatch": "^2.0.4" @@ -6840,29 +7094,131 @@ "dev": true }, "standard": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/standard/-/standard-13.1.0.tgz", - "integrity": "sha512-h3NaMzsa88+/xtjXCMvdn6EWWdlodsI/HvtsQF+EGwrF9kVNwNha9TkFABU6bSBoNfC79YDyIAq9ekxOMBFkuw==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/standard/-/standard-14.0.2.tgz", + "integrity": "sha512-2Rjsc+B1zaXiQVfUlH7n+ZIrCpxxAaVEItps2lBQUQLuyCH/Vc788w6q16PMK4ezPA61jm8A1vzBnBwcokGOgQ==", "dev": true, "requires": { "eslint": "~6.1.0", - "eslint-config-standard": "13.0.1", - "eslint-config-standard-jsx": "7.0.0", + "eslint-config-standard": "14.0.1", + "eslint-config-standard-jsx": "8.0.1", "eslint-plugin-import": "~2.18.0", "eslint-plugin-node": "~9.1.0", "eslint-plugin-promise": "~4.2.1", "eslint-plugin-react": "~7.14.2", "eslint-plugin-standard": "~4.0.0", - "standard-engine": "~11.0.1" + "funding": "^1.0.0", + "standard-engine": "^12.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "eslint": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.1.0.tgz", + "integrity": "sha512-QhrbdRD7ofuV09IuE2ySWBz0FyXCq0rriLTZXZqaWSI79CVtHVRdkFuFTViiqzZhkCgfOh9USpriuGN2gIpZDQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^6.0.0", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^11.7.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^6.4.1", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + } } }, "standard-engine": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-11.0.1.tgz", - "integrity": "sha512-WZQ5PpEDfRzPFk+H9xvKVQPQIxKnAQB2cb2Au4NyTCtdw5R0pyMBUZLbPXyFjnlhe8Ae+zfNrWU4m6H5b7cEAg==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-12.0.0.tgz", + "integrity": "sha512-gJIIRb0LpL7AHyGbN9+hJ4UJns37lxmNTnMGRLC8CFrzQ+oB/K60IQjKNgPBCB2VP60Ypm6f8DFXvhVWdBOO+g==", "dev": true, "requires": { - "deglob": "^3.0.0", + "deglob": "^4.0.0", "get-stdin": "^7.0.0", "minimist": "^1.1.0", "pkg-conf": "^3.1.0" @@ -7052,9 +7408,9 @@ "integrity": "sha1-cAcEaNbSl3ylI3suUZyn0Gouo/0=" }, "swagger-ui-dist": { - "version": "3.22.3", - "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-3.22.3.tgz", - "integrity": "sha512-tmjAsqT43pqg5UoiQ2805c+juX0ASSoI/Ash/0c19jjAOFtTfE93ZrzmFd9hjqVgre935CYeXT0uaku42Lu8xg==" + "version": "3.23.6", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-3.23.6.tgz", + "integrity": "sha512-fQvjwnezUed1JHNtqudePjgWUl+GuUiI9l+8i/FjAEIZugkiDV2bS0mf+lKRphBjDcifKs0gGpqswJLcOxAfbA==" }, "swagmock": { "version": "1.0.0", @@ -7136,9 +7492,9 @@ "dev": true }, "table": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.5.tgz", - "integrity": "sha512-oGa2Hl7CQjfoaogtrOHEJroOcYILTx7BZWLGsJIlzoWmB2zmguhNfPJZsWPKYek/MgCxfco54gEi31d1uN2hFA==", + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, "requires": { "ajv": "^6.10.2", @@ -7756,6 +8112,12 @@ "triple-beam": "^1.2.0" } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/package.json b/package.json index c9ab13d..0224bdb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "transaction-requests-service", "description": "An asynchronous pass through transaction request API for merchant payment initiated requests.", "license": "Apache-2.0", - "version": "7.3.0", + "version": "7.4.1", "author": "ModusBox", "contributors": [ "Rajiv Mothilal " @@ -44,14 +44,14 @@ ] }, "dependencies": { - "@hapi/good": "8.2.0", - "@hapi/hapi": "18.3.1", + "@hapi/good": "8.2.1", + "@hapi/hapi": "18.3.2", "@hapi/inert": "5.2.1", "@hapi/vision": "5.5.2", "@mojaloop/central-services-health": "7.0.0", "@mojaloop/central-services-metrics": "5.2.0", - "@mojaloop/central-services-shared": "7.2.0", - "@mojaloop/central-services-error-handling": "7.3.0", + "@mojaloop/central-services-shared": "7.4.5", + "@mojaloop/central-services-error-handling": "7.4.0", "axios": "0.19.0", "blipp": "4.0.0", "catbox": "10.0.6", @@ -59,19 +59,19 @@ "docdash": "1.1.1", "glob": "7.1.4", "hapi-openapi": "1.2.2", - "hapi-swagger": "10.0.2", + "hapi-swagger": "10.1.0", "immutable": "3.8.2", "jsdoc": "3.6.3", - "mustache": "3.0.1", + "mustache": "3.0.2", "uuid4": "1.1.4" }, "devDependencies": { - "ava": "2.2.0", - "eslint": "6.1.0", + "ava": "2.3.0", + "eslint": "6.2.2", "nyc": "14.1.1", "proxyquire": "2.1.3", "sinon": "7.4.1", - "standard": "13.1.0", + "standard": "14.0.2", "swagmock": "1.0.0", "tap-xunit": "2.4.1" }, diff --git a/src/domain/transactionRequests/transactionRequests.js b/src/domain/transactionRequests/transactionRequests.js index 9d2c4b7..66023d3 100644 --- a/src/domain/transactionRequests/transactionRequests.js +++ b/src/domain/transactionRequests/transactionRequests.js @@ -23,59 +23,54 @@ ******/ 'use strict' -const Enum = require('../../lib/enum') -const participantEndpointModel = require('../../models/participantEndpoint/participantEndpoint') -const Errors = require('../../lib/errors') +const Enum = require('@mojaloop/central-services-shared').Enum +const Endpoint = require('@mojaloop/central-services-shared').Util.Endpoints const Logger = require('@mojaloop/central-services-shared').Logger const util = require('util') const Mustache = require('mustache') -const Utils = require('../../lib/util') -const requests = require('../../lib/request') +const requests = require('@mojaloop/central-services-shared').Util.Request const ErrorHandler = require('@mojaloop/central-services-error-handling') +const Config = require('../../lib/config.js') /** * Forwards transactionRequests endpoint requests to destination FSP for processing * * @returns {undefined} */ -const forwardTransactionRequest = async (request, path) => { +const forwardTransactionRequest = async (path, headers, method, params, payload) => { let endpoint - const fspiopSource = request.headers['fspiop-source'] - const fspiopDest = request.headers['fspiop-destination'] - const payload = request.payload || { transactionRequestId: request.params.ID } + const fspiopSource = headers[Enum.Http.Headers.FSPIOP.SOURCE] + const fspiopDest = headers[Enum.Http.Headers.FSPIOP.DESTINATION] + const payloadLocal = payload || { transactionRequestId: params.ID } try { - endpoint = await participantEndpointModel.getEndpoint(fspiopDest, Enum.endpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION) - Logger.info(`Resolved PAYER party ${Enum.endpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint for transactionRequest ${payload.transactionRequestId || 'error.test.js'} to: ${util.inspect(endpoint)}`) + endpoint = await Endpoint.getEndpoint(Config.SWITCH_ENDPOINT, fspiopDest, Enum.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION) + Logger.info(`Resolved PAYER party ${Enum.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint for transactionRequest ${payload.transactionRequestId || 'error.test.js'} to: ${util.inspect(endpoint)}`) if (!endpoint) { // we didnt get an endpoint for the payee dfsp! // make an error callback to the initiator - throw new Errors.FSPIOPError(request.method.toUpperCase() !== Enum.restMethods.GET ? payload : undefined, - `No ${Enum.endpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint found for transactionRequest ${payload.transactionRequestId} for ${fspiopDest}`, fspiopSource, - Errors.ApiErrorCodes.DESTINATION_FSP_ERROR) + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_FSP_ERROR, `No ${Enum.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint found for transactionRequest ${payload.transactionRequestId} for ${Enum.Http.Headers.FSPIOP.DESTINATION}`, request.method.toUpperCase() !== Enum.Http.RestMethods.GET ? payload : undefined, fspiopSource) } const fullUrl = Mustache.render(endpoint + path, { - ID: payload.transactionRequestId || request.params.ID + ID: payloadLocal.transactionRequestId || params.ID }) Logger.info(`Forwarding transaction request to endpoint: ${fullUrl}`) // Network errors lob an exception. Bare in mind 3xx 4xx and 5xx are not network errors // so we need to wrap the request below in a `try catch` to handle network errors let res try { - res = await requests.sendRequest(fullUrl, Utils.generateRequestHeaders(request.headers), request.method, request.method.toUpperCase() !== Enum.restMethods.GET ? payload : undefined) + res = await requests.sendRequest(fullUrl, headers, fspiopSource, fspiopDest, method, method.toUpperCase() !== Enum.Http.RestMethods.GET ? payloadLocal : undefined) } catch (e) { - throw new Errors.FSPIOPError('Network error', `Network error forwarding quote request: ${e.stack || util.inspect(e)}`, - fspiopSource, Errors.ApiErrorCodes.DESTINATION_COMMUNICATION_ERROR) + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_COMMUNICATION_ERROR, `Network error forwarding quote request: ${e.stack || util.inspect(e)}`, 'Network error', fspiopSource) } Logger.info(`Forwarding transaction request ${payload.transactionRequestId} from ${fspiopSource} to ${fspiopDest} got response ${res.status} ${res.statusText}`) // handle non network related errors below if (!res.ok) { - throw new Errors.FSPIOPError(res.statusText, 'Got non-success response forwarding transaction request', - fspiopSource, Errors.ApiErrorCodes.DESTINATION_COMMUNICATION_ERROR) + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_COMMUNICATION_ERROR, 'Got non-success response forwarding transaction request', res.statusText, fspiopSource) } return true } catch (err) { Logger.info(`Error forwarding transaction request to endpoint ${endpoint}: ${err.stack || util.inspect(err)}`) - forwardTransactionRequestError(request.headers, fspiopSource, Enum.endpoints.TRANSACTION_REQUEST_PUT_ERROR, Enum.restMethods.PUT, request.params.ID, err) + forwardTransactionRequestError(headers, Enum.Http.Headers.FSPIOP.SOURCE, Enum.EndPoints.FspEndpointTemplates.TRANSACTION_REQUEST_PUT_ERROR, Enum.Http.RestMethods.PUT, params.ID, err) throw ErrorHandler.Factory.reformatFSPIOPError(err) } } @@ -87,17 +82,16 @@ const forwardTransactionRequest = async (request, path) => { */ const forwardTransactionRequestError = async (headers, to, path, method, transactionRequestId, payload) => { let endpoint - const fspiopSource = headers['fspiop-source'] + const fspiopSource = headers[Enum.Http.Headers.FSPIOP.SOURCE] + const fspiopDestination = headers[Enum.Http.Headers.FSPIOP.DESTINATION] try { - endpoint = await participantEndpointModel.getEndpoint(to, Enum.endpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION) - Logger.info(`Resolved PAYER party ${Enum.endpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint for transactionRequest ${transactionRequestId || 'error.test.js'} to: ${util.inspect(endpoint)}`) + endpoint = await Endpoint.getEndpoint(Config.SWITCH_ENDPOINT, to, Enum.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION) + Logger.info(`Resolved PAYER party ${Enum.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint for transactionRequest ${transactionRequestId || 'error.test.js'} to: ${util.inspect(endpoint)}`) if (!endpoint) { // we didnt get an endpoint for the payee dfsp! // make an error callback to the initiator - throw new Errors.FSPIOPError(payload, - `No ${Enum.endpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint found for transactionRequest ${transactionRequestId} for ${to}`, fspiopSource, - Errors.ApiErrorCodes.DESTINATION_FSP_ERROR) + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_FSP_ERROR, `No ${Enum.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_TRANSACTION} endpoint found for transactionRequest ${transactionRequestId} for ${to}`, payload, fspiopSource) } const fullUrl = Mustache.render(endpoint + path, { ID: transactionRequestId @@ -108,17 +102,15 @@ const forwardTransactionRequestError = async (headers, to, path, method, transac // so we need to wrap the request below in a `try catch` to handle network errors let res try { - res = await requests.sendRequest(fullUrl, Utils.generateRequestHeaders(headers), method, payload || undefined) + res = await requests.sendRequest(fullUrl, headers, fspiopSource, fspiopDestination, method, payload || undefined) } catch (e) { - throw new Errors.FSPIOPError('Network error', `Network error forwarding quote request: ${e.stack || util.inspect(e)}`, - fspiopSource, Errors.ApiErrorCodes.DESTINATION_COMMUNICATION_ERROR) + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_FSP_ERROR, `Network error forwarding quote request: ${e.stack || util.inspect(e)}`, 'Network error', fspiopSource) } Logger.info(`Forwarding transaction request ${transactionRequestId} from ${fspiopSource} to ${to} got response ${res.status} ${res.statusText}`) // handle non network related errors below if (!res.ok) { - throw new Errors.FSPIOPError(res.statusText, 'Got non-success response forwarding transaction request', - fspiopSource, Errors.ApiErrorCodes.DESTINATION_COMMUNICATION_ERROR) + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_COMMUNICATION_ERROR, 'Got non-success response forwarding transaction request', res.statusText, fspiopSource) } return true } catch (err) { diff --git a/src/handlers/health.js b/src/handlers/health.js index 3221129..249e53b 100644 --- a/src/handlers/health.js +++ b/src/handlers/health.js @@ -41,4 +41,4 @@ module.exports = { * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503 */ get: defaultHealthHandler(healthCheck) -} \ No newline at end of file +} diff --git a/src/handlers/transactionRequests.js b/src/handlers/transactionRequests.js index 52e1263..a91caae 100644 --- a/src/handlers/transactionRequests.js +++ b/src/handlers/transactionRequests.js @@ -1,6 +1,6 @@ 'use strict' -const Enum = require('../lib/enum') +const Enum = require('@mojaloop/central-services-shared').Enum const transactionRequest = require('../domain/transactionRequests/transactionRequests') /** * Operations on /transactionRequests @@ -14,7 +14,7 @@ module.exports = { * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ post: function (request, h) { - transactionRequest.forwardTransactionRequest(request, Enum.endpoints.TRANSACTION_REQUEST_POST) - return h.response().code(202) + transactionRequest.forwardTransactionRequest(Enum.EndPoints.FspEndpointTemplates.TRANSACTION_REQUEST_POST, request.headers, request.method, request.params, request.payload) + return h.response().code(Enum.Http.ReturnCodes.ACCEPTED.CODE) } } diff --git a/src/handlers/transactionRequests/{ID}.js b/src/handlers/transactionRequests/{ID}.js index 1cca267..fba5a6d 100644 --- a/src/handlers/transactionRequests/{ID}.js +++ b/src/handlers/transactionRequests/{ID}.js @@ -1,6 +1,6 @@ 'use strict' -const Enum = require('../../lib/enum') +const Enum = require('@mojaloop/central-services-shared').Enum const transactionRequest = require('../../domain/transactionRequests/transactionRequests') /** @@ -15,8 +15,8 @@ module.exports = { * responses: 202, 400, 401, 403, 404, 405, 406, 501, 503 */ get: function (request, h) { - transactionRequest.forwardTransactionRequest(request, Enum.endpoints.TRANSACTION_REQUEST_GET) - return h.response().code(202) + transactionRequest.forwardTransactionRequest(request, Enum.EndPoints.FspEndpointTemplates.TRANSACTION_REQUEST_GET) + return h.response().code(Enum.Http.ReturnCodes.ACCEPTED.CODE) }, /** * summary: TransactionRequestsByID @@ -26,7 +26,7 @@ module.exports = { * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503 */ put: function (request, h) { - transactionRequest.forwardTransactionRequest(request, Enum.endpoints.TRANSACTION_REQUEST_PUT) - return h.response().code(200) + transactionRequest.forwardTransactionRequest(request, Enum.EndPoints.FspEndpointTemplates.TRANSACTION_REQUEST_PUT) + return h.response().code(Enum.Http.ReturnCodes.OK.CODE) } } diff --git a/src/handlers/transactionRequests/{ID}/error.js b/src/handlers/transactionRequests/{ID}/error.js index feef41a..bd769aa 100644 --- a/src/handlers/transactionRequests/{ID}/error.js +++ b/src/handlers/transactionRequests/{ID}/error.js @@ -1,6 +1,6 @@ 'use strict' -const Enum = require('../../../lib/enum') +const Enum = require('@mojaloop/central-services-shared').Enum const transactionRequest = require('../../../domain/transactionRequests/transactionRequests') /** @@ -15,7 +15,7 @@ module.exports = { * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503 */ put: function (request, h) { - transactionRequest.forwardTransactionRequestError(request.headers, request.headers['fspiop-destination'], Enum.endpoints.TRANSACTION_REQUEST_PUT_ERROR, Enum.restMethods.PUT, request.params.ID, request.payload) - return h.response().code(200) + transactionRequest.forwardTransactionRequestError(request.headers, request.headers['fspiop-destination'], Enum.EndPoints.FspEndpointTemplates.TRANSACTION_REQUEST_PUT_ERROR, Enum.Http.RestMethods.PUT, request.params.ID, request.payload) + return h.response().code(Enum.Http.ReturnCodes.OK.CODE) } } diff --git a/src/lib/enum.js b/src/lib/enum.js deleted file mode 100644 index 2ac46e9..0000000 --- a/src/lib/enum.js +++ /dev/null @@ -1,113 +0,0 @@ -/***** - 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 - - * Rajiv Mothilal - - -------------- - ******/ -'use strict' - -// TODO We should store this in the database and like to oracleEndpoint table for oracleType -const type = { - MSISDN: 'MSISDN', - EMAIL: 'EMAIL', - PERSONAL_ID: 'PERSONAL_ID', - BUSINESS: 'BUSINESS', - DEVICE: 'DEVICE', - ACCOUNT_ID: 'ACCOUNT_ID', - IBAN: 'IBAN', - ALIAS: 'ALIAS' -} - -const resources = { - participants: 'participants', - oracle: 'oracle' -} - -const apiServices = { - SWITCH: 'switch' -} - -// TODO need get all these endpoints from somewhere -const endpointTypes = { - FSPIOP_CALLBACK_URL_TRANSACTION: 'FSPIOP_CALLBACK_URL_TRANSACTION' -} - -const restMethods = { - GET: 'GET', - POST: 'POST', - PUT: 'PUT', - DELETE: 'DELETE' -} - -// TODO this needs to be looked at -const defaultHeaderWhitelist = [ - 'accept', - 'fspiop-destination', - 'fspiop-http-method', - 'fspiop-signature', - 'fspiop-source', - 'fspiop-uri', - 'date', - 'content-type' -] - -const headers = { - FSPIOP: { - SWITCH: { - regex: /^switch$/i, - value: 'switch' - }, - SOURCE: 'fspiop-source', - DESTINATION: 'fspiop-destination', - HTTP_METHOD: 'fspiop-http-method', - SIGNATURE: 'fspiop-signature', - URI: 'fspiop-uri' - }, - GENERAL: { - ACCEPT: 'accept', - DATE: 'date', - CONTENT_LENGTH: 'content-length', - HOST: 'host', - CONTENT_TYPE: 'content-type' - }, - DEFAULT: { - APPLICATION_JSON: 'application/json' - } -} - -const endpoints = { - TRANSACTION_REQUEST_POST: '/transactionRequests', - TRANSACTION_REQUEST_PUT: '/transactionRequests/{{ID}}', - TRANSACTION_REQUEST_GET: '/transactionRequests/{{ID}}', - TRANSACTION_REQUEST_PUT_ERROR: '/transactionRequests/{{ID}}/error', - PARTICIPANT_ENDPOINTS_GET: '/participants/{{fsp}}/endpoints', - PARTICIPANTS_GET: '/participants/{{fsp}}' -} - -module.exports = { - type, - resources, - apiServices, - endpointTypes, - restMethods, - defaultHeaderWhitelist, - endpoints, - headers -} diff --git a/src/lib/errors.js b/src/lib/errors.js deleted file mode 100644 index f0fb863..0000000 --- a/src/lib/errors.js +++ /dev/null @@ -1,180 +0,0 @@ -// (C)2018 ModusBox Inc. -/***** - 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. - - Initial contribution - -------------------- - The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. - * Project: Mowali - - 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 - - * Rajiv Mothilal - - -------------- - ******/ - -const util = require('util') - -/** - * See section 7.6 of "API Definition v1.0.docx" - */ -const ApiErrorCodes = { - // Generic communication errors - COMMUNICATION_ERROR: { code: 1000, message: 'Server error' }, - DESTINATION_COMMUNICATION_ERROR: { code: 1001, message: 'Destination communication error' }, - - // Generic server errors - SERVER_ERROR: { code: 2000, message: 'Server error' }, - INTERNAL_SERVER_ERROR: { code: 2001, message: 'Internal server error' }, - NOT_IMPLEMENTED: { code: 2002, message: 'Not implemented' }, - SERVICE_CURRENTLY_UNAVAILABLE: { code: 2003, message: 'Service currently unavailable' }, - SERVER_TIMED_OUT: { code: 2004, message: 'Server timed out' }, - SERVER_BUSY: { code: 2005, message: 'Server busy' }, - - // Generic client errors - CLIENT_ERROR: { code: 3000, message: 'Client error' }, - UNACCEPTABLE_VERSION: { code: 3001, message: 'Unacceptable version' }, - UNKNOWN_URI: { code: 3002, message: 'Unknown URI' }, - ADD_PARTY_INFO_ERROR: { code: 3003, message: 'Error updating or adding party information' }, - - // Client validation errors - VALIDATION_ERROR: { code: 3100, message: 'Validation error' }, - MALFORMED_SYNTAX: { code: 3101, message: 'Malformed syntax' }, - MISSING_ELEMENT: { code: 3102, message: 'Missing mandatory element' }, - TOO_MANY_ELEMENTS: { code: 3103, message: 'Too many elements' }, - TOO_LARGE_PAYLOAD: { code: 3104, message: 'Payload too large' }, - INVALID_SIGNATURE: { code: 3105, message: 'Invalid signature' }, - MODIFIED_REQUEST: { code: 3106, message: 'Modified request' }, - MISSING_MANDATORY_EXTENSION: { code: 3107, message: 'Missing mandatory extension' }, - - // identifier errors - ID_NOT_FOUND: { code: 3200, message: 'ID not found' }, - DESTINATION_FSP_ERROR: { code: 3201, message: 'Destination FSP does not exist or cannot be found' }, - PAYER_FSP_ID_NOT_FOUND: { code: 3202, message: 'Payer FSP ID not found' }, - PAYEE_FSP_ID_NOT_FOUND: { code: 3203, message: 'Payee FSP ID not found' }, - PARTY_NOT_FOUND: { code: 3204, message: 'Party not found' }, - QUOTE_ID_NOT_FOUND: { code: 3205, message: 'Quote ID not found' }, - TXN_REQUEST_ID_NOT_FOUND: { code: 3206, message: 'Transaction request ID not found' }, - TXN_ID_NOT_FOUND: { code: 3207, message: 'Transaction ID not found' }, - TRANSFER_ID_NOT_FOUND: { code: 3208, message: 'Transfer ID not found' }, - BULK_QUOTE_ID_NOT_FOUND: { code: 3209, message: 'Bulk quote ID not found' }, - BULK_TRANSFER_ID_NOT_FOUND: { code: 3210, message: 'Bulk transfer ID not found' }, - - // expired errors - EXPIRED_ERROR: { code: 3300, message: 'Entity expired' }, - TXN_REQUEST_EXPIRED: { code: 3301, message: 'Transaction request expired' }, - QUOTE_EXPIRED: { code: 3302, message: 'Quote expired' }, - TRANSFER_EXPIRED: { code: 3303, message: 'Transfer expired' }, - - // payer errors - PAYER_ERROR: { code: 4000, message: 'Error related to the Payer or Payer FSP' }, - PAYER_FSP_INSUFFICIENT_LIQUIDITY: { code: 4001, message: 'Payer FSP insufficient liquidity' }, - PAYER_REJECTION: { code: 4100, message: 'Payer or Payer FSP rejected the request' }, - PAYER_REJECTED_TXN_REQUEST: { code: 4101, message: 'Payer rejected the transaction request' }, - PAYER_FSP_UNSUPPORTED_TXN_TYPE: { code: 4102, message: 'Payer FSP does not support or rejected the transaction type' }, - PAYER_UNSUPPORTED_CURRENCY: { code: 4103, message: 'Payer does not have an account which supports the requested currency' }, - PAYER_LIMIT_ERROR: { code: 4200, message: 'Payer limit exceeded' }, - PAYER_PERMISSION_ERROR: { code: 4300, message: 'Payer or Payer FSP insufficient permissions' }, - PAYER_BLOCKED_ERROR: { code: 4400, message: 'Payer blocked' }, - - // payee errors - PAYEE_ERROR: { code: 5000, message: 'Error related to the payee or payee FSP' }, - PAYEE_FSP_INSUFFICIENT_LIQUIDITY: { code: 5001, message: 'Payee FSP insufficient liquidity' }, - PAYEE_REJECTION: { code: 5100, message: 'Payee or Payee FSP rejected the request.' }, - PAYEE_REJECTED_QUOTE: { code: 5101, message: 'Payee rejected quote' }, - PAYEE_FSP_UNSUPPORTED_TXN_TYPE: { code: 5102, message: 'Payee FSP does not support or rejected the transaction type' }, - PAYEE_FSP_REJECTED_QUOTE: { code: 5103, message: 'Payee FSP rejected quote' }, - PAYEE_REJECTED_TXN: { code: 5104, message: 'Payee rejected the transaction' }, - PAYEE_FSP_REJECTED_TXN: { code: 5105, message: 'Payee FSP rejected the transaction.' }, - PAYEE_UNSUPPORTED_CURRENCY: { code: 5106, message: 'Payee does not have an account which supports the requested currency.' }, - PAYEE_LIMIT_ERROR: { code: 5200, message: 'Payee limit exceeded' }, - PAYEE_PERMISSION_ERROR: { code: 5300, message: 'Payee or Payee FSP insufficient permissions' }, - GENERIC_PAYEE_BLOCKED_ERROR: { code: 5400, message: 'Payee blocked' } -} - -function ApiErrorCodeFromCode (code) { - const ec = Object.keys(ApiErrorCodes).find(ec => { - return ApiErrorCodes[ec].code === code - }) - - if (ec) { - return ApiErrorCodes[ec] - } - return undefined -} - -/** - * Encapsulates an error and the required information to pass is back to a client for processing - */ -class FSPIOPError extends Error { - /** - * Constructs a new error object - */ - constructor (cause, message, replyTo, apiErrorCode, extensions) { - super(message) - this.name = 'FSPIOPError' - this.cause = cause - this.replyTo = replyTo - this.apiErrorCode = apiErrorCode - this.extensions = extensions - } - - /** - * Returns an object that complies with the API specification for error bodies. - * This can be used to serialise the error to a JSON body - * - * @returns {object} - */ - toApiErrorObject () { - const e = { - errorInformation: { - errorCode: this.apiErrorCode.code, - errorDescription: this.apiErrorCode.message - } - } - - if (this.extensionList) { - e.errorInformation.extensionList = this.extensions - } - - return e - } - - /** - * Returns an object containing all details of the error e.g. for logging - * - * @returns {object} - */ - toFullErrorObject () { - return { - message: this.message, - replyTo: this.replyTo, - apiErrorCode: this.apiErrorCode, - extensions: this.extensions, - cause: this.cause ? this.cause.stack || util.inspect(this.cause) : undefined - } - } -} - -module.exports = { - ApiErrorCodes: ApiErrorCodes, - FSPIOPError: FSPIOPError, - ApiErrorCodeFromCode: ApiErrorCodeFromCode -} diff --git a/src/lib/request.js b/src/lib/request.js deleted file mode 100644 index 4a526b8..0000000 --- a/src/lib/request.js +++ /dev/null @@ -1,65 +0,0 @@ -/***** - 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 - - * Rajiv Mothilal - - -------------- - ******/ -'use strict' - -const request = require('axios') -const Logger = require('@mojaloop/central-services-shared').Logger -const util = require('./util') -const ErrorHandler = require('@mojaloop/central-services-error-handling') - -/** - * @function validateParticipant - * - * @description sends a request to central-ledger to retrieve participant details and validate that they exist within the switch - * - * @param {string} url the endpoint for the service you require - * @param {object} headers the http headers - * @param {string} method http method being requested i.e. GET, POST, PUT - * @param {object} payload the body of the request being sent - * - *@return {object} The response for the request being sent or error object with response included - */ -const sendRequest = async (url, headers, method = 'get', payload = undefined) => { - try { - const transformedHeaders = util.transformHeaders(headers, { httpMethod: method, sourceFsp: headers['FSPIOP-Source'], destinationFsp: headers['FSPIOP-Destination'] }) - const requestOptions = { - url, - method: method, - headers: transformedHeaders, - data: payload, - responseType: 'json' - } - Logger.debug(`sendRequest::request ${JSON.stringify(requestOptions)}`) - const response = await request(requestOptions) - Logger.debug(`Success: sendRequest::response`) - return response - } catch (err) { - Logger.error(err) - throw ErrorHandler.Factory.reformatFSPIOPError(err) - } -} - -module.exports = { - sendRequest -} diff --git a/src/lib/util.js b/src/lib/util.js deleted file mode 100644 index e23385c..0000000 --- a/src/lib/util.js +++ /dev/null @@ -1,198 +0,0 @@ -/***** - 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 - - * Rajiv Mothilal - - -------------- - ******/ -'use strict' - -const Enum = require('./enum') -const ErrorHandler = require('@mojaloop/central-services-error-handling') - -/** - * @function defaultHeaders - * - * @description This returns a set of default headers used for requests - * - * see https://nodejs.org/dist/latest-v10.x/docs/api/http.html#http_message_headers - * - * @param {string} destination - to who the request is being sent - * @param {string} resource - the flow that is being requested i.e. participants - * @param {string} source - from who the request is made - * @param {string} version - the version for the accept and content-type headers - * - * @returns {object} Returns the default headers - */ -function defaultHeaders (destination, resource, source, version = '1.0') { - // TODO: See API section 3.2.1; what should we do about X-Forwarded-For? Also, should we - // add/append to this field in all 'queueResponse' calls? - return { - accept: `application/vnd.interoperability.${resource}+json;version=${version}`, - 'FSPIOP-Destination': destination || '', - 'content-type': `application/vnd.interoperability.${resource}+json;version=${version}`, - date: (new Date()).toUTCString(), - 'FSPIOP-Source': source - } -} - -/** - * Utility function to remove null and undefined keys from an object. - * This is useful for removing "nulls" that come back from database queries - * when projecting into API spec objects - * - * @returns {object} - */ -function removeEmptyKeys (originalObject) { - const obj = { ...originalObject } - Object.keys(obj).forEach(key => { - if (obj[key] && typeof obj[key] === 'object') { - if (Object.keys(obj[key]).length < 1) { - // remove empty object - delete obj[key] - } else { - // recurse - obj[key] = removeEmptyKeys(obj[key]) - } - } else if (obj[key] == null) { - // null or undefined, remove it - delete obj[key] - } - }) - return obj -} - -/** - * Generates and returns an object containing API spec compliant HTTP request headers - * - * @returns {object} - */ -function generateRequestHeaders (headers, noAccept) { - const ret = { - 'Content-Type': 'application/vnd.interoperability.quotes+json;version=1.0', - Date: new Date().toUTCString(), - 'FSPIOP-Source': headers['fspiop-source'], - 'FSPIOP-Destination': headers['fspiop-destination'], - 'FSPIOP-HTTP-Method': headers['fspiop-http-method'], - 'FSPIOP-Signature': headers['fspiop-signature'], - 'FSPIOP-URI': headers['fspiop-uri'], - Accept: null - } - if (!noAccept) { - ret['Accept'] = 'application/vnd.interoperability.quotes+json;version=1' - } - return removeEmptyKeys(ret) -} - -/** - * @function transformHeaders - * - * @description This will transform the headers before sending to kafka - * NOTE: Assumes incoming headers keys are lowercased. This is a safe - * assumption only if the headers parameter comes from node default http framework. - * - * see https://nodejs.org/dist/latest-v10.x/docs/api/http.html#http_message_headers - * - * @param {object} headers - the http header from the request - * @param {object} config - the required headers you with to alter - * - * @returns {object} Returns the normalized headers - */ -const transformHeaders = (headers, config) => { - // Normalized keys - const normalizedKeys = Object.keys(headers).reduce( - function (keys, k) { - keys[k.toLowerCase()] = k - return keys - }, {}) - - // Normalized headers - const normalizedHeaders = {} - - // check to see if FSPIOP-Destination header has been left out of the initial request. If so then add it. - if (!normalizedKeys[Enum.headers.FSPIOP.DESTINATION]) { - headers[Enum.headers.FSPIOP.DESTINATION] = '' - } - - for (const headerKey in headers) { - const headerValue = headers[headerKey] - switch (headerKey.toLowerCase()) { - case (Enum.headers.GENERAL.DATE): - let tempDate = {} - if (typeof headerValue === 'object' && headerValue instanceof Date) { - tempDate = headerValue.toUTCString() - } else { - try { - tempDate = (new Date(headerValue)).toUTCString() - if (tempDate === 'Invalid Date') { - throw ErrorHandler.Factory.createInternalServerFSPIOPError('Invalid Date') - } - } catch (err) { - tempDate = headerValue - } - } - normalizedHeaders[headerKey] = tempDate - break - case (Enum.headers.GENERAL.CONTENT_LENGTH || Enum.headers.FSPIOP.URI || Enum.headers.GENERAL.HOST): - // Do nothing here, do not map. This will be inserted correctly by the Hapi framework. - break - case (Enum.headers.FSPIOP.HTTP_METHOD): - if (config.httpMethod.toLowerCase() === headerValue.toLowerCase()) { - // HTTP Methods match, and thus no change is required - normalizedHeaders[headerKey] = headerValue - } else { - // HTTP Methods DO NOT match, and thus a change is required for target HTTP Method - normalizedHeaders[headerKey] = config.httpMethod - } - break - case (Enum.headers.FSPIOP.SIGNATURE): - // Check to see if we find a regex match the source header containing the switch name. - // If so we include the signature otherwise we remove it. - - if (headers[normalizedKeys[Enum.headers.FSPIOP.SOURCE]].match(Enum.headers.FSPIOP.SWITCH.regex) === null) { - normalizedHeaders[headerKey] = headerValue - } - break - case (Enum.headers.FSPIOP.SOURCE): - normalizedHeaders[headerKey] = config.sourceFsp - break - case (Enum.headers.FSPIOP.DESTINATION): - if (config.destinationFsp) { - normalizedHeaders[headerKey] = config.destinationFsp - } - break - case (Enum.headers.GENERAL.ACCEPT || Enum.headers.GENERAL.CONTENT_TYPE): - normalizedHeaders[headerKey] = headerValue - break - default: - normalizedHeaders[headerKey] = headerValue - } - } - - if (config && config.httpMethod !== Enum.restMethods.POST) { - delete normalizedHeaders[Enum.headers.GENERAL.ACCEPT] - } - return normalizedHeaders -} - -module.exports = { - defaultHeaders, - transformHeaders, - generateRequestHeaders -} diff --git a/src/models/participantEndpoint/facade.js b/src/models/participantEndpoint/facade.js deleted file mode 100644 index b8001d3..0000000 --- a/src/models/participantEndpoint/facade.js +++ /dev/null @@ -1,109 +0,0 @@ -/***** - 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 - - - Rajiv Mothilal - -------------- - ******/ - -'use strict' - -const Logger = require('@mojaloop/central-services-shared').Logger -const Cache = require('./participantEndpoint') -const request = require('../../lib/request') -const Enums = require('../../lib/enum') -const util = require('../../lib/util') -const Mustache = require('mustache') -const Config = require('../../lib/config') -const ErrorHandler = require('@mojaloop/central-services-error-handling') - -/** - * @module src/models/participantEndpoint/facade - */ - -/** - * @function sendRequest - * - * @description it gets the applicable endpoints and sends through the response to them - * - * @param {object} req - initial request coming in - * @param {string} requestedParticipant - the participant the request needs to be sent to - * @param {string} endpointType - the type of endpoint being requested - * @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 - * - * @returns {object} - Returns http response from request endpoint - */ -exports.sendRequest = async (req, requestedParticipant, endpointType, method = undefined, payload = undefined, options = undefined) => { - try { - const requestedEndpoint = await Cache.getEndpoint(requestedParticipant, endpointType, options || undefined) - Logger.debug(`participant endpoint url: ${requestedEndpoint} for endpoint type ${endpointType}`) - return await request.sendRequest(requestedEndpoint, req.headers, method, payload) - } catch (err) { - Logger.error(err) - throw ErrorHandler.Factory.reformatFSPIOPError(err) - } -} - -/** - * @function validateParticipant - * - * @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 - * @returns the participants info in a successful case and - */ -exports.validateParticipant = async (fsp) => { - try { - const requestedParticipantUrl = Mustache.render(Config.SWITCH_ENDPOINT + Enums.endpoints.PARTICIPANTS_GET, { fsp }) - Logger.debug(`validateParticipant url: ${requestedParticipantUrl}`) - return await request.sendRequest(requestedParticipantUrl, util.defaultHeaders(Enums.apiServices.SWITCH, Enums.resources.participants, Enums.apiServices.SWITCH)) - } catch (e) { - Logger.error(e) - return null - } -} - -/** - * @function sendErrorToParticipant - * - * @description it gets the applicable endpoints and sends through an error message - * - * @param {object} req - initial request coming in - * @param {string} participantName - the participant the request needs to be sent to - * @param {string} endpointType - the type of endpoint being requested - * @param {object} errorInformation - payload of the error information being sent out - * - * @returns {object} - Returns http response from request endpoint - */ -exports.sendErrorToParticipant = async (req, participantName, endpointType, errorInformation) => { - let requestIdExists = false - if (req.payload && req.payload.requestId) { - requestIdExists = true - } - const requesterErrorEndpoint = await Cache.getEndpoint(participantName, endpointType, { - partyIdType: req.params.Type, - partyIdentifier: req.params.ID, - partySubIdOrType: req.params.SubId || undefined, - requestId: requestIdExists ? req.payload.requestId : undefined - }) - Logger.debug(`participant endpoint url: ${requesterErrorEndpoint} for endpoint type ${endpointType}`) - await request.sendRequest(requesterErrorEndpoint, req.headers, Enums.restMethods.PUT, errorInformation) -} diff --git a/src/models/participantEndpoint/participantEndpoint.js b/src/models/participantEndpoint/participantEndpoint.js deleted file mode 100644 index cf603c2..0000000 --- a/src/models/participantEndpoint/participantEndpoint.js +++ /dev/null @@ -1,135 +0,0 @@ -/***** - 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 - - * Shashikant Hirugade - * Rajiv Mothilal - -------------- - ******/ - -'use strict' - -const Logger = require('@mojaloop/central-services-shared').Logger -const Config = require('../../lib/config') -const Catbox = require('catbox') -const { Map } = require('immutable') -const util = require('../../lib/util') -const Enum = require('../../lib/enum') -const partition = 'endpoint-cache' -const clientOptions = { partition } -const policyOptions = Config.ENDPOINT_CACHE_CONFIG -const Mustache = require('mustache') -const request = require('../../lib/request') -const ErrorHandler = require('@mojaloop/central-services-error-handling') - -let client -let policy - -/** - * @function fetchEndpoints - * - * @description This populates the cache of endpoints - * - * @param {string} fsp The fsp id - * @returns {object} endpointMap Returns the object containing the endpoints for given fsp id - */ - -const fetchEndpoints = async (fsp) => { - try { - Logger.info(`[fsp=${fsp}] ~ participantEndpointCache::fetchEndpoints := Refreshing the cache for FSP: ${fsp}`) - const defaultHeaders = util.defaultHeaders(Enum.apiServices.SWITCH, Enum.resources.participants, Enum.apiServices.SWITCH) - const url = Mustache.render(Config.SWITCH_ENDPOINT + Enum.endpoints.PARTICIPANT_ENDPOINTS_GET, { fsp }) - Logger.debug(`[fsp=${fsp}] ~ participantEndpointCache::fetchEndpoints := URL for FSP: ${url}`) - const response = await request.sendRequest(url, defaultHeaders) - Logger.debug(`[fsp=${fsp}] ~ Model::participantEndpoint::fetchEndpoints := successful with body: ${JSON.stringify(response.data)}`) - const endpoints = response.data - const endpointMap = {} - if (Array.isArray(endpoints)) { - endpoints.forEach(item => { - Mustache.parse(item.value) - endpointMap[item.type] = item.value - }) - } - Logger.debug(`[fsp=${fsp}] ~ participantEndpointCache::fetchEndpoints := Returning the endpoints: ${JSON.stringify(endpointMap)}`) - return endpointMap - } catch (e) { - Logger.error(`participantEndpointCache::fetchEndpoints:: ERROR:'${e}'`) - } -} - -/** - * @module src/domain/participant/lib/cache - */ - -/** - * @function initializeCache - * - * @description This initializes the cache for endpoints - * - * @returns {boolean} Returns true on successful initialization of the cache, throws error on falires - */ -exports.initializeCache = async () => { - try { - Logger.info(`participantEndpointCache::initializeCache::start::clientOptions - ${JSON.stringify(clientOptions)}`) - client = new Catbox.Client(require('catbox-memory'), clientOptions) - await client.start() - policyOptions.generateFunc = fetchEndpoints - Logger.info(`participantEndpointCache::initializeCache::start::policyOptions - ${JSON.stringify(policyOptions)}`) - policy = new Catbox.Policy(policyOptions, client, partition) - Logger.info('participantEndpointCache::initializeCache::Cache initialized successfully') - return true - } catch (err) { - Logger.error(`participantEndpointCache::Cache error:: ERROR:'${err}'`) - throw ErrorHandler.Factory.reformatFSPIOPError(err) - } -} - -/** - * @function getEndpoint - * - * @description It returns the endpoint for a given fsp and type from the cache if the cache is still valid, otherwise it will refresh the cache and return the value - * - * @param {string} fsp - the id of the fsp - * @param {string} endpointType - the type of the endpoint - * @param {object} options - contains the options for the mustache template function - * - * @returns {string} - Returns the endpoint, throws error if failure occurs - */ -exports.getEndpoint = async (fsp, endpointType, options = {}) => { - Logger.info(`participantEndpointCache::getEndpoint::endpointType - ${endpointType}`) - try { - const endpoints = await policy.get(fsp) - return Mustache.render(new Map(endpoints).get(endpointType), options) - } catch (err) { - Logger.error(`participantEndpointCache::getEndpoint:: ERROR:'${err}'`) - throw ErrorHandler.Factory.reformatFSPIOPError(err) - } -} - -// /** -// * @function stopCache -// * -// * @description It stops the cache client -// * -// * @returns {boolean} - Returns the status -// */ -// const stopCache = async () => { -// Logger.info('participantEndpointCache::stopCache::Stopping the cache') -// return client.stop() -// } diff --git a/src/server.js b/src/server.js index dba914b..20d9d67 100644 --- a/src/server.js +++ b/src/server.js @@ -31,7 +31,7 @@ const Config = require('./lib/config.js') const Logger = require('@mojaloop/central-services-shared').Logger const Plugins = require('./plugins') const RequestLogger = require('./lib/requestLogger') -const ParticipantEndpointCache = require('./models/participantEndpoint/participantEndpoint') +const Endpoint = require('@mojaloop/central-services-shared').Util.Endpoints const ErrorHandler = require('@mojaloop/central-services-error-handling') const openAPIOptions = { @@ -83,7 +83,7 @@ const initialize = async (port = Config.PORT) => { const server = await createServer(port) server.plugins.openapi.setHost(server.info.host + ':' + server.info.port) Logger.info(`Server running on ${server.info.host}:${server.info.port}`) - await ParticipantEndpointCache.initializeCache() + await Endpoint.initializeCache(Config.ENDPOINT_CACHE_CONFIG) return server }