diff --git a/package-lock.json b/package-lock.json index e9d1100..795ba6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,9 +20,9 @@ } }, "@types/node": { - "version": "10.17.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.17.tgz", - "integrity": "sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q==" + "version": "10.17.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.27.tgz", + "integrity": "sha512-J0oqm9ZfAXaPdwNXMMgAhylw5fhmXkToJd06vuDUSAgEDZ/n/69/69UmyBZbc+zT34UnShuDSBqvim3SPnozJg==" }, "JSONStream": { "version": "1.3.5", @@ -43,9 +43,9 @@ } }, "ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", + "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -66,11 +66,6 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" - }, "async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", @@ -132,6 +127,44 @@ "requires": { "readable-stream": "^2.3.5", "safe-buffer": "^5.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + } } }, "bluebird": { @@ -207,6 +240,16 @@ "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } } }, "cipher-base": { @@ -306,9 +349,9 @@ } }, "cyberway-core-service": { - "version": "3.58.4", - "resolved": "https://registry.npmjs.org/cyberway-core-service/-/cyberway-core-service-3.58.4.tgz", - "integrity": "sha512-Wqvp7w5DZVdxcQAbpPdKna/eQe91dgN1lOuFsA5ddufe+BwbVpz9Rt1Zb8Ph4KJuAcMUid0xeeSQbWENpeBnKg==", + "version": "3.59.3", + "resolved": "https://registry.npmjs.org/cyberway-core-service/-/cyberway-core-service-3.59.3.tgz", + "integrity": "sha512-cakQXoiDkHBfuO7weMeXmtDy8xEJT97Mw7K5svUeVOOYdDjuj+ppHkn8/gaEXyJ/4iB6pEnk1lzBxCbSPbElqA==", "requires": { "ajv": "^6.10.2", "bignumber.js": "^7.2.1", @@ -394,9 +437,9 @@ } }, "domutils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.0.0.tgz", - "integrity": "sha512-n5SelJ1axbO636c2yUtOGia/IcJtVtlhQbFiVDBZHKV5ReJO1ViX7sFEemtuyoAnBxk5meNSYgA8V4s0271efg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.1.0.tgz", + "integrity": "sha512-CD9M0Dm1iaHfQ1R/TI+z3/JWp/pgub0j4jIQKH89ARR4ATAV2nbaOQS5XxU9maJP5jHaPdDDQSEHuE2UmpUTKg==", "requires": { "dom-serializer": "^0.2.1", "domelementtype": "^2.0.1", @@ -422,9 +465,9 @@ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, "entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", - "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", + "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==" }, "eosjs-ecc": { "version": "4.0.7", @@ -529,9 +572,9 @@ "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-json-stable-stringify": { "version": "2.1.0", @@ -573,12 +616,13 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" } }, "htmlparser2": { @@ -670,40 +714,15 @@ "integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw==" }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" - }, - "lodash.escaperegexp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", - "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" - }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, - "lodash.mergewith": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", - "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" - }, "lodash.template": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", @@ -763,22 +782,22 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", - "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" }, "mime-types": { - "version": "2.1.26", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", - "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", "requires": { - "mime-db": "1.43.0" + "mime-db": "1.44.0" } }, "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", + "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" }, "mongodb": { "version": "3.4.1", @@ -792,30 +811,35 @@ } }, "mongoose": { - "version": "5.9.4", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.9.4.tgz", - "integrity": "sha512-aUw4hzvJX9UJVN79JcElCwu/YsW1Sl/IDjErwiIX89xz77kmMjQjCmMsXGE1okUEcJGzGnXPqYl9BggXw8Nlvg==", + "version": "5.9.25", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.9.25.tgz", + "integrity": "sha512-vz/DqJ3mrHqEIlfRbKmDZ9TzQ1a0hCtSQpjHScIxr4rEtLs0tjsXDeEWcJ/vEEc3oLfP6vRx9V+uYSprXDUvFQ==", "requires": { - "bson": "~1.1.1", + "bson": "^1.1.4", "kareem": "2.3.1", - "mongodb": "3.5.4", + "mongodb": "3.5.9", "mongoose-legacy-pluralize": "1.0.2", - "mpath": "0.6.0", + "mpath": "0.7.0", "mquery": "3.2.2", "ms": "2.1.2", "regexp-clone": "1.0.0", - "safe-buffer": "5.1.2", + "safe-buffer": "5.2.1", "sift": "7.0.1", "sliced": "1.0.1" }, "dependencies": { + "bson": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.4.tgz", + "integrity": "sha512-S/yKGU1syOMzO86+dGpg2qGoDL0zvzcb262G+gqEy6TgP6rt6z6qxSFX/8X6vLC91P7G7C3nLs0+bvDzmvBA3Q==" + }, "mongodb": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.4.tgz", - "integrity": "sha512-xGH41Ig4dkSH5ROGezkgDbsgt/v5zbNUwE3TcFsSbDc6Qn3Qil17dhLsESSDDPTiyFDCPJRpfd4887dtsPgKtA==", + "version": "3.5.9", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.9.tgz", + "integrity": "sha512-vXHBY1CsGYcEPoVWhwgxIBeWqP3dSu9RuRDsoLRPTITrcrgm1f0Ubu1xqF9ozMwv53agmEiZm0YGo+7WL3Nbug==", "requires": { "bl": "^2.2.0", - "bson": "^1.1.1", + "bson": "^1.1.4", "denque": "^1.4.1", "require_optional": "^1.0.1", "safe-buffer": "^5.1.2", @@ -828,9 +852,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" } } }, @@ -840,9 +864,9 @@ "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" }, "mpath": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.6.0.tgz", - "integrity": "sha512-i75qh79MJ5Xo/sbhxrDrPSEG0H/mr1kcZXJ8dH6URU5jD/knFxCVqVC/gVSW7GIXL/9hHWlT9haLbCXWOll3qw==" + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.7.0.tgz", + "integrity": "sha512-Aiq04hILxhz1L+f7sjGyn7IxYzWm1zLNNXcfhDtx04kZ2Gk7uvFdgZ8ts1cWa/6d0TQmag2yR8zSGZUmp0tFNg==" }, "mquery": { "version": "3.2.2", @@ -949,23 +973,13 @@ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "postcss": { - "version": "7.0.27", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.27.tgz", - "integrity": "sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ==", + "version": "7.0.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", + "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "requires": { "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" - }, - "dependencies": { - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "requires": { - "has-flag": "^3.0.0" - } - } } }, "prettier": { @@ -1007,14 +1021,14 @@ "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, "random": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/random/-/random-2.1.1.tgz", - "integrity": "sha512-8HQriGPwjc8R+7hPOI9ZphAEEWmIt/RmuqXZ682ww9kjK5HRGXcN7hgWUxZ9AabgjZm5wIa6EwapTI1sg11XXg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/random/-/random-2.2.0.tgz", + "integrity": "sha512-4HBR4Xye4jJ41QBi6RfIaO1yKQpxVUZafQtdE6NvvjzirNlwWgsk3tkGLTbQtWUarF4ofZsUVEmWqB1TDQlkwA==", "requires": { "babel-runtime": "^6.26.0", "ow": "^0.4.0", "ow-lite": "^0.0.2", - "seedrandom": "^2.4.4" + "seedrandom": "^3.0.5" } }, "randombytes": { @@ -1042,24 +1056,13 @@ } }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" } }, "regenerator-runtime": { @@ -1106,20 +1109,14 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sanitize-html": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-1.22.0.tgz", - "integrity": "sha512-3RPo65mbTKpOAdAYWU496MSty1YbB3Y5bjwL5OclgaSSMtv65xvM7RW/EHRumzaZ1UddEJowCbSdK0xl5sAu0A==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-1.27.1.tgz", + "integrity": "sha512-C+N7E+7ikYaLHdb9lEkQaFOgmj+9ddZ311Ixs/QsBsoLD411/vdLweiFyGqrswUVgLqagOS5NCDxcEPH7trObQ==", "requires": { - "chalk": "^2.4.1", "htmlparser2": "^4.1.0", - "lodash.clonedeep": "^4.5.0", - "lodash.escaperegexp": "^4.1.2", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.mergewith": "^4.6.1", + "lodash": "^4.17.15", "postcss": "^7.0.27", - "srcset": "^2.0.1", - "xtend": "^4.0.1" + "srcset": "^2.0.1" } }, "saslprep": { @@ -1132,9 +1129,9 @@ } }, "seedrandom": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz", - "integrity": "sha512-9A+PDmgm+2du77B5i0Ip2cxOqqHjgNxnBgglxLcX78A2D6c2rTo61z4jnVABpF4cKeDMDG+cmXXvdnqse2VqMA==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" }, "semver": { "version": "5.7.1", @@ -1228,24 +1225,17 @@ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "requires": { - "safe-buffer": "~5.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } + "safe-buffer": "~5.2.0" } }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", "requires": { "has-flag": "^3.0.0" } @@ -1343,11 +1333,6 @@ "requires": { "async-limiter": "~1.0.0" } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" } } } diff --git a/package.json b/package.json index e41dd3a..38cc8c9 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "GPL-3.0", "dependencies": { "bytebuffer": "^5.0.1", - "cyberway-core-service": "^3.58.4", + "cyberway-core-service": "^3.59.3", "cyberwayjs": "^20.0.0-beta7", "eosjs-ecc": "latest", "mongodb": "^3.2.7", diff --git a/src/controllers/Community.js b/src/controllers/Community.js index ae03c46..dc7d65a 100644 --- a/src/controllers/Community.js +++ b/src/controllers/Community.js @@ -13,7 +13,7 @@ class Community extends BasicService { await this.registerForkChanges({ type: 'create', - Model: CommunityModel, + Model: Community, documentId: newCommunity._id, }); } @@ -53,7 +53,7 @@ class Community extends BasicService { await this.registerForkChanges({ type: 'update', - Model: CommunityModel, + Model: Community, documentId: previousModel._id, data: { $set: { diff --git a/src/controllers/Gallery.js b/src/controllers/Gallery.js index b34d222..7b8c7d5 100644 --- a/src/controllers/Gallery.js +++ b/src/controllers/Gallery.js @@ -139,6 +139,13 @@ class Gallery extends Service { async handleMosaicState(state) { const { tracery } = state; + const collectionEnd = state.collection_end_date + 'Z'; + + let displayReward; + if (new Date(collectionEnd) > Date.now()) { + displayReward = state.reward; + } + const previousModel = await Mosaic.findOneAndUpdate( { tracery, @@ -146,12 +153,13 @@ class Gallery extends Service { { $set: { tracery, - collectionEnd: state.collection_end_date + 'Z', + collectionEnd, gemCount: state.gem_count, shares: state.shares, damnShares: state.damn_shares, reward: state.reward, banned: state.banned, + displayReward, }, } ); @@ -169,6 +177,8 @@ class Gallery extends Service { damnShares: previousModel.damnShares, reward: previousModel.reward, banned: previousModel.banned, + // do not change display reward if it hasn't been changed + displayReward: displayReward ? previousModel.displayReward : undefined, }, }, }); diff --git a/src/controllers/connector/Gallery.js b/src/controllers/connector/Gallery.js index 618c7c3..8533bf2 100644 --- a/src/controllers/connector/Gallery.js +++ b/src/controllers/connector/Gallery.js @@ -56,6 +56,7 @@ class Gallery extends BasicController { $project: { topCount: 1, reward: 1, + displayReward: 1, collectionEnd: 1, tracery: 1, _id: 0, @@ -71,7 +72,7 @@ class Gallery extends BasicController { for (const mosaic of mosaics) { if (userId) { const gems = await Gem.find( - { 'contentId.userId': userId, tracery: mosaic.tracery, isClaimable: true }, + { 'contentId.userId': userId, tracery: mosaic.tracery }, { reward: 1 }, { lean: true } ); @@ -97,6 +98,21 @@ class Gallery extends BasicController { }; } } + + const [rewardAmount, symbol] = mosaic.reward.split(' '); + + if (parseFloat(rewardAmount) && this.pointsPrices) { + const cmn = parseFloat(rewardAmount / this.pointsPrices.prices[symbol]).toFixed(4); + + // TODO get from price feed + const usd = parseFloat(cmn * env.COMMUN_PRICE).toFixed(2); + + mosaic.convertedReward = { + cmn, + usd, + }; + } + mosaic.isClosed = Date.now() - mosaic.collectionEnd >= 0; mosaic.contentId = traceryContentIdMap.get(mosaic.tracery); } diff --git a/src/models/Fork.js b/src/models/Fork.js deleted file mode 100644 index 9fad561..0000000 --- a/src/models/Fork.js +++ /dev/null @@ -1,55 +0,0 @@ -const core = require('cyberway-core-service'); -const MongoDB = core.services.MongoDB; - -module.exports = MongoDB.makeModel( - 'Fork', - { - blockNum: { - type: Number, - required: true, - }, - blockTime: { - type: Date, - required: true, - }, - blockSequence: { - type: Number, - required: true, - }, - stack: { - type: [ - { - type: { - type: String, - enum: ['swap', 'update', 'create', 'remove', 'reorderLeaders'], - required: true, - }, - className: { - type: String, - }, - documentId: { - type: MongoDB.mongoTypes.ObjectId, - }, - data: { - type: Object, - }, - meta: { - type: Object, - }, - }, - ], - }, - }, - { - schema: { - strict: false, - }, - index: [ - { - fields: { - blockNum: -1, - }, - }, - ], - } -); diff --git a/src/models/Mosaic.js b/src/models/Mosaic.js index b84d2e8..a2e9280 100644 --- a/src/models/Mosaic.js +++ b/src/models/Mosaic.js @@ -23,6 +23,9 @@ module.exports = MongoDB.makeModel( reward: { type: String, }, + displayReward: { + type: String, + }, banned: { type: Boolean, }, diff --git a/src/services/Fork.js b/src/services/Fork.js deleted file mode 100644 index 8b02523..0000000 --- a/src/services/Fork.js +++ /dev/null @@ -1,215 +0,0 @@ -const core = require('cyberway-core-service'); -const BasicService = core.services.Basic; -const { Logger } = core.utils; -const ForkModel = require('../models/Fork'); - -class Fork extends BasicService { - async initBlock({ blockNum, blockTime, sequence }) { - await ForkModel.create({ blockNum, blockTime, blockSequence: sequence }); - } - - async registerChanges({ type, Model, documentId, data }) { - const revertItem = { - type, - className: Model.modelName, - documentId, - data: data ? this._packData(data) : {}, - }; - - await ForkModel.findOneAndUpdate( - {}, - { $push: { stack: revertItem } }, - { sort: { blockNum: -1 } } - ); - } - - async revert(subscriber, baseBlockNum) { - Logger.info('Revert on fork...'); - - const documents = await ForkModel.find( - { - blockNum: { - $gte: baseBlockNum, - }, - }, - {}, - { sort: { blockNum: -1 } } - ); - - const newBase = documents.pop(); - - if (!newBase || newBase.blockNum !== baseBlockNum) { - Logger.error('Critical Error! Not found base block in the fork data!'); - process.exit(1); - } - - await this._revertStacks(documents); - - await ForkModel.deleteMany({ - blockNum: { - $gt: baseBlockNum, - }, - }); - - await subscriber.setLastBlockMetaData({ - lastBlockNum: newBase.blockNum, - lastBlockSequence: newBase.blockSequence, - }); - - Logger.info('Revert on fork done!'); - } - - async _revertStacks(documents) { - for (const document of documents) { - Logger.info(`Reverting block num: ${document.blockNum}`); - await document.remove(); - } - } - - async registerIrreversibleBlock({ blockNum }) { - try { - // Удаляем все записи до неоткатного блока и блока до него, - // Запись о неоткатном блоке сохраняем, чтобы можно было до него откатиться. - await ForkModel.deleteMany({ - blockNum: { - $lt: blockNum - 1, - }, - }); - } catch (err) { - Logger.warn("Can't clear outdated fork data:", err); - } - } - - async revertLastBlock(subscriber) { - Logger.info('Revert last block...'); - - const [current, previous] = await ForkModel.find( - {}, - {}, - { sort: { blockNum: -1 }, limit: 2 } - ); - - if (!current) { - Logger.warn('Empty restore data.'); - return; - } - - await this._revertStacks([current]); - await current.remove(); - - if (!previous) { - Logger.warn('No previous block, resetting block num to 0'); - } - - await subscriber.setLastBlockMetaData({ - lastBlockNum: (previous && previous.blockNum) || 0, - lastBlockSequence: (previous && previous.blockSequence) || 0, - }); - } - - async _restoreBy(document) { - const stack = document.stack; - let stackItem; - - while ((stackItem = stack.pop())) { - const { type, className, documentId, meta } = stackItem; - - const data = this._unpackData(stackItem.data || {}); - const Model = require(`../models/${className}`); - - switch (type) { - case 'create': - await this._removeDocument(Model, documentId); - break; - - case 'update': - await this._restoreDocument(Model, documentId, data); - break; - - case 'remove': - await this._recreateDocument(Model, documentId, data); - break; - } - } - } - - async _removeDocument(Model, documentId) { - await Model.deleteOne({ _id: documentId }); - } - - async _restoreDocument(Model, documentId, data) { - await Model.updateOne({ _id: documentId }, data); - } - - async _recreateDocument(Model, documentId, data) { - await Model.create({ _id: documentId, ...data }); - } - - _packData(data) { - try { - return this._packDataIteration(data, 0); - } catch (err) { - if (err === 'Too many recursion') { - throw new Error(err); - } - - throw err; - } - } - - _packDataIteration(data, iteration) { - if (iteration > 20) { - throw 'Too many recursion'; - } - - if (data && typeof data.toObject === 'function') { - data = data.toObject(); - } - - if (data) { - const specialKeys = []; - - for (const key of Object.keys(data)) { - if (key.indexOf('$') === 0) { - specialKeys.push(key); - } - - if (data[key] && typeof data[key] === 'object') { - this._packDataIteration(data[key], iteration + 1); - } - } - - for (const key of specialKeys) { - data[`@${key}`] = data[key]; - - delete data[key]; - } - } - - return data; - } - - _unpackData(data) { - const specialKeys = []; - - for (const key of Object.keys(data)) { - if (key.indexOf('@$') === 0) { - specialKeys.push(key); - } - - if (data[key] && typeof data[key] === 'object') { - this._unpackData(data[key]); - } - } - - for (const key of specialKeys) { - data[key.slice(1)] = data[key]; - - delete data[key]; - } - - return data; - } -} - -module.exports = Fork;